Commit 06d04828 by Rashid Khan

added more view options for hits panel

parent c407da00
<div ng-controller="hits"> <div ng-controller="hits">
<div class="row-fluid"> <div class="row-fluid">
<div class="span2 "><label class="small">Font Size</label> <div class="span3">
<select class="input-mini" ng-model="panel.style['font-size']" ng-options="f for f in ['7pt','8pt','9pt','10pt','12pt','14pt','16pt','18pt','20pt','24pt','28pt','32pt','36pt','42pt','48pt','52pt','60pt','72pt']"></select></span>
</div>
<div class="span2">
<label class="small">Aggregate</label><input type="checkbox" ng-model="panel.aggregate" ng-checked="panel.aggregate">
</div>
<div class="span3" ng-show="!panel.aggregate">
<label class="small">Counter Style</label>
<select class="input-small" ng-model="panel.arrangement" ng-options="f for f in ['none','horizontal','vertical']"></select></span>
</div>
</div>
<h5 ng-show="!panel.aggregate">Chart Options</h5>
<div class="row-fluid" ng-show="!panel.aggregate">
<div class="span3">
<label class="small">Style</label> <label class="small">Style</label>
<select class="input-small" ng-model="panel.chart" ng-options="f for f in ['none','bar','pie']"></select></span> <select class="input-small" ng-model="panel.chart" ng-options="f for f in ['bar','pie','list','total']"></select></span>
</div>
<div class="span2" ng-show="panel.chart == 'total' || panel.chart == 'list'">
<label class="small">Font Size</label>
<select class="input-mini" ng-model="panel.style['font-size']" ng-options="f for f in ['7pt','8pt','9pt','10pt','12pt','14pt','16pt','18pt','20pt','24pt','28pt','32pt','36pt','42pt','48pt','52pt','60pt','72pt']"></select></span>
</div> </div>
<div class="row-fluid" > <div class="span3" ng-show="panel.chart == 'bar' || panel.chart == 'pie'">
<div class="span3" ng-show="!panel.aggregate">
<label class="small">Legend</label> <label class="small">Legend</label>
<select class="input-small" ng-model="panel.counter_pos" ng-options="f for f in ['above','below']"></select></span> <select class="input-small" ng-model="panel.counter_pos" ng-options="f for f in ['above','below','none']"></select></span>
</div>
<div class="span3" ng-show="panel.chart != 'total' && panel.counter_pos != 'none'">
<label class="small" >List Format</label>
<select class="input-small" ng-model="panel.arrangement" ng-options="f for f in ['horizontal','vertical']"></select></span>
</div> </div>
<div class="span1" ng-show='panel.chart == "pie"'> <div class="span1" ng-show='panel.chart == "pie"'>
<label class="small"> Donut </label><input type="checkbox" ng-model="panel.donut" ng-checked="panel.donut"> <label class="small">Donut</label><input type="checkbox" ng-model="panel.donut" ng-checked="panel.donut">
</div> </div>
<div class="span1" ng-show='panel.chart == "pie"'> <div class="span1" ng-show='panel.chart == "pie"'>
<label class="small"> Tilt </label><input type="checkbox" ng-model="panel.tilt" ng-checked="panel.tilt"> <label class="small">Tilt</label><input type="checkbox" ng-model="panel.tilt" ng-checked="panel.tilt">
</div> </div>
<div class="span1" ng-show='panel.chart == "pie"'> <div class="span1" ng-show='panel.chart == "pie"'>
<label class="small"> Labels </label><input type="checkbox" ng-model="panel.labels" ng-checked="panel.labels"> <label class="small">Labels</label><input type="checkbox" ng-model="panel.labels" ng-checked="panel.labels">
</div> </div>
</div> </div>
<h5>Queries</h5> <h5>Queries</h5>
......
<kibana-panel ng-controller='hits' ng-init="init()"> <kibana-panel ng-controller='hits' ng-init="init()">
<div ng-show="panel.counters && panel.counter_pos == 'above'"> <div ng-show="panel.counter_pos == 'above' && (panel.chart == 'bar' || panel.chart == 'pie')" id='{{$id}}-legend'>
<!-- no chart, aggregated numbers -->
<p ng-style="panel.style" ng-show="panel.aggregate">{{hits}}</p>
<!-- vertical legend --> <!-- vertical legend -->
<table ng-style="panel.style" ng-show="!panel.aggregate && panel.arrangement == 'vertical'"> <table class="small" ng-show="panel.arrangement == 'vertical'">
<tr style="line-height:{{panel.style['font-size']}}" ng-repeat="query in plot.getData()"> <tr ng-repeat="query in plot.getData()">
<td style="background:{{query.color}};width:{{panel.style['font-size']}}"></td> <td style="padding-right:10px;padding-left:10px;">{{query.label}}</td><td>{{query.data[0][1]}}</td> <td><div style="display:inline-block;border-radius:5px;background:{{query.color}};height:10px;width:10px"></div></td> <td style="padding-right:10px;padding-left:10px;">{{query.label}}</td><td>{{query.data[0][1]}}</td>
</tr> </tr>
</table> </table>
<!-- horizontal legend --> <!-- horizontal legend -->
<div ng-style="panel.style" ng-show="!panel.aggregate && panel.arrangement == 'horizontal'" ng-repeat="query in plot.getData()" style="float:left;padding-left: 10px;"> <div class="small" ng-show="panel.arrangement == 'horizontal'" ng-repeat="query in plot.getData()" style="float:left;padding-left: 10px;">
<span><div style="display:inline-block;border-radius:{{panel.style['font-size']}};background:{{query.color}};height:{{panel.style['font-size']}};width:{{panel.style['font-size']}}"></div></span> {{query.label}} ({{query.data[0][1]}}) </span> <span><div style="display:inline-block;border-radius:5px;background:{{query.color}};height:10px;width:10px"></div></span> {{query.label}} ({{query.data[0][1]}}) </span>
</div><br> </div><br>
</div> </div>
<div style="clear:both"></div> <div style="clear:both"></div>
<div ng-show='panel.chart != "none" && !panel.aggregate ' hits-chart params="{{panel}}" style="height:{{panel.height || row.height}};position:relative"></div>
<div ng-show="panel.counters && panel.counter_pos == 'below'"> <div ng-show="panel.chart == 'pie' || panel.chart == 'bar'" hits-chart params="{{panel}}" style="height:{{panel.height || row.height}};position:relative"></div>
<!-- no chart, aggregated numbers -->
<p ng-style="panel.style" ng-show="panel.aggregate">{{hits}}</p> <div ng-show="panel.counter_pos == 'below' && (panel.chart == 'bar' || panel.chart == 'pie')" id='{{$id}}-legend'>
<!-- vertical legend --> <!-- vertical legend -->
<table ng-style="panel.style" ng-show="!panel.aggregate && panel.arrangement == 'vertical'"> <table class="small" ng-show="panel.arrangement == 'vertical'">
<tr style="line-height:{{panel.style['font-size']}}" ng-repeat="query in plot.getData()"> <tr ng-repeat="query in plot.getData()">
<tdstyle="background:{{query.color}};width:{{panel.style['font-size']}}"></td> <td style="padding-right:10px;padding-left:10px;">{{query.label}}</td><td>{{query.data[0][1]}}</td> <td><div style="display:inline-block;border-radius:5px;background:{{query.color}};height:10px;width:10px"></div></td> <td style="padding-right:10px;padding-left:10px;">{{query.label}}</td><td>{{query.data[0][1]}}</td>
</tr> </tr>
</table> </table>
<!-- horizontal legend --> <!-- horizontal legend -->
<div ng-style="panel.style" ng-show="!panel.aggregate && panel.arrangement == 'horizontal'" ng-repeat="query in plot.getData()" style="float:left;padding-left: 10px;"> <div class="small" ng-show="panel.arrangement == 'horizontal'" ng-repeat="query in plot.getData()" style="float:left;padding-left: 10px;">
<span><div style="display:inline-block;border-radius:{{panel.style['font-size']}};background:{{query.color}};height:{{panel.style['font-size']}};width:{{panel.style['font-size']}}"></div></span> {{query.label}} ({{query.data[0][1]}}) </span> <span><div style="display:inline-block;border-radius:5px;background:{{query.color}};height:10px;width:10px"></div></span> {{query.label}} ({{query.data[0][1]}}) </span>
</div><br> </div><br>
</div> </div>
<div ng-show="panel.chart == 'total'"><div ng-style="panel.style" style="line-height:{{panel.style['font-size']}}">{{hits}}</div></div>
<span ng-show="panel.chart == 'list'"><span ng-style="panel.style" style="line-height:{{panel.style['font-size']}}" ng-repeat="query in data">{{query.label}} ({{query.hits}})<span></span><br ng-show="panel.arrangement == 'vertical' && panel.chart == 'list'">
</kibana-panel> </kibana-panel>
\ No newline at end of file
...@@ -98,7 +98,6 @@ angular.module('kibana.hits', []) ...@@ -98,7 +98,6 @@ angular.module('kibana.hits', [])
i++; i++;
}); });
$scope.$emit('render'); $scope.$emit('render');
if(_segment < $scope.panel.index.length-1) if(_segment < $scope.panel.index.length-1)
$scope.get_data(_segment+1,query_id) $scope.get_data(_segment+1,query_id)
...@@ -200,6 +199,10 @@ angular.module('kibana.hits', []) ...@@ -200,6 +199,10 @@ angular.module('kibana.hits', [])
colors: ['#86B22D','#BF6730','#1D7373','#BFB930','#BF3030','#77207D'] colors: ['#86B22D','#BF6730','#1D7373','#BFB930','#BF3030','#77207D']
}); });
// Compensate for the height of the legend. Gross
elem.height(
(scope.panel.height || scope.row.height).replace('px','') - $("#"+scope.$id+"-legend").height())
// Work around for missing legend at initialization // Work around for missing legend at initialization
if(!scope.$$phase) if(!scope.$$phase)
scope.$apply() scope.$apply()
......
...@@ -34,7 +34,7 @@ angular.module('kibana.stringquery', []) ...@@ -34,7 +34,7 @@ angular.module('kibana.stringquery', [])
$scope.panel.query = new Array($scope.panel.query) $scope.panel.query = new Array($scope.panel.query)
$scope.panel.query.push("") $scope.panel.query.push("")
} }
} }
$scope.set_multi = function(multi) { $scope.set_multi = function(multi) {
$scope.panel.query = multi ? $scope.panel.query = multi ?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment