Skip to content

Commit 3f08d29

Browse files
authored
Add statuses to sidebar (#299)
1 parent be9eb68 commit 3f08d29

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## Unreleased
44

5+
### Added
6+
7+
- Workspace and agent statuses now show in the sidebar. These are updated every
8+
five seconds.
9+
510
## [v1.0.2](https://github.com/coder/vscode-coder/releases/tag/v1.0.2) (2024-06-12)
611

712
### Fixed

src/remote.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,11 @@ export class Remote {
253253
writeEmitter.fire(log.output + "\r\n")
254254
})
255255
socket.on("error", (error) => {
256-
reject(new Error(`Failed to watch workspace build using ${socketUrlRaw}: ${errToStr(error, "no further details")}`))
256+
reject(
257+
new Error(
258+
`Failed to watch workspace build using ${socketUrlRaw}: ${errToStr(error, "no further details")}`,
259+
),
260+
)
257261
})
258262
socket.on("close", () => {
259263
resolve()

src/workspacesProvider.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
3535
private workspaces: WorkspaceTreeItem[] = []
3636
private agentWatchers: Record<WorkspaceAgent["id"], AgentWatcher> = {}
3737
private timeout: NodeJS.Timeout | undefined
38-
private visible = false
3938
private fetching = false
4039

4140
constructor(
@@ -147,7 +146,6 @@ export class WorkspaceProvider implements vscode.TreeDataProvider<vscode.TreeIte
147146
* Either start or stop the refresh timer based on visibility.
148147
*/
149148
setVisibility(visible: boolean) {
150-
this.visible = visible
151149
if (!visible) {
152150
this.cancelPendingRefresh()
153151
} else {
@@ -282,6 +280,7 @@ export class OpenableTreeItem extends vscode.TreeItem {
282280
constructor(
283281
label: string,
284282
tooltip: string,
283+
description: string,
285284
collapsibleState: vscode.TreeItemCollapsibleState,
286285

287286
public readonly workspaceOwner: string,
@@ -294,6 +293,7 @@ export class OpenableTreeItem extends vscode.TreeItem {
294293
super(label, collapsibleState)
295294
this.contextValue = contextValue
296295
this.tooltip = tooltip
296+
this.description = description
297297
}
298298

299299
iconPath = {
@@ -309,11 +309,10 @@ class AgentTreeItem extends OpenableTreeItem {
309309
workspaceName: string,
310310
watchMetadata = false,
311311
) {
312-
const label = agent.name
313-
const detail = `Status: ${agent.status}`
314312
super(
315-
label,
316-
detail,
313+
agent.name, // label
314+
`Status: ${agent.status}`, // tooltip
315+
agent.status, // description
317316
watchMetadata ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None,
318317
workspaceOwner,
319318
workspaceName,
@@ -339,6 +338,7 @@ export class WorkspaceTreeItem extends OpenableTreeItem {
339338
super(
340339
label,
341340
detail,
341+
workspace.latest_build.status, // description
342342
showOwner ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.Expanded,
343343
workspace.owner_name,
344344
workspace.name,

0 commit comments

Comments
 (0)