Skip to content
Snippets Groups Projects
Commit e2d6e534 authored by cmaeder's avatar cmaeder
Browse files

display groups and search table if groups are few

parent 9bc97106
No related branches found
No related tags found
1 merge request!2Search all fields and start with an overview by grouping identical short messages
......@@ -15,7 +15,25 @@
group by
<select ng-click="group()" ng-model="field" ng-init="columns[shortMsg].long"
ng-options="columns[key].long for key in colProps | filter : '!id'"></select>
as overview with clickable content
as overview with clickable maximal rows:
<input type="number" min="0" max="10000" ng-click="group()"
ng-model="maxGroups"/>
<table ng-if="groupMode || groups.length <= 10 ">
<thead>
<tr>
<th>#</th>
<th>{{columns[field].long}} ({{groups.length}} rows)</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="g in groups">
<td>{{g.count}}</td>
<td ng-click="columns[field].search = g.content; search()"
style="cursor:pointer">{{g.content}}
</td>
</tr>
</tbody>
</table>
<p/>
display:
......@@ -29,17 +47,15 @@
entries).</p>
<button ng-click="clear()">clear filters</button>
<button ng-click="search()">search</button>
<span>
maximal entries:
<input type="number" min="0" max="10000" ng-model="maxNumber"/>
</span>
<span ng-show="!groupMode">
<span ng-show="number > results.length">{{number}} entries (showing {{results.length}})</span>
<span ng-show="number <= results.length">result: {{results.length}}</span>
</span>
<p/>
<table ng-if="!groupMode">
<table ng-if="!groupMode || groups.length <= 10">
<thead>
<tr>
<th ng-repeat="key in colProps" ng-if="columns[key].x">
......@@ -64,22 +80,6 @@
</tr>
</tbody>
</table>
<table ng-if="groupMode">
<thead>
<tr>
<th>#</th>
<th>{{columns[field].long}} ({{groups.length}} rows)</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="g in groups">
<td>{{g.count}}</td>
<td ng-click="columns[field].search = g.content; search()"
style="cursor:pointer">{{g.content}}
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
......@@ -18,15 +18,16 @@ angular.module('searchApp', []).controller('SearchController',
$scope.groups = [];
$scope.number = 0;
$scope.maxNumber = 100;
$scope.maxGroups = 6;
$scope.searchText = '';
$scope.groupMode = false;
$scope.query = function () {
$scope.query = function (limit) {
var res = '';
for (k in $scope.columns) {
var str = escape($scope.columns[k].search);
res = res + '&' + k + "=" + str;
};
return '?limit=' + $scope.maxNumber + res;
return '?limit=' + limit + res;
};
$scope.clear = function() {
for (k in $scope.columns) {
......@@ -37,22 +38,23 @@ angular.module('searchApp', []).controller('SearchController',
$scope.groupMode = true;
$scope.clear();
$scope.columns[$scope.field].x = true;
$http.get('/sally/error/group/' + $scope.field + $scope.query()).success(function(data) {
$http.get('/sally/error/group/' + $scope.field + $scope.query($scope.maxGroups)).success(function(data) {
$scope.groups = data;
});
};
$scope.search = function() {
$scope.groupMode = false;
$http.get('/sally/error/search2' + $scope.query()).success(function(data) {
$http.get('/sally/error/search2' + $scope.query($scope.maxNumber)).success(function(data) {
$scope.results = data;
});
$scope.count();
};
$scope.count = function() {
$http.get('/sally/error/count2' + $scope.query()).success(function(data) {
$http.get('/sally/error/count2' + $scope.query($scope.maxNumber)).success(function(data) {
$scope.number = data[0].count;
});
};
$scope.search();
$scope.group();
$scope.sort = {
col: 'id',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment