Skip to content

Commit 93101b3

Browse files
committed
add back status icon in error case
1 parent cc07fac commit 93101b3

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,15 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
174174
val workspaceWithAgent = deployment?.items?.firstOrNull { it.workspace.name == workspaceName }
175175
val status =
176176
if (deploymentError != null) {
177-
Pair(UIUtil.getErrorForeground(), deploymentError)
177+
Triple(UIUtil.getErrorForeground(), deploymentError, UIUtil.getBalloonErrorIcon())
178178
} else if (workspaceWithAgent != null) {
179-
Pair(
179+
Triple(
180180
workspaceWithAgent.status.statusColor(),
181181
workspaceWithAgent.status.description,
182+
null
182183
)
183184
} else {
184-
Pair(UIUtil.getContextHelpForeground(), "Querying workspace status...")
185+
Triple(UIUtil.getContextHelpForeground(), "Querying workspace status...", AnimatedIcon.Default())
185186
}
186187
val gap =
187188
if (top) {
@@ -201,19 +202,25 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
201202
label("").resizableColumn().align(AlignX.FILL)
202203
}.topGap(gap)
203204

204-
connections.forEach { workspaceProjectIDE ->
205-
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)
205+
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)
207207

208+
// We only display an API error on the first workspace rather than duplicating it on each workspace.
209+
if (deploymentError == null || showError) {
208210
row {
209211
if (inLoadingState) {
210212
icon(AnimatedIcon.Default())
211213
}
214+
if (status.third != null) {
215+
icon(status.third!!)
216+
}
212217
label("<html><body style='width:350px;'>" + status.second + "</html>").applyToComponent {
213218
foreground = status.first
214219
}
215220
}
221+
}
216222

223+
connections.forEach { workspaceProjectIDE ->
217224
row {
218225
icon(workspaceProjectIDE.ideProduct.icon)
219226
if (enableLinks) {

0 commit comments

Comments
 (0)