Skip to content

Commit

Permalink
[Obs AI Assistant] hide ai assistant menu item when in a disabled spa…
Browse files Browse the repository at this point in the history
…ce (#188017)

Hides AI Assistant button when in a space where the AI Assistant is
disabled
  • Loading branch information
neptunian authored Jul 11, 2024
1 parent ee35439 commit 81b1705
Showing 1 changed file with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 81b1705

Please sign in to comment.