Skip to content

Commit

Permalink
Fix syscollector state value
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Ángel committed Jun 10, 2019
1 parent f91d63c commit f8d3d0e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
9 changes: 7 additions & 2 deletions public/directives/wz-table-eui/wz-table-directive.js
Expand Up @@ -20,7 +20,7 @@ import { initTable } from './lib/init';
import { sort } from './lib/sort';
import React, { Component } from 'react';
import { EuiHealth } from '@elastic/eui';

import * as ProcessEquivalence from '../../../util/process-state-equivalence';
const app = uiModules.get('app/wazuh', []);

app.directive('wzTableEui', function() {
Expand All @@ -37,6 +37,7 @@ app.directive('wzTableEui', function() {
{state}
</EuiHealth>
);
const processStatus = value => ProcessEquivalence[value] || value;

const defaultRender = value => value || '-';

Expand All @@ -47,7 +48,11 @@ app.directive('wzTableEui', function() {
width: item.width || undefined,
sortable: typeof item.sortable !== 'undefined' ? item.sortable : true,
render: value =>
item.isHealth ? health(value, item.isHealth) : defaultRender(value)
item.isHealth
? health(value, item.isHealth)
: item.isProcessStatus
? processStatus(value)
: defaultRender(value)
}));
};

Expand Down
25 changes: 13 additions & 12 deletions public/templates/agents/agents-syscollector.html
Expand Up @@ -74,17 +74,17 @@
<md-card flex class="wz-md-card" ng-if="agent && agent.os && agent.os.platform !== 'darwin'">
<md-card-content>
<span class=" wz-headline-title">
<react-component name="EuiIcon" props="{type:'inputOutput'}" /> Network ports
</span>
<md-divider class="wz-margin-top-10"></md-divider>
<wz-table-eui flex ng-if="agent && agent.os && agent.os.platform === 'windows'"
path="'/syscollector/' + agent.id + '/ports'" initial-sort-field="'process'"
keys="['process',{value:'local.ip', sortable:false},{value:'local.port', sortable:false},'state','protocol']">
</wz-table-eui>
<wz-table-eui flex ng-if="agent && agent.os && agent.os.platform !== 'windows'"
path="'/syscollector/' + agent.id + '/ports'" initial-sort-field="'protocol'"
keys="[{value:'local.ip', sortable:false},{value:'local.port', sortable:false},'state','protocol']">
</wz-table-eui>
<react-component name="EuiIcon" props="{type:'inputOutput'}" /> Network ports
</span>
<md-divider class="wz-margin-top-10"></md-divider>
<wz-table-eui flex ng-if="agent && agent.os && agent.os.platform === 'windows'"
path="'/syscollector/' + agent.id + '/ports'" initial-sort-field="'process'"
keys="['process',{value:'local.ip', sortable:false},{value:'local.port', sortable:false},'state','protocol']">
</wz-table-eui>
<wz-table-eui flex ng-if="agent && agent.os && agent.os.platform !== 'windows'"
path="'/syscollector/' + agent.id + '/ports'" initial-sort-field="'protocol'"
keys="[{value:'local.ip', sortable:false},{value:'local.port', sortable:false},'state','protocol']">
</wz-table-eui>
</md-card-content>
</md-card>
</div>
Expand Down Expand Up @@ -180,7 +180,8 @@
<wz-table-eui flex ng-if="agent && agent.os && agent.os.platform === 'windows'"
path="'/syscollector/' + agent.id + '/processes'" keys="['name','cmd','priority','nlwp']" />
<wz-table-eui flex ng-if="agent && agent.os && agent.os.platform !== 'windows'"
path="'/syscollector/' + agent.id + '/processes'" keys="['name','euser','nice','state']" />
path="'/syscollector/' + agent.id + '/processes'"
keys="['name','euser','nice',{value:'state',isProcessStatus:true}]" />
</div>
<div layout="row" layout-align="end center">
<button type="button"
Expand Down

0 comments on commit f8d3d0e

Please sign in to comment.