Skip to content

Commit 67c7af6

Browse files
committed
NETOBSERV-1958: fix CSV export
Do not stringify undefined fields as they end up == "undefined"
1 parent 34ce8eb commit 67c7af6

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

web/src/model/__tests__/export-query.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ describe('buildExportQuery', () => {
55
const query = buildExportQuery({
66
filters: 'SrcK8S_Name%3Dtest1%2Ctest2',
77
recordType: 'flowLog',
8+
namespace: undefined,
89
dataSource: 'auto',
910
packetLoss: 'all',
1011
limit: 500,

web/src/model/export-query.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import * as _ from 'lodash';
12
import { FlowQuery } from './flow-query';
23

34
export const buildExportQuery = (flowQuery: FlowQuery, columns?: string[]) => {
@@ -11,5 +12,6 @@ export const buildExportQuery = (flowQuery: FlowQuery, columns?: string[]) => {
1112
if (columns) {
1213
query.columns = String(columns);
1314
}
14-
return new URLSearchParams(query).toString();
15+
const omitEmpty = _.omitBy(query, a => a === undefined);
16+
return new URLSearchParams(omitEmpty).toString();
1517
};

0 commit comments

Comments
 (0)