mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(apps): more polish on app dashboard save warning, #5529
This commit is contained in:
parent
f3db2fa262
commit
b2acac3a41
@ -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})
|
||||
}
|
||||
|
@ -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";
|
||||
|
@ -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});
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div class="modal-body">
|
||||
<div class="modal-body" ng-cloak>
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-header-title">
|
||||
<i class="fa {{icon}}"></i>
|
||||
@ -24,6 +24,7 @@
|
||||
<div class="confirm-modal-buttons">
|
||||
<button type="button" class="btn btn-inverse" ng-click="dismiss()">{{noText}}</button>
|
||||
<button type="button" class="btn btn-danger" ng-click="onConfirm();dismiss();">{{yesText}}</button>
|
||||
<button ng-show="onAltAction" type="button" class="btn btn-success" ng-click="dismiss();onAltAction();">{{altActionText}}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user