diff --git a/CHANGELOG.md b/CHANGELOG.md
index 639edd3b..add0004d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,9 +6,11 @@
### Added
- warning system when plugin might not be compatible with Coder REST API
+- a `Create workspace` button which links to Coder's templates page
### Fixed
- outdated Coder CLI binaries are cleaned up
+- workspace status color style: running workspaces are green, failed ones should be red, everything else is gray
## 2.1.2 - 2022-11-23
diff --git a/src/main/kotlin/com/coder/gateway/icons/CoderIcons.kt b/src/main/kotlin/com/coder/gateway/icons/CoderIcons.kt
index 3f7a587f..16322770 100644
--- a/src/main/kotlin/com/coder/gateway/icons/CoderIcons.kt
+++ b/src/main/kotlin/com/coder/gateway/icons/CoderIcons.kt
@@ -9,6 +9,7 @@ object CoderIcons {
val OPEN_TERMINAL = IconLoader.getIcon("open_terminal.svg", javaClass)
+ val CREATE = IconLoader.getIcon("create.svg", javaClass)
val RUN = IconLoader.getIcon("run.svg", javaClass)
val STOP = IconLoader.getIcon("stop.svg", javaClass)
val UPDATE = IconLoader.getIcon("update.svg", javaClass)
diff --git a/src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt b/src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt
index 0c61414c..25575415 100644
--- a/src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt
+++ b/src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt
@@ -131,6 +131,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
private val startWorkspaceAction = StartWorkspaceAction()
private val stopWorkspaceAction = StopWorkspaceAction()
private val updateWorkspaceTemplateAction = UpdateWorkspaceTemplateAction()
+ private val createWorkspaceAction = CreateWorkspaceAction()
private val toolbar = ToolbarDecorator.createDecorator(tableOfWorkspaces)
.disableAddAction()
@@ -139,6 +140,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
.addExtraAction(startWorkspaceAction)
.addExtraAction(stopWorkspaceAction)
.addExtraAction(updateWorkspaceTemplateAction)
+ .addExtraAction(createWorkspaceAction)
private var poller: Job? = null
@@ -225,6 +227,12 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
}
}
+ private inner class CreateWorkspaceAction : AnActionButton(CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.create.text"), CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.create.text"), CoderIcons.CREATE) {
+ override fun actionPerformed(p0: AnActionEvent) {
+ BrowserUtil.browse(coderClient.coderURL.toURI().resolve("/templates"))
+ }
+ }
+
private inner class StopWorkspaceAction : AnActionButton(CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.stop.text"), CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.stop.text"), CoderIcons.STOP) {
override fun actionPerformed(p0: AnActionEvent) {
if (tableOfWorkspaces.selectedObject != null) {
@@ -263,6 +271,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
}
private fun updateWorkspaceActions() {
+ createWorkspaceAction.isEnabled = true
+
when (tableOfWorkspaces.selectedObject?.agentStatus) {
RUNNING -> {
startWorkspaceAction.isEnabled = false
@@ -642,8 +652,8 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
private fun WorkspaceAgentModel.statusColor() = when (this.agentStatus) {
RUNNING -> JBColor.GREEN
- STARTING, STOPPING, DELETING -> if (JBColor.isBright()) JBColor.LIGHT_GRAY else JBColor.DARK_GRAY
- else -> JBColor.RED
+ FAILED -> JBColor.RED
+ else -> if (JBColor.isBright()) JBColor.LIGHT_GRAY else JBColor.DARK_GRAY
}
}
diff --git a/src/main/resources/create.svg b/src/main/resources/create.svg
new file mode 100644
index 00000000..c6da8ba4
--- /dev/null
+++ b/src/main/resources/create.svg
@@ -0,0 +1,8 @@
+
+
diff --git a/src/main/resources/create_dark.svg b/src/main/resources/create_dark.svg
new file mode 100644
index 00000000..511a8ef5
--- /dev/null
+++ b/src/main/resources/create_dark.svg
@@ -0,0 +1,8 @@
+
+
diff --git a/src/main/resources/messages/CoderGatewayBundle.properties b/src/main/resources/messages/CoderGatewayBundle.properties
index 05bd400d..9bbae2c1 100644
--- a/src/main/resources/messages/CoderGatewayBundle.properties
+++ b/src/main/resources/messages/CoderGatewayBundle.properties
@@ -14,6 +14,7 @@ gateway.connector.view.coder.workspaces.next.text=Select IDE and Project
gateway.connector.view.coder.workspaces.start.text=Start Workspace
gateway.connector.view.coder.workspaces.stop.text=Stop Workspace
gateway.connector.view.coder.workspaces.update.text=Update Workspace Template
+gateway.connector.view.coder.workspaces.create.text=Create workspace
gateway.connector.view.coder.workspaces.unsupported.os.info=Gateway supports only Linux machines. Support for macOS and Windows is planned.
gateway.connector.view.coder.workspaces.invalid.coder.version=Could not parse Coder version {0}. Coder Gateway plugin might not be compatible with this version.
gateway.connector.view.coder.workspaces.unsupported.coder.version=Coder version {0} might not be compatible with this plugin version.