diff --git a/src/app/controllers/dashboardNavCtrl.js b/src/app/controllers/dashboardNavCtrl.js index 084d1e215a6..3e3321b7d0d 100644 --- a/src/app/controllers/dashboardNavCtrl.js +++ b/src/app/controllers/dashboardNavCtrl.js @@ -93,12 +93,18 @@ function (angular, _, moment, config, store) { }; $scope.deleteDashboard = function(evt, options) { - if (!confirm('Do you want to delete dashboard ' + options.title + ' ?')) { - return; - } - if (!$scope.isAdmin()) { return false; } + $scope.appEvent('confirm-modal', { + title: 'Delete dashboard', + text: 'Do you want to delete dashboard ' + options.title + '?', + onConfirm: function() { + $scope.deleteDashboardConfirmed(options); + } + }); + }; + + $scope.deleteDashboardConfirmed = function(options) { var id = options.id; $scope.db.deleteDashboard(id).then(function(id) { $scope.appEvent('alert-success', ['Dashboard Deleted', id + ' has been deleted']); diff --git a/src/app/controllers/row.js b/src/app/controllers/row.js index e18529ee519..c92155d8d7e 100644 --- a/src/app/controllers/row.js +++ b/src/app/controllers/row.js @@ -47,9 +47,13 @@ function (angular, app, _) { }; $scope.delete_row = function() { - if (confirm("Are you sure you want to delete this row?")) { - $scope.dashboard.rows = _.without($scope.dashboard.rows, $scope.row); - } + $scope.appEvent('confirm-modal', { + title: 'Delete row', + text: 'Are you sure you want to delete this row?', + onConfirm: function() { + $scope.dashboard.rows = _.without($scope.dashboard.rows, $scope.row); + } + }); }; $scope.move_row = function(direction) { @@ -77,7 +81,8 @@ function (angular, app, _) { $scope.remove_panel_from_row = function(row, panel) { $scope.appEvent('confirm-modal', { - title: 'Are you sure you want to remove this panel?', + title: 'Remove panel', + text: 'Are you sure you want to remove this panel?', onConfirm: function() { row.panels = _.without(row.panels, panel); } diff --git a/src/app/partials/confirm_modal.html b/src/app/partials/confirm_modal.html index 6968fdf82a9..6c954d756bd 100644 --- a/src/app/partials/confirm_modal.html +++ b/src/app/partials/confirm_modal.html @@ -2,17 +2,20 @@
- Confirm + {{title}}
+

+ {{text}} +
+
+

- - {{title}} - - - + + +
diff --git a/src/app/services/alertSrv.js b/src/app/services/alertSrv.js index d7deae52a53..74b3308c4e8 100644 --- a/src/app/services/alertSrv.js +++ b/src/app/services/alertSrv.js @@ -69,6 +69,7 @@ function (angular, _) { var confirmModal = $modal({ template: './app/partials/confirm_modal.html', persist: true, + modalClass: 'confirm-modal', show: false, scope: scope, keyboard: false diff --git a/src/css/less/grafana.less b/src/css/less/grafana.less index f24d2e21d87..c174fd46a59 100644 --- a/src/css/less/grafana.less +++ b/src/css/less/grafana.less @@ -561,3 +561,7 @@ select.grafana-target-segment-input { th:last-child { text-align: left; } td:first-child { text-align: right; } } + +.confirm-modal { + max-width: 500px; +}