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

This commit is contained in:
Torkel Ödegaard
2014-12-15 17:30:01 +01:00
parent 846cf934f5
commit 9f766557f1
2 changed files with 8 additions and 0 deletions
+1
View File
@@ -107,6 +107,7 @@ function (angular, _, moment, config, store) {
$scope.deleteDashboardConfirmed = function(options) {
var id = options.id;
$scope.db.deleteDashboard(id).then(function(id) {
$scope.appEvent('dashboard-deleted', id);
$scope.appEvent('alert-success', ['Dashboard Deleted', id + ' has been deleted']);
}, function(err) {
$scope.appEvent('alert-error', ['Deleted failed', err]);
+7
View File
@@ -19,6 +19,9 @@ function (angular, _, config, $) {
$scope.db = datasourceSrv.getGrafanaDB();
$scope.currentSearchId = 0;
// events
$scope.onAppEvent('dashboard-deleted', $scope.dashboardDeleted);
$timeout(function() {
$scope.giveSearchFocus = $scope.giveSearchFocus + 1;
$scope.query.query = 'title:';
@@ -123,6 +126,10 @@ function (angular, _, config, $) {
$scope.deleteDashboard = function(dash, evt) {
evt.stopPropagation();
$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);
};