Skip to content

Commit 9407e7d

Browse files
committed
Use flags list
1 parent 866485e commit 9407e7d

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

web/src/api/ipfix.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export interface Fields {
118118
/** Network Events */
119119
NetworkEvents?: string[];
120120
/** Logical OR combination of unique TCP flags comprised in the flow, as per RFC-9293, with additional custom flags to represent the following per-packet combinations: SYN+ACK (0x100), FIN+ACK (0x200) and RST+ACK (0x400). */
121-
Flags?: string;
121+
Flags?: string[];
122122
/** Number of packets */
123123
Packets?: number;
124124
/** In conversation tracking, A to B packets counter per conversation */

web/src/components/drawer/record/record-field.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -473,21 +473,23 @@ export const RecordField: React.FC<RecordFieldProps> = ({
473473
}
474474
case ColumnsId.tcpflags: {
475475
let child = emptyText();
476-
const sVal = String(value);
477-
const flags = getFlagsList(sVal);
478-
if (detailed) {
479-
let description = `${t('Value')}: ${value}`;
480-
if (flags.length === 1) {
481-
description += '. ' + flags[0].description;
482-
} else if (flags.length > 1) {
483-
description +=
484-
'. ' +
485-
t('The flow contains packets with various flags: ') +
486-
flags.map(f => f.name + ' (' + f.description + ')').join('; ');
476+
if (Array.isArray(value) && value.length > 0) {
477+
const flags = getFlagsList(value as string[]);
478+
const joined = value.join(', ');
479+
if (detailed) {
480+
let description = `${t('Value')}: ${value}`;
481+
if (flags.length === 1) {
482+
description += '. ' + flags[0].description;
483+
} else if (flags.length > 1) {
484+
description +=
485+
'. ' +
486+
t('The flow contains packets with various flags: ') +
487+
flags.map(f => f.name + ' (' + f.description + ')').join('; ');
488+
}
489+
child = clickableContent(joined, description, getTCPFlagsDocUrl());
490+
} else {
491+
child = simpleTextWithTooltip(joined)!;
487492
}
488-
child = clickableContent(sVal, description, getTCPFlagsDocUrl());
489-
} else {
490-
child = simpleTextWithTooltip(sVal)!;
491493
}
492494
return singleContainer(child);
493495
}

web/src/utils/tcp-flags.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export const tcpFlagsList = [
1616
{ name: 'RST_ACK', description: 'Acknowledgement of RST (custom flag)' }
1717
] as const;
1818

19-
export const getFlagsList = (joined: string): { name: string, description: string}[] => {
20-
const names = joined.split(',');
19+
export const getFlagsList = (names: string[]): { name: string, description: string}[] => {
2120
return tcpFlagsList.filter(f => names.includes(f.name));
2221
};

0 commit comments

Comments
 (0)