diff --git a/src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt b/src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt index 5aa09aa..ac5d890 100644 --- a/src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt +++ b/src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt @@ -106,31 +106,27 @@ class CoderRemoteEnvironment( override suspend fun getContentsView(): EnvironmentContentsView = EnvironmentView(client.url, workspace, agent) + override val connectionRequest: MutableStateFlow? = MutableStateFlow(false) + /** * Does nothing. In theory, we could do something like start the workspace * when you click into the workspace, but you would still need to press * "connect" anyway before the content is populated so there does not seem * to be much value. */ - override fun setVisible(visibilityState: EnvironmentVisibilityState) {} - - /** - * Immediately send the state to the listener and store for updates. - */ -// override fun addStateListener(consumer: EnvironmentStateConsumer): Boolean { -// // TODO@JB: It would be ideal if we could have the workspace state and -// // the connected state listed separately, since right now the -// // connected state can mask the workspace state. -// // TODO@JB: You can still press connect if the environment is -// // unreachable. Is that expected? -// consumer.consume(status.toRemoteEnvironmentState(serviceLocator)) -// return super.addStateListener(consumer) -// } + override fun setVisible(visibilityState: EnvironmentVisibilityState) { + if (wsRawStatus.ready() && visibilityState.contentsVisible == true && visibilityState.isBackendConnected == false) { + context.logger.info("Connecting to $id...") + context.cs.launch { + connectionRequest?.update { + true + } + } + } + } override fun onDelete() { context.cs.launch { - // TODO info and cancel pop-ups only appear on the main page where all environments are listed. - // However, #showSnackbar works on other pages. Until JetBrains fixes this issue we are going to use the snackbar val shouldDelete = if (wsRawStatus.canStop()) { context.ui.showOkCancelPopup( context.i18n.ptrl("Delete running workspace?"), pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy