Commit 7b5c1a67 by Rashid Khan

Fixed bugs in multiquery receive

parent c0273d88
<div class="row-fluid"> <div>
<div class="span3"> <div class="row-fluid">
<label class="small">Mulit Query</label><input type="checkbox" ng-change="set_multi(panel.multi) "ng-model="panel.multi" ng-checked="panel.multi"> <div class="span3">
<label class="small">Mulit Query</label><input type="checkbox" ng-change="set_multi(panel.multi) "ng-model="panel.multi" ng-checked="panel.multi">
</div>
<div class="span4" ng-show="panel.multi">
<label class="small">Multiquery Arrangement</label>
<select class="input-medium" ng-model="panel.multi_arrange" ng-options="f for f in ['vertical','horizontal']"></select>
</div>
<div class="span4" style="white-space:nowrap">
<label class="small">Sort</label>
<input ng-show="all_fields.length<=0 || !all_fields"style="width:85%" ng-model="panel.sort[0]" type="text"></input>
<select ng-show="all_fields.length>0"style="width:85%" ng-model="panel.sort[0]" ng-options="f for f in all_fields"></select>
<i ng-click="set_sort(panel.sort[0])" ng-class="{'icon-chevron-up': panel.sort[1] == 'asc','icon-chevron-down': panel.sort[1] == 'desc'}"></i>
</div>
</div> </div>
<div class="span4" ng-show="panel.multi"> <div class="row-fluid" ng-show="panel.multi">
<label class="small">Multiquery Arrangement</label> <div class="span12">
<select class="input-medium" ng-model="panel.multi_arrange" ng-options="f for f in ['vertical','horizontal']"></select> <h5>A note on multi query panels</h5>
</div> <p>You turned on multi panel support: <i>cool</i>. Be aware that not all panels support display of multiple queries. Panels that don't support receiving several queries at one time will (should) display the results of the <strong>first query in the list</strong>. Further, some panels might not support receiving multiple queries in all modes. For example, the <strong>pie panel</strong> supports multiple queries only in <strong>query mode</strong>. In its other modes it will display the results of the first query in the list</p>
<div class="span4" style="white-space:nowrap"> </div>
<label class="small">Sort</label>
<input ng-show="all_fields.length<=0 || !all_fields"style="width:85%" ng-model="panel.sort[0]" type="text"></input>
<select ng-show="all_fields.length>0"style="width:85%" ng-model="panel.sort[0]" ng-options="f for f in all_fields"></select>
<i ng-click="set_sort(panel.sort[0])" ng-class="{'icon-chevron-up': panel.sort[1] == 'asc','icon-chevron-down': panel.sort[1] == 'desc'}"></i>
</div> </div>
</div> </div>
\ No newline at end of file
<kibana-panel ng-controller='stringquery'> <kibana-panel ng-controller='stringquery'>
<div ng-show="!panel.multi"> <div ng-show="!panel.multi">
<form class="input-append" style="margin-bottom:0px; width:100%;z-index:1000;overflow:auto"> <table class="form-horizontal">
<label><small>{{panel.label}}</small></label> <tr><td><label><small>{{panel.label}}</small></label></td></tr>
<input type="text" ng-model="panel.query" style="width:85%"> <tr>
<button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i></button> <td width="97%" style="padding-right:20px">
<button type="submit" class="btn btn-danger" ng-click="panel.query='';send_query(panel.query)"><i class="icon-ban-circle"></i></button> <input type="text" style="width:100%" ng-model="panel.query">
<button ng-show="panel.multi" type="submit" class="btn" ng-click="add_query()"><i class="icon-plus"></i></button> </td>
</form> <td style="margin-left:20px" width="1%">
<button style="margin-top:0px" type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i></button>
</td>
<td width="1%">
<button style="margin-top:0px" type="submit" class="btn btn-danger" ng-click="panel.query='';send_query(panel.query)"><i class="icon-ban-circle"></i></button>
</td>
<td width="1%">
<button style="margin-top:0px" ng-show="panel.multi" type="submit" class="btn" ng-click="add_query()"><i class="icon-plus"></i></button>
</td>
<tr>
</table>
</div> </div>
<div ng-show="panel.multi"> <div class='row-fluid' ng-show="panel.multi && panel.multi_arrange == 'horizontal'">
<form ng-class="{'form-inline': panel.multi_arrange == 'horizontal'}" style="width:100%;" > <form ng-class="{'form-inline': panel.multi_arrange == 'horizontal'}" style="width:100%;" >
<span ng-repeat="q in panel.query"> <span ng-repeat="q in panel.query">
<span class="input-append" style="margin-bottom:0px;margin-right:5px"> <span class="input-append" style="margin-bottom:0px;margin-right:5px">
<button class="btn btn-danger" type="submit" style="width:50px;margin-left:-50px;visibility:hidden"></button> <button class="btn btn-danger" type="submit" style="width:50px;margin-left:-50px;visibility:hidden" ng-click="send_query(panel.query)"></button>
<input style="margin-bottom:5px;" type="text" ng-model="panel.query[$index]" ng-model-onblur style="width:90%"> <input style="margin-bottom:5px;" type="text" ng-model="panel.query[$index]" ng-model-onblur style="width:90%">
<button class="btn btn-danger" ng-show="panel.query.length > 1" ng-click="remove_query($index);send_query(panel.query)"><i class="icon-minus"></i></button><br> <button class="btn btn-danger" ng-show="panel.query.length > 1" ng-click="remove_query($index);send_query(panel.query)"><i class="icon-minus"></i></button><br>
</span><br style:"height:0px" ng-show="panel.multi_arrange == 'vertical'"> </span>
</span> </span>
</form> </form>
<button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i> Search</button> <button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i> Search</button>
<button type="submit" class="btn" ng-click="send_query(panel.query);add_query();"><i class="icon-plus"></i> Add Query</button> <button type="submit" class="btn" ng-click="send_query(panel.query);add_query();"><i class="icon-plus"></i> Add Query</button>
</div> </div>
<div ng-show="panel.multi && panel.multi_arrange == 'vertical'">
<form>
<table class="form-horizontal">
<tr ng-repeat="q in panel.query" style="margin-bottom:10px">
<td width="99%"><input type="text" ng-model="panel.query[$index]" ng-model-onblur style="width:100%"></td>
<td width="1%" style="visibility:hidden"><button class="btn btn-info" type="submit"></button></td>
<td width="1%"><button class="btn btn-danger" ng-show="panel.query.length > 1" ng-click="remove_query($index);send_query(panel.query)"><i class="icon-minus"></i></button></td>
</tr>
</table>
<button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i> Search</button>
<button type="submit" class="btn" ng-click="send_query(panel.query);add_query();"><i class="icon-plus"></i> Add Query</button>
</form>
</kibana-panel> </kibana-panel>
\ No newline at end of file
...@@ -17,7 +17,14 @@ angular.module('kibana.stringquery', []) ...@@ -17,7 +17,14 @@ angular.module('kibana.stringquery', [])
$scope.panel.group : [$scope.panel.group]; $scope.panel.group : [$scope.panel.group];
$scope.init = function() { $scope.init = function() {
// I don't like this compromise. I'm not totally sure what this panel
// Should do if its in multi query mode and receives a query. For now, just
// replace the first one, though I feel like that isn't right.
eventBus.register($scope,'query',function(event,query) { eventBus.register($scope,'query',function(event,query) {
if (_.isArray($scope.panel.query))
$scope.panel.query[0] = query
else
$scope.panel.query = query; $scope.panel.query = query;
}); });
} }
...@@ -40,6 +47,13 @@ angular.module('kibana.stringquery', []) ...@@ -40,6 +47,13 @@ angular.module('kibana.stringquery', [])
new Array($scope.panel.query) : $scope.panel.query[0]; new Array($scope.panel.query) : $scope.panel.query[0];
} }
$scope.set_sort = function(field) {
if($scope.panel.sort[0] === field)
$scope.panel.sort[1] = $scope.panel.sort[1] == 'asc' ? 'desc' : 'asc';
else
$scope.panel.sort[0] = field;
}
$scope.remove_query = function(index) { $scope.remove_query = function(index) {
$scope.panel.query.splice(index,1); $scope.panel.query.splice(index,1);
console.log($scope.panel.query) console.log($scope.panel.query)
......
...@@ -52,7 +52,7 @@ angular.module('kibana.table', []) ...@@ -52,7 +52,7 @@ angular.module('kibana.table', [])
$scope.panel.fields = _.without($scope.panel.fields,field) $scope.panel.fields = _.without($scope.panel.fields,field)
else else
$scope.panel.fields.push(field) $scope.panel.fields.push(field)
broadcast_fields(); broadcast_results();
} }
$scope.toggle_details = function(row) { $scope.toggle_details = function(row) {
......
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