pi-agent: Fix final integrated review
This commit is contained in:
@@ -17,10 +17,13 @@ type dashboardRenderState struct {
|
||||
focus dashboardPane
|
||||
detailsOffset int
|
||||
operationProgress map[string]app.TargetProgressPhase
|
||||
applyingFrame string
|
||||
terminalWidth int
|
||||
terminalHeight int
|
||||
}
|
||||
|
||||
func (p terminalPresentation) renderDashboard(state dashboardRenderState, width, height int) string {
|
||||
if width >= wideWidth && height >= 12 {
|
||||
if state.terminalWidth >= wideWidth && state.terminalHeight >= wideHeight {
|
||||
leftWidth := (width - 1) * 2 / 5
|
||||
rightWidth := width - leftWidth - 1
|
||||
left := p.renderTargetListPane(state, leftWidth, height)
|
||||
@@ -49,7 +52,7 @@ func (p terminalPresentation) renderTargetListPane(state dashboardRenderState, w
|
||||
if item.ID == state.selectedTargetID {
|
||||
cursor = "> "
|
||||
}
|
||||
badge := p.targetBadge(item, state.operationProgress[item.ID])
|
||||
badge := p.targetBadge(item, state.operationProgress[item.ID], state.applyingFrame)
|
||||
lines = append(lines, cursor+badge+" "+item.Description.Name)
|
||||
}
|
||||
if len(lines) == 0 {
|
||||
@@ -70,7 +73,7 @@ func (p terminalPresentation) renderTargetDetailsPane(state dashboardRenderState
|
||||
selected, ok := state.catalog.selected(state.selectedTargetID)
|
||||
content := "Select a Target to review its details."
|
||||
if ok {
|
||||
content = p.targetDetails(selected)
|
||||
content = p.targetDetails(selected, state.operationProgress[selected.ID], state.applyingFrame)
|
||||
}
|
||||
body := fixedViewport(content, width, bodyHeight, state.detailsOffset, true)
|
||||
return fitPane(heading+"\n"+paneRule(width)+"\n"+body, width, height)
|
||||
@@ -101,27 +104,32 @@ func fixedViewport(content string, width, height, offset int, wrap bool) string
|
||||
return view.View()
|
||||
}
|
||||
|
||||
func (p terminalPresentation) targetBadge(item app.TargetSnapshot, progress app.TargetProgressPhase) string {
|
||||
switch progress {
|
||||
case app.TargetProgressRunning:
|
||||
return p.theme.renderTargetState(item.State, true)
|
||||
case app.TargetProgressFailed:
|
||||
return p.theme.checkFailed.Render("! Failed")
|
||||
}
|
||||
func (p terminalPresentation) targetBadge(item app.TargetSnapshot, progress app.TargetProgressPhase, applyingFrame string) string {
|
||||
switch item.DetectionPhase {
|
||||
case app.TargetChecking:
|
||||
return p.theme.checking.Render("… Checking")
|
||||
case app.TargetDetectionFailed:
|
||||
return p.theme.checkFailed.Render("! Check failed")
|
||||
return p.theme.checkFailed.Render("! Failed")
|
||||
}
|
||||
if !item.Available {
|
||||
return p.theme.unavailable.Render("○ Unavailable")
|
||||
}
|
||||
return p.theme.renderTargetState(item.State, false)
|
||||
actual := p.theme.renderTargetState(item.State, false)
|
||||
switch progress {
|
||||
case app.TargetProgressRunning:
|
||||
if applyingFrame == "" {
|
||||
applyingFrame = "|"
|
||||
}
|
||||
return p.theme.applying.Render(applyingFrame + " Applying")
|
||||
case app.TargetProgressFailed:
|
||||
return actual + " " + p.theme.checkFailed.Render("! Failed")
|
||||
default:
|
||||
return actual
|
||||
}
|
||||
}
|
||||
|
||||
func (p terminalPresentation) targetDetails(item app.TargetSnapshot) string {
|
||||
state := p.targetBadge(item, 0)
|
||||
func (p terminalPresentation) targetDetails(item app.TargetSnapshot, progress app.TargetProgressPhase, applyingFrame string) string {
|
||||
state := p.targetBadge(item, progress, applyingFrame)
|
||||
evidence := item.Evidence
|
||||
switch item.DetectionPhase {
|
||||
case app.TargetChecking:
|
||||
|
||||
Reference in New Issue
Block a user