Skip to content

Commit b004e4d

Browse files
committed
chore: refactor workspace icons
1 parent 4d5b628 commit b004e4d

File tree

6 files changed

+11
-6
lines changed

6 files changed

+11
-6
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/utils.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import * as path from 'path';
2+
3+
export const mediaDir = path.join(__filename, '..', '..', 'media');

src/workspaces.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from 'vscode';
22
import * as cp from 'child_process';
33
import * as path from 'path';
4+
import { mediaDir } from './utils';
45

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

@@ -127,15 +128,16 @@ export class CoderWorkspace extends vscode.TreeItem {
127128
const image = images.find(a => a.id === workspace.image_id);
128129
this.description = `${image.repository}:${workspace.image_tag}, ${workspace.cpu_cores} vCPU, ${workspace.memory_gb}GB Memory`;
129130

130-
this.iconPath = path.join(__filename, '..', '..', 'media', workspaceIcon(workspace));
131+
this.iconPath = workspaceIcon(workspace);
131132
}
132133
}
133134

134135
const workspaceIcon = ({latest_stat: { container_status }}: CoderWorkspace): string => {
135-
return {
136-
"OFF": "grey.png",
137-
"CREATING": "yellow.png",
138-
"ERROR": "red.png",
139-
"ON": "green.png"
136+
const file = {
137+
OFF: "off.png",
138+
CREATING: "creating.png",
139+
ERROR: "error.png",
140+
ON: "on.png"
140141
}[container_status];
142+
return path.join(mediaDir, file);
141143
};

0 commit comments

Comments
 (0)