From 2dc5872bd68ce996e64551cd757bf8cfa41298c2 Mon Sep 17 00:00:00 2001 From: kay delaney <45561153+kaydelaney@users.noreply.github.com> Date: Thu, 27 Apr 2023 11:11:19 +0100 Subject: [PATCH] New Dashboard: Fix "build a dashboard" when empty dash page feature is enabled (#66816) * New Dashboard: Fix "build a dashboard" when used with empty dash page feature Closes #66659 --- .../AddPanelButton/AddPanelMenu.tsx | 8 ++++- .../containers/NewDashboardWithDS.tsx | 32 ++++++++++++------- .../dashboard/dashgrid/DashboardEmpty.tsx | 8 ++++- .../app/features/dashboard/state/reducers.ts | 5 +++ .../app/features/dashboard/utils/dashboard.ts | 3 +- public/app/types/dashboard.ts | 3 +- 6 files changed, 43 insertions(+), 16 deletions(-) diff --git a/public/app/features/dashboard/components/AddPanelButton/AddPanelMenu.tsx b/public/app/features/dashboard/components/AddPanelButton/AddPanelMenu.tsx index f7f69edb45e..4ec49a60bfc 100644 --- a/public/app/features/dashboard/components/AddPanelButton/AddPanelMenu.tsx +++ b/public/app/features/dashboard/components/AddPanelButton/AddPanelMenu.tsx @@ -12,6 +12,9 @@ import { onCreateNewRow, onPasteCopiedPanel, } from 'app/features/dashboard/utils/dashboard'; +import { useDispatch, useSelector } from 'app/types'; + +import { setInitialDatasource } from '../../state/reducers'; interface Props { dashboard: DashboardModel; @@ -19,6 +22,8 @@ interface Props { export const AddPanelMenu = ({ dashboard }: Props) => { const copiedPanelPlugin = useMemo(() => getCopiedPanelPlugin(), []); + const dispatch = useDispatch(); + const initialDatasource = useSelector((state) => state.dashboard.initialDatasource); return (