[Profiling] Space-specific feature privileges (#154734)

This commit is contained in:
Cauê Marcondes 2023-04-11 20:35:48 -04:00 committed by GitHub
parent 2f46929805
commit 2f001a2f8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 28 deletions

View file

@ -50,27 +50,30 @@ export class ProfilingPlugin implements Plugin {
const kuerySubject = new BehaviorSubject<string>('');
const section$ = combineLatest([from(coreSetup.getStartServices()), kuerySubject]).pipe(
map(([_, kuery]) => {
const sections: NavigationSection[] = [
{
label: i18n.translate('xpack.profiling.navigation.sectionLabel', {
defaultMessage: 'Universal Profiling',
}),
isBetaFeature: true,
entries: links.map((link) => {
return {
app: 'profiling',
label: link.title,
path: `${link.path}?kuery=${kuery ?? ''}`,
matchPath: (path) => {
return path.startsWith(link.path);
},
};
}),
sortKey: 700,
},
];
return sections;
map(([[coreStart], kuery]) => {
if (coreStart.application.capabilities.profiling.show) {
const sections: NavigationSection[] = [
{
label: i18n.translate('xpack.profiling.navigation.sectionLabel', {
defaultMessage: 'Universal Profiling',
}),
isBetaFeature: true,
entries: links.map((link) => {
return {
app: 'profiling',
label: link.title,
path: `${link.path}?kuery=${kuery ?? ''}`,
matchPath: (path) => {
return path.startsWith(link.path);
},
};
}),
sortKey: 700,
},
];
return sections;
}
return [];
})
);