Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Fix the selected fields issue in csv report #293

Merged
merged 1 commit into from
Jan 8, 2021
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
6 changes: 4 additions & 2 deletions kibana-reports/server/routes/utils/dataReportHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ export var metaData = {

// Get the selected columns by the user.
export const getSelectedFields = async (columns) => {
const selectedFields = [];
for (let column of columns) {
if (column !== '_source') {
metaData.fields_exist = true;
metaData.selectedFields.push(column);
selectedFields.push(column);
} else {
metaData.selectedFields.push('_source');
selectedFields.push('_source');
}
}
metaData.selectedFields = selectedFields;
};

//Build the ES query from the meta data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,13 @@ async function populateMetaData(
(metaData.timeFieldName = resIndexPattern.timeFieldName),
(metaData.fields = resIndexPattern.fields); // Get all fields
// Getting fields of type Date
const dateFields = [];
for (const item of JSON.parse(metaData.fields)) {
if (item.type === 'date') {
metaData.dateFields.push(item.name);
dateFields.push(item.name);
}
}
metaData.dateFields = dateFields;
}
}
}
Expand Down