Commit 7b5c1a67 by Rashid Khan

Fixed bugs in multiquery receive

parent c0273d88
<div class="row-fluid">
<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="row-fluid">
<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 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 class="row-fluid" ng-show="panel.multi">
<div class="span12">
<h5>A note on multi query panels</h5>
<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>
</div>
</div>
\ No newline at end of file
<kibana-panel ng-controller='stringquery'>
<div ng-show="!panel.multi">
<form class="input-append" style="margin-bottom:0px; width:100%;z-index:1000;overflow:auto">
<label><small>{{panel.label}}</small></label>
<input type="text" ng-model="panel.query" style="width:85%">
<button type="submit" class="btn btn-info" ng-click="send_query(panel.query)"><i class="icon-search"></i></button>
<button type="submit" class="btn btn-danger" ng-click="panel.query='';send_query(panel.query)"><i class="icon-ban-circle"></i></button>
<button ng-show="panel.multi" type="submit" class="btn" ng-click="add_query()"><i class="icon-plus"></i></button>
</form>
<table class="form-horizontal">
<tr><td><label><small>{{panel.label}}</small></label></td></tr>
<tr>
<td width="97%" style="padding-right:20px">
<input type="text" style="width:100%" ng-model="panel.query">
</td>
<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 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%;" >
<span ng-repeat="q in panel.query">
<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%">
<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>
</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" ng-click="send_query(panel.query);add_query();"><i class="icon-plus"></i> Add Query</button>
</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>
\ No newline at end of file
......@@ -17,7 +17,14 @@ angular.module('kibana.stringquery', [])
$scope.panel.group : [$scope.panel.group];
$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) {
if (_.isArray($scope.panel.query))
$scope.panel.query[0] = query
else
$scope.panel.query = query;
});
}
......@@ -40,6 +47,13 @@ angular.module('kibana.stringquery', [])
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.panel.query.splice(index,1);
console.log($scope.panel.query)
......
......@@ -52,7 +52,7 @@ angular.module('kibana.table', [])
$scope.panel.fields = _.without($scope.panel.fields,field)
else
$scope.panel.fields.push(field)
broadcast_fields();
broadcast_results();
}
$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