diff --git a/public/app/features/templating/editorCtrl.js b/public/app/features/templating/editorCtrl.js index 43bda1db05f..5efebc21e30 100644 --- a/public/app/features/templating/editorCtrl.js +++ b/public/app/features/templating/editorCtrl.js @@ -25,6 +25,7 @@ function (angular, _) { {value: "interval", text: "Interval"}, {value: "datasource", text: "Data source"}, {value: "custom", text: "Custom"}, + {value: "constant", text: "Constant"}, ]; $scope.refreshOptions = [ @@ -141,15 +142,34 @@ function (angular, _) { $scope.current = angular.copy(replacementDefaults); }; + $scope.showSelectionOptions = function() { + if ($scope.current) { + if ($scope.current.type === 'query') { + return true; + } + if ($scope.current.type === 'custom') { + return true; + } + } + return false; + }; + $scope.typeChanged = function () { if ($scope.current.type === 'interval') { $scope.current.query = '1m,10m,30m,1h,6h,12h,1d,7d,14d,30d'; + $scope.current.refresh = 0; } if ($scope.current.type === 'query') { $scope.current.query = ''; } + if ($scope.current.type === 'constant') { + $scope.current.query = ''; + $scope.current.refresh = 0; + $scope.current.hide = 2; + } + if ($scope.current.type === 'datasource') { $scope.current.query = $scope.datasourceTypes[0].value; $scope.current.regex = ''; diff --git a/public/app/features/templating/partials/editor.html b/public/app/features/templating/partials/editor.html index fc387ff44cf..19f9c25715b 100644 --- a/public/app/features/templating/partials/editor.html +++ b/public/app/features/templating/partials/editor.html @@ -152,6 +152,14 @@ +
+
Constant options
+
+ Value + +
+
+
Query Options
@@ -214,7 +222,7 @@
-
+
Selection Options