Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## Unreleased

### Changed

- improved workspace status reporting (icon and colors) when it is stopping, deleting, stopped or when we are
establishing the SSH connection.

## 0.2.2 - 2025-05-21

### Added
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ class CoderRemoteEnvironment(

override fun beforeConnection() {
context.logger.info("Connecting to $id...")
context.cs.launch {
state.update {
wsRawStatus.toSshConnectingEnvState(context)
}
}
isConnected.update { true }
pollJob = pollNetworkMetrics()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import com.jetbrains.toolbox.api.remoteDev.states.CustomRemoteEnvironmentState
import com.jetbrains.toolbox.api.remoteDev.states.EnvironmentStateIcons
import com.jetbrains.toolbox.api.remoteDev.states.StandardRemoteEnvironmentState


private val CircularSpinner: EnvironmentStateIcons = EnvironmentStateIcons.Connecting

/**
* WorkspaceAndAgentStatus represents the combined status of a single agent and
* its workspace (or just the workspace if there are no agents).
Expand Down Expand Up @@ -71,7 +74,7 @@ enum class WorkspaceAndAgentStatus(val label: String, val description: String) {
private fun getStateColor(context: CoderToolboxContext): StateColor {
return if (ready()) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Active)
else if (unhealthy()) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Unhealthy)
else if (canStart()) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Failed)
else if (canStart() || this == STOPPING) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Hibernating)
else if (pending()) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Activating)
else if (this == DELETING) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Deleting)
else if (this == DELETED) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Deleted)
Expand All @@ -80,12 +83,21 @@ enum class WorkspaceAndAgentStatus(val label: String, val description: String) {

private fun getStateIcon(): EnvironmentStateIcons {
return if (ready() || unhealthy()) EnvironmentStateIcons.Active
else if (canStart()) EnvironmentStateIcons.Hibernated
else if (pending()) EnvironmentStateIcons.Connecting
else if (this == DELETING || this == DELETED) EnvironmentStateIcons.Offline
else if (canStart()) EnvironmentStateIcons.Offline
else if (pending() || this == DELETING || this == DELETED || this == STOPPING) CircularSpinner
else EnvironmentStateIcons.NoIcon
}

fun toSshConnectingEnvState(context: CoderToolboxContext): CustomRemoteEnvironmentState {
val existingState = toRemoteEnvironmentState(context)
return CustomRemoteEnvironmentState(
"SSHing",
existingState.color,
existingState.isReachable,
EnvironmentStateIcons.Connecting
)
}

/**
* Return true if the agent is in a connectable state.
*/
Expand Down
Loading