Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

impl: workspace status reporting (color and icons)#118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fioan89 merged 2 commits intomainfromimprove-workspace-state-reporting
May 22, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
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 deletionsCHANGELOG.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,11 @@

## Unreleased

### Changed

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

## 0.2.2 - 2025-05-21

### Added
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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 DownExpand Up@@ -69,23 +72,34 @@ 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 (pending()) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Activating)
return if (this == FAILED) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.FailedToStart)
else if (this == DELETING) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Deleting)
else if (this == DELETED) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Deleted)
else if (ready()) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Active)
else if (unhealthy()) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Unhealthy)
else if (canStart() || this == STOPPING) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Hibernating)
else if (pending()) context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Activating)
else context.envStateColorPalette.getColor(StandardRemoteEnvironmentState.Unreachable)
}

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
return if (this == FAILED) EnvironmentStateIcons.Error
else if (pending() || this == DELETING || this == DELETED || this == STOPPING) CircularSpinner
else if (ready() || unhealthy()) EnvironmentStateIcons.Active
else if (canStart()) EnvironmentStateIcons.Offline
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

[8]ページ先頭

©2009-2025 Movatter.jp