Skip to content

Commit b676814

Browse files
author
Katia Aresti
committed
[#653] Swagger and Metrics links
1 parent 50b8803 commit b676814

File tree

4 files changed

+56
-18
lines changed

4 files changed

+56
-18
lines changed

src/app/AppLayout/AppLayout.tsx

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
MenuToggle,
1818
MenuToggleElement,
1919
Nav,
20+
NavGroup,
2021
NavItem,
2122
NavList,
2223
Page,
@@ -264,21 +265,34 @@ const AppLayout: React.FunctionComponent<IAppLayout> = ({ children }) => {
264265
const Navigation = (
265266
<Nav id="nav-primary-simple">
266267
<NavList id="nav-list-simple">
267-
{filteredRoutes.map(
268-
(route, idx) =>
269-
displayNavMenu(route) && (
270-
<NavItem key={`${route.label}-${idx}`} id={`${route.label}-${idx}`}>
271-
<NavLink
272-
itemID={route.id}
273-
caseSensitive={true}
274-
to={route.path + location.search}
275-
className={isCurrentActiveNavItem(route) ? 'pf-m-current' : ''}
276-
>
277-
{route.label}
278-
</NavLink>
279-
</NavItem>
280-
)
281-
)}
268+
<NavGroup title="Operations">
269+
{filteredRoutes.map(
270+
(route, idx) =>
271+
displayNavMenu(route) && (
272+
<NavItem key={`${route.label}-${idx}`} id={`${route.label}-${idx}`}>
273+
<NavLink
274+
itemID={route.id}
275+
caseSensitive={true}
276+
to={route.path + location.search}
277+
className={isCurrentActiveNavItem(route) ? 'pf-m-current' : ''}
278+
>
279+
{route.label}
280+
</NavLink>
281+
</NavItem>
282+
)
283+
)}
284+
</NavGroup>
285+
<NavGroup title="DevOps Tools">
286+
<NavItem icon={<ExternalLinkAltIcon />} onClick={() => window.open(ConsoleServices.swaggerUi(), '_blank')}>
287+
{t('layout.swagger-ui')}
288+
</NavItem>
289+
<NavItem
290+
icon={<ExternalLinkAltIcon />}
291+
onClick={() => window.open(ConsoleServices.metricsEndpoint(), '_blank')}
292+
>
293+
{'Metrics endpoint'}
294+
</NavItem>
295+
</NavGroup>
282296
</NavList>
283297
</Nav>
284298
);

src/app/assets/languages/en.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"documentation-name": "Documentation",
3939
"close-browser-message": "Close the browser or open an incognito window to log again.",
4040
"dark-theme": "Dark theme",
41-
"logout": "Logout"
41+
"logout": "Logout",
42+
"swagger-ui": "Swagger Ui"
4243
},
4344
"welcome-page": {
4445
"welcome-title": "Welcome to {{brandname}} Server",
@@ -57,7 +58,8 @@
5758
"learn-more": " Get started",
5859
"develop": "Code applications for different use cases.",
5960
"tutorials": " Run quick tutorials",
60-
"go-to-console": "Open the console"
61+
"go-to-console": "Open the console",
62+
"open-swagger-ui": "Open Swagger UI"
6163
},
6264
"login-form": {
6365
"login-main": "Log in to {{brandname}}.",

src/config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
window.INFINISPAN_CONFIG = { restContextPath: '{{INFINISPAN_REST_CONTEXT_PATH}}' };
1+
window.INFINISPAN_CONFIG = {
2+
restContextPath: '{{INFINISPAN_REST_CONTEXT_PATH}}'
3+
};

src/services/ConsoleServices.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ export class ConsoleServices {
5555
}
5656
}
5757

58+
public static metricsEndpoint(): string {
59+
return ConsoleServices.getEndpoint('/metrics');
60+
}
61+
62+
public static swaggerUi(): string {
63+
return ConsoleServices.getEndpoint('/swagger-ui');
64+
}
65+
66+
private static getEndpoint(endpoint: string): string {
67+
if (ConsoleServices.isDevMode()) {
68+
if (!process.env.INFINISPAN_SERVER_URL) {
69+
return 'http://localhost:11222' + endpoint;
70+
} else {
71+
return process.env.INFINISPAN_SERVER_URL + endpoint;
72+
}
73+
} else {
74+
return window.location.origin.toString() + endpoint;
75+
}
76+
}
77+
5878
public static landing(): string {
5979
if (ConsoleServices.isDevMode()) {
6080
return 'http://localhost:9000/console/';

0 commit comments

Comments
 (0)