- Notifications
You must be signed in to change notification settings - Fork16
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
a51beea
c704fa5
6aeb88d
7cd80fb
9c876af
cc07fac
93101b3
901c2c3
a6b196b
3202bb8
3020473
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -17,10 +17,8 @@ | ||
import com.coder.gateway.services.CoderSettingsService | ||
import com.coder.gateway.util.humanizeConnectionError | ||
import com.coder.gateway.util.toURL | ||
import com.coder.gateway.util.withoutNull | ||
import com.intellij.icons.AllIcons | ||
import com.intellij.openapi.Disposable | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.application.ModalityState | ||
@@ -56,6 +54,7 @@ | ||
import kotlinx.coroutines.isActive | ||
import kotlinx.coroutines.launch | ||
import kotlinx.coroutines.withContext | ||
import java.awt.Color | ||
import java.awt.Component | ||
import java.awt.Dimension | ||
import java.util.Locale | ||
@@ -175,15 +174,21 @@ | ||
val workspaceWithAgent = deployment?.items?.firstOrNull { it.workspace.name == workspaceName } | ||
val status = | ||
if (deploymentError != null) { | ||
Triple(UIUtil.getErrorForeground(),deploymentError,UIUtil.getBalloonErrorIcon()) | ||
} else if (workspaceWithAgent != null) { | ||
val inLoadingState = listOf(WorkspaceStatus.STARTING, WorkspaceStatus.CANCELING, WorkspaceStatus.DELETING, WorkspaceStatus.STOPPING).contains(workspaceWithAgent?.workspace?.latestBuild?.status) | ||
Check warning on line 179 in src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt
| ||
Triple( | ||
workspaceWithAgent.status.statusColor(), | ||
workspaceWithAgent.status.description, | ||
if (inLoadingState) { | ||
AnimatedIcon.Default() | ||
} else { | ||
null | ||
}, | ||
) | ||
} else { | ||
Triple(UIUtil.getContextHelpForeground(), "Querying workspace status...", AnimatedIcon.Default()) | ||
} | ||
val gap = | ||
if (top) { | ||
@@ -193,11 +198,6 @@ | ||
TopGap.MEDIUM | ||
} | ||
row { | ||
label(workspaceName).applyToComponent { | ||
font = JBFont.h3().asBold() | ||
}.align(AlignX.LEFT).gap(RightGap.SMALL) | ||
@@ -206,94 +206,44 @@ | ||
font = ComponentPanelBuilder.getCommentFont(font) | ||
} | ||
label("").resizableColumn().align(AlignX.FILL) | ||
}.topGap(gap) | ||
val enableLinks = listOf(WorkspaceStatus.STOPPED, WorkspaceStatus.CANCELED, WorkspaceStatus.FAILED, WorkspaceStatus.STARTING, WorkspaceStatus.RUNNING).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) { | ||
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 we might want to add this check back or something similar to it. It is poorly named but basically it was making sure we only display an API error on the first workspace rather than duplicating it on each workspace (it was pretty noisy, especially since the API errors can get long). For example, say you have 5 workspaces and your token expires, you see a message about being unauthorized and to check your token 5 times on the page. Or we could group workspaces under a deployment heading and show the API error under the deployment heading, but that might be out of scope for this PR. CollaboratorAuthor
| ||
row { | ||
status.third?.let { | ||
icon(it) | ||
} | ||
label("<html><body style='width:350px;'>" + status.second + "</html>").applyToComponent { | ||
foreground = status.first | ||
} | ||
} | ||
} | ||
connections.forEach { workspaceProjectIDE -> | ||
row { | ||
icon(workspaceProjectIDE.ideProduct.icon) | ||
if (enableLinks) { | ||
cell( | ||
ActionLink(workspaceProjectIDE.projectPathDisplay) { | ||
withoutNull(deployment?.client, workspaceWithAgent?.workspace) { client, workspace -> | ||
CoderRemoteConnectionHandle().connect { | ||
if (listOf(WorkspaceStatus.STOPPED, WorkspaceStatus.CANCELED, WorkspaceStatus.FAILED).contains(workspace.latestBuild.status)) { | ||
client.startWorkspace(workspace) | ||
Comment on lines +233 to +234 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 opened#465 for future improvement | ||
} | ||
workspaceProjectIDE | ||
} | ||
GatewayUI.getInstance().reset() | ||
} | ||
}, | ||
) | ||
} else { | ||
label(workspaceProjectIDE.projectPathDisplay).applyToComponent { | ||
foreground = Color.GRAY | ||
} | ||
} | ||
label("").resizableColumn().align(AlignX.FILL) | ||
label(workspaceProjectIDE.ideName).applyToComponent { | ||
foreground = JBUI.CurrentTheme.ContextHelp.FOREGROUND | ||
Uh oh!
There was an error while loading.Please reload this page.