@@ -110,31 +110,27 @@ class CoderRemoteEnvironment(
110
110
override suspend
111
111
fun getContentsView (): EnvironmentContentsView = EnvironmentView (client.url, workspace, agent)
112
112
113
+ override val connectionRequest: MutableStateFlow <Boolean >? = MutableStateFlow (false )
114
+
113
115
/* *
114
116
* Does nothing. In theory, we could do something like start the workspace
115
117
* when you click into the workspace, but you would still need to press
116
118
* "connect" anyway before the content is populated so there does not seem
117
119
* to be much value.
118
120
*/
119
- override fun setVisible (visibilityState : EnvironmentVisibilityState ) {}
120
-
121
- /* *
122
- * Immediately send the state to the listener and store for updates.
123
- */
124
- // override fun addStateListener(consumer: EnvironmentStateConsumer): Boolean {
125
- // // TODO@JB: It would be ideal if we could have the workspace state and
126
- // // the connected state listed separately, since right now the
127
- // // connected state can mask the workspace state.
128
- // // TODO@JB: You can still press connect if the environment is
129
- // // unreachable. Is that expected?
130
- // consumer.consume(status.toRemoteEnvironmentState(serviceLocator))
131
- // return super.addStateListener(consumer)
132
- // }
121
+ override fun setVisible (visibilityState : EnvironmentVisibilityState ) {
122
+ if (wsRawStatus.ready() && visibilityState.contentsVisible == true && visibilityState.isBackendConnected == false ) {
123
+ context.logger.info(" Connecting to $id ..." )
124
+ context.cs.launch {
125
+ connectionRequest?.update {
126
+ true
127
+ }
128
+ }
129
+ }
130
+ }
133
131
134
132
override fun onDelete () {
135
133
context.cs.launch {
136
- // TODO info and cancel pop-ups only appear on the main page where all environments are listed.
137
- // However, #showSnackbar works on other pages. Until JetBrains fixes this issue we are going to use the snackbar
138
134
val shouldDelete = if (wsRawStatus.canStop()) {
139
135
context.ui.showOkCancelPopup(
140
136
context.i18n.ptrl(" Delete running workspace?" ),
0 commit comments