diff --git a/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionSidebarProvider.tsx b/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionSidebarProvider.tsx index 4a5e6798a4b..63b4812955e 100644 --- a/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionSidebarProvider.tsx +++ b/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionSidebarProvider.tsx @@ -11,7 +11,12 @@ import { DEFAULT_EXTENSION_SIDEBAR_WIDTH } from './ExtensionSidebar'; export const EXTENSION_SIDEBAR_EXTENSION_POINT_ID = 'grafana/extension-sidebar/v0-alpha'; export const EXTENSION_SIDEBAR_DOCKED_LOCAL_STORAGE_KEY = 'grafana.navigation.extensionSidebarDocked'; export const EXTENSION_SIDEBAR_WIDTH_LOCAL_STORAGE_KEY = 'grafana.navigation.extensionSidebarWidth'; -const PERMITTED_EXTENSION_SIDEBAR_PLUGINS = ['grafana-investigations-app', 'grafana-assistant-app', 'grafana-dash-app']; +const PERMITTED_EXTENSION_SIDEBAR_PLUGINS = [ + 'grafana-investigations-app', + 'grafana-assistant-app', + 'grafana-dash-app', + 'grafana-grafanadocsplugin-app', +]; type ExtensionSidebarContextType = { /** diff --git a/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItem.tsx b/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItem.tsx index 7f9cfe74152..02cad31ea91 100644 --- a/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItem.tsx +++ b/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItem.tsx @@ -14,10 +14,12 @@ export function ExtensionToolbarItem() { useExtensionSidebarContext(); let dockedComponentTitle = ''; + let dockedPluginId = ''; if (dockedComponentId) { const dockedComponent = getComponentMetaFromComponentId(dockedComponentId); if (dockedComponent) { dockedComponentTitle = dockedComponent.componentTitle; + dockedPluginId = dockedComponent.pluginId; } } @@ -47,6 +49,7 @@ export function ExtensionToolbarItem() { setDockedComponentId(getComponentIdFromComponentMeta(components[0].pluginId, components[0])); } }} + pluginId={components[0].pluginId} /> @@ -85,6 +88,7 @@ export function ExtensionToolbarItem() { setDockedComponentId(undefined); } }} + pluginId={dockedPluginId} /> ) : ( diff --git a/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItemButton.tsx b/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItemButton.tsx index da79fc15536..44e33526095 100644 --- a/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItemButton.tsx +++ b/public/app/core/components/AppChrome/ExtensionSidebar/ExtensionToolbarItemButton.tsx @@ -9,13 +9,24 @@ interface ToolbarItemButtonProps { isOpen: boolean; title?: string; onClick?: () => void; + pluginId?: string; +} + +function getPluginIcon(pluginId?: string): string { + switch (pluginId) { + case 'grafana-grafanadocsplugin-app': + return 'book'; + default: + return 'ai-sparkle'; + } } function ExtensionToolbarItemButtonComponent( - { isOpen, title, onClick }: ToolbarItemButtonProps, + { isOpen, title, onClick, pluginId }: ToolbarItemButtonProps, ref: React.ForwardedRef ) { const styles = useStyles2(getStyles); + const icon = getPluginIcon(pluginId); if (isOpen) { // render button to close the sidebar @@ -23,7 +34,7 @@ function ExtensionToolbarItemButtonComponent(