|
1 | 1 | package com.coder.gateway.views.steps
|
2 | 2 |
|
3 |
| -import com.coder.gateway.sdk.v1.Workspace |
| 3 | +import com.coder.gateway.sdk.v2.models.ProvisionerJobStatus |
| 4 | +import com.coder.gateway.sdk.v2.models.Workspace |
| 5 | +import com.coder.gateway.sdk.v2.models.WorkspaceBuildTransition |
4 | 6 | import com.intellij.ui.IconManager
|
5 | 7 | import com.intellij.ui.dsl.builder.panel
|
6 | 8 | import com.intellij.ui.dsl.gridLayout.HorizontalAlign
|
@@ -32,22 +34,35 @@ class WorkspaceCellRenderer : ListCellRenderer<Workspace> {
|
32 | 34 | }
|
33 | 35 | }
|
34 | 36 |
|
35 |
| - private fun iconForImageTag(workspace: Workspace) = when (workspace.imageTag) { |
| 37 | + private fun iconForImageTag(workspace: Workspace) = when (workspace.templateName) { |
36 | 38 | "ubuntu" -> UBUNTU_ICON
|
37 | 39 | "centos" -> CENTOS_ICON
|
38 | 40 | else -> LINUX_ICON
|
39 | 41 | }
|
40 | 42 |
|
41 |
| - private fun iconForStatus(workspace: Workspace) = when (workspace.latestStat.container_status) { |
42 |
| - "ON" -> GREEN_CIRCLE_ICON |
43 |
| - "OFF" -> GRAY_CIRCLE_ICON |
| 43 | + private fun iconForStatus(workspace: Workspace) = when (workspace.latestBuild.job.status) { |
| 44 | + ProvisionerJobStatus.succeeded -> if (workspace.latestBuild.workspaceTransition == WorkspaceBuildTransition.start) GREEN_CIRCLE_ICON else RED_CIRCLE_ICON |
| 45 | + ProvisionerJobStatus.running -> when (workspace.latestBuild.workspaceTransition) { |
| 46 | + WorkspaceBuildTransition.start, WorkspaceBuildTransition.stop, WorkspaceBuildTransition.delete -> GRAY_CIRCLE_ICON |
| 47 | + } |
44 | 48 | else -> RED_CIRCLE_ICON
|
45 | 49 | }
|
46 | 50 |
|
47 |
| - private fun labelForStatus(workspace: Workspace) = when (workspace.latestStat.container_status) { |
48 |
| - "ON" -> "Running" |
49 |
| - "OFF" -> "Off" |
50 |
| - else -> "Unknown status" |
| 51 | + private fun labelForStatus(workspace: Workspace) = when (workspace.latestBuild.job.status) { |
| 52 | + ProvisionerJobStatus.pending -> "◍ Queued" |
| 53 | + ProvisionerJobStatus.running -> when (workspace.latestBuild.workspaceTransition) { |
| 54 | + WorkspaceBuildTransition.start -> "⦿ Starting" |
| 55 | + WorkspaceBuildTransition.stop -> "◍ Stopping" |
| 56 | + WorkspaceBuildTransition.delete -> "⦸ Deleting" |
| 57 | + } |
| 58 | + ProvisionerJobStatus.succeeded -> when (workspace.latestBuild.workspaceTransition) { |
| 59 | + WorkspaceBuildTransition.start -> "⦿ Running" |
| 60 | + WorkspaceBuildTransition.stop -> "◍ Stopped" |
| 61 | + WorkspaceBuildTransition.delete -> "⦸ Deleted" |
| 62 | + } |
| 63 | + ProvisionerJobStatus.canceling -> "◍ Canceling action" |
| 64 | + ProvisionerJobStatus.canceled -> "◍ Canceled action" |
| 65 | + ProvisionerJobStatus.failed -> "ⓧ Failed" |
51 | 66 | }
|
52 | 67 |
|
53 | 68 | companion object {
|
|
0 commit comments