gui: use Connections to update agent state on revision change

This commit is contained in:
Levi Neely 2026-08-04 16:24:57 +02:00
parent 670d759769
commit 9929abc73b
1 changed files with 14 additions and 6 deletions

View File

@ -1125,6 +1125,17 @@ ApplicationWindow {
Layout.alignment: Qt.AlignVCenter
radius: 4
visible: type !== "header"
property string currentState: type === "agent" ? ollie.agentState(parentId, agentId) : ""
Connections {
target: ollie
function onAgentStateRevisionChanged() {
if (type === "agent") {
stateDot.currentState = ollie.agentState(parentId, agentId)
}
}
}
color: {
if (type === "session") {
var cc = connectionColor || "gray"
@ -1133,13 +1144,10 @@ ApplicationWindow {
if (cc === "red") return "#f44336"
return "#9e9e9e"
}
// Agent: gray if paused, else state color from map
// Revision forces re-eval when any state changes
var rev = ollie.agentStateRevision
// Agent: gray if paused, else state color
if (ollie.isSessionPaused(parentId)) return "#9e9e9e"
var s = rev >= 0 ? ollie.agentState(parentId, agentId) : "idle"
if (s === "idle") return "#4caf50"
if (s.startsWith("calling")) return "#ff9800"
if (currentState === "idle") return "#4caf50"
if (currentState.startsWith("calling")) return "#ff9800"
return "#2196f3"
}
}