-
Notifications
You must be signed in to change notification settings - Fork 16
revise recent projects flow to be less confusing #464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a51beea
c704fa5
6aeb88d
7cd80fb
9c876af
cc07fac
93101b3
901c2c3
a6b196b
3202bb8
3020473
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,14 +174,15 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback: | |
val workspaceWithAgent = deployment?.items?.firstOrNull { it.workspace.name == workspaceName } | ||
val status = | ||
if (deploymentError != null) { | ||
Pair(UIUtil.getErrorForeground(), deploymentError) | ||
Triple(UIUtil.getErrorForeground(), deploymentError, UIUtil.getBalloonErrorIcon()) | ||
} else if (workspaceWithAgent != null) { | ||
Pair( | ||
Triple( | ||
workspaceWithAgent.status.statusColor(), | ||
workspaceWithAgent.status.description, | ||
null | ||
) | ||
} else { | ||
Pair(UIUtil.getContextHelpForeground(), "Querying workspace status...") | ||
Triple(UIUtil.getContextHelpForeground(), "Querying workspace status...", AnimatedIcon.Default()) | ||
} | ||
val gap = | ||
if (top) { | ||
|
@@ -201,19 +202,25 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback: | |
label("").resizableColumn().align(AlignX.FILL) | ||
}.topGap(gap) | ||
|
||
connections.forEach { workspaceProjectIDE -> | ||
val enableLinks = listOf(WorkspaceStatus.STOPPED, WorkspaceStatus.CANCELED, WorkspaceStatus.FAILED, WorkspaceStatus.STARTING, WorkspaceStatus.RUNNING).contains(workspaceWithAgent?.workspace?.latestBuild?.status) | ||
val inLoadingState = listOf(WorkspaceStatus.STARTING, WorkspaceStatus.CANCELING, WorkspaceStatus.DELETING, WorkspaceStatus.STOPPING).contains(workspaceWithAgent?.workspace?.latestBuild?.status) | ||
val enableLinks = listOf(WorkspaceStatus.STOPPED, WorkspaceStatus.CANCELED, WorkspaceStatus.FAILED, WorkspaceStatus.STARTING, WorkspaceStatus.RUNNING).contains(workspaceWithAgent?.workspace?.latestBuild?.status) | ||
val inLoadingState = listOf(WorkspaceStatus.STARTING, WorkspaceStatus.CANCELING, WorkspaceStatus.DELETING, WorkspaceStatus.STOPPING).contains(workspaceWithAgent?.workspace?.latestBuild?.status) | ||
|
||
// We only display an API error on the first workspace rather than duplicating it on each workspace. | ||
if (deploymentError == null || showError) { | ||
row { | ||
if (inLoadingState) { | ||
icon(AnimatedIcon.Default()) | ||
} | ||
if (status.third != null) { | ||
icon(status.third!!) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idk if this is more Kotlin-y but I think you can also do something like this over the assertion:
Admittedly untested though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I low key hate that they named a function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think the main issue with assertions is that they bypass the safety provided to you by the language, which feels dangerous for an unclear benefit. If you see a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I meant use withoutNull inside the if check, but you're totally right the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahaha yeah and I swear I have to look it up every time because I always forget it is called |
||
label("<html><body style='width:350px;'>" + status.second + "</html>").applyToComponent { | ||
foreground = status.first | ||
} | ||
} | ||
} | ||
|
||
connections.forEach { workspaceProjectIDE -> | ||
row { | ||
icon(workspaceProjectIDE.ideProduct.icon) | ||
if (enableLinks) { | ||
|
Uh oh!
There was an error while loading. Please reload this page.