fix: simplify dashboard and disable unauthorized actions
hermetic-ci / test (push) Canceled after 0s
hermetic-ci / test (push) Canceled after 0s
This commit is contained in:
+15
-52
@@ -14,12 +14,7 @@ func (p terminalPresentation) mainView(model presentationState, width, height in
|
||||
if activeProfile == "" {
|
||||
activeProfile = "No Active Profile"
|
||||
}
|
||||
header := fmt.Sprintf("%s Operations Console\nActive Profile: %s Targets: %s",
|
||||
p.theme.title.Render("proxyctl"), activeProfile, p.stateCountSummary(model.snapshot))
|
||||
if width < wideWidth {
|
||||
header = fmt.Sprintf("%s Operations Console\nActive Profile: %s\nTargets: %s",
|
||||
p.theme.title.Render("proxyctl"), activeProfile, p.stateCountSummary(model.snapshot))
|
||||
}
|
||||
header := fmt.Sprintf("%s Profile: %s", p.theme.title.Render("proxyctl"), activeProfile)
|
||||
|
||||
catalog := newTargetCatalog(model.snapshot, dashboard.showUnavailable, dashboard.selectedTargetID)
|
||||
footer := p.dashboardFooter(model, catalog)
|
||||
@@ -97,62 +92,30 @@ func (p terminalPresentation) driftResolutionView(selected app.TargetSnapshot) (
|
||||
}
|
||||
|
||||
func (p terminalPresentation) dashboardFooter(model presentationState, catalog targetCatalog) string {
|
||||
dashboard, operation, width := model.dashboard, model.operation, model.terminal.width
|
||||
visibility := "u: show unavailable"
|
||||
dashboard, operation := model.dashboard, model.operation
|
||||
visibility := "u: Show hidden"
|
||||
if dashboard.showUnavailable {
|
||||
visibility = "u: hide unavailable"
|
||||
visibility = "u: Hide unavailable"
|
||||
}
|
||||
if operation.exitDeferred {
|
||||
return "Operation stopping; changes disabled ?: Help"
|
||||
}
|
||||
if dashboard.focus == targetDetailsPane {
|
||||
if operation.exitDeferred {
|
||||
return "↑/k ↓/j PgUp/PgDn: browse Tab: focus Targets " + visibility + " ?: help\nExit pending; new work disabled until safe completion"
|
||||
}
|
||||
if width < wideWidth {
|
||||
if operation.active {
|
||||
return "↑/k ↓/j PgUp/PgDn: browse Tab: focus Targets\n?: help q/Ctrl+C: defer exit; mutations disabled"
|
||||
}
|
||||
if width < 70 {
|
||||
return "↑/k ↓/j PgUp/PgDn: scroll Tab: focus Targets\np: switch Profile m: manage ?: help q: quit"
|
||||
}
|
||||
return "↑/k ↓/j PgUp/PgDn: scroll Tab: focus Targets\np: switch Active Profile m: manage Proxy Profiles ?: help q: quit"
|
||||
}
|
||||
footer := "↑/k ↓/j PgUp/PgDn: scroll Tab: focus Targets " + visibility + "\np: switch Active Profile m: manage Proxy Profiles ?: help q/Ctrl+C: quit"
|
||||
if operation.active {
|
||||
footer = "↑/k ↓/j PgUp/PgDn: scroll Tab: focus Targets " + visibility + " ?: help\nq/Ctrl+C: defer safe exit; mutations disabled"
|
||||
return "↑/↓: Scroll Tab: Targets ?: Help q: Stop"
|
||||
}
|
||||
return footer
|
||||
}
|
||||
actions := "↑/k ↓/j: select Tab: focus details " + visibility
|
||||
if operation.exitDeferred {
|
||||
return actions + " ?: help\nExit pending; new work disabled until safe completion"
|
||||
return "↑/↓: Scroll Tab: Targets " + visibility + "\np: Profile m: Profiles r: Refresh ?: Help q: Quit"
|
||||
}
|
||||
selected, ok := catalog.selected(dashboard.selectedTargetID)
|
||||
availability := targetMutationAvailability(selected, ok, operation.active || operation.exitDeferred)
|
||||
label := targetActionLabel(selected.PrimaryAction.Kind)
|
||||
if availability.available {
|
||||
actions = "Space: " + label + " " + actions
|
||||
} else {
|
||||
actions = "Space: " + label + " disabled (" + availability.compactReason + ") " + actions
|
||||
availability := targetMutationAvailability(selected, ok, operation.active)
|
||||
action := "Space: " + targetActionLabel(selected.PrimaryAction.Kind)
|
||||
if !availability.available {
|
||||
action += " unavailable"
|
||||
}
|
||||
if width < wideWidth {
|
||||
if availability.available {
|
||||
actions = "Space: " + label + " ↑/k ↓/j: select Tab: focus details"
|
||||
} else {
|
||||
actions = "Space: " + label + " disabled ↑/k ↓/j: select Tab: focus details"
|
||||
}
|
||||
|
||||
if operation.active {
|
||||
return actions + "\n?: help q/Ctrl+C: defer exit; mutations disabled"
|
||||
}
|
||||
if width < 70 {
|
||||
return actions + "\np: switch Profile m: manage ?: help q: quit"
|
||||
}
|
||||
return actions + "\np: switch Active Profile m: manage Proxy Profiles ?: help q: quit"
|
||||
}
|
||||
footer := actions + "\np: switch Active Profile m: manage Proxy Profiles r: refresh ?: help q/Ctrl+C: quit"
|
||||
if operation.active {
|
||||
footer = actions + "\n?: help q: defer safe exit; new mutations disabled"
|
||||
return action + " ↑/↓: Select Tab: Details\n?: Help q: Stop"
|
||||
}
|
||||
return footer
|
||||
return action + " ↑/↓: Select Tab: Details " + visibility + "\np: Profile m: Profiles r: Refresh ?: Help q: Quit"
|
||||
}
|
||||
|
||||
func (p terminalPresentation) profilesView(model presentationState) terminalPage {
|
||||
|
||||
Reference in New Issue
Block a user