grafana/src/app/features/dashboard/cloneDashboardCtrl.js

31 lines
755 B
JavaScript
Raw Normal View History

define([
'angular',
],
function (angular) {
'use strict';
var module = angular.module('grafana.controllers');
module.controller('CloneDashboardCtrl', function($scope, backendSrv, $location) {
$scope.init = function() {
$scope.clone.id = null;
$scope.clone.editable = true;
$scope.clone.title = $scope.clone.title + " Copy";
};
$scope.saveClone = function() {
backendSrv.saveDashboard($scope.clone)
.then(function(result) {
2015-03-06 01:23:36 -06:00
$scope.appEvent('alert-success', ['Dashboard saved', 'Saved as ' + $scope.clone.title]);
$location.url('/dashboard/db/' + result.slug);
$scope.appEvent('dashboard-saved', $scope.clone);
$scope.dismiss();
});
};
});
});