From b2acac3a41fbef7bd6bb918849cbfc2ddf5dbba0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Tue, 12 Jul 2016 08:41:56 +0200 Subject: [PATCH] feat(apps): more polish on app dashboard save warning, #5529 --- pkg/api/dashboard.go | 4 ++-- public/app/core/services/alert_srv.ts | 2 ++ public/app/features/dashboard/dashnav/dashnav.ts | 8 ++++++-- public/app/partials/confirm_modal.html | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkg/api/dashboard.go b/pkg/api/dashboard.go index a6bf96da876..041f2a7f8cf 100644 --- a/pkg/api/dashboard.go +++ b/pkg/api/dashboard.go @@ -139,10 +139,10 @@ func PostDashboard(c *middleware.Context, cmd m.SaveDashboardCommand) Response { return Json(412, util.DynMap{"status": "version-mismatch", "message": err.Error()}) } if pluginErr, ok := err.(m.UpdatePluginDashboardError); ok { - message := "Dashboard is belongs to plugin " + pluginErr.PluginId + "." + message := "The dashboard belongs to plugin " + pluginErr.PluginId + "." // look up plugin name if pluginDef, exist := plugins.Plugins[pluginErr.PluginId]; exist { - message = "Dashboard is belongs to plugin " + pluginDef.Name + "." + message = "The dashboard belongs to plugin " + pluginDef.Name + "." } return Json(412, util.DynMap{"status": "plugin-dashboard", "message": message}) } diff --git a/public/app/core/services/alert_srv.ts b/public/app/core/services/alert_srv.ts index 3003e59c74b..edfff2e8d00 100644 --- a/public/app/core/services/alert_srv.ts +++ b/public/app/core/services/alert_srv.ts @@ -73,6 +73,8 @@ export class AlertSrv { scope.text = payload.text; scope.text2 = payload.text2; scope.onConfirm = payload.onConfirm; + scope.onAltAction = payload.onAltAction; + scope.altActionText = payload.altActionText; scope.icon = payload.icon || "fa-check"; scope.yesText = payload.yesText || "Yes"; scope.noText = payload.noText || "Cancel"; diff --git a/public/app/features/dashboard/dashnav/dashnav.ts b/public/app/features/dashboard/dashnav/dashnav.ts index 601be4d7eea..7d25e352e9e 100644 --- a/public/app/features/dashboard/dashnav/dashnav.ts +++ b/public/app/features/dashboard/dashnav/dashnav.ts @@ -141,9 +141,13 @@ export class DashNavCtrl { $scope.appEvent('confirm-modal', { title: 'Plugin Dashboard', text: err.data.message, - text2: 'Your changes will be overwritten next time you update the plugin. Use Save As to create custom version.', - yesText: "Save & Overwrite", + text2: 'Your changes will be lost when you update the plugin. Use Save As to create custom version.', + yesText: "Overwrite", icon: "fa-warning", + altActionText: "Save As", + onAltAction: function() { + $scope.saveDashboardAs(); + }, onConfirm: function() { $scope.saveDashboard({overwrite: true}); } diff --git a/public/app/partials/confirm_modal.html b/public/app/partials/confirm_modal.html index d9da8bdacc4..6ab4a6b32c5 100644 --- a/public/app/partials/confirm_modal.html +++ b/public/app/partials/confirm_modal.html @@ -1,4 +1,4 @@ -