mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 20:54:22 -06:00
fix(graphite): raw query mode (disable graphite query editor mode) is now persisted property on the query, Fixes #2328, Fixes #2307
This commit is contained in:
parent
ca1cd89190
commit
9f6c9cd6ff
@ -12,7 +12,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="tight-form-item">
|
<li class="tight-form-item">
|
||||||
<a class="pointer" tabindex="1" ng-click="showTextEditor = !showTextEditor">
|
<a class="pointer" tabindex="1" ng-click="toggleEditorMode()">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -65,15 +65,14 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<input type="text"
|
<input type="text" class="tight-form-clear-input span10"
|
||||||
class="tight-form-clear-input span10"
|
|
||||||
ng-model="target.target"
|
ng-model="target.target"
|
||||||
focus-me="showTextEditor"
|
focus-me="target.textEditor"
|
||||||
spellcheck='false'
|
spellcheck='false'
|
||||||
ng-model-onblur ng-change="targetTextChanged()"
|
ng-model-onblur ng-change="get_data()"
|
||||||
ng-show="showTextEditor" />
|
ng-show="target.textEditor" />
|
||||||
|
|
||||||
<ul class="tight-form-list" role="menu" ng-hide="showTextEditor">
|
<ul class="tight-form-list" role="menu" ng-hide="target.textEditor">
|
||||||
<li ng-repeat="segment in segments" role="menuitem">
|
<li ng-repeat="segment in segments" role="menuitem">
|
||||||
<metric-segment segment="segment" get-alt-segments="getAltSegments($index)" on-value-changed="segmentValueChanged(segment, $index)"></metric-segment>
|
<metric-segment segment="segment" get-alt-segments="getAltSegments($index)" on-value-changed="segmentValueChanged(segment, $index)"></metric-segment>
|
||||||
</li>
|
</li>
|
||||||
|
@ -20,15 +20,22 @@ function (angular, _, config, gfunc, Parser) {
|
|||||||
parseTarget();
|
parseTarget();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.toggleEditorMode = function() {
|
||||||
|
$scope.target.textEditor = !$scope.target.textEditor;
|
||||||
|
parseTarget();
|
||||||
|
};
|
||||||
|
|
||||||
// The way parsing and the target editor works needs
|
// The way parsing and the target editor works needs
|
||||||
// to be rewritten to handle functions that take multiple series
|
// to be rewritten to handle functions that take multiple series
|
||||||
function parseTarget() {
|
function parseTarget() {
|
||||||
$scope.functions = [];
|
$scope.functions = [];
|
||||||
$scope.segments = [];
|
$scope.segments = [];
|
||||||
$scope.showTextEditor = false;
|
|
||||||
|
|
||||||
delete $scope.parserError;
|
delete $scope.parserError;
|
||||||
|
|
||||||
|
if ($scope.target.textEditor) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var parser = new Parser($scope.target.target);
|
var parser = new Parser($scope.target.target);
|
||||||
var astNode = parser.getAst();
|
var astNode = parser.getAst();
|
||||||
if (astNode === null) {
|
if (astNode === null) {
|
||||||
@ -38,7 +45,7 @@ function (angular, _, config, gfunc, Parser) {
|
|||||||
|
|
||||||
if (astNode.type === 'error') {
|
if (astNode.type === 'error') {
|
||||||
$scope.parserError = astNode.message + " at position: " + astNode.pos;
|
$scope.parserError = astNode.message + " at position: " + astNode.pos;
|
||||||
$scope.showTextEditor = true;
|
$scope.target.textEditor = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +55,7 @@ function (angular, _, config, gfunc, Parser) {
|
|||||||
catch (err) {
|
catch (err) {
|
||||||
console.log('error parsing target:', err.message);
|
console.log('error parsing target:', err.message);
|
||||||
$scope.parserError = err.message;
|
$scope.parserError = err.message;
|
||||||
$scope.showTextEditor = true;
|
$scope.target.textEditor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkOtherSegments($scope.segments.length - 1);
|
checkOtherSegments($scope.segments.length - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user