Skip to content

Commit 1da3f4b

Browse files
committed
impl: don't start the workspace automatically if disable-autostart is enabled
- uri handling always tried to start the workspace if it was stopped. - this commit honors the `disable autostart` setting which should stop the starting of the workspace automatically when connecting via SSH. - instead user is warned via a pop-up dialog that manual starting is needed
1 parent 3a8738c commit 1da3f4b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt

+13
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,19 @@ open class CoderProtocolHandler(
9595

9696
WorkspaceStatus.STOPPING, WorkspaceStatus.STOPPED,
9797
WorkspaceStatus.CANCELING, WorkspaceStatus.CANCELED -> {
98+
if (context.settings.disableAutostart) {
99+
context.ui.showWindow()
100+
context.envPageManager.showPluginEnvironmentsPage(true)
101+
102+
context.logger.warn("$workspaceName from $deploymentURL is not started and autostart is disabled.")
103+
context.ui.showInfoPopup(
104+
context.i18n.pnotr("$workspaceName is not running"),
105+
context.i18n.ptrl("Can't handle URI because workspace is not running and autostart is disabled. Please start the workspace manually and execute the URI again."),
106+
context.i18n.ptrl("OK")
107+
)
108+
return
109+
}
110+
98111
restClient.startWorkspace(workspace)
99112
if (restClient.waitForReady(workspace) != true) {
100113
context.logger.error("$workspaceName from $deploymentURL could not be started on time")

src/main/resources/localization/defaultMessages.po

+3
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,7 @@ msgid "Get a token"
146146
msgstr ""
147147

148148
msgid "Connect"
149+
msgstr ""
150+
151+
msgid "Can't handle URI because workspace is not running and autostart is disabled. Please start the workspace manually and execute the URI again."
149152
msgstr ""

0 commit comments

Comments
 (0)