mirror of https://github.com/grafana/grafana.git
ExtensionSidebar: Allow `Assistant` to be shown in compact mode (#110400)
This commit is contained in:
parent
0b7cb8c17c
commit
04ccd1e6bd
|
|
@ -12,7 +12,13 @@ import { ExtensionToolbarItemButton } from './ExtensionToolbarItemButton';
|
|||
|
||||
type ComponentWithPluginId = ExtensionInfo & { pluginId: string };
|
||||
|
||||
export function ExtensionToolbarItem() {
|
||||
type Props = {
|
||||
compact?: boolean;
|
||||
};
|
||||
|
||||
const compactAllowedComponents = ['grafana-assistant-app'];
|
||||
|
||||
export function ExtensionToolbarItem({ compact }: Props) {
|
||||
const { availableComponents, dockedComponentId, setDockedComponentId } = useExtensionSidebarContext();
|
||||
|
||||
if (availableComponents.size === 0) {
|
||||
|
|
@ -27,6 +33,12 @@ export function ExtensionToolbarItem() {
|
|||
const componentId = getComponentIdFromComponentMeta(pluginId, component);
|
||||
const isActive = dockedComponentId === componentId;
|
||||
|
||||
// we now allow more components in the extension sidebar
|
||||
// in compact mode we only want to allow the Assistant app right now
|
||||
if (compact && !compactAllowedComponents.includes(pluginId)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ExtensionToolbarItemButton
|
||||
key={pluginId}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ export const SingleTopBar = memo(function SingleTopBar({
|
|||
</Dropdown>
|
||||
)}
|
||||
<NavToolbarSeparator />
|
||||
{!isSmallScreen && <ExtensionToolbarItem />}
|
||||
{!isSmallScreen && <ExtensionToolbarItem compact={isSmallScreen} />}
|
||||
{!showToolbarLevel && actions}
|
||||
{!contextSrv.user.isSignedIn && <SignInLink />}
|
||||
<InviteUserButton />
|
||||
|
|
|
|||
Loading…
Reference in New Issue