From a3d2c79d0679fbd4147eab6c6ba7f700d42dd6fc Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Mon, 3 Jan 2022 17:15:50 -0500 Subject: [PATCH] Previews: check feature flag on dashboard manage page (#43632) --- public/app/features/search/components/ManageDashboards.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/public/app/features/search/components/ManageDashboards.tsx b/public/app/features/search/components/ManageDashboards.tsx index 7c74edded89..b9382c638e4 100644 --- a/public/app/features/search/components/ManageDashboards.tsx +++ b/public/app/features/search/components/ManageDashboards.tsx @@ -3,6 +3,7 @@ import { useLocalStorage } from 'react-use'; import { css } from '@emotion/css'; import { stylesFactory, useTheme, Spinner, FilterInput } from '@grafana/ui'; import { GrafanaTheme } from '@grafana/data'; +import { config } from '@grafana/runtime'; import { contextSrv } from 'app/core/services/context_srv'; import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA'; import { FolderDTO } from 'app/types'; @@ -23,6 +24,7 @@ export interface Props { const { isEditor } = contextSrv; export const ManageDashboards: FC = memo(({ folder }) => { + const previewsEnabled = Boolean(config.featureToggles.dashboardPreviews); const [showPreviews, setShowPreviews] = useLocalStorage(PREVIEWS_LOCAL_STORAGE_KEY, true); const onShowPreviewsChange = (event: React.ChangeEvent) => { setShowPreviews(event.target.checked); @@ -118,7 +120,7 @@ export const ManageDashboards: FC = memo(({ folder }) => { onSortChange={onSortChange} onTagFilterChange={onTagFilterChange} query={query} - showPreviews={showPreviews} + showPreviews={previewsEnabled && showPreviews} hideLayout={!!folderUid} onLayoutChange={onLayoutChange} editable={hasEditPermissionInFolders} @@ -131,7 +133,7 @@ export const ManageDashboards: FC = memo(({ folder }) => { onToggleSection={onToggleSection} onToggleChecked={onToggleChecked} layout={query.layout} - showPreviews={showPreviews} + showPreviews={previewsEnabled && showPreviews} />