Skip to content

Commit ca1d63a

Browse files
authored
Merge pull request #2006 from github/nora/update-old-panel-icons
Update icons of old DB panel
2 parents ad6cbe6 + 0771e93 commit ca1d63a

File tree

4 files changed

+7
-211
lines changed

4 files changed

+7
-211
lines changed

extensions/ql-vscode/media/dark/check.svg

Lines changed: 0 additions & 56 deletions
This file was deleted.

extensions/ql-vscode/media/light/check.svg

Lines changed: 0 additions & 57 deletions
This file was deleted.

extensions/ql-vscode/media/red-x.svg

Lines changed: 0 additions & 58 deletions
This file was deleted.

extensions/ql-vscode/src/databases-ui.ts

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
window,
1111
env,
1212
CancellationToken,
13+
ThemeIcon,
14+
ThemeColor,
1315
} from "vscode";
1416
import { pathExists, stat, readdir, remove } from "fs-extra";
1517

@@ -40,33 +42,6 @@ import { isCanary } from "./config";
4042
import { App } from "./common/app";
4143
import { Credentials } from "./common/authentication";
4244

43-
type ThemableIconPath = { light: string; dark: string } | string;
44-
45-
/**
46-
* Path to icons to display next to currently selected database.
47-
*/
48-
const SELECTED_DATABASE_ICON: ThemableIconPath = {
49-
light: "media/light/check.svg",
50-
dark: "media/dark/check.svg",
51-
};
52-
53-
/**
54-
* Path to icon to display next to an invalid database.
55-
*/
56-
const INVALID_DATABASE_ICON: ThemableIconPath = "media/red-x.svg";
57-
58-
function joinThemableIconPath(
59-
base: string,
60-
iconPath: ThemableIconPath,
61-
): ThemableIconPath {
62-
if (typeof iconPath == "object")
63-
return {
64-
light: join(base, iconPath.light),
65-
dark: join(base, iconPath.dark),
66-
};
67-
else return join(base, iconPath);
68-
}
69-
7045
enum SortOrder {
7146
NameAsc = "NameAsc",
7247
NameDesc = "NameDesc",
@@ -88,10 +63,7 @@ class DatabaseTreeDataProvider
8863
);
8964
private currentDatabaseItem: DatabaseItem | undefined;
9065

91-
constructor(
92-
private databaseManager: DatabaseManager,
93-
private readonly extensionPath: string,
94-
) {
66+
constructor(private databaseManager: DatabaseManager) {
9567
super();
9668

9769
this.currentDatabaseItem = databaseManager.currentDatabaseItem;
@@ -136,16 +108,11 @@ class DatabaseTreeDataProvider
136108
public getTreeItem(element: DatabaseItem): TreeItem {
137109
const item = new TreeItem(element.name);
138110
if (element === this.currentDatabaseItem) {
139-
item.iconPath = joinThemableIconPath(
140-
this.extensionPath,
141-
SELECTED_DATABASE_ICON,
142-
);
111+
item.iconPath = new ThemeIcon("check");
112+
143113
item.contextValue = "currentDatabase";
144114
} else if (element.error !== undefined) {
145-
item.iconPath = joinThemableIconPath(
146-
this.extensionPath,
147-
INVALID_DATABASE_ICON,
148-
);
115+
item.iconPath = new ThemeIcon("error", new ThemeColor("errorForeground"));
149116
}
150117
item.tooltip = element.databaseUri.fsPath;
151118
item.description = element.language;
@@ -230,7 +197,7 @@ export class DatabaseUI extends DisposableObject {
230197
super();
231198

232199
this.treeDataProvider = this.push(
233-
new DatabaseTreeDataProvider(databaseManager, extensionPath),
200+
new DatabaseTreeDataProvider(databaseManager),
234201
);
235202
this.push(
236203
window.createTreeView("codeQLDatabases", {

0 commit comments

Comments
 (0)