Skip to content

Commit

Permalink
Remove unused status icons
Browse files Browse the repository at this point in the history
We display the status text and color, but not the icons.
  • Loading branch information
code-asher committed Sep 5, 2024
1 parent ce85ff5 commit 9d040a8
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 51 deletions.
4 changes: 0 additions & 4 deletions src/main/kotlin/com/coder/gateway/icons/CoderIcons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ object CoderIcons {

val OPEN_TERMINAL = IconLoader.getIcon("icons/open_terminal.svg", javaClass)

val PENDING = IconLoader.getIcon("icons/pending.svg", javaClass)
val RUNNING = IconLoader.getIcon("icons/running.svg", javaClass)
val OFF = IconLoader.getIcon("icons/off.svg", javaClass)

val HOME = IconLoader.getIcon("icons/homeFolder.svg", javaClass)
val CREATE = IconLoader.getIcon("icons/create.svg", javaClass)
val RUN = IconLoader.getIcon("icons/run.svg", javaClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class WorkspaceAgentListModel(
val workspace: Workspace,
// If this is missing, assume the workspace is off or has no agents.
val agent: WorkspaceAgent? = null,
// The icon to display on the row.
// The icon of the template from which this workspace was created.
var icon: Icon? = null,
// The combined status of the workspace and agent to display on the row.
val status: WorkspaceAndAgentStatus = WorkspaceAndAgentStatus.from(workspace, agent),
Expand Down
50 changes: 23 additions & 27 deletions src/main/kotlin/com/coder/gateway/models/WorkspaceAndAgentStatus.kt
Original file line number Diff line number Diff line change
@@ -1,54 +1,50 @@
package com.coder.gateway.models

import com.coder.gateway.icons.CoderIcons
import com.coder.gateway.sdk.v2.models.Workspace
import com.coder.gateway.sdk.v2.models.WorkspaceAgent
import com.coder.gateway.sdk.v2.models.WorkspaceAgentLifecycleState
import com.coder.gateway.sdk.v2.models.WorkspaceAgentStatus
import com.coder.gateway.sdk.v2.models.WorkspaceStatus
import com.intellij.ui.JBColor
import javax.swing.Icon

/**
* WorkspaceAndAgentStatus represents the combined status of a single agent and
* its workspace (or just the workspace if there are no agents).
*/
enum class WorkspaceAndAgentStatus(val icon: Icon, val label: String, val description: String) {
enum class WorkspaceAndAgentStatus(val label: String, val description: String) {
// Workspace states.
QUEUED(CoderIcons.PENDING, "Queued", "The workspace is queueing to start."),
STARTING(CoderIcons.PENDING, "Starting", "The workspace is starting."),
FAILED(CoderIcons.OFF, "Failed", "The workspace has failed to start."),
DELETING(CoderIcons.PENDING, "Deleting", "The workspace is being deleted."),
DELETED(CoderIcons.OFF, "Deleted", "The workspace has been deleted."),
STOPPING(CoderIcons.PENDING, "Stopping", "The workspace is stopping."),
STOPPED(CoderIcons.OFF, "Stopped", "The workspace has stopped."),
CANCELING(CoderIcons.PENDING, "Canceling action", "The workspace is being canceled."),
CANCELED(CoderIcons.OFF, "Canceled action", "The workspace has been canceled."),
RUNNING(CoderIcons.RUN, "Running", "The workspace is running, waiting for agents."),
QUEUED("Queued", "The workspace is queueing to start."),
STARTING("Starting", "The workspace is starting."),
FAILED("Failed", "The workspace has failed to start."),
DELETING("Deleting", "The workspace is being deleted."),
DELETED("Deleted", "The workspace has been deleted."),
STOPPING("Stopping", "The workspace is stopping."),
STOPPED("Stopped", "The workspace has stopped."),
CANCELING("Canceling action", "The workspace is being canceled."),
CANCELED("Canceled action", "The workspace has been canceled."),
RUNNING("Running", "The workspace is running, waiting for agents."),

// Agent states.
CONNECTING(CoderIcons.PENDING, "Connecting", "The agent is connecting."),
DISCONNECTED(CoderIcons.OFF, "Disconnected", "The agent has disconnected."),
TIMEOUT(CoderIcons.PENDING, "Timeout", "The agent is taking longer than expected to connect."),
AGENT_STARTING(CoderIcons.PENDING, "Starting", "The startup script is running."),
CONNECTING("Connecting", "The agent is connecting."),
DISCONNECTED("Disconnected", "The agent has disconnected."),
TIMEOUT("Timeout", "The agent is taking longer than expected to connect."),
AGENT_STARTING("Starting", "The startup script is running."),
AGENT_STARTING_READY(
CoderIcons.RUNNING,
"Starting",
"The startup script is still running but the agent is ready to accept connections.",
),
CREATED(CoderIcons.PENDING, "Created", "The agent has been created."),
START_ERROR(CoderIcons.RUNNING, "Started with error", "The agent is ready but the startup script errored."),
START_TIMEOUT(CoderIcons.PENDING, "Starting", "The startup script is taking longer than expected."),
CREATED("Created", "The agent has been created."),
START_ERROR("Started with error", "The agent is ready but the startup script errored."),
START_TIMEOUT("Starting", "The startup script is taking longer than expected."),
START_TIMEOUT_READY(
CoderIcons.RUNNING,
"Starting",
"The startup script is taking longer than expected but the agent is ready to accept connections.",
),
SHUTTING_DOWN(CoderIcons.PENDING, "Shutting down", "The agent is shutting down."),
SHUTDOWN_ERROR(CoderIcons.OFF, "Shutdown with error", "The agent shut down but the shutdown script errored."),
SHUTDOWN_TIMEOUT(CoderIcons.OFF, "Shutting down", "The shutdown script is taking longer than expected."),
OFF(CoderIcons.OFF, "Off", "The agent has shut down."),
READY(CoderIcons.RUNNING, "Ready", "The agent is ready to accept connections."),
SHUTTING_DOWN("Shutting down", "The agent is shutting down."),
SHUTDOWN_ERROR("Shutdown with error", "The agent shut down but the shutdown script errored."),
SHUTDOWN_TIMEOUT("Shutting down", "The shutdown script is taking longer than expected."),
OFF("Off", "The agent has shut down."),
READY("Ready", "The agent is ready to accept connections."),
;

fun statusColor(): JBColor =
Expand Down
6 changes: 0 additions & 6 deletions src/main/resources/icons/off.svg

This file was deleted.

7 changes: 0 additions & 7 deletions src/main/resources/icons/pending.svg

This file was deleted.

6 changes: 0 additions & 6 deletions src/main/resources/icons/running.svg

This file was deleted.

0 comments on commit 9d040a8

Please sign in to comment.