2019-04-10 13:45:47 +02:00
|
|
|
import * as vscode from "vscode";
|
2019-04-12 08:35:29 +02:00
|
|
|
import * as path from "path";
|
2019-04-10 13:45:47 +02:00
|
|
|
|
|
|
|
export class Issue extends vscode.TreeItem {
|
|
|
|
|
|
|
|
constructor(public readonly label: string,
|
|
|
|
public issueId: number,
|
|
|
|
public body: string,
|
|
|
|
public issueState: string,
|
|
|
|
public assignee: string,
|
2019-04-12 08:09:19 +02:00
|
|
|
public labels: any[],
|
|
|
|
public collapsibleState: vscode.TreeItemCollapsibleState,
|
2019-04-10 13:45:47 +02:00
|
|
|
public readonly command?: vscode.Command) {
|
|
|
|
super(label, collapsibleState);
|
|
|
|
}
|
|
|
|
|
|
|
|
get tooltip() {
|
|
|
|
return this.label + " - " + this.assignee;
|
|
|
|
}
|
2019-04-12 08:35:29 +02:00
|
|
|
|
|
|
|
labelDependentIcon(dark: boolean = false): string {
|
|
|
|
let filename = "";
|
|
|
|
if (this.labels.length === 0) {
|
|
|
|
filename = "issue";
|
|
|
|
} else {
|
|
|
|
this.labels[0].name.toLowerCase() === "feature" ? filename = "feature" : filename = this.labels[0].name.toLowerCase() === "bug" ? "bug" : "issue";
|
|
|
|
}
|
|
|
|
return path.join(__filename, '..', '..', 'resources', dark ? 'dark' : 'light', filename + '.svg');
|
|
|
|
}
|
|
|
|
|
|
|
|
iconPath = {
|
|
|
|
light: this.labelDependentIcon(),
|
|
|
|
dark: this.labelDependentIcon(true)
|
|
|
|
};
|
|
|
|
|
2019-04-10 13:45:47 +02:00
|
|
|
contextValue = 'issue';
|
|
|
|
}
|