Skip to content

Commit

Permalink
[Logs Explorer] Fix Privileges Accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedhamed-ahmed committed Sep 24, 2024
1 parent dcff283 commit 57bf5cd
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@

import {
AppMountParameters,
AppStatus,
AppUpdater,
CoreSetup,
CoreStart,
DEFAULT_APP_CATEGORIES,
Plugin,
PluginInitializerContext,
} from '@kbn/core/public';
import { OBSERVABILITY_LOGS_EXPLORER_APP_ID } from '@kbn/deeplinks-observability';
import { BehaviorSubject } from 'rxjs';
import {
AllDatasetsLocatorDefinition,
ObservabilityLogsExplorerLocators,
Expand All @@ -35,6 +38,7 @@ export class ObservabilityLogsExplorerPlugin
{
private config: ObservabilityLogsExplorerConfig;
private locators?: ObservabilityLogsExplorerLocators;
private appStateUpdater = new BehaviorSubject<AppUpdater>(() => ({}));

constructor(context: PluginInitializerContext<ObservabilityLogsExplorerConfig>) {
this.config = context.config.get();
Expand All @@ -56,6 +60,7 @@ export class ObservabilityLogsExplorerPlugin
? ['globalSearch', 'sideNav']
: ['globalSearch'],
keywords: ['logs', 'log', 'explorer', 'logs explorer'],
updater$: this.appStateUpdater,
mount: async (appMountParams: ObservabilityLogsExplorerAppMountParameters) => {
const [coreStart, pluginsStart, ownPluginStart] = await core.getStartServices();
const { renderObservabilityLogsExplorer } = await import(
Expand Down Expand Up @@ -123,7 +128,18 @@ export class ObservabilityLogsExplorerPlugin
};
}

public start(_core: CoreStart, _pluginsStart: ObservabilityLogsExplorerStartDeps) {
public start(core: CoreStart, _pluginsStart: ObservabilityLogsExplorerStartDeps) {
const { discover, integrations } = core.application.capabilities.navLinks;

if (!(discover && integrations)) {
this.appStateUpdater.next(() => {
return {
status: AppStatus.inaccessible,
visibleIn: [],
};
});
}

return {};
}
}

0 comments on commit 57bf5cd

Please sign in to comment.