diff --git a/CHANGELOG.md b/CHANGELOG.md index 87ba18f..3077db9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,25 @@ # Change Log +## [1.0.1] - 2019-06-24 + +## Added +- Multiple issue view support +- JIRA task polling frequency configuration + +## Changed +- Issue polling default frequency now 1800000 ms + +## Removed +- Total task count notification (Due to every refresh on views was showing notification many times) + +## Fixes +- Open Issue functionality +- More error controls added + + ## [1.0.0] - 2019-06-23 - Initial release +[1.0.1]: https://github.com/Semyonic/jira-aux/releases/tag/v1.0.1 [1.0.0]: https://github.com/Semyonic/jira-aux/releases/tag/v1.0.0 \ No newline at end of file diff --git a/package.json b/package.json index 2edbc72..8a6f3a3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "jiraux", "displayName": "JirAux", "description": "List and view your issues and create Git-flow like branches from them", - "version": "1.0.0", + "version": "1.0.1", "author": "Semih Onay", "publisher": "SemihOnay", "engines": { @@ -133,6 +133,14 @@ "default": "", "description": "JIRA password" }, + "jira.poll": { + "type": [ + "number", + "null" + ], + "default": 1800000, + "description": "Polling frequency in miliseconds" + }, "jira.jqlExpression": { "type": [ "string", diff --git a/src/JiraFactory.ts b/src/JiraFactory.ts index d532727..8c1804f 100755 --- a/src/JiraFactory.ts +++ b/src/JiraFactory.ts @@ -22,6 +22,7 @@ function instantiateJira(config: ExtensionConfig) { port: config.port, username: config.username, password: config.password, + poll: config.poll, apiVersion: '2', strictSSL: false, }; diff --git a/src/models/interfaces/JiraConfig.interface.ts b/src/models/interfaces/JiraConfig.interface.ts index dd9bb5c..599b6b0 100755 --- a/src/models/interfaces/JiraConfig.interface.ts +++ b/src/models/interfaces/JiraConfig.interface.ts @@ -4,6 +4,7 @@ export interface JiraConfig { port?: string; username: string; password: string; + poll?: number; apiVersion?: string; strictSSL?: boolean; jql?: string; diff --git a/src/providers/JiraProvider.ts b/src/providers/JiraProvider.ts index 2a832e0..c74e048 100755 --- a/src/providers/JiraProvider.ts +++ b/src/providers/JiraProvider.ts @@ -5,10 +5,12 @@ import jiraFactory from '../JiraFactory'; import { ExtensionConfig, IssueItem, IssueTypes, JiraResponse } from '../models/interfaces'; import { JiraIssue } from '../models/JiraIssue'; import { IssueDetailPanel } from '../views'; + let jiraClient: { loadError: any; searchWithQueryFromConfig?: any }; +let config: vscode.WorkspaceConfiguration; try { - const config = vscode.workspace.getConfiguration('jira'); + config = vscode.workspace.getConfiguration('jira'); jiraClient = jiraFactory.instantiateJira(config); } catch (error) { jiraClient = { @@ -118,9 +120,7 @@ export class JiraProvider implements vscode.TreeDataProvider { const data: JiraResponse = await jiraClient.searchWithQueryFromConfig(); const total = data.issues.length; - data.total > 0 - ? vscode.window.showInformationMessage(`You got ${total} tasks`) - : vscode.window.showInformationMessage(`No issues, enjoy your day !`); + // data.total > 0 ? '' : vscode.window.showInformationMessage(`No issues, enjoy your day !`); let children: JiraIssue[] = []; const promises = data.issues.map(async (issue: IssueItem) => { @@ -143,11 +143,11 @@ export class JiraProvider implements vscode.TreeDataProvider { } } - private async refresh(config?: ExtensionConfig): Promise { + private async refresh(configuration?: ExtensionConfig): Promise { if (!this.fetching) { - if (config) { + if (configuration) { try { - jiraClient = jiraFactory.instantiateJira(config); + jiraClient = jiraFactory.instantiateJira(configuration); } catch (error) { jiraClient = { loadError: error.message, @@ -160,21 +160,21 @@ export class JiraProvider implements vscode.TreeDataProvider { } private async poll(): Promise { - const thirtyMinutes = 30 * 60 * 1000; - if (!this.lastFetch || this.lastFetch + thirtyMinutes < Date.now()) { + if (!this.lastFetch || this.lastFetch + config.poll < Date.now()) { return this.refresh(); } } private openIssue(issue: JiraIssue): void { - const base = issue.item.self - .split('/rest') - .entries() - .next().value; - vscode.commands.executeCommand( - 'vscode.open', - vscode.Uri.parse(`${base}/browse/${issue.item.key}`), - ); + const base = issue.item.self.split('/rest')[0]; + try { + vscode.commands.executeCommand( + 'vscode.open', + vscode.Uri.parse(`${base}/browse/${issue.item.key}`), + ); + } catch (error) { + console.error(error); + } } private showDescription({ item }: JiraIssue): void { @@ -194,22 +194,31 @@ export class JiraProvider implements vscode.TreeDataProvider { const switchAndCreate: any = await childProc.exec( `cd ${vscode.workspace.rootPath} && git fetch && git checkout -b ${branchName}`, ); - switchAndCreate.stderr.on('data', async x => { - if (x.includes('already')) { - try { - await this.switchBranch(branchName); - return await vscode.window.showInformationMessage( - `Switched to branch ${branchName}`, - ); - } catch (err) { - vscode.window.showErrorMessage(err); + try { + switchAndCreate.stderr.on('data', async x => { + if (x.includes('already')) { + try { + await this.switchBranch(branchName); + return await vscode.window.showInformationMessage( + `Switched to branch ${branchName}`, + ); + } catch (error) { + console.error(error); + vscode.window.showErrorMessage(error); + } } - } - vscode.window.showInformationMessage(`${branchName} created and switched`); - }); + vscode.window.showInformationMessage(`${branchName} created and switched`); + }); + } catch (error) { + console.error(error); + } } private async switchBranch(branchName: string): Promise { - await childProc.exec(`cd ${vscode.workspace.rootPath} && git checkout ${branchName}`); + try { + await childProc.exec(`cd ${vscode.workspace.rootPath} && git checkout ${branchName}`); + } catch (error) { + console.error(error); + } } } diff --git a/src/views/IssueDetailPanel.ts b/src/views/IssueDetailPanel.ts index 57eebc6..0893eb2 100644 --- a/src/views/IssueDetailPanel.ts +++ b/src/views/IssueDetailPanel.ts @@ -15,12 +15,6 @@ export class IssueDetailPanel { ? vscode.window.activeTextEditor.viewColumn : undefined; - // If we already have a panel, show it. - if (IssueDetailPanel.currentPanel) { - IssueDetailPanel.currentPanel.panel.reveal(column); - return; - } - // Otherwise, create a new panel. const panel = vscode.window.createWebviewPanel( IssueDetailPanel.viewType, @@ -39,7 +33,7 @@ export class IssueDetailPanel { IssueDetailPanel.currentPanel = new IssueDetailPanel(panel, extensionPath); } - private constructor(panel: vscode.WebviewPanel, extensionPath: string) { + constructor(panel: vscode.WebviewPanel, extensionPath: string) { this.panel = panel; this.extensionPath = extensionPath; @@ -131,8 +125,6 @@ export class IssueDetailPanel { - -