Added tooltip and truncate to Wazuh tables

This commit is contained in:
Jesús Ángel González 2018-07-03 15:33:53 +02:00 committed by Javier Castro
parent 31870b8dbc
commit 28a78ebcce
2 changed files with 32 additions and 16 deletions

View File

@ -273,17 +273,33 @@ app.directive('wazuhTable', function() {
return array;
};
$scope.checkIfArray = item => {
return typeof item === 'object' ?
splitArray(item) :
item == 0 ? '0' : item;
};
const checkIfArray = item => typeof item === 'object' ?
splitArray(item) :
item == 0 ?
'0' :
item;
$scope.$on('$destroy',() => {
realTime = null;
wzTableFilter.set([]);
});
$scope.nonDecoderValue = (key,item) => {
return key === 'os.name' ?
item.os.name || '---' :
key === 'os.version' ?
item.os.version || '---' :
checkIfArray(item[key.value || key]) || '---';
};
$scope.decoderValue = (key,item) => {
return key === 'details.program_name' || key.value === 'details.program_name' ?
item.details.program_name || '---' :
key === 'details.order' || key.value === 'details.order' ?
item.details.order || '---' :
checkIfArray(item[key.value || key]) || '---';
};
},
template: template
}

View File

@ -17,21 +17,21 @@
<tr ng-class="allowClick ? 'cursor-pointer' : ''" class="wz-word-wrap" ng-repeat="item in pagedItems[currentPage] | filter:{item:'!'}" ng-click="clickAction(item)">
<td ng-repeat="key in keys" ng-if="path !== '/decoders'">
{{
key === 'os.name' ?
item.os.name || '---' :
key === 'os.version' ?
item.os.version || '---' :
checkIfArray(item[key.value || key]) || '---'
nonDecoderValue(key,item) | limitTo: 25
}}
<span ng-if="nonDecoderValue(key,item).length > 25">...</span>
<md-tooltip ng-if="nonDecoderValue(key,item).length > 25" md-direction="bottom" class="wz-tooltip">
{{ nonDecoderValue(key,item) }}
</md-tooltip>
</td>
<td ng-repeat="key in keys" ng-if="path === '/decoders'">
{{
key === 'details.program_name' || key.value === 'details.program_name' ?
item.details.program_name || '---' :
key === 'details.order' || key.value === 'details.order' ?
item.details.order || '---' :
checkIfArray(item[key.value || key]) || '---'
decoderValue(key,item) | limitTo: 25
}}
<span ng-if="decoderValue(key,item).length > 25">...</span>
<md-tooltip ng-if="decoderValue(key,item).length > 25" md-direction="bottom" class="wz-tooltip">
{{ decoderValue(key,item) }}
</md-tooltip>
</td>
</tr>