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 {
13
13
}
14
14
15
15
export 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
+ }
16
23
// check if label exists
17
24
if ( record . labels [ fieldOrLabel as keyof Labels ] !== undefined ) {
18
25
return record . labels [ fieldOrLabel as keyof Labels ] ;
19
26
}
20
- // check if field exists
21
- if ( record . fields [ fieldOrLabel as keyof Fields ] !== undefined ) {
22
- return record . fields [ fieldOrLabel as keyof Fields ] ;
23
- }
24
27
// fallback on default
25
28
return defaultValue ;
26
29
} ;
Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ export const RecordPanel: React.FC<RecordDrawerProps> = ({
302
302
} , [ record . labels . _RecordType , t ] ) ;
303
303
304
304
const getSortedJSON = React . useCallback ( ( ) => {
305
- const flat = { ...record . fields , ...record . labels } ;
305
+ const flat = { ...record . labels , ...record . fields } ;
306
306
return JSON . stringify ( flat , Object . keys ( flat ) . sort ( ) , 2 ) ;
307
307
} , [ record ] ) ;
308
308
You can’t perform that action at this time.
0 commit comments