mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[Uptime] Only register route in side nav if uptime show capability is true (#101709)
This commit is contained in:
parent
75ad61ae0f
commit
96c684c4ec
1 changed files with 36 additions and 26 deletions
|
@ -12,7 +12,8 @@ import {
|
|||
PluginInitializerContext,
|
||||
AppMountParameters,
|
||||
} from 'kibana/public';
|
||||
import { of } from 'rxjs';
|
||||
import { from } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { DEFAULT_APP_CATEGORIES } from '../../../../../src/core/public';
|
||||
import {
|
||||
|
@ -104,32 +105,41 @@ export class UptimePlugin
|
|||
});
|
||||
|
||||
plugins.observability.navigation.registerSections(
|
||||
of([
|
||||
{
|
||||
label: 'Uptime',
|
||||
sortKey: 200,
|
||||
entries: [
|
||||
{
|
||||
label: i18n.translate('xpack.uptime.overview.heading', {
|
||||
defaultMessage: 'Monitoring overview',
|
||||
}),
|
||||
app: 'uptime',
|
||||
path: '/',
|
||||
matchFullPath: true,
|
||||
ignoreTrailingSlash: true,
|
||||
},
|
||||
{
|
||||
label: i18n.translate('xpack.uptime.certificatesPage.heading', {
|
||||
defaultMessage: 'TLS Certificates',
|
||||
}),
|
||||
app: 'uptime',
|
||||
path: '/certificates',
|
||||
matchFullPath: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
from(core.getStartServices()).pipe(
|
||||
map(([coreStart]) => {
|
||||
if (coreStart.application.capabilities.uptime.show) {
|
||||
return [
|
||||
{
|
||||
label: 'Uptime',
|
||||
sortKey: 200,
|
||||
entries: [
|
||||
{
|
||||
label: i18n.translate('xpack.uptime.overview.heading', {
|
||||
defaultMessage: 'Monitoring overview',
|
||||
}),
|
||||
app: 'uptime',
|
||||
path: '/',
|
||||
matchFullPath: true,
|
||||
ignoreTrailingSlash: true,
|
||||
},
|
||||
{
|
||||
label: i18n.translate('xpack.uptime.certificatesPage.heading', {
|
||||
defaultMessage: 'TLS Certificates',
|
||||
}),
|
||||
app: 'uptime',
|
||||
path: '/certificates',
|
||||
matchFullPath: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return [];
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
core.application.register({
|
||||
id: PLUGIN.ID,
|
||||
euiIconType: 'logoObservability',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue