Skip to content

Commit

Permalink
v 0.19.0
Browse files Browse the repository at this point in the history
Features

- added projectsToShow setting
  • Loading branch information
gioboa committed Dec 16, 2019
1 parent 9981635 commit 47a7952
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

open_collective: jira-plugin
19 changes: 19 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Mark stale issues and pull requests

on:
schedule:
- cron: "0 14 * * *"

jobs:
stale:

runs-on: ubuntu-latest

steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue has been automatically marked as stale because it has not had activity in the last 30 days. Remove stale label or comment or this will be closed in 5 days. Thank you for your contributions.'
days-before-stale: 30
days-before-close: 5
stale-issue-label: 'no-issue-activity'
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.19.0

### Features

- added projectsToShow setting

## 0.18.4

### Bug Fixes
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@

## Support

**jira-plugin** is an open source extension.<br>While being free and open source, if you find it useful, please consider supporting it by donating via PayPal.<br>**Thanks!**
**jira-plugin** is an open source extension.<br>While being free and open source, if you find it useful, please consider supporting it by donating.<br>**Thanks!**

<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=UANXPBHUX7DJW&item_name=Donation+for+jira-plugin.+Thanks+for+be+a+backer.&currency_code=EUR&source=url">
<img src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"/>
</a>
[[Become a backer](https://opencollective.com/jira-plugin#backers)]
<a href="https://opencollective.com/jira-plugin#backers" target="_blank"><img src="https://opencollective.com/jira-plugin/backers.svg?width=890"></a>

## Installation

Expand Down Expand Up @@ -93,8 +92,12 @@ The extension store credentials in VS Code settings.<br><br>
Refresh explorer every x minutes (n.b: setting to 0 disables auto-refresh)
- **Number Of Issues In List** <br>
Number of issues to show in list (n.b: If you define high numbers the research can be slow)
- **Project Key Mapping** <br>
Setting for map projects key for git integration (e.g. CUSTOMKEY=JIRAKEY)
- **Projects To Hide** <br>
Here you can define which projects you want to hide (e.g. PROJECT-KEY-1, PROJECT-KEY-2, PROJECT-KEY-3)
- **Projects To Show** <br>
Here you can define which projects you want to show (e.g. PROJECT-KEY-1, PROJECT-KEY-2, PROJECT-KEY-3)
- **Requests Timeout** <br>
Jira requests timeout (expressed in minutes)
- **StrictSSL param** <br>
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jira-plugin",
"displayName": "Jira Plugin",
"description": "Manage your on-premises/cloud Jira in vscode",
"version": "0.18.4",
"version": "0.19.0",
"publisher": "gioboa",
"icon": "images/icons/icon.png",
"galleryBanner": {
Expand Down Expand Up @@ -100,11 +100,24 @@
"description": "Number of issues to show in list (n.b: If you define high numbers the research can be slow)",
"default": 50
},
"jira-plugin.projectKeyMapping": {
"type": "array",
"items": {
"type": "string"
},
"description": "Setting for map projects key for git integration (e.g. CUSTOMKEY=JIRAKEY)",
"default": []
},
"jira-plugin.projectsToHide": {
"type": "string",
"description": "Here you can define which projects you want to hide (e.g. PROJECT-KEY-1, PROJECT-KEY-2, PROJECT-KEY-3)",
"default": ""
},
"jira-plugin.projectsToShow": {
"type": "string",
"description": "Here you can define which projects you want to show (e.g. PROJECT-KEY-1, PROJECT-KEY-2, PROJECT-KEY-3)",
"default": ""
},
"jira-plugin.requestsTimeout": {
"type": "integer",
"description": "Jira requests timeout (expressed in minutes)",
Expand Down
32 changes: 22 additions & 10 deletions src/services/git-integration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export default class GitIntegrationService {
}

public async getHeadBranchName(): Promise<string | void> {
const [repo] = await this.getGitRepositories();
const repos = await this.getGitRepositories();
const repo = !!repos ? repos[repos.length - 1] : undefined;
if (repo) {
vscode.commands.executeCommand('setContext', 'gitEnabled', '1');
} else {
Expand Down Expand Up @@ -142,28 +143,39 @@ export default class GitIntegrationService {
if (refs.length === 1) {
newBranch = refs[0].name;
} else {
const selected = await vscode.window.showQuickPick<CheckoutItem>(refs.map((ref: any) => new CheckoutItem(ref)), {
placeHolder: 'Select a branch'
});
const selected = await vscode.window.showQuickPick<CheckoutItem>(
refs.map((ref: any) => new CheckoutItem(ref)),
{
placeHolder: 'Select a branch'
}
);
newBranch = selected ? selected.label : undefined;
}
}
return newBranch;
}

private parseTicket(branchName: string): { project: string; issue: string } | null {
const matched = branchName.match(/([A-Z0-9]+)-(\d+)/);
// read settings and map custom names here
// project: matched[1].replace('MYPROJ', 'MYNEWPROJ'),
// issue: matched[0].replace('MYPROJ', 'MYNEWPROJ')
const matched = branchName.match(/([A-Za-z0-9]+)-(\d+)/);
return (
matched && {
project: matched[1],
issue: matched[0]
project: this.mapProjectKeyIfNeeed(matched[1]),
issue: this.mapProjectKeyIfNeeed(matched[0])
}
);
}

private mapProjectKeyIfNeeed(value: string): string {
const projectKeyToMap = configuration.get(CONFIG.PROJECT_KEY_MAPPING);
projectKeyToMap.forEach((k: string) => {
if (k.indexOf('=') > 0) {
const keys = k.split('=');
value = value.replace(keys[0], keys[1]);
}
});
return value;
}

private async setCurrentWorkingProjectAndIssue(ticket: { project: string; issue: string }, issue: IIssue): Promise<void> {
try {
store.changeStateProject(ticket.project, false);
Expand Down
2 changes: 1 addition & 1 deletion src/services/select-values.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class SelectValuesService {
try {
if (store.canExecuteJiraAPI()) {
if (store.state.projects.length === 0) {
store.state.projects = utilities.hideProjects(await store.state.jira.getProjects());
store.state.projects = utilities.hideProjects(utilities.projectsToShow(await store.state.jira.getProjects()));
utilities.createDocumentLinkProvider(store.state.projects);
}
const picks = store.state.projects.map(project => ({
Expand Down
2 changes: 1 addition & 1 deletion src/services/store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class StoreService {
this.addAdditionalStatuses();
this.state.statuses.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));

this.state.projects = utilities.hideProjects(await this.state.jira.getProjects());
this.state.projects = utilities.hideProjects(utilities.projectsToShow(await this.state.jira.getProjects()));
utilities.createDocumentLinkProvider(this.state.projects);

const project = configuration.get(CONFIG.WORKING_PROJECT);
Expand Down
9 changes: 9 additions & 0 deletions src/services/utilities.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,13 @@ export default class UtilitiesService {
}
return projects;
}

projectsToShow(projects: IProject[]): IProject[] {
let projectsToShow = configuration.get(CONFIG.PROJECTS_TO_SHOW);
if (!!projectsToShow) {
projectsToShow = projectsToShow.split(',').map((p: string) => p.trim());
projects = projects.filter((project: IProject) => projectsToShow.includes(project.key));
}
return projects;
}
}
2 changes: 2 additions & 0 deletions src/shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export const CONFIG = {
GROUP_TASK_AND_SUBTASKS: 'groupTaskAndSubtasks',
ISSUE_LIST_AUTO_REFRESH_INTERVAL: 'issueListAutoRefreshInterval',
NUMBER_ISSUES_IN_LIST: 'numberOfIssuesInList',
PROJECT_KEY_MAPPING: 'projectKeyMapping',
PROJECTS_TO_HIDE: 'projectsToHide',
PROJECTS_TO_SHOW: 'projectsToShow',
REQUESTS_TIMEOUT: 'requestsTimeout',
STRICT_SSL: 'strictSSL',
TRACKING_TIME_MODE: 'trackingTimeMode',
Expand Down

0 comments on commit 47a7952

Please sign in to comment.