Skip to content

Commit 3202bb8

Browse files
committed
decide icon in one place
1 parent a6b196b commit 3202bb8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt

+7-5
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,16 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
176176
if (deploymentError != null) {
177177
Triple(UIUtil.getErrorForeground(), deploymentError, UIUtil.getBalloonErrorIcon())
178178
} else if (workspaceWithAgent != null) {
179+
val inLoadingState = listOf(WorkspaceStatus.STARTING, WorkspaceStatus.CANCELING, WorkspaceStatus.DELETING, WorkspaceStatus.STOPPING).contains(workspaceWithAgent?.workspace?.latestBuild?.status)
180+
179181
Triple(
180182
workspaceWithAgent.status.statusColor(),
181183
workspaceWithAgent.status.description,
182-
null,
184+
if (inLoadingState) {
185+
AnimatedIcon.Default()
186+
} else {
187+
null
188+
},
183189
)
184190
} else {
185191
Triple(UIUtil.getContextHelpForeground(), "Querying workspace status...", AnimatedIcon.Default())
@@ -203,14 +209,10 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
203209
}.topGap(gap)
204210

205211
val enableLinks = listOf(WorkspaceStatus.STOPPED, WorkspaceStatus.CANCELED, WorkspaceStatus.FAILED, WorkspaceStatus.STARTING, WorkspaceStatus.RUNNING).contains(workspaceWithAgent?.workspace?.latestBuild?.status)
206-
val inLoadingState = listOf(WorkspaceStatus.STARTING, WorkspaceStatus.CANCELING, WorkspaceStatus.DELETING, WorkspaceStatus.STOPPING).contains(workspaceWithAgent?.workspace?.latestBuild?.status)
207212

208213
// We only display an API error on the first workspace rather than duplicating it on each workspace.
209214
if (deploymentError == null || showError) {
210215
row {
211-
if (inLoadingState) {
212-
icon(AnimatedIcon.Default())
213-
}
214216
if (status.third != null) {
215217
icon(status.third!!)
216218
}

0 commit comments

Comments
 (0)