Updated default dashboard, added filtering panel

This commit is contained in:
Rashid Khan
2013-07-14 21:42:35 -07:00
parent de8f8c5851
commit 2c5eb8bfb4
14 changed files with 230 additions and 87 deletions
+4 -4
View File
@@ -1,8 +1,8 @@
<a class="close" ng-click="dismiss()" href="">×</a>
<h4>
Micro Analysis of {{micropanel.field}}
<i class="pointer icon-search" ng-click="fieldExists(micropanel.field,'exists');dismiss();"></i>
<i class="pointer icon-ban-circle" ng-click="fieldExists(micropanel.field,'missing');dismiss();"></i>
<i class="pointer icon-search" ng-click="fieldExists(micropanel.field,'must');dismiss();"></i>
<i class="pointer icon-ban-circle" ng-click="fieldExists(micropanel.field,'mustNot');dismiss();"></i>
<br><small>{{micropanel.count}} events in the table set</small>
</h4>
<table style="width:480px" class='table table-bordered table-striped table-condensed'>
@@ -15,8 +15,8 @@
<tr ng-repeat='field in micropanel.values'>
<td>{{{true: "__blank__",false:field[0]}[field[0] == ""]}}</td>
<td>
<i class="pointer icon-search" ng-click="build_search(micropanel.field,field[0]);dismiss();"></i>
<i class="pointer icon-ban-circle" ng-click="build_search(micropanel.field,field[0],true);dismiss();"></i>
<i class="pointer icon-search" ng-click="build_search(micropanel.field,field[0],'must');dismiss();"></i>
<i class="pointer icon-ban-circle" ng-click="build_search(micropanel.field,field[0],'mustNot');dismiss();"></i>
</td>
<td>{{field[1]}}</td>
</tr>
+6 -5
View File
@@ -79,14 +79,15 @@ angular.module('kibana.fields', [])
eventBus.broadcast($scope.$id,$scope.panel.group,"selected_fields",$scope.active)
}
$scope.build_search = function(field,value,negate) {
var query = (negate ? '-':'+')+field+":\""+value+"\""
filterSrv.set({type:'querystring',query:query})
$scope.build_search = function(field,value,mandate) {
var query = field+":"+angular.toJson(value)
filterSrv.set({type:'querystring',query:query,mandate:mandate})
dashboard.refresh();
}
$scope.fieldExists = function(field,mode) {
filterSrv.set({type:mode,field:field})
$scope.fieldExists = function(field,mandate) {
filterSrv.set({type:'exists',field:field,mandate:mandate})
dashboard.refresh();
}
+7
View File
@@ -0,0 +1,7 @@
<div>
<div class="row-fluid">
<div class="span12">
No options here
</div>
</div>
</div>
+15
View File
@@ -0,0 +1,15 @@
<div>
<style>
.input-query-alias {
margin-bottom: 5px !important;
}
</style>
<a class="close" ng-click="render();dismiss();" href="">×</a>
<h6>Query Alias</h6>
<form>
<input class="input-medium input-query-alias" type="text" ng-model="queries.list[id].alias" placeholder='Alias...' />
<div>
<i ng-repeat="color in queries.colors" class="pointer" ng-class="{'icon-circle-blank':queries.list[id].color == color,'icon-circle':queries.list[id].color != color}" style="color:{{color}}" ng-click="queries.list[id].color = color;render();"> </i>
</div>
</form>
</div>
+36
View File
@@ -0,0 +1,36 @@
<kibana-panel ng-controller='filtering' ng-init="init()">
<style>
.filter-panel-filter {
display:inline-block;
margin-left: 10px;
width: 200px;
padding: 5px;
border: #555 1px solid;
margin: 0px 5px 5px 0px;
}
.filter-must {
border-bottom: #7EB26D 3px solid;
}
.filter-mustNot {
border-bottom: #E24D42 3px solid;
}
.filter-should {
border-bottom: #EF843C 3px solid;
}
.filter-remove {
float:right;
margin-bottom: 0px !important;
}
</style>
<div ng-repeat="id in filterSrv.ids" class="small filter-panel-filter">
<div class="filter-{{filterSrv.list[id].mandate}}">
{{filterSrv.list[id].type}} ({{filterSrv.list[id].mandate}})
<i class="filter-remove pointer icon-remove" ng-click="remove(id)"></i>
</div>
<ul class="unstyled">
<li ng-repeat="(key,value) in stripped(filterSrv.list[id])"><strong>{{key}}</strong> : {{value}}</li>
</ul>
</div>
</kibana-panel>
+42
View File
@@ -0,0 +1,42 @@
/*
## filtering
An experimental for interacting with the filter service
### Parameters
*/
angular.module('kibana.filtering', [])
.controller('filtering', function($scope, filterSrv, $rootScope, dashboard) {
// Set and populate defaults
var _d = {
status : "Experimental"
}
_.defaults($scope.panel,_d);
$scope.init = function() {
$scope.filterSrv = filterSrv
}
$scope.remove = function(id) {
filterSrv.remove(id);
dashboard.refresh();
}
$scope.refresh = function(query) {
$rootScope.$broadcast('refresh')
}
$scope.render = function(query) {
$rootScope.$broadcast('render')
}
$scope.stripped = function(filter) {
var filter = _.omit(filter,'type','id','alias','mandate')
return filter
}
});
+7 -8
View File
@@ -32,12 +32,6 @@
* x-axis :: Show x-axis labels and grid lines
* y-axis :: Show y-axis labels and grid lines
* interactive :: Allow drag to select time range
### Group Events
#### Receives
* time :: An object containing the time range to use and the index(es) to query
* query :: An Array of queries, even if its only one
#### Sends
* get_time :: On panel initialization get time range to query
*/
@@ -80,6 +74,8 @@ angular.module('kibana.histogram', [])
$scope.get_data();
})
$scope.get_data()
}
$scope.get_data = function(segment,query_id) {
@@ -157,7 +153,10 @@ angular.module('kibana.histogram', [])
// Null values at each end of the time range ensure we see entire range
if(_.isUndefined($scope.data[i]) || _segment == 0) {
var data = [[_range.from.getTime(), null],[_range.to.getTime(), null]];
var data = []
if(filterSrv.idsByType('time').length > 0) {
data = [[_range.from.getTime(), null],[_range.to.getTime(), null]];
}
var hits = 0;
} else {
var data = $scope.data[i].data
@@ -236,7 +235,7 @@ angular.module('kibana.histogram', [])
$scope.modal = {
title: "Inspector",
body : "<h5>Last Elasticsearch Query</h5><pre>"+
'curl -XGET '+config.elasticsearch+'/'+$scope.index+"/_search?pretty -d'\n"+
'curl -XGET '+config.elasticsearch+'/'+dashboard.indices+"/_search?pretty -d'\n"+
angular.toJson(JSON.parse(request.toString()),true)+
"'</pre>",
}
+1 -1
View File
@@ -45,7 +45,7 @@
<span class="end-query">
<i class="icon-search pointer" ng-click="refresh()" ng-show="$last"></i>
<i class="icon-plus pointer" ng-click="queries.set({})" ng-show="$last"></i>
</span
</span>
</form>
</div>
</kibana-panel>
+3 -4
View File
@@ -55,8 +55,7 @@ angular.module('kibana.table', [])
$scope.set_listeners($scope.panel.group)
// Now that we're all setup, request the time from our group
eventBus.broadcast($scope.$id,$scope.panel.group,"get_time")
$scope.get_data();
}
$scope.set_listeners = function(group) {
@@ -108,8 +107,8 @@ angular.module('kibana.table', [])
}
$scope.build_search = function(field,value,negate) {
var query = (negate ? '-':'+')+field+":\""+value+"\""
filterSrv.set({type:'querystring',query:query})
var query = field+":"+angular.toJson(value)
filterSrv.set({type:'querystring',query:query,mandate:(negate ? 'mustNot':'must')})
$scope.panel.offset = 0;
dashboard.refresh();
}