Skip to content

Commit

Permalink
#1637 Add a option to toggle displaying custom fields in alert and ca…
Browse files Browse the repository at this point in the history
…se lists
  • Loading branch information
nadouani committed Nov 11, 2020
1 parent b37a15a commit 117f1d6
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 3 deletions.
4 changes: 4 additions & 0 deletions frontend/app/scripts/controllers/alert/AlertListCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
this.filtering.toggleFilters();
};

this.toggleAdvanced = function () {
this.filtering.toggleAdvanced();
};

this.canMarkAsRead = AlertingSrv.canMarkAsRead;
this.canMarkAsUnread = AlertingSrv.canMarkAsUnread;

Expand Down
4 changes: 4 additions & 0 deletions frontend/app/scripts/controllers/case/CaseListCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@
this.filtering.toggleFilters();
};

this.toggleAdvanced = function () {
this.filtering.toggleAdvanced();
};

this.filter = function () {
self.filtering.filter().then(this.applyFilters);
};
Expand Down
6 changes: 6 additions & 0 deletions frontend/app/scripts/services/common/ui/FilteringSrv.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
state: state,
showFilters: self.defaults.showFilters || false,
showStats: self.defaults.showStats || false,
showAdvanced: self.defaults.showAdvanced || true,
pageSize: self.defaults.pageSize || 15,
sort: self.defaults.sort || [],
filters: self.defaultFilter || []
Expand Down Expand Up @@ -106,6 +107,11 @@
self.storeContext();
};

this.toggleAdvanced = function() {
self.context.showAdvanced = !self.context.showAdvanced;
self.storeContext();
};

this.setPageSize = function(pageSize) {
self.context.pageSize = pageSize;
self.storeContext();
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/views/partials/alert/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ <h3 class="box-title">List of alerts ({{$vm.list.total || 0}} of {{$vm.alertList
</td>
<td></td>
</tr>
<tr>
<tr ng-if="$vm.filtering.context.showAdvanced">
<td></td>
<td colspan="9">
<custom-field-labels custom-fields="event.customFields" on-field-click="$vm.addFilterValue(name, value)"><custom-field-labels>
Expand Down
6 changes: 6 additions & 0 deletions frontend/app/views/partials/alert/list/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@
<i class="fa fa-bar-chart"></i> Stats
</button>
</div>

<div class="btn-group pull-right" role="group">
<button class="btn btn-sm" ng-class="{true: 'btn-primary', false:'btn-default'}[!!$vm.filtering.context.showAdvanced]" type="button" ng-click="$vm.toggleAdvanced()">
<i class="fa fa-code"></i> Custom Fields
</button>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion frontend/app/views/partials/case/case.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ <h3 class="box-title">List of cases ({{$vm.list.total || 0}} of {{$vm.caseCount}
</span>
</div>

<custom-field-labels custom-fields="currentCase.customFields" on-field-click="$vm.addFilterValue(name, value)"><custom-field-labels>
<custom-field-labels ng-if="$vm.filtering.context.showAdvanced" custom-fields="currentCase.customFields" on-field-click="$vm.addFilterValue(name, value)"><custom-field-labels>

<div class="text-success" ng-show="currentCase.status !== 'Open'">
<small>
Expand Down
8 changes: 7 additions & 1 deletion frontend/app/views/partials/case/list/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@
</div>

<div class="btn-group pull-right" role="group">
<button class="btn btn-sm" ng-class="{true: 'btn-primary', false:'btn-default'}[$vm.filtering.context.showStats]" type="button" ng-click="$vm.toggleStats()">
<button class="btn btn-sm" ng-class="{true: 'btn-primary', false:'btn-default'}[!!$vm.filtering.context.showStats]" type="button" ng-click="$vm.toggleStats()">
<i class="fa fa-bar-chart"></i> Stats
</button>
</div>

<div class="btn-group pull-right" role="group">
<button class="btn btn-sm" ng-class="{true: 'btn-primary', false:'btn-default'}[!!$vm.filtering.context.showAdvanced]" type="button" ng-click="$vm.toggleAdvanced()">
<i class="fa fa-code"></i> Custom Fields
</button>
</div>
</div>
</div>
</div>

0 comments on commit 117f1d6

Please sign in to comment.