mirror of
https://github.com/lukaszraczylo/kportal.git
synced 2026-07-14 07:51:00 +00:00
feat(ui): toggle httpLog per-forward in add/edit wizard
Adds an HTTP-log enable toggle to the wizard's confirmation step so
users can flip httpLog on a forward without editing YAML by hand.
Behaviour:
- 'h' on the confirmation step toggles HTTPLog when not focused on
the alias text input. When focus is on alias, 'h' is treated as
text so users can still type aliases like 'host' or 'http-proxy'.
- The confirmation summary shows '[x] enabled' or '[ ] disabled'.
- New forwards: toggle on -> &HTTPLogSpec{Enabled: true}; off -> nil.
- Edit mode: pre-populates the toggle from the existing forward and
preserves any advanced HTTPLog fields the user had configured in
YAML (logFile, includeHeaders, maxBodySize, filterPath) by copying
the original spec on save. Toggling off discards the advanced
fields (consistent with 'absent in YAML = disabled').
State changes:
- ForwardStatus gains *config.HTTPLogSpec so the wizard can see the
full original spec on edit.
- AddWizardState gains httpLog bool + httpLogOriginal *HTTPLogSpec.
Three new tests:
- TestHandleAddWizardKeys_HToggleHTTPLog
- TestHandleAddWizardKeys_HOnAliasFocusIsTextInput
- TestEditPrefill_PreservesHTTPLog
This commit is contained in:
@@ -3,6 +3,7 @@ package ui
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/lukaszraczylo/kportal/internal/config"
|
||||
"github.com/lukaszraczylo/kportal/internal/k8s"
|
||||
)
|
||||
|
||||
@@ -110,6 +111,7 @@ func (r ResourceType) Description() string {
|
||||
// AddWizardState maintains the state for the add port forward wizard
|
||||
type AddWizardState struct {
|
||||
error error
|
||||
httpLogOriginal *config.HTTPLogSpec
|
||||
resourceValue string
|
||||
originalID string
|
||||
portCheckMsg string
|
||||
@@ -119,16 +121,16 @@ type AddWizardState struct {
|
||||
selector string
|
||||
selectedContext string
|
||||
selectedNamespace string
|
||||
pods []k8s.PodInfo
|
||||
contexts []string
|
||||
services []k8s.ServiceInfo
|
||||
detectedPorts []k8s.PortInfo
|
||||
matchingPods []k8s.PodInfo
|
||||
services []k8s.ServiceInfo
|
||||
contexts []string
|
||||
namespaces []string
|
||||
scrollOffset int
|
||||
pods []k8s.PodInfo
|
||||
localPort int
|
||||
selectedResourceType ResourceType
|
||||
step AddWizardStep
|
||||
localPort int
|
||||
scrollOffset int
|
||||
cursor int
|
||||
remotePort int
|
||||
inputMode InputMode
|
||||
@@ -136,6 +138,7 @@ type AddWizardState struct {
|
||||
portAvailable bool
|
||||
isEditing bool
|
||||
loading bool
|
||||
httpLog bool
|
||||
}
|
||||
|
||||
// newAddWizardState creates a new add wizard state initialized to the first step
|
||||
|
||||
Reference in New Issue
Block a user