Skip to content

Commit 2231750

Browse files
committed
Rerouted menu item, added old api reference url to page, renamed to API instead of Swagger API
1 parent 7e39f13 commit 2231750

9 files changed

Lines changed: 115 additions & 73 deletions

File tree

ApiReference.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ public function registerEvents()
2929

3030
public function getClientSideTranslationKeys(&$translationKeys): void
3131
{
32+
$translationKeys[] = 'General_API';
3233
$translationKeys[] = 'CoreHome_LearnMoreFullStop';
34+
$translationKeys[] = 'ApiReference_LookingForLegacyApiReference';
3335
$translationKeys[] = 'ApiReference_ReportingApiMoreInformation';
3436
$translationKeys[] = 'ApiReference_ReportingApiReference';
3537
$translationKeys[] = 'ApiReference_ReportingApiSummary';
36-
$translationKeys[] = 'ApiReference_SwaggerApi';
3738
$translationKeys[] = 'ApiReference_SwaggerPagePluginEmpty';
3839
$translationKeys[] = 'ApiReference_SwaggerPageRequestFailed';
3940
$translationKeys[] = 'ApiReference_SwaggerPageSpecLoadFailed';

Menu.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public function configureAdminMenu(MenuAdmin $menu): void
2020
return;
2121
}
2222

23-
$menu->addPlatformItem(
24-
'ApiReference_SwaggerApi',
25-
$this->urlForAction('swagger'),
26-
30
23+
$menu->editUrl(
24+
'CorePluginsAdmin_MenuPlatform',
25+
'General_API',
26+
$this->urlForAction('swagger')
2727
);
2828
}
2929
}

lang/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"ApiReference": {
3+
"LookingForLegacyApiReference": "Looking for the legacy API reference? The %1$slegacy API reference%2$s page is still available while we continue improving the new API documentation. If anything is missing or behaving unexpectedly in this new version, %3$splease let us know%4$s so we can improve the experience.",
34
"ReportingApiMoreInformation": "More info about the Matomo APIs available in %1$sIntroduction to Matomo API%2$s and the %3$sMatomo API Reference%4$s.",
45
"ReportingApiReference": "Reporting API Reference",
56
"ReportingApiSummary": "All the data in Matomo is available through simple APIs.",
6-
"SwaggerApi": "Swagger API",
77
"SwaggerPagePluginEmpty": "No plugins are configured in the ApiReference whitelist.",
88
"SwaggerPageRequestFailed": "The plugin whitelist could not be loaded.",
99
"SwaggerPageSpecLoadFailed": "The OpenAPI spec could not be loaded for this plugin.",

templates/swagger.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<script src="plugins/ApiReference/vue/lib/swagger-ui/swagger-ui-bundle.js"></script>
88
{% endblock %}
99

10-
{% set title %}{{ 'ApiReference_SwaggerApi'|translate }}{% endset %}
10+
{% set title %}{{ 'General_API'|translate }}{% endset %}
1111

1212
{% block content %}
1313
<div

tests/Integration/MenuTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function tearDown(): void
5050
parent::tearDown();
5151
}
5252

53-
public function testConfigureAdminMenuAddsSwaggerItemForViewAccess(): void
53+
public function testConfigureAdminMenuAddsApiItemForViewAccess(): void
5454
{
5555
FakeAccess::clearAccess(
5656
$superUser = false,
@@ -62,10 +62,10 @@ public function testConfigureAdminMenuAddsSwaggerItemForViewAccess(): void
6262
$items = $this->buildConfiguredMenu()->getMenu();
6363

6464
$this->assertArrayHasKey('CorePluginsAdmin_MenuPlatform', $items);
65-
$this->assertArrayHasKey('ApiReference_SwaggerApi', $items['CorePluginsAdmin_MenuPlatform']);
65+
$this->assertArrayHasKey('General_API', $items['CorePluginsAdmin_MenuPlatform']);
6666
}
6767

68-
public function testConfigureAdminMenuSkipsSwaggerItemWithoutViewAccess(): void
68+
public function testConfigureAdminMenuSkipsApiItemWithoutViewAccess(): void
6969
{
7070
FakeAccess::clearAccess(
7171
$superUser = false,
@@ -81,7 +81,7 @@ public function testConfigureAdminMenuSkipsSwaggerItemWithoutViewAccess(): void
8181
return;
8282
}
8383

84-
$this->assertArrayNotHasKey('ApiReference_SwaggerApi', $items['CorePluginsAdmin_MenuPlatform']);
84+
$this->assertArrayNotHasKey('General_API', $items['CorePluginsAdmin_MenuPlatform']);
8585
}
8686

8787
private function buildConfiguredMenu(): MenuAdmin

vue/dist/ApiReference.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)