From e07b6efbc493d625c73dfa9730e949671160f2f8 Mon Sep 17 00:00:00 2001 From: Sergej-Vlasov <37613182+Sergej-Vlasov@users.noreply.github.com> Date: Wed, 19 Feb 2025 10:03:37 +0000 Subject: [PATCH] ImportDashboardForm: Add more meaningful error message for Editor user (#100581) return error message when getting 403 during dashboard import --- public/app/features/manage-dashboards/utils/validation.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/app/features/manage-dashboards/utils/validation.ts b/public/app/features/manage-dashboards/utils/validation.ts index 7e4b1d9089e..d70e22ed975 100644 --- a/public/app/features/manage-dashboards/utils/validation.ts +++ b/public/app/features/manage-dashboards/utils/validation.ts @@ -53,6 +53,12 @@ export const validateUid = (value: string) => { }) .catch((error) => { error.isHandled = true; + + // when Editor user tries to import admin only dashboard (with same uid) he gets an unhelpful 403 error + // therefore handling this use case to return some indication of whats wrong + if (error.status === 403) { + return 'Dashboard with the same UID already exists'; + } return true; }); };