mirror of
https://github.com/lukaszraczylo/kportal.git
synced 2026-10-19 05:18:50 +00:00
feat(ui): type the namespace when the cluster does not list them (#84)
Some users cannot list namespaces on a cluster. The add wizard showed an error and offered no way forward. The namespace step now switches to a text prompt when the list call fails or returns nothing. The prompt shows the reason and checks that the name is a valid DNS label. Esc from a later step returns to the prompt. The j and k keys now type into text fields. They moved the list cursor before, so a name such as kube-system could not be typed. Closes #66
This commit is contained in:
@@ -111,6 +111,7 @@ func (r ResourceType) Description() string {
|
||||
// AddWizardState maintains the state for the add port forward wizard
|
||||
type AddWizardState struct {
|
||||
error error
|
||||
namespaceListErr error
|
||||
httpLogOriginal *config.HTTPLogSpec
|
||||
resourceValue string
|
||||
originalID string
|
||||
@@ -137,6 +138,7 @@ type AddWizardState struct {
|
||||
confirmationFocus ConfirmationFocus
|
||||
portAvailable bool
|
||||
isEditing bool
|
||||
namespaceManual bool
|
||||
loading bool
|
||||
httpLog bool
|
||||
}
|
||||
@@ -223,6 +225,13 @@ func (w *AddWizardState) handleTextInput(char rune) {
|
||||
}
|
||||
}
|
||||
|
||||
// isTypingText reports whether printable keys must go into a text field,
|
||||
// including keys that otherwise navigate (j, k).
|
||||
func (w *AddWizardState) isTypingText() bool {
|
||||
return w.inputMode == InputModeText ||
|
||||
(w.step == StepConfirmation && w.confirmationFocus == FocusAlias)
|
||||
}
|
||||
|
||||
// clearTextInput clears the text input field
|
||||
func (w *AddWizardState) clearTextInput() {
|
||||
w.textInput = ""
|
||||
|
||||
Reference in New Issue
Block a user