From 28ef972c9f877d5093de497e99a6fffe1f83cac1 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Wed, 23 Sep 2015 22:13:38 +0530 Subject: [PATCH 1/2] Added duplicate feature for variable. --- public/app/features/templating/editorCtrl.js | 8 ++++++++ public/app/features/templating/partials/editor.html | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/public/app/features/templating/editorCtrl.js b/public/app/features/templating/editorCtrl.js index 74157ac3dd8..bd913e28fb5 100644 --- a/public/app/features/templating/editorCtrl.js +++ b/public/app/features/templating/editorCtrl.js @@ -96,6 +96,14 @@ function (angular, _) { } }; + $scope.duplicate = function(variable) { + $scope.current = angular.copy(variable); + $scope.variables.push($scope.current); + $scope.current = $scope.variables[$scope.variables.length - 1]; + $scope.current.name = 'copy_of_'+variable.name; + $scope.updateSubmenuVisibility(); + }; + $scope.update = function() { if ($scope.isValid()) { $scope.runQuery().then(function() { diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index 63ecd00adcf..43e2513e618 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -59,6 +59,11 @@ Edit + + + Duplicate + + From 9cdf0601eba06d63d6ea16698f257d8a8bb01432 Mon Sep 17 00:00:00 2001 From: ubhatnagar Date: Wed, 23 Sep 2015 22:20:38 +0530 Subject: [PATCH 2/2] Removed unnecessary statement. --- public/app/features/templating/editorCtrl.js | 1 - 1 file changed, 1 deletion(-) diff --git a/public/app/features/templating/editorCtrl.js b/public/app/features/templating/editorCtrl.js index bd913e28fb5..09dc300934e 100644 --- a/public/app/features/templating/editorCtrl.js +++ b/public/app/features/templating/editorCtrl.js @@ -99,7 +99,6 @@ function (angular, _) { $scope.duplicate = function(variable) { $scope.current = angular.copy(variable); $scope.variables.push($scope.current); - $scope.current = $scope.variables[$scope.variables.length - 1]; $scope.current.name = 'copy_of_'+variable.name; $scope.updateSubmenuVisibility(); };