File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
components/netflow-record Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -13,14 +13,17 @@ export interface Record {
1313}
1414
1515export const getRecordValue = ( record : Record , fieldOrLabel : string , defaultValue ?: string | number ) => {
16+ /* TODO: fix following behavior:
17+ * Check if field exists first since /flow endpoint return fields as labels when using filters
18+ * This is mandatory to ensure fields types
19+ */
20+ if ( record . fields [ fieldOrLabel as keyof Fields ] !== undefined ) {
21+ return record . fields [ fieldOrLabel as keyof Fields ] ;
22+ }
1623 // check if label exists
1724 if ( record . labels [ fieldOrLabel as keyof Labels ] !== undefined ) {
1825 return record . labels [ fieldOrLabel as keyof Labels ] ;
1926 }
20- // check if field exists
21- if ( record . fields [ fieldOrLabel as keyof Fields ] !== undefined ) {
22- return record . fields [ fieldOrLabel as keyof Fields ] ;
23- }
2427 // fallback on default
2528 return defaultValue ;
2629} ;
Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ export const RecordPanel: React.FC<RecordDrawerProps> = ({
302302 } , [ record . labels . _RecordType , t ] ) ;
303303
304304 const getSortedJSON = React . useCallback ( ( ) => {
305- const flat = { ...record . fields , ...record . labels } ;
305+ const flat = { ...record . labels , ...record . fields } ;
306306 return JSON . stringify ( flat , Object . keys ( flat ) . sort ( ) , 2 ) ;
307307 } , [ record ] ) ;
308308
You can’t perform that action at this time.
0 commit comments