feat: add dedicated Profile management page

This commit is contained in:
proxyctl coordinator
2026-07-17 22:37:25 +08:00
parent 7c0b4481d7
commit d34ce0cd6b
11 changed files with 583 additions and 160 deletions
+8 -10
View File
@@ -142,18 +142,17 @@ func TestRefreshKeyRunsAsynchronouslyAndRendersRefreshingThenCompleted(t *testin
}
}
func TestBusyActivationBlocksPageEntryAndEveryNewOperation(t *testing.T) {
func TestBusyProfileTransitionBlocksPageEntryAndEveryNewOperation(t *testing.T) {
initial := app.Snapshot{
ActiveProfile: "old",
Profiles: []profile.Profile{{Name: "new"}},
Targets: []app.TargetSnapshot{{ID: "shell", Description: target.Description{Name: "Shell"}, Available: true, State: target.Enabled}},
}
module := &progressiveTargetModule{targetModule: targetModule{snapshot: initial}, updates: make(chan app.OperationUpdate)}
model := updateKey(NewModel(module), "p")
updated, command := model.Update(tea.KeyMsg{Type: tea.KeyEnter})
model = updated.(Model)
model := NewModel(module)
command := model.startOperation(app.Intent{Kind: app.ActivateProfile, Name: "new"})
if command == nil || len(module.intents) != 1 || module.intents[0].Kind != app.ActivateProfile {
t.Fatalf("activation did not start exactly once: command=%v intents=%#v", command != nil, module.intents)
t.Fatalf("Profile transition did not start exactly once: command=%v intents=%#v", command != nil, module.intents)
}
for _, key := range []string{"p", "r", " "} {
@@ -309,13 +308,12 @@ func TestActiveProfileTransitionRendersPerTargetProgress(t *testing.T) {
updates <- app.SucceededOperationUpdate(completedSnapshot, app.OperationStatus{Summary: "Activated Profile new"}, []app.TargetProgress{{TargetID: "shell", Phase: app.TargetProgressSucceeded, State: target.Enabled}})
close(updates)
module := &progressiveTargetModule{targetModule: targetModule{snapshot: initial}, updates: updates}
model := updateKey(NewModel(module), "p")
updated, command := model.Update(tea.KeyMsg{Type: tea.KeyEnter})
model = updated.(Model)
model := NewModel(module)
command := model.startOperation(app.Intent{Kind: app.ActivateProfile, Name: "new"})
if command == nil {
t.Fatal("activation did not start progressive operation")
t.Fatal("Profile transition did not start progressive operation")
}
updated, command = model.Update(command())
updated, command := model.Update(command())
model = updated.(Model)
if command == nil || !strings.Contains(model.View(), "Applying") || !strings.Contains(model.View(), "Active Profile: new") {
t.Fatalf("applying progress:\n%s", model.View())