Dashboards: Allow dashboards with same name in different folders (#70378)

* Dashboards: Allow dashboards with same name in different folders

Co-authored-by: Tobias Skarhed <tobias.skarhed@gmail.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
Co-authored-by: joshhunt <josh@trtr.co>

* fix

---------

Co-authored-by: Tobias Skarhed <tobias.skarhed@gmail.com>
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
Josh Hunt
2023-06-26 12:49:50 +01:00
committed by GitHub
parent 9e0f6ceb57
commit e50cf55649
3 changed files with 20 additions and 32 deletions

View File

@@ -52,8 +52,9 @@ export const SaveDashboardAsForm = ({ dashboard, isNew, onSubmit, onCancel, onSu
if (dashboardName && dashboardName === getFormValues().$folder.title?.trim()) {
return 'Dashboard name cannot be the same as folder name';
}
try {
await validationSrv.validateNewDashboardName(getFormValues().$folder.uid, dashboardName);
await validationSrv.validateNewDashboardName(getFormValues().$folder.uid ?? 'general', dashboardName);
return true;
} catch (e) {
return e instanceof Error ? e.message : 'Dashboard name is invalid';