Skip to content

Commit 68a7f2e

Browse files
committed
add status icons to workspace tree items
1 parent 0620dd2 commit 68a7f2e

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

media/green.png

13.4 KB
Loading

media/grey.png

22.1 KB
Loading

media/red.png

40.3 KB
Loading

media/yellow.png

3.74 KB
Loading

src/workspaces.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as vscode from 'vscode';
22
import * as cp from 'child_process';
3+
import * as path from 'path';
34

45
export class CoderWorkspacesProvider implements vscode.TreeDataProvider<CoderWorkspace> {
56

@@ -89,6 +90,9 @@ export interface CoderWorkspace {
8990
image_tag: string
9091
image_id: string
9192
gpus: number
93+
latest_stat: {
94+
container_status: string
95+
}
9296
}
9397

9498
export interface CoderImage {
@@ -108,5 +112,16 @@ export class CoderWorkspace extends vscode.TreeItem {
108112
this.tooltip = `${this.label}`;
109113
const image = images.find(a => a.id === workspace.image_id);
110114
this.description = `${image.repository}:${workspace.image_tag}, ${workspace.cpu_cores} vCPU, ${workspace.memory_gb}GB Memory`;
115+
116+
this.iconPath = path.join(__filename, '..', '..', 'media', workspaceIcon(workspace));
111117
}
112118
}
119+
120+
const workspaceIcon = ({latest_stat: { container_status }}: CoderWorkspace): string => {
121+
return {
122+
"OFF": "grey.png",
123+
"CREATING": "yellow.png",
124+
"ERROR": "red.png",
125+
"ON": "green.png"
126+
}[container_status];
127+
};

0 commit comments

Comments
 (0)