[Obs AI Assistant] hide ai assistant menu item when in a disabled space (#188017)

Hides AI Assistant button when in a space where the AI Assistant is
disabled
This commit is contained in:
Sandra G 2024-07-11 17:06:24 -04:00 committed by GitHub
parent ee3543990b
commit 81b1705ea6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -103,27 +103,29 @@ export class ObservabilityAIAssistantAppPlugin
const appService = (this.appService = createAppService({
pluginsStart,
}));
const isEnabled = appService.isEnabled();
if (isEnabled) {
coreStart.chrome.navControls.registerRight({
mount: (element) => {
ReactDOM.render(
<SharedProviders
coreStart={coreStart}
pluginsStart={pluginsStart}
service={appService}
theme$={coreStart.theme.theme$}
>
<LazyNavControl />
</SharedProviders>,
element,
() => {}
);
coreStart.chrome.navControls.registerRight({
mount: (element) => {
ReactDOM.render(
<SharedProviders
coreStart={coreStart}
pluginsStart={pluginsStart}
service={appService}
theme$={coreStart.theme.theme$}
>
<LazyNavControl />
</SharedProviders>,
element,
() => {}
);
return () => {};
},
// right before the user profile
order: 1001,
});
return () => {};
},
// right before the user profile
order: 1001,
});
}
const service = pluginsStart.observabilityAIAssistant.service;