Skip to content

Commit

Permalink
OCPBUGS-17953: Remove port if the value is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
upalatucci committed Aug 24, 2023
1 parent 86bc1d8 commit f1df276
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/utils/components/PolicyForm/PolicyInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,17 @@ const PolicyInterface: FC<PolicyInterfaceProps> = ({
onInterfaceChange((draftInterface) => {
if (draftInterface.type === InterfaceType.BOND) {
ensurePath(draftInterface, 'link-aggregation.port');
draftInterface['link-aggregation'].port = value.split(',');

value
? (draftInterface['link-aggregation'].port = value.split(','))
: delete draftInterface['link-aggregation'].port;
}

if (draftInterface.type === InterfaceType.LINUX_BRIDGE) {
ensurePath(draftInterface, 'bridge.port');
draftInterface.bridge.port = [{ name: value }];
value
? (draftInterface.bridge.port = [{ name: value }])
: delete draftInterface.bridge.port;
}
});
};
Expand Down

0 comments on commit f1df276

Please sign in to comment.