Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate tables #671

Merged
merged 5 commits into from
Jul 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions public/directives/wazuh-table/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ app.directive('wazuhTable', function() {
keys: '=keys',
allowClick: '=allowClick',
implicitFilter: '=implicitFilter',
rowsPerPage: '=rowsPerPage'
rowsPerPage: '=rowsPerPage',
extraLimit: '=extraLimit'
},
controller: function($scope, apiReq, $timeout, shareAgent, $location, errorHandler, wzTableFilter) {
$scope.keyEquivalence = KeyEquivalenece;
Expand Down Expand Up @@ -273,17 +274,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 && item.os.name ? item.os.name : false) || '---' :
key === 'os.version' ?
(item.os && item.os.version ? item.os.version : false) || '---' :
checkIfArray(item[key.value || key]) || '---';
};

$scope.decoderValue = (key,item) => {
return key === 'details.program_name' || key.value === 'details.program_name' ?
(item.details && item.details.program_name ? item.details.program_name : false) || '---' :
key === 'details.order' || key.value === 'details.order' ?
(item.details && item.details.order ? item.details.order : false) || '---' :
checkIfArray(item[key.value || key]) || '---';
};

},
template: template
}
Expand Down
20 changes: 10 additions & 10 deletions public/directives/wazuh-table/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -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: extraLimit ? 100 : 25
}}
<span ng-if="nonDecoderValue(key,item).length > (extraLimit ? 100 : 25)">...</span>
<md-tooltip ng-if="nonDecoderValue(key,item).length > (extraLimit ? 100 : 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: extraLimit ? 100 : 25
}}
<span ng-if="decoderValue(key,item).length > (extraLimit ? 100 : 25)">...</span>
<md-tooltip ng-if="decoderValue(key,item).length > (extraLimit ? 100 : 25)" md-direction="bottom" class="wz-tooltip">
{{ decoderValue(key,item) }}
</md-tooltip>
</td>

</tr>
Expand Down
3 changes: 2 additions & 1 deletion public/templates/agents/agents-syscollector.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
<wazuh-table
flex
path="'/syscollector/' + agent.id + '/packages'"
keys="['name','architecture','version',{value:'vendor',size:3},{value:'description',size:3}]">
rows-per-page="8"
keys="[{value:'name',size:2},'architecture',{value:'version',size:2},{value:'vendor',size:2},{value:'description',size:3}]">
</wazuh-table>
</div>
<div layout="row" class="md-padding" ng-if="agent">
Expand Down
8 changes: 5 additions & 3 deletions public/templates/manager/groups/groups-preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@
<div layout="row" ng-if="!lookingGroup" class="md-padding">
<wazuh-table
flex
extra-limit="true"
path="'/agents/groups'"
keys="['name','count','merged_sum']"
keys="['name',{value:'count',size:1},{value:'merged_sum',size:3}]"
allow-click="true"
rows-per-page="19">
rows-per-page="14">
</wazuh-table>
</div>
<!-- End groups table -->
Expand Down Expand Up @@ -113,11 +114,12 @@
<!-- Group files table -->
<div layout="row" ng-if="lookingGroup && groupsSelectedTab==='files' && !fileViewer && currentGroup" class="md-padding">
<wazuh-table
extra-limit="true"
flex
path="'/agents/groups/' + currentGroup.name + '/files'"
keys="[{value:'filename',size:2},{value:'hash',size:6}]"
allow-click="true"
rows-per-page="14">
rows-per-page="10">
</wazuh-table>
</div>
<!-- End Group files table -->
Expand Down
1 change: 1 addition & 0 deletions public/templates/manager/manager-osseclog.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<div layout="row" layout-padding>
<wazuh-table
flex
extra-limit="true"
path="'/manager/logs'"
keys="['timestamp',{value:'tag',size:2},'level',{value:'description',size:4,nosortable:true}]"
rows-per-page="15">
Expand Down