Skip to content

Commit e78bb4f

Browse files
authored
Merge pull request #156 from Tinkoff/155-show-sla-line
#155 Показать SLA линию при входе на график Control-Chart
2 parents 8a1d006 + d1136d1 commit e78bb4f

File tree

7 files changed

+27
-7
lines changed

7 files changed

+27
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ auto-update.xml
33
dev-utils.crx
44
dist.crx
55
main.pem
6+
dist.pem
67
.DS_Store
78
node_modules
89
.vscode

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "jira-helper",
3-
"version": "2.13.2",
3+
"version": "2.13.3",
44
"description": "jira-helper: Elements for vizualizations, tetris-planing with sprints, button template, swimline-viz",
5-
"repository": "https://github.com/TinkoffCreditSystems/jira-helper.git",
5+
"repository": "https://github.com/Tinkoff/jira-helper.git",
66
"license": "ISC",
77
"contributors": [
88
{

src/charts/AddChartGrid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ class ResizableDraggableGrid {
244244

245245
export default class extends PageModification {
246246
shouldApply() {
247-
return this.getSearchParam('chart') === 'controlChart';
247+
return this.getSearchParam('chart') === 'controlChart' || this.getReportNameFromURL() === 'control-chart';
248248
}
249249

250250
getModificationId() {

src/charts/AddSlaLine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ const renderSlaInput = (initialValue, canEdit, addEventListener, { onChange, onS
269269

270270
export default class extends PageModification {
271271
shouldApply() {
272-
return this.getSearchParam('chart') === 'controlChart';
272+
return this.getSearchParam('chart') === 'controlChart' || this.getReportNameFromURL() === 'control-chart';
273273
}
274274

275275
getModificationId() {

src/routing.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,22 @@ export const getSearchParam = param => {
1515
return new URLSearchParams(window.location.search).get(param);
1616
};
1717

18+
/*
19+
sheme new 2022: https://companyname.atlassian.net/jira/software/c/projects/{KEY}/boards/41/reports/control-chart?days=0
20+
*/
21+
export const getReportNameFromURL = () => {
22+
// eslint-disable-next-line no-useless-escape
23+
const matchRapidView = window.location.pathname.match(/reports\/([^\/\?]*)/im);
24+
if (matchRapidView != null) {
25+
return matchRapidView[1];
26+
}
27+
return null;
28+
};
29+
1830
/*
1931
sheme old https://companyname.atlassian.net/secure/RapidBoard.jspa?projectKey=PN&rapidView=12
20-
sheme new https://companyname.atlassian.net/jira/software/c/projects/PN/boards/12
32+
sheme new https://companyname.atlassian.net/jira/software/c/projects/{KEY}/boards/12
33+
sheme new 2022: https://companyname.atlassian.net/jira/software/c/projects/{KEY}/boards/41/reports/control-chart?days=0
2134
*/
2235
export const getBoardIdFromURL = () => {
2336
if (window.location.href.indexOf('rapidView') > 0) {
@@ -76,6 +89,8 @@ export const getCurrentRoute = () => {
7689
if (/boards\/(\d+)/im.test(pathname)) {
7790
if (params.get('config')) return Routes.SETTINGS;
7891
if (params.get('view') === 'reporting') return Routes.REPORTS;
92+
// https://{server}/jira/software/c/projects/{key}/boards/{id}/reports/control-chart?days=0
93+
if (/reports/im.test(pathname)) return Routes.REPORTS;
7994

8095
return Routes.BOARD;
8196
}

src/shared/PageModification.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getBoardIdFromURL, getSearchParam } from '../routing';
1+
import { getBoardIdFromURL, getSearchParam, getReportNameFromURL } from '../routing';
22
import { waitForElement } from './utils';
33
import {
44
deleteBoardProperty,
@@ -185,6 +185,10 @@ export class PageModification {
185185
return getSearchParam(param);
186186
}
187187

188+
getReportNameFromURL() {
189+
return getReportNameFromURL();
190+
}
191+
188192
getBoardId() {
189193
return getBoardIdFromURL();
190194
}

0 commit comments

Comments
 (0)