|
|
@@ -7,7 +7,7 @@ function (angular, _) {
|
|
|
|
|
|
var module = angular.module('grafana.services');
|
|
|
|
|
|
- module.service('alertSrv', function($timeout, $sce, $rootScope) {
|
|
|
+ module.service('alertSrv', function($timeout, $sce, $rootScope, $modal, $q) {
|
|
|
var self = this;
|
|
|
|
|
|
this.init = function() {
|
|
|
@@ -20,6 +20,7 @@ function (angular, _) {
|
|
|
$rootScope.onAppEvent('alert-success', function(e, alert) {
|
|
|
self.set(alert[0], alert[1], 'success', 3000);
|
|
|
});
|
|
|
+ $rootScope.onAppEvent('confirm-modal', this.showConfirmModal);
|
|
|
};
|
|
|
|
|
|
// List of all alert objects
|
|
|
@@ -57,5 +58,27 @@ function (angular, _) {
|
|
|
this.clearAll = function() {
|
|
|
self.list = [];
|
|
|
};
|
|
|
+
|
|
|
+ this.showConfirmModal = function(e, payload) {
|
|
|
+ var scope = $rootScope.$new();
|
|
|
+
|
|
|
+ scope.title = payload.title;
|
|
|
+ scope.text = payload.text;
|
|
|
+ scope.onConfirm = payload.onConfirm;
|
|
|
+
|
|
|
+ var confirmModal = $modal({
|
|
|
+ template: './app/partials/confirm_modal.html',
|
|
|
+ persist: true,
|
|
|
+ show: false,
|
|
|
+ scope: scope,
|
|
|
+ keyboard: false
|
|
|
+ });
|
|
|
+
|
|
|
+ $q.when(confirmModal).then(function(modalEl) {
|
|
|
+ modalEl.modal('show');
|
|
|
+ });
|
|
|
+
|
|
|
+ };
|
|
|
+
|
|
|
});
|
|
|
});
|