Fix CDB list export (#1423)

This commit is contained in:
Jesús Ángel 2019-05-02 17:55:06 +02:00 committed by GitHub
parent a8d1778fe2
commit 4c816030bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 7 deletions

View File

@ -2,7 +2,7 @@
All notable changes to the Wazuh app project will be documented in this file.
## Wazuh v3.9.0 - Kibana v6.7.0 / v6.7.1 - Revision 438
## Wazuh v3.9.0 - Kibana v6.7.0 / v6.7.1 - Revision 439
### Added

View File

@ -1,8 +1,8 @@
{
"name": "wazuh",
"version": "3.9.0",
"revision": "0438",
"code": "0438-0",
"revision": "0439",
"code": "0439-0",
"kibana": {
"version": "6.7.1"
},

View File

@ -58,7 +58,7 @@
<td>
<input ng-show="editingKey === item[0]" ng-disabled="loadingChange" type="text"
class="wz-input-text" ng-model="currentList.editingNewValue"></input>
<span ng-show="!editingKey || editingKey !== item[0]">{{item[1]}}</span>
<span ng-show="!editingKey || editingKey !== item[0]">{{item[1] || '-'}}</span>
</td>
<td class="action-btn-td">
<div ng-hide="!adminMode">

View File

@ -932,6 +932,7 @@ export class WazuhApiCtrl {
params,
cred
);
if ((((output || {}).body || {}).data || {}).totalItems) {
params.offset = 0;
const { totalItems } = output.body.data;
@ -949,7 +950,10 @@ export class WazuhApiCtrl {
}
if ((((output || {}).body || {}).data || {}).totalItems) {
const fields = req.payload.path.includes('/agents')
const isList = req.payload.path.includes('/lists');
const isAgents = req.payload.path.includes('/agents');
const fields = isAgents
? [
'id',
'status',
@ -971,10 +975,19 @@ export class WazuhApiCtrl {
'os.uname',
'os.version'
]
: isList
? ['key', 'value']
: Object.keys(output.body.data.items[0]);
const json2csvParser = new Parser({ fields });
let csv = json2csvParser.parse(itemsArray);
if (isList) {
itemsArray[0].map(item => {
if (!item.value || !item.value.length) item.value = '-';
return item;
});
}
let csv = json2csvParser.parse(isList ? itemsArray[0] : itemsArray);
for (const field of fields) {
if (csv.includes(field)) {

View File

@ -99,5 +99,6 @@ export const KeyEquivalenece = {
directory: 'Path(s)',
rationale: 'Rationale',
registry: 'Registry',
date: 'Date'
date: 'Date',
value: 'Value'
};