FIXED #3 Issue is now opened just once

This commit is contained in:
IJustDev 2019-06-14 13:22:17 +02:00
parent d01f0dc17c
commit 643f98225f
3 changed files with 22 additions and 4 deletions

View File

@ -41,6 +41,12 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### Added:
- Label dependent icons now allow the user to use the colors from the Gitea server
## [0.0.7] - 2019-06-14
### Added:
- Every issue can now be opened just once at a time
### Refactored:
- Removed "filename" from `issue.ts` `labelDependentIcon()`
## [Unreleased]

View File

@ -10,7 +10,7 @@ export function activate(context: vscode.ExtensionContext) {
initializeIssueTracker();
});
context.subscriptions.push(disposable);
let openIssues: Array<Issue> = [];
const openIssuesProvider = new OpenIssuesProvider();
const closedIssuesProvider = new ClosedIssuesProvider();
@ -24,10 +24,25 @@ export function activate(context: vscode.ExtensionContext) {
// });
vscode.commands.registerCommand('giteaIssues.openIssue', (issue: Issue) => {
for (let i = 0; i !== openIssues.length; i++) {
let openIssue = openIssues[i];
if (openIssue.issueId === issue.issueId) {
return;
}
}
const panel = vscode.window.createWebviewPanel('issue', issue.label,
vscode.ViewColumn.Active,
{});
panel.webview.html = showIssueHTML(issue);
openIssues.push(issue);
panel.onDidDispose(event => {
for (let i = 0; i !== openIssues.length; i++) {
let openIssue = openIssues[i];
if (openIssue.issueId === issue.issueId) {
openIssues.splice(openIssues.indexOf(issue), 1);
}
}
});
});
vscode.commands.registerCommand('giteaIssues.refreshIssues', () => {

View File

@ -34,12 +34,9 @@ export class Issue extends vscode.TreeItem {
}
labelDependentIcon(dark: boolean = false): string {
let filename = "";
if (this.labels.length === 0) {
filename = "issue";
return path.join(__filename, '..', '..', 'media', 'issue.svg');
} else {
filename = this.labels[0].name;
return path.join(vscode.workspace.rootPath as string, '.gitea', 'label_pictures', this.labels[0].name + ".svg");
}
}