From 27ec0d532e2d3d6e31b41695ec818f25e020f113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Mon, 10 Nov 2014 10:40:45 +0100 Subject: [PATCH] began work on custom confirm modal --- src/app/controllers/row.js | 9 ++++++--- src/app/panels/graph/legend.js | 4 ++-- src/app/partials/confirm_modal.html | 20 ++++++++++++++++++++ src/app/services/alertSrv.js | 25 ++++++++++++++++++++++++- 4 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 src/app/partials/confirm_modal.html diff --git a/src/app/controllers/row.js b/src/app/controllers/row.js index 4d7f288b16e..e18529ee519 100644 --- a/src/app/controllers/row.js +++ b/src/app/controllers/row.js @@ -76,9 +76,12 @@ function (angular, app, _) { }; $scope.remove_panel_from_row = function(row, panel) { - if (confirm('Are you sure you want to remove this ' + panel.type + ' panel?')) { - row.panels = _.without(row.panels,panel); - } + $scope.appEvent('confirm-modal', { + title: 'Are you sure you want to remove this panel?', + onConfirm: function() { + row.panels = _.without(row.panels, panel); + } + }); }; $scope.replacePanel = function(newPanel, oldPanel) { diff --git a/src/app/panels/graph/legend.js b/src/app/panels/graph/legend.js index 558420053f4..393e5d3dff4 100644 --- a/src/app/panels/graph/legend.js +++ b/src/app/panels/graph/legend.js @@ -22,8 +22,8 @@ function (angular, app, _, kbn, $) { var data; var i; - scope.$on('render', function(event, renderData) { - data = renderData || data; + scope.$on('render', function() { + data = scope.seriesList; if (data) { render(); } diff --git a/src/app/partials/confirm_modal.html b/src/app/partials/confirm_modal.html new file mode 100644 index 00000000000..6968fdf82a9 --- /dev/null +++ b/src/app/partials/confirm_modal.html @@ -0,0 +1,20 @@ +