|
@@ -22,7 +22,8 @@ function (angular, _) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
$scope.init = function() {
|
|
$scope.init = function() {
|
|
|
- $scope.editor = { index: 0 };
|
|
|
|
|
|
|
+ $scope.mode = 'list';
|
|
|
|
|
+
|
|
|
$scope.datasources = _.filter(datasourceSrv.getMetricSources(), function(ds) {
|
|
$scope.datasources = _.filter(datasourceSrv.getMetricSources(), function(ds) {
|
|
|
return !ds.meta.builtIn;
|
|
return !ds.meta.builtIn;
|
|
|
});
|
|
});
|
|
@@ -30,8 +31,8 @@ function (angular, _) {
|
|
|
$scope.variables = templateSrv.variables;
|
|
$scope.variables = templateSrv.variables;
|
|
|
$scope.reset();
|
|
$scope.reset();
|
|
|
|
|
|
|
|
- $scope.$watch('editor.index', function(index) {
|
|
|
|
|
- if ($scope.currentIsNew === false && index === 1) {
|
|
|
|
|
|
|
+ $scope.$watch('mode', function(val) {
|
|
|
|
|
+ if (val === 'new') {
|
|
|
$scope.reset();
|
|
$scope.reset();
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -75,7 +76,7 @@ function (angular, _) {
|
|
|
$scope.edit = function(variable) {
|
|
$scope.edit = function(variable) {
|
|
|
$scope.current = variable;
|
|
$scope.current = variable;
|
|
|
$scope.currentIsNew = false;
|
|
$scope.currentIsNew = false;
|
|
|
- $scope.editor.index = 2;
|
|
|
|
|
|
|
+ $scope.mode = 'edit';
|
|
|
|
|
|
|
|
if ($scope.current.datasource === void 0) {
|
|
if ($scope.current.datasource === void 0) {
|
|
|
$scope.current.datasource = null;
|
|
$scope.current.datasource = null;
|
|
@@ -88,7 +89,7 @@ function (angular, _) {
|
|
|
if ($scope.isValid()) {
|
|
if ($scope.isValid()) {
|
|
|
$scope.runQuery().then(function() {
|
|
$scope.runQuery().then(function() {
|
|
|
$scope.reset();
|
|
$scope.reset();
|
|
|
- $scope.editor.index = 0;
|
|
|
|
|
|
|
+ $scope.mode = 'list';
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|