diff --git a/CHANGELOG.md b/CHANGELOG.md
index d7d00dc..492a57c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+## 0.16.1
+
+### Bug Fixes
+
+- managed error message when configuration is empty
+- credentials in json format
+
## 0.16.0
### Features
diff --git a/README.md b/README.md
index dc6d68e..dfc3ea3 100644
--- a/README.md
+++ b/README.md
@@ -89,7 +89,7 @@ The extension store credentials in VS Code settings.
Automatically watch for branch switching and select appropriate project and working issue
- **Group Task And Subtasks**
Group task and subtasks into explorer
-- **Issue List Auto Refresh Interval**
+- **Issue List Auto Refresh Interval**
Refresh explorer every x minutes (n.b: setting to 0 disables auto-refresh)
- **Number Of Issues In List**
Number of issues to show in list (n.b: If you define high numbers the research can be slow)
diff --git a/package-lock.json b/package-lock.json
index f8c8859..a980acd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "jira-plugin",
- "version": "0.16.0",
+ "version": "0.16.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 818c0e3..b6e1f3f 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"name": "jira-plugin",
"displayName": "Jira Plugin",
"description": "Jira integration for vscode",
- "version": "0.16.0",
+ "version": "0.16.1",
"publisher": "gioboa",
"icon": "images/icons/icon.png",
"galleryBanner": {
diff --git a/src/services/configuration.service.ts b/src/services/configuration.service.ts
index c6c9889..8b98ac0 100644
--- a/src/services/configuration.service.ts
+++ b/src/services/configuration.service.ts
@@ -30,7 +30,22 @@ export default class ConfigurationService {
public get credentials(): { username: string; password: string } {
const config = this.settings;
const credentials: string = (config && this.globalState.get(`${CONFIG_NAME}:${config.baseUrl}`)) || '';
+ let jsonCredentials = undefined;
+ try {
+ jsonCredentials = JSON.parse(credentials);
+ } catch (e) {
+ //
+ }
+ if (!!jsonCredentials) {
+ return jsonCredentials;
+ }
+ return this.OLD_credentials;
+ }
+ // DEPRECATED
+ public get OLD_credentials(): { username: string; password: string } {
+ const config = this.settings;
+ const credentials: string = (config && this.globalState.get(`${CONFIG_NAME}:${config.baseUrl}`)) || '';
const [username = '', password = ''] = credentials.split(CREDENTIALS_SEPARATOR);
return { username, password };
}
@@ -61,7 +76,8 @@ export default class ConfigurationService {
public async setPassword(password: string | undefined): Promise {
const config = this.settings;
return (
- config && this.globalState.update(`${CONFIG_NAME}:${config.baseUrl}`, `${config.username}${CREDENTIALS_SEPARATOR}${password || ''}`)
+ config &&
+ this.globalState.update(`${CONFIG_NAME}:${config.baseUrl}`, JSON.stringify({ username: config.username, password: password || '' }))
);
}
diff --git a/src/services/http.model.ts b/src/services/http.model.ts
index 3522b70..075f746 100644
--- a/src/services/http.model.ts
+++ b/src/services/http.model.ts
@@ -1,4 +1,5 @@
export interface IJira {
+ baseUrl: string;
getCloudSession(): Promise<{ name: string; value: string }>;
search(params: { jql: string; maxResults: number }): Promise;
getStatuses(): Promise;
diff --git a/src/services/http.service.ts b/src/services/http.service.ts
index f89c189..d18b056 100644
--- a/src/services/http.service.ts
+++ b/src/services/http.service.ts
@@ -1,5 +1,5 @@
import { configuration, logger } from '.';
-import { ASSIGNEES_MAX_RESULTS, CONFIG } from '../shared/constants';
+import { ASSIGNEES_MAX_RESULTS, CONFIG, ERROR_WRONG_CONFIGURATION } from '../shared/constants';
import { patchJiraInstance } from '../shared/jira-instance-patch';
import {
IAddComment,
@@ -34,9 +34,11 @@ export class Jira implements IJira {
constructor() {
if (!configuration.isValid()) {
+ if (!!configuration.get(CONFIG.BASE_URL) && !!configuration.credentials.username && !!configuration.credentials.password) {
+ logger.printErrorMessageInOutputAndShowAlert('Check Jira Plugin settings in VSCode.');
+ }
this.baseUrl = '';
- logger.printErrorMessageInOutputAndShowAlert('Error: Check Jira Plugin settings in VSCode.');
- return;
+ throw new Error(ERROR_WRONG_CONFIGURATION);
}
this.baseUrl = configuration.get(CONFIG.BASE_URL);
diff --git a/src/services/index.ts b/src/services/index.ts
index f6264f8..711a7a8 100644
--- a/src/services/index.ts
+++ b/src/services/index.ts
@@ -1,5 +1,6 @@
import IssuesExplorer from '../explorer/issues-explorer';
import ConfigurationService from './configuration.service';
+import CreateIssueService from './create-issue.service';
import GitIntegrationService from './git-integration.service';
import IssueHelperService from './issue-helper.service';
import LoggerService from './logger.service';
diff --git a/src/services/logger.service.ts b/src/services/logger.service.ts
index 08b7403..cca31ea 100644
--- a/src/services/logger.service.ts
+++ b/src/services/logger.service.ts
@@ -4,14 +4,14 @@ import { store } from '.';
export default class LoggerService {
public printErrorMessageInOutputAndShowAlert(err: any) {
if (store.state.channel) {
- vscode.window.showErrorMessage(`Error: Check logs in Jira Plugin terminal output.`);
- store.state.channel.append(`Error: ${err}\n`);
+ vscode.window.showErrorMessage(`Check logs in Jira Plugin terminal output.`);
+ store.state.channel.append(`${err.message || err}\n`);
}
}
public printErrorMessageInOutput(err: any) {
if (store.state.channel) {
- store.state.channel.append(`Error: ${err}\n`);
+ store.state.channel.append(`${err.message || err}\n`);
}
}
diff --git a/src/services/store.service.ts b/src/services/store.service.ts
index 6dd5a42..f55bf16 100644
--- a/src/services/store.service.ts
+++ b/src/services/store.service.ts
@@ -54,7 +54,7 @@ export default class StoreService {
statusBar.updateWorkingProjectItem('', true);
}, 1000);
this.changeStateIssues('', '', []);
- logger.printErrorMessageInOutputAndShowAlert(err);
+ logger.printErrorMessageInOutput(err);
}
}
diff --git a/src/shared/constants.ts b/src/shared/constants.ts
index 05517ba..5c47b9c 100644
--- a/src/shared/constants.ts
+++ b/src/shared/constants.ts
@@ -85,6 +85,7 @@ export const LOADING = { text: 'LOADING', file: 'cloud.png' };
export const UNASSIGNED = 'Unassigned';
export const NO_WORKING_ISSUE = { text: 'No working issue', key: 'NO_WORKING_ISSUE' };
export const BACK_PICK_LABEL = '$(arrow-left) Back';
+export const ERROR_WRONG_CONFIGURATION = 'Wrong configuration';
export const SEARCH_MAX_RESULTS = 1000;
export const ASSIGNEES_MAX_RESULTS = 1000;