Skip to content

Commit 337b1e4

Browse files
committed
fix: open web terminal action is no longer displayed
when the workspace is stopped. This action will be available only when the workspace is up and running (even when it is running with errors)
1 parent a327073 commit 337b1e4

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
- render network status in the Settings tab, under `Additional environment information` section.
88
- quick action for creating new workspaces from the web dashboard.
99

10+
### Fixed
11+
12+
- `Open web terminal` action is no longer displayed when the workspace is stopped.
13+
1014
## 0.2.1 - 2025-05-05
1115

1216
### Changed

src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,32 @@ class CoderRemoteEnvironment(
7070
fun asPairOfWorkspaceAndAgent(): Pair<Workspace, WorkspaceAgent> = Pair(workspace, agent)
7171

7272
private fun getAvailableActions(): List<ActionDescription> {
73-
val actions = mutableListOf(
74-
Action(context.i18n.ptrl("Open web terminal")) {
73+
val actions = mutableListOf<Action>()
74+
if (wsRawStatus.canStop()) {
75+
actions.add(Action(context.i18n.ptrl("Open web terminal")) {
7576
context.cs.launch {
7677
BrowserUtil.browse(client.url.withPath("/${workspace.ownerName}/$name/terminal").toString()) {
7778
context.ui.showErrorInfoPopup(it)
7879
}
7980
}
80-
},
81+
})
82+
}
83+
actions.add(
8184
Action(context.i18n.ptrl("Open in dashboard")) {
8285
context.cs.launch {
8386
BrowserUtil.browse(client.url.withPath("/@${workspace.ownerName}/${workspace.name}").toString()) {
8487
context.ui.showErrorInfoPopup(it)
8588
}
8689
}
87-
},
90+
})
8891

89-
Action(context.i18n.ptrl("View template")) {
90-
context.cs.launch {
91-
BrowserUtil.browse(client.url.withPath("/templates/${workspace.templateName}").toString()) {
92-
context.ui.showErrorInfoPopup(it)
93-
}
92+
actions.add(Action(context.i18n.ptrl("View template")) {
93+
context.cs.launch {
94+
BrowserUtil.browse(client.url.withPath("/templates/${workspace.templateName}").toString()) {
95+
context.ui.showErrorInfoPopup(it)
9496
}
95-
})
97+
}
98+
})
9699

97100
if (wsRawStatus.canStart()) {
98101
if (workspace.outdated) {

0 commit comments

Comments
 (0)