feat(top_nav): option to make dashboards editable again

closes #2587
closes #2554
This commit is contained in:
carl bergquist 2015-12-15 08:41:16 +01:00
parent f163ceffd0
commit 9ece45caa5

View File

@ -49,6 +49,21 @@ function (angular, _) {
$scope.appEvent('hide-dash-search');
};
$scope.makeEditable = function(evt) {
$scope.dashboard.editable = true;
var clone = $scope.dashboard.getSaveModelClone();
backendSrv.saveDashboard(clone, {overwrite: false}).then(function(data) {
$scope.dashboard.version = data.version;
$scope.appEvent('dashboard-saved', $scope.dashboard);
$scope.appEvent('alert-success', ['Dashboard saved', 'Saved as ' + clone.title]);
//force refresh whole page
window.location.href = window.location.href;
}, $scope.handleSaveDashError);
};
$scope.saveDashboard = function(options) {
if ($scope.dashboardMeta.canSave === false) {
return;