mirror of
https://github.com/lukaszraczylo/kportal.git
synced 2026-07-17 08:14:33 +00:00
fix(ui): edit-mode wizard allows keeping the same local port
Previously, editing a forward and keeping its local port unchanged failed the wizard's port-availability check: the in-config scan found the forward's own entry and reported '✗ Port N already assigned to <self.ID>'. Users had to pick a different port, edit, then change back. checkPortCmd now accepts an excludeID. The wizard passes wizard.originalID when isEditing so the forward being edited is ignored during the in-config conflict scan. The OS-level port check is unchanged (still catches actual port collisions). New regression test: TestCheckPortCmd_ExcludeID_AllowsKeepingOwnPort.
This commit is contained in:
@@ -656,7 +656,11 @@ func (m model) handleAddWizardEnter() (tea.Model, tea.Cmd) {
|
||||
wizard.localPort = port
|
||||
wizard.loading = true
|
||||
wizard.error = nil
|
||||
return m, checkPortCmd(port, m.ui.configPath)
|
||||
excludeID := ""
|
||||
if wizard.isEditing {
|
||||
excludeID = wizard.originalID
|
||||
}
|
||||
return m, checkPortCmd(port, m.ui.configPath, excludeID)
|
||||
}
|
||||
|
||||
case StepConfirmation:
|
||||
|
||||
Reference in New Issue
Block a user