mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Previews: check feature flag on dashboard manage page (#43632)
This commit is contained in:
parent
56d088c441
commit
a3d2c79d06
@ -3,6 +3,7 @@ import { useLocalStorage } from 'react-use';
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { stylesFactory, useTheme, Spinner, FilterInput } from '@grafana/ui';
|
import { stylesFactory, useTheme, Spinner, FilterInput } from '@grafana/ui';
|
||||||
import { GrafanaTheme } from '@grafana/data';
|
import { GrafanaTheme } from '@grafana/data';
|
||||||
|
import { config } from '@grafana/runtime';
|
||||||
import { contextSrv } from 'app/core/services/context_srv';
|
import { contextSrv } from 'app/core/services/context_srv';
|
||||||
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
import EmptyListCTA from 'app/core/components/EmptyListCTA/EmptyListCTA';
|
||||||
import { FolderDTO } from 'app/types';
|
import { FolderDTO } from 'app/types';
|
||||||
@ -23,6 +24,7 @@ export interface Props {
|
|||||||
const { isEditor } = contextSrv;
|
const { isEditor } = contextSrv;
|
||||||
|
|
||||||
export const ManageDashboards: FC<Props> = memo(({ folder }) => {
|
export const ManageDashboards: FC<Props> = memo(({ folder }) => {
|
||||||
|
const previewsEnabled = Boolean(config.featureToggles.dashboardPreviews);
|
||||||
const [showPreviews, setShowPreviews] = useLocalStorage<boolean>(PREVIEWS_LOCAL_STORAGE_KEY, true);
|
const [showPreviews, setShowPreviews] = useLocalStorage<boolean>(PREVIEWS_LOCAL_STORAGE_KEY, true);
|
||||||
const onShowPreviewsChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const onShowPreviewsChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setShowPreviews(event.target.checked);
|
setShowPreviews(event.target.checked);
|
||||||
@ -118,7 +120,7 @@ export const ManageDashboards: FC<Props> = memo(({ folder }) => {
|
|||||||
onSortChange={onSortChange}
|
onSortChange={onSortChange}
|
||||||
onTagFilterChange={onTagFilterChange}
|
onTagFilterChange={onTagFilterChange}
|
||||||
query={query}
|
query={query}
|
||||||
showPreviews={showPreviews}
|
showPreviews={previewsEnabled && showPreviews}
|
||||||
hideLayout={!!folderUid}
|
hideLayout={!!folderUid}
|
||||||
onLayoutChange={onLayoutChange}
|
onLayoutChange={onLayoutChange}
|
||||||
editable={hasEditPermissionInFolders}
|
editable={hasEditPermissionInFolders}
|
||||||
@ -131,7 +133,7 @@ export const ManageDashboards: FC<Props> = memo(({ folder }) => {
|
|||||||
onToggleSection={onToggleSection}
|
onToggleSection={onToggleSection}
|
||||||
onToggleChecked={onToggleChecked}
|
onToggleChecked={onToggleChecked}
|
||||||
layout={query.layout}
|
layout={query.layout}
|
||||||
showPreviews={showPreviews}
|
showPreviews={previewsEnabled && showPreviews}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<ConfirmDeleteModal
|
<ConfirmDeleteModal
|
||||||
|
Loading…
Reference in New Issue
Block a user