Skip to content

Commit

Permalink
fix(default datasource): minor fix for handling of default datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
torkelo committed Aug 18, 2015
1 parent 2f5115c commit 0339026
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 43 deletions.
16 changes: 4 additions & 12 deletions public/app/plugins/datasource/influxdb/partials/query.editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,10 @@
<i class="fa fa-bars"></i>
</a>
<ul class="dropdown-menu pull-right" role="menu">
<a tabindex="1" ng-click="toggleEditorMode()">
Switch editor mode
</a>
<li role="menuitem">
<a tabindex="1" ng-click="duplicate()">Duplicate</a>
</li>
<li role="menuitem">
<a tabindex="1" ng-click="moveMetricQuery($index, $index-1)">Move up</a>
</li>
<li role="menuitem">
<a tabindex="1" ng-click="moveMetricQuery($index, $index+1)">Move down</a>
</li>
<li role="menuitem"><a tabindex="1" ng-click="toggleQueryMode()">Switch editor mode</a></li>
<li role="menuitem"><a tabindex="1" ng-click="duplicate()">Duplicate</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveMetricQuery($index, $index-1)">Move up</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveMetricQuery($index, $index+1)">Move down</a></li>
</ul>
</div>
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<div class="tight-form">
<ul class="tight-form-list pull-right">
<li class="tight-form-item small" ng-show="target.datasource">
<em>{{target.datasource}}</em>
</li>
<li class="tight-form-item">
<div class="dropdown">
<a class="pointer dropdown-toggle"
data-toggle="dropdown"
tabindex="1">
<a class="pointer dropdown-toggle" data-toggle="dropdown" tabindex="1">
<i class="fa fa-bars"></i>
</a>
<ul class="dropdown-menu pull-right" role="menu">
<li role="menuitem"><a tabindex="1" ng-click="toggleQueryMode()">Switch editor mode</a></li>
<li role="menuitem"><a tabindex="1" ng-click="duplicate()">Duplicate</a></li>
<li role="menuitem"><a tabindex="1" ng-click="showQuery()" ng-hide="target.rawQuery">Raw query mode</a></li>
<li role="menuitem"><a tabindex="1" ng-click="hideQuery()" ng-show="target.rawQuery">Query editor mode</a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveMetricQuery($index, $index-1)">Move up </a></li>
<li role="menuitem"><a tabindex="1" ng-click="moveMetricQuery($index, $index+1)">Move down</a></li>
</ul>
Expand All @@ -35,19 +35,13 @@
</ul>

<!-- Raw Query mode -->
<ul class="tight-form-list" ng-show="target.rawQuery">
<li>
<input type="text"
class="tight-form-input span10"
ng-model="target.query"
placeholder="select ..."
give-focus="target.rawQuery"
spellcheck='false'
data-min-length=0 data-items=100
ng-model-onblur
ng-blur="get_data()">
</li>
</ul>
<input type="text" class="tight-form-clear-input" style="width: 80%" ng-model="target.query"
placeholder="select ..." ng-show="target.rawQuery"
give-focus="target.rawQuery"
spellcheck='false'
data-min-length=0 data-items=100
ng-model-onblur
ng-blur="get_data()"></input>

<!-- Query editor mode -->
<ul class="tight-form-list" role="menu" ng-hide="target.rawQuery">
Expand Down
10 changes: 2 additions & 8 deletions public/app/plugins/datasource/influxdb_08/queryCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ function (angular, _) {
delete target.groupby_field_add;
}

$scope.rawQuery = false;

$scope.functions = [
'count', 'mean', 'sum', 'min',
'max', 'mode', 'distinct', 'median',
Expand All @@ -46,12 +44,8 @@ function (angular, _) {
});
};

$scope.showQuery = function () {
$scope.target.rawQuery = true;
};

$scope.hideQuery = function () {
$scope.target.rawQuery = false;
$scope.toggleQueryMode = function () {
$scope.target.rawQuery = !$scope.target.rawQuery;
};

// Cannot use typeahead and ng-change on blur at the same time
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<div class="tight-form">
<ul class="tight-form-list pull-right">
<li class="tight-form-item small" ng-show="target.datasource">
<em>{{target.datasource}}</em>
</li>
<li class="tight-form-item">
<div class="dropdown">
<a class="pointer dropdown-toggle" data-toggle="dropdown" tabindex="1">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<div class="tight-form">
<ul class="tight-form-list pull-right">
<li class="tight-form-item small" ng-show="target.datasource">
<em>{{target.datasource}}</em>
</li>
<li class="tight-form-item">
<div class="dropdown">
<a class="pointer dropdown-toggle"
data-toggle="dropdown"
tabindex="1">
<a class="pointer dropdown-toggle" data-toggle="dropdown" tabindex="1">
<i class="fa fa-bars"></i>
</a>
<ul class="dropdown-menu pull-right" role="menu">
<li role="menuitem">
<a tabindex="1"
ng-click="duplicate()">
<a tabindex="1" ng-click="duplicate()">
Duplicate
</a>
</li>
Expand Down

0 comments on commit 0339026

Please sign in to comment.