Skip to content

Commit

Permalink
#1637 Refind the custom fields list:
Browse files Browse the repository at this point in the history
- Display field readable name when possible
- Display custom fields in cases list
- Add tooltip with custom field description
  • Loading branch information
nadouani authored and To-om committed Nov 13, 2020
1 parent 1892b74 commit 0fe4535
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@

angular.module('theHiveComponents')
.component('customFieldLabels', {
controller: function() {
controller: function(CustomFieldsSrv) {
var self = this;

this.fieldsCache = {};
this.fieldClicked = function(fieldName, newValue) {
this.onFieldClick({
name: fieldName,
value: newValue
});
};

this.$onInit = function() {
CustomFieldsSrv.all().then(function(fields) {
self.fieldsCache = fields;
});
};
},
controllerAs: '$cmp',
templateUrl: 'views/components/common/custom-field-labels.component.html',
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/styles/label.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
border-left-width: 3px;
border-left-style: solid;
}
.double-val-label>span:nth-child(2) {
.double-val-label>span:last-child {
border-bottom-right-radius: 0.25em;
border-top-right-radius: .25em;
/* border-left: 1px dashed #777; */
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ table.tbody-stripped > tbody:nth-child(2n+1) > tr > th {
}

table.tbody-stripped > tbody > tr:first-child > td {
padding-bottom:0;
/* padding-bottom:0; */
}

/* table.tbody-stripped > tbody > tr:nth-child(2n) > td { */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ng-click="$cmp.fieldClicked('customFields.' + cf.name, cf.value)"
ng-if="cf.value !== undefined && cf.value !== null">

<span class="default">{{cf.name}}</span>
<span class="default" uib-tooltip="{{cf.description}}" tooltip-placement="top">{{$cmp.fieldsCache[cf.name].name || cf.name}}</span>
<span class="default">{{cf.value}}</span>
</span>
</div>
15 changes: 0 additions & 15 deletions frontend/app/views/partials/alert/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,6 @@ <h3 class="box-title">List of alerts ({{$vm.list.total || 0}} of {{$vm.alertList
<tr>
<td></td>
<td colspan="9">
<!-- <div class="case-tags flexwrap">
<span class="mr-xxxs text-muted"><i class="fa fa-code"></i></span>
<strong class="text-muted mr-xxxs" ng-if="!event.customFields || event.customFields.length === 0">None</strong>
<span class="double-val-label mb-xxxs mr-xxxs pointer"
ng-repeat="cf in event.customFields | orderBy:'order' track by $index"
ng-click="$vm.addFilterValue('customFields.'+cf.name, cf.value)"
ng-if="cf.value !== undefined && cf.value !== null">
<span class="default">{{cf.name}}</span>
<span class="default">{{cf.value}}</span>
</span>
</div>
<hr /> -->

<custom-field-labels custom-fields="event.customFields" on-field-click="$vm.addFilterValue(name, value)"><custom-field-labels>
</td>
<td></td>
Expand Down
3 changes: 3 additions & 0 deletions frontend/app/views/partials/case/case.list.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ <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>

<div class="text-success" ng-show="currentCase.status !== 'Open'">
<small>
(Closed at {{currentCase.endDate | showDate}} as <strong>{{$vm.CaseResolutionStatus[currentCase.resolutionStatus]}}</strong>)
Expand Down

0 comments on commit 0fe4535

Please sign in to comment.