mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Added ability to add custom query string filters
This commit is contained in:
parent
0f96b7a2a3
commit
b766d900a8
@ -74,17 +74,18 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div ng-show="filterSrv.list[id].editing && isEditable(filterSrv.list[id])">
|
<form ng-show="filterSrv.list[id].editing && isEditable(filterSrv.list[id])">
|
||||||
<ul class="unstyled">
|
<ul class="unstyled">
|
||||||
<li ng-repeat="key in _.keys(filterSrv.list[id])" ng-show="show_key(key)">
|
<li ng-repeat="key in _.keys(filterSrv.list[id])" ng-show="show_key(key)">
|
||||||
<strong>{{key}}</strong> : <input type='text' ng-model="filterSrv.list[id][key]">
|
<strong>{{key}}</strong> : <input type='text' ng-model="filterSrv.list[id][key]">
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
<div>
|
||||||
<div class="filter-apply" ng-show="filterSrv.list[id].editing">
|
<input type="submit" value="Apply" ng-click="filterSrv.list[id].editing=undefined;refresh()" class="filter-apply btn btn-success btn-mini" bs-tooltip="'Save and refresh'"/>
|
||||||
<button ng-click="filterSrv.list[id].editing=undefined" class="btn btn-mini" bs-tooltip="'Save without refresh'">Save</button>
|
<button ng-click="filterSrv.list[id].editing=undefined" class="filter-apply btn btn-mini" bs-tooltip="'Save without refresh'">Save</button>
|
||||||
<button ng-click="filterSrv.list[id].editing=undefined;refresh()" class="btn btn-success btn-mini" bs-tooltip="'Save and refresh'">Apply</button>
|
</div>
|
||||||
</div>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<i class="link icon-plus-sign" ng-click="add()" bs-tooltip="'Add a query filter'" data-placement="right"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
@ -17,7 +17,7 @@ function (angular, app, _) {
|
|||||||
module.controller('filtering', function($scope, filterSrv, $rootScope, dashboard) {
|
module.controller('filtering', function($scope, filterSrv, $rootScope, dashboard) {
|
||||||
|
|
||||||
$scope.panelMeta = {
|
$scope.panelMeta = {
|
||||||
status : "Beta",
|
status : "Stable",
|
||||||
description : "A controllable list of all filters currently applied to the dashboard. You "+
|
description : "A controllable list of all filters currently applied to the dashboard. You "+
|
||||||
"almost certainly want one of these on your dashboard somewhere."
|
"almost certainly want one of these on your dashboard somewhere."
|
||||||
};
|
};
|
||||||
@ -45,6 +45,16 @@ function (angular, app, _) {
|
|||||||
dashboard.refresh();
|
dashboard.refresh();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.add = function(query) {
|
||||||
|
query = query || '*';
|
||||||
|
filterSrv.set({
|
||||||
|
editing : true,
|
||||||
|
type : 'querystring',
|
||||||
|
query : query,
|
||||||
|
mandate : 'must'
|
||||||
|
},undefined,true);
|
||||||
|
};
|
||||||
|
|
||||||
$scope.refresh = function() {
|
$scope.refresh = function() {
|
||||||
dashboard.refresh();
|
dashboard.refresh();
|
||||||
};
|
};
|
||||||
|
@ -60,7 +60,6 @@ function (angular, app, _, kbn, moment) {
|
|||||||
|
|
||||||
// Set and populate defaults
|
// Set and populate defaults
|
||||||
var _d = {
|
var _d = {
|
||||||
status : "Stable",
|
|
||||||
queries : {
|
queries : {
|
||||||
mode : 'all',
|
mode : 'all',
|
||||||
ids : []
|
ids : []
|
||||||
|
@ -36,7 +36,7 @@ function (angular, app, _, $, kbn) {
|
|||||||
editorTabs : [
|
editorTabs : [
|
||||||
{title:'Queries', src:'app/partials/querySelect.html'}
|
{title:'Queries', src:'app/partials/querySelect.html'}
|
||||||
],
|
],
|
||||||
status : "Beta",
|
status : "Stable",
|
||||||
description : "Displays the results of an elasticsearch facet as a pie chart, bar chart, or a "+
|
description : "Displays the results of an elasticsearch facet as a pie chart, bar chart, or a "+
|
||||||
"table"
|
"table"
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user