Skip to content

Commit

Permalink
NETOBSERV-1958: fix CSV export (#643)
Browse files Browse the repository at this point in the history
Do not stringify undefined fields as they end up == "undefined"
  • Loading branch information
jotak authored Nov 13, 2024
1 parent 5e50466 commit f8abad2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions web/src/model/__tests__/export-query.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ describe('buildExportQuery', () => {
const query = buildExportQuery({
filters: 'SrcK8S_Name%3Dtest1%2Ctest2',
recordType: 'flowLog',
namespace: undefined,
dataSource: 'auto',
packetLoss: 'all',
limit: 500,
Expand Down
4 changes: 3 additions & 1 deletion web/src/model/export-query.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as _ from 'lodash';
import { FlowQuery } from './flow-query';

export const buildExportQuery = (flowQuery: FlowQuery, columns?: string[]) => {
Expand All @@ -11,5 +12,6 @@ export const buildExportQuery = (flowQuery: FlowQuery, columns?: string[]) => {
if (columns) {
query.columns = String(columns);
}
return new URLSearchParams(query).toString();
const omitEmpty = _.omitBy(query, a => a === undefined);
return new URLSearchParams(omitEmpty).toString();
};

0 comments on commit f8abad2

Please sign in to comment.