Description
When adding a new rule from the Port Range tab, the rule appears in the Single Port tab instead of the Port Range tab.
Root Cause
The tab filtering logic in lib/page/port_forwarding/views/usp_port_forwarding_detail_view.dart uses the isSinglePort getter from lib/page/_shared/models/port_forwarding_rule_ui_model.dart:
bool get isSinglePort =>
externalPortEndRange == 0 || externalPortEndRange == externalPort;
If externalPortEndRange equals externalPort (e.g., when the user enters the same value for start and end), the rule is classified as single port. Additionally, if the dialog result does not correctly set externalPortEndRange, the default value of 0 would also cause the rule to be classified as single port.
Expected Behavior
Rules created from the Port Range tab should always appear in the Port Range tab. The classification logic should account for the creation context, or the dialog should enforce that end port is strictly greater than start port with a clear error message.
Description
When adding a new rule from the Port Range tab, the rule appears in the Single Port tab instead of the Port Range tab.
Root Cause
The tab filtering logic in
lib/page/port_forwarding/views/usp_port_forwarding_detail_view.dartuses theisSinglePortgetter fromlib/page/_shared/models/port_forwarding_rule_ui_model.dart:If
externalPortEndRangeequalsexternalPort(e.g., when the user enters the same value for start and end), the rule is classified as single port. Additionally, if the dialog result does not correctly setexternalPortEndRange, the default value of0would also cause the rule to be classified as single port.Expected Behavior
Rules created from the Port Range tab should always appear in the Port Range tab. The classification logic should account for the creation context, or the dialog should enforce that end port is strictly greater than start port with a clear error message.