Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a51beea

Browse files
committedAug 14, 2024·
revise recent projects flow to be less confusing
1 parent cae0cb4 commit a51beea

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed
 

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

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.coder.gateway.CoderGatewayConstants
77
import com.coder.gateway.CoderRemoteConnectionHandle
88
import com.coder.gateway.icons.CoderIcons
99
import com.coder.gateway.models.WorkspaceAgentListModel
10+
import com.coder.gateway.models.WorkspaceAndAgentStatus
1011
import com.coder.gateway.models.WorkspaceProjectIDE
1112
import com.coder.gateway.models.toWorkspaceProjectIDE
1213
import com.coder.gateway.sdk.CoderRestClient
@@ -193,11 +194,11 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
193194
TopGap.MEDIUM
194195
}
195196
row {
196-
icon(status.first).applyToComponent {
197-
foreground = status.second
198-
}.align(AlignX.LEFT).gap(RightGap.SMALL).applyToComponent {
199-
size = Dimension(JBUI.scale(16), JBUI.scale(16))
200-
}
197+
// icon(status.first).applyToComponent {
198+
// foreground = status.second
199+
// }.align(AlignX.LEFT).gap(RightGap.SMALL).applyToComponent {
200+
// size = Dimension(JBUI.scale(16), JBUI.scale(16))
201+
// }
201202
label(workspaceName).applyToComponent {
202203
font = JBFont.h3().asBold()
203204
}.align(AlignX.LEFT).gap(RightGap.SMALL)
@@ -280,41 +281,47 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
280281
if (deploymentError == null || showError) {
281282
row {
282283
// There must be a way to make this properly wrap?
284+
if (status.first == CoderIcons.PENDING) {
285+
icon(status.first)
286+
}
283287
label("<html><body style='width:350px;'>" + status.third + "</html>").applyToComponent {
284288
foreground = status.second
285289
}
286290
}
287291
}
288-
connections.forEach { workspaceProjectIDE ->
289-
row {
290-
icon(workspaceProjectIDE.ideProduct.icon)
291-
cell(
292-
ActionLink(workspaceProjectIDE.projectPathDisplay) {
293-
CoderRemoteConnectionHandle().connect { workspaceProjectIDE }
294-
GatewayUI.getInstance().reset()
295-
},
296-
)
297-
label("").resizableColumn().align(AlignX.FILL)
298-
label(workspaceProjectIDE.ideName).applyToComponent {
299-
foreground = JBUI.CurrentTheme.ContextHelp.FOREGROUND
300-
font = ComponentPanelBuilder.getCommentFont(font)
301-
}
302-
label(workspaceProjectIDE.lastOpened.toString()).applyToComponent {
303-
foreground = JBUI.CurrentTheme.ContextHelp.FOREGROUND
304-
font = ComponentPanelBuilder.getCommentFont(font)
292+
if (workspaceWithAgent?.workspace?.latestBuild?.status == WorkspaceStatus.RUNNING && workspaceWithAgent.status == WorkspaceAndAgentStatus.READY) {
293+
row { label("Select a project to launch.") }
294+
connections.forEach { workspaceProjectIDE ->
295+
row {
296+
icon(workspaceProjectIDE.ideProduct.icon)
297+
cell(
298+
ActionLink(workspaceProjectIDE.projectPathDisplay) {
299+
CoderRemoteConnectionHandle().connect { workspaceProjectIDE }
300+
GatewayUI.getInstance().reset()
301+
},
302+
)
303+
label("").resizableColumn().align(AlignX.FILL)
304+
label(workspaceProjectIDE.ideName).applyToComponent {
305+
foreground = JBUI.CurrentTheme.ContextHelp.FOREGROUND
306+
font = ComponentPanelBuilder.getCommentFont(font)
307+
}
308+
label(workspaceProjectIDE.lastOpened.toString()).applyToComponent {
309+
foreground = JBUI.CurrentTheme.ContextHelp.FOREGROUND
310+
font = ComponentPanelBuilder.getCommentFont(font)
311+
}
312+
actionButton(
313+
object : DumbAwareAction(
314+
CoderGatewayBundle.message("gateway.connector.recent-connections.remove.button.tooltip"),
315+
"",
316+
CoderIcons.DELETE,
317+
) {
318+
override fun actionPerformed(e: AnActionEvent) {
319+
recentConnectionsService.removeConnection(workspaceProjectIDE.toRecentWorkspaceConnection())
320+
updateRecentView()
321+
}
322+
},
323+
)
305324
}
306-
actionButton(
307-
object : DumbAwareAction(
308-
CoderGatewayBundle.message("gateway.connector.recent-connections.remove.button.tooltip"),
309-
"",
310-
CoderIcons.DELETE,
311-
) {
312-
override fun actionPerformed(e: AnActionEvent) {
313-
recentConnectionsService.removeConnection(workspaceProjectIDE.toRecentWorkspaceConnection())
314-
updateRecentView()
315-
}
316-
},
317-
)
318325
}
319326
}
320327
}

0 commit comments

Comments
 (0)
Please sign in to comment.