Skip to content

Commit d710e04

Browse files
authored
Merge pull request #6 from kungfux/feature/copy_issue_number
Copy issue number to clipboard
2 parents c40d8d2 + 0e5ccf2 commit d710e04

24 files changed

+566
-64
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,5 @@ jobs:
5050
with:
5151
name: jira-issue-expert
5252
path: |
53-
dist/
54-
!dist/**/*.zip
53+
dist/**/*.zip
5554
if-no-files-found: error

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"editor.defaultFormatter": "esbenp.prettier-vscode",
33
"editor.formatOnSave": true,
4+
"files.eol": "\n",
45
"files.insertFinalNewline": true,
6+
"[typescript]": {
7+
"editor.defaultFormatter": "esbenp.prettier-vscode"
8+
},
59
"[json]": {
610
"editor.defaultFormatter": "esbenp.prettier-vscode"
711
}

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,30 @@
22

33
`IssueExpert for JIRA` is a browser extension that adds extra functionality to JIRA for operating with issues.
44

5+
> Note: Currently supported JIRA version is 9.4.0 only!
6+
57
# Features
68

7-
- TBD
9+
> Check out [demo](#demo) section to see it in action.
10+
11+
- Copy issue link, number, summary to clipboard
812

913
# Install
1014

1115
Add an extension to your favorite browser by visiting extensions store
1216

13-
TBD
17+
[![](docs/get_addon_firefox.png)](https://addons.mozilla.org/en-US/firefox/addon/issueexpert-for-jira/) [![](docs/get_addon_chrome.png)](https://chrome.google.com/webstore/detail/issueexpert-for-jira/fdpnlhakdaikopniehgchiagamknknom)
18+
19+
## Note for Firefox users
20+
21+
Make sure to allow the extension to access website:
22+
23+
- Navigate to JIRA instance site
24+
- Click the extensions icon
25+
- Click gear icon
26+
- Click `Always Allow on *.issueexpert.com`
27+
28+
![asd](docs/firefox_permissions.png)
1429

1530
# Build and test locally
1631

@@ -38,3 +53,8 @@ $ npm run watch:firefox
3853

3954
- Check out [LICENSE](LICENSE) for the license details
4055
- Icons by [Flatart](https://www.freepik.com/author/flatart)
56+
57+
# Demo
58+
59+
![Copy issue number](docs/copy-issue-number.png)
60+
 

docs/copy-issue-number.png

Lines changed: 3 additions & 0 deletions
Loading

docs/firefox_permissions.png

Lines changed: 3 additions & 0 deletions
Loading

docs/get_addon_chrome.png

Lines changed: 3 additions & 0 deletions
Loading

docs/get_addon_firefox.png

Lines changed: 3 additions & 0 deletions
Loading

package.json

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jira-issue-expert",
3-
"version": "1.0.0",
3+
"version": "0.1.4",
44
"description": "Add extra functionality to JIRA for operating with issues.",
55
"private": true,
66
"scripts": {
@@ -29,24 +29,25 @@
2929
},
3030
"homepage": "https://github.com/kungfux/jira-issue-expert#readme",
3131
"devDependencies": {
32-
"@eslint-recommended/eslint-config-typescript": "^17.0.3",
33-
"@types/webextension-polyfill": "^0.10.0",
34-
"@typescript-eslint/eslint-plugin": "^5.59.0",
32+
"@eslint-recommended/eslint-config-typescript": "^33.0.0",
33+
"@types/webextension-polyfill": "^0.10.4",
34+
"@typescript-eslint/eslint-plugin": "^6.7.5",
3535
"copy-webpack-plugin": "^11.0.0",
36-
"eslint": "^8.38.0",
37-
"eslint-config-prettier": "^8.8.0",
38-
"eslint-plugin-import": "^2.27.5",
39-
"eslint-plugin-n": "^15.7.0",
40-
"eslint-plugin-prettier": "^4.2.1",
36+
"eslint": "^8.51.0",
37+
"eslint-config-prettier": "^9.0.0",
38+
"eslint-plugin-import": "^2.28.1",
39+
"eslint-plugin-n": "^16.2.0",
40+
"eslint-plugin-prettier": "^5.0.1",
4141
"eslint-plugin-promise": "^6.1.1",
42-
"html-webpack-plugin": "^5.5.1",
42+
"html-webpack-plugin": "^5.5.3",
4343
"merge-jsons-webpack-plugin": "^2.0.1",
44-
"prettier": "^2.8.7",
45-
"ts-loader": "^9.4.2",
46-
"typescript": "^5.0.4",
47-
"webpack": "^5.79.0",
48-
"webpack-cli": "^5.0.1",
49-
"webpack-merge": "^5.8.0"
44+
"prettier": "^3.0.3",
45+
"ts-loader": "^9.5.0",
46+
"typescript": "^5.2.2",
47+
"webpack": "^5.89.0",
48+
"webpack-cli": "^5.1.4",
49+
"webpack-merge": "^5.9.0",
50+
"zip-webpack-plugin": "^4.0.1"
5051
},
5152
"dependencies": {
5253
"webextension-polyfill": "^0.10.0"

src/background/background-service.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { Tabs, WebNavigation } from 'webextension-polyfill';
22
import { tabs, webNavigation, scripting } from 'webextension-polyfill';
33
import { Settings } from '../settings';
4+
import { Log } from '../log';
5+
import * as Browser from 'webextension-polyfill';
46

57
export class BackgroundService {
68
private readonly settings = new Settings();
@@ -25,15 +27,19 @@ export class BackgroundService {
2527
tabInfo: Tabs.Tab
2628
): Promise<void> {
2729
if (changeInfo.url !== undefined && this.isJiraUrl(changeInfo.url)) {
30+
void Log.info('onTabUpdated gets called');
2831
await this.injectContentScript(tabId);
32+
this.sendNewUrlMessage(tabId, changeInfo.url);
2933
}
3034
}
3135

3236
private async onNavigationCompleted(
3337
details: WebNavigation.OnCompletedDetailsType
3438
): Promise<void> {
3539
if (details.url.length > 0 && this.isJiraUrl(details.url)) {
40+
void Log.info('onNavigationCompleted gets called');
3641
await this.injectContentScript(details.tabId);
42+
this.sendNewUrlMessage(details.tabId, details.url);
3743
}
3844
}
3945

@@ -63,7 +69,11 @@ export class BackgroundService {
6369
files: ['content.bundle.js'],
6470
});
6571
} catch (error) {
66-
console.error(`Failed to inject content script: ${String(error)}`);
72+
void Log.error(`Failed to inject content script: ${String(error)}`);
6773
}
6874
}
75+
76+
private sendNewUrlMessage(tabId: number, newUrl: string): void {
77+
void Browser.tabs.sendMessage(tabId, { newUrl });
78+
}
6979
}

src/background/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { runtime } from 'webextension-polyfill';
22
import { BackgroundService } from './background-service';
33

4-
new BackgroundService().init();
5-
6-
runtime.onInstalled.addListener(() => {
7-
void runtime.openOptionsPage();
4+
runtime.onInstalled.addListener((details) => {
5+
if (details.reason === 'install') {
6+
void runtime.openOptionsPage();
7+
}
88
});
9+
10+
new BackgroundService().init();

0 commit comments

Comments
 (0)