diff --git a/public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx b/public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx index 9232b5e9c68..84012e2f694 100644 --- a/public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx +++ b/public/app/features/dashboard-scene/saving/SaveDashboardAsForm.tsx @@ -48,6 +48,7 @@ export function SaveDashboardAsForm({ dashboard, changeInfo }: Props) { const { state, onSaveDashboard } = useSaveDashboard(false); const [contentSent, setContentSent] = useState<{ title?: string; folderUid?: string }>({}); + const [hasFolderChanged, setHasFolderChanged] = useState(false); const onSave = async (overwrite: boolean) => { const data = getValues(); @@ -70,10 +71,10 @@ export function SaveDashboardAsForm({ dashboard, changeInfo }: Props) { ); - const saveButton = (overwrite: boolean) => ( - - ); - + const saveButton = (overwrite: boolean) => { + const showSaveButton = !isValid && hasFolderChanged ? true : isValid; + return ; + }; function renderFooter(error?: Error) { const formValuesMatchContentSent = formValues.title.trim() === contentSent.title && formValues.folder.uid === contentSent.folderUid; @@ -127,6 +128,8 @@ export function SaveDashboardAsForm({ dashboard, changeInfo }: Props) { { setValue('folder', { uid, title }); + const folderUid = dashboard.state.meta.folderUid; + setHasFolderChanged(uid !== folderUid); }} // Old folder picker fields value={formValues.folder?.uid}