Commit 9f766557 by Torkel Ödegaard

Dashboard: fixed minor issue when trying to aborting dashboard delete from search list, Fixes #1233

parent 846cf934
...@@ -107,6 +107,7 @@ function (angular, _, moment, config, store) { ...@@ -107,6 +107,7 @@ function (angular, _, moment, config, store) {
$scope.deleteDashboardConfirmed = function(options) { $scope.deleteDashboardConfirmed = function(options) {
var id = options.id; var id = options.id;
$scope.db.deleteDashboard(id).then(function(id) { $scope.db.deleteDashboard(id).then(function(id) {
$scope.appEvent('dashboard-deleted', id);
$scope.appEvent('alert-success', ['Dashboard Deleted', id + ' has been deleted']); $scope.appEvent('alert-success', ['Dashboard Deleted', id + ' has been deleted']);
}, function(err) { }, function(err) {
$scope.appEvent('alert-error', ['Deleted failed', err]); $scope.appEvent('alert-error', ['Deleted failed', err]);
......
...@@ -19,6 +19,9 @@ function (angular, _, config, $) { ...@@ -19,6 +19,9 @@ function (angular, _, config, $) {
$scope.db = datasourceSrv.getGrafanaDB(); $scope.db = datasourceSrv.getGrafanaDB();
$scope.currentSearchId = 0; $scope.currentSearchId = 0;
// events
$scope.onAppEvent('dashboard-deleted', $scope.dashboardDeleted);
$timeout(function() { $timeout(function() {
$scope.giveSearchFocus = $scope.giveSearchFocus + 1; $scope.giveSearchFocus = $scope.giveSearchFocus + 1;
$scope.query.query = 'title:'; $scope.query.query = 'title:';
...@@ -123,6 +126,10 @@ function (angular, _, config, $) { ...@@ -123,6 +126,10 @@ function (angular, _, config, $) {
$scope.deleteDashboard = function(dash, evt) { $scope.deleteDashboard = function(dash, evt) {
evt.stopPropagation(); evt.stopPropagation();
$scope.appEvent('delete-dashboard', { id: dash.id, title: dash.title }); $scope.appEvent('delete-dashboard', { id: dash.id, title: dash.title });
};
$scope.dashboardDeleted = function(evt, id) {
var dash = _.findWhere($scope.results.dashboards, {id: id});
$scope.results.dashboards = _.without($scope.results.dashboards, dash); $scope.results.dashboards = _.without($scope.results.dashboards, dash);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment