From 7c605f024f2ee0d6889673a6d8c806a51f3c5ccd Mon Sep 17 00:00:00 2001 From: Oscar Kilhed Date: Thu, 10 Apr 2025 14:59:20 +0200 Subject: [PATCH] Dynamic dashboards: Add paste panel back, change paste icon (#103780) * Add paste panel back, change paste icon * make i18n-extract --- .../layout-rows/RowsLayoutManagerRenderer.tsx | 2 +- .../layout-tabs/TabsLayoutManagerRenderer.tsx | 2 +- .../scene/layouts-shared/CanvasGridAddActions.tsx | 15 ++++++++++++++- public/locales/en-US/grafana.json | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManagerRenderer.tsx b/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManagerRenderer.tsx index ae261137de9..94b624971a7 100644 --- a/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManagerRenderer.tsx +++ b/public/app/features/dashboard-scene/scene/layout-rows/RowsLayoutManagerRenderer.tsx @@ -45,7 +45,7 @@ export function RowLayoutManagerRenderer({ model }: SceneComponentPropsNew row {hasCopiedRow && ( - )} diff --git a/public/app/features/dashboard-scene/scene/layout-tabs/TabsLayoutManagerRenderer.tsx b/public/app/features/dashboard-scene/scene/layout-tabs/TabsLayoutManagerRenderer.tsx index acfda7fa47c..cbf84c9fd1d 100644 --- a/public/app/features/dashboard-scene/scene/layout-tabs/TabsLayoutManagerRenderer.tsx +++ b/public/app/features/dashboard-scene/scene/layout-tabs/TabsLayoutManagerRenderer.tsx @@ -57,7 +57,7 @@ export function TabsLayoutManagerRenderer({ model }: SceneComponentPropsNew tab {hasCopiedTab && ( - )} diff --git a/public/app/features/dashboard-scene/scene/layouts-shared/CanvasGridAddActions.tsx b/public/app/features/dashboard-scene/scene/layouts-shared/CanvasGridAddActions.tsx index cc70eb236ce..6ca67510a78 100644 --- a/public/app/features/dashboard-scene/scene/layouts-shared/CanvasGridAddActions.tsx +++ b/public/app/features/dashboard-scene/scene/layouts-shared/CanvasGridAddActions.tsx @@ -12,6 +12,7 @@ import { TabsLayoutManager } from '../layout-tabs/TabsLayoutManager'; import { DashboardLayoutManager } from '../types/DashboardLayoutManager'; import { addNewRowTo, addNewTabTo } from './addNew'; +import { useClipboardState } from './useClipboardState'; import { ungroupLayout } from './utils'; export interface Props { @@ -20,6 +21,7 @@ export interface Props { export function CanvasGridAddActions({ layoutManager }: Props) { const styles = useStyles2(getStyles); + const { hasCopiedPanel } = useClipboardState(); return (
@@ -55,8 +57,19 @@ export function CanvasGridAddActions({ layoutManager }: Props) { Group panels - {} {renderUngroupAction(layoutManager)} + {hasCopiedPanel && layoutManager.pastePanel && ( + + )}
); } diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index c5f47cf5968..51a56abfae4 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -2622,6 +2622,7 @@ "group-panels": "Group panels", "new-row": "New row", "new-tab": "New tab", + "paste-panel": "Paste panel", "paste-row": "Paste row", "paste-tab": "Paste tab", "un-group-panels": "Ungroup"