From a8b94fe203867c2f6b12a1cde9a3389d4fff28ae Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Tue, 1 Oct 2024 10:55:48 +0100 Subject: [PATCH] SingleTopNav: Move org switcher into Megamenu header (#94053) move org switcher into megamenu header --- .../AppChrome/MegaMenu/MegaMenuHeader.tsx | 5 +++-- .../OrganizationSwitcher.tsx | 18 +++++++++++++----- .../AppChrome/TopBar/SingleTopBar.tsx | 2 -- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx b/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx index 6f0d1feeb62..cfce7392d31 100644 --- a/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx +++ b/public/app/core/components/AppChrome/MegaMenu/MegaMenuHeader.tsx @@ -1,11 +1,12 @@ import { css } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; -import { IconButton, Stack, Text, ToolbarButton, useTheme2 } from '@grafana/ui'; +import { IconButton, Stack, ToolbarButton, useTheme2 } from '@grafana/ui'; import { useGrafana } from 'app/core/context/GrafanaContext'; import { t } from 'app/core/internationalization'; import { Branding } from '../../Branding/Branding'; +import { OrganizationSwitcher } from '../OrganizationSwitcher/OrganizationSwitcher'; import { TOP_BAR_LEVEL_HEIGHT } from '../types'; export interface Props { @@ -26,7 +27,7 @@ export function MegaMenuHeader({ handleMegaMenu, handleDockedMenu, onClose }: Pr - {Branding.AppTitle} + { - setIsSmallScreen(!e.matches); + setIsSmallScreen(!config.featureToggles.singleTopNav && !e.matches); }, }); if (orgs?.length <= 1) { - return null; + if (config.featureToggles.singleTopNav) { + return {Branding.AppTitle}; + } else { + return null; + } } const Switcher = isSmallScreen ? OrganizationPicker : OrganizationSelect; diff --git a/public/app/core/components/AppChrome/TopBar/SingleTopBar.tsx b/public/app/core/components/AppChrome/TopBar/SingleTopBar.tsx index 2052979f2c8..40db95e4000 100644 --- a/public/app/core/components/AppChrome/TopBar/SingleTopBar.tsx +++ b/public/app/core/components/AppChrome/TopBar/SingleTopBar.tsx @@ -16,7 +16,6 @@ import { Breadcrumbs } from '../../Breadcrumbs/Breadcrumbs'; import { buildBreadcrumbs } from '../../Breadcrumbs/utils'; import { enrichHelpItem } from '../MegaMenu/utils'; import { NewsContainer } from '../News/NewsContainer'; -import { OrganizationSwitcher } from '../OrganizationSwitcher/OrganizationSwitcher'; import { QuickAdd } from '../QuickAdd/QuickAdd'; import { TOP_BAR_LEVEL_HEIGHT } from '../types'; @@ -59,7 +58,6 @@ export const SingleTopBar = memo(function SingleTopBar({ )} -