From 4d098b955167e309686284706624e685a547312e Mon Sep 17 00:00:00 2001 From: Shridhar TL Date: Fri, 20 Oct 2023 15:23:51 +0530 Subject: [PATCH 1/2] #336 - Fix for timer controls not visible in Agile board --- src/content-scripts/jira-board.js | 56 ++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/src/content-scripts/jira-board.js b/src/content-scripts/jira-board.js index 39bbb067..18037fdf 100644 --- a/src/content-scripts/jira-board.js +++ b/src/content-scripts/jira-board.js @@ -5,19 +5,51 @@ import { waitAndGet } from "./utils"; export async function applyBoardLogic(currentPage, settings, firstTime, applyModifications) { if (currentPage === Pages.Board) { - $('.ghx-columns div.js-issue .ja-issue-el').remove(); - const triggerFunc = triggerWLTracking.bind({ settings, applyModifications }); - const selector = '.ghx-columns div.js-issue'; - const issues = firstTime ? (await waitAndGet(selector)) : $(selector); - issues.each((i, el) => { - el = $(el); - const issueKey = el.attr('data-issue-key'); - const issueId = el.attr('data-issue-id'); - - const controls = el.find(isCloud ? '.ghx-stat-fields .ghx-row:first-child' : '.ghx-card-footer'); - addTimerControls(currentPage, controls, issueKey, settings, issueId, triggerFunc); - }); + if (isCloud) { + await handleForCloudJira(triggerFunc, firstTime, currentPage, settings); + } else { + await handleForPrivateJiraInstance(triggerFunc, firstTime, currentPage, settings); + } } } + +async function handleForCloudJira(triggerFunc, firstTime, currentPage, settings) { + $('#ak-main-content div[data-test-id="platform-board-kit.ui.card.card"] span.ghx-field.ja-issue-el').remove(); + const selector = '#ak-main-content div[data-test-id="platform-board-kit.ui.card.card"]'; + + const issues = firstTime ? (await waitAndGet(selector)) : $(selector); + issues.each((i, el) => { + el = $(el); + let issueKey = el.attr('id'); + if (!issueKey?.startsWith('card-')) { + return; + } + issueKey = issueKey.substring(5); + + let issueId = el.attr('data-rbd-draggable-id'); + if (!issueId?.startsWith('ISSUE::')) { + return; + } + issueId = issueId.substring(7); + + const controls = el.find('> div > div > div > div:last-child:not(:first-child) > div:first-child:last-child > div:first-child'); + addTimerControls(currentPage, controls, issueKey, settings, issueId, triggerFunc); + }); +} + +async function handleForPrivateJiraInstance(triggerFunc, firstTime, currentPage, settings) { + $('.ghx-columns div.js-issue .ja-issue-el').remove(); + + const selector = '.ghx-columns div.js-issue'; + const issues = firstTime ? (await waitAndGet(selector)) : $(selector); + issues.each((i, el) => { + el = $(el); + const issueKey = el.attr('data-issue-key'); + const issueId = el.attr('data-issue-id'); + + const controls = el.find('.ghx-card-footer'); + addTimerControls(currentPage, controls, issueKey, settings, issueId, triggerFunc); + }); +} \ No newline at end of file From 8fa1122065d84ba179e27eb1b2936d1dc6a123b0 Mon Sep 17 00:00:00 2001 From: Shridhar TL Date: Mon, 13 Nov 2023 15:43:34 +0530 Subject: [PATCH 2/2] #329 - Added support to pick report from within Pivot report --- package.json | 28 ++++++++-------- src/components/ReportSelectList.js | 40 +++++++++++++++++++++++ src/views/reports/pivot-report/Style.scss | 3 ++ src/views/reports/pivot-report/index.js | 5 ++- 4 files changed, 61 insertions(+), 15 deletions(-) create mode 100644 src/components/ReportSelectList.js create mode 100644 src/views/reports/pivot-report/Style.scss diff --git a/package.json b/package.json index 06ba6350..a213c03e 100644 --- a/package.json +++ b/package.json @@ -51,9 +51,9 @@ } }, "dependencies": { - "@forge/api": "^2.19.2", - "@forge/bridge": "^2.6.1", - "@forge/resolver": "^1.5.18", + "@forge/api": "^2.20.0", + "@forge/bridge": "^3.0.0", + "@forge/resolver": "^1.5.21", "@fortawesome/fontawesome-free": "^6.4.2", "@fullcalendar/core": "^6.1.9", "@fullcalendar/daygrid": "^6.1.9", @@ -72,19 +72,19 @@ "electron-updater": "^6.1.1", "espree": "^9.6.1", "exceljs": "^4.4.0", - "firebase": "^10.5.0", + "firebase": "^10.6.0", "jquery": "^3.7.1", - "js-sql-parser": "^1.4.1", + "js-sql-parser": "^1.5.0", "jsd-report": "^0.1.11", "jspdf": "^2.5.1", - "jspdf-autotable": "^3.7.0", + "jspdf-autotable": "^3.7.1", "moment": "^2.29.4", "moment-timezone": "^0.5.43", "papaparse": "^5.4.1", "patternomaly": "^1.3.2", "primeflex": "^3.3.1", "primeicons": "^6.0.1", - "primereact": "^9.6.2", + "primereact": "^9.6.3", "queue": "^7.0.0", "rc-time-picker": "^3.7.3", "react": "^18.2.0", @@ -93,24 +93,24 @@ "react-dnd": "^14.0.4", "react-dnd-html5-backend": "^14.0.2", "react-dom": "^18.2.0", - "react-router-dom": "^6.17.0", + "react-router-dom": "^6.18.0", "react-scripts": "^5.0.1", "static-eval": "^2.1.0", - "zustand": "^4.4.3" + "zustand": "^4.4.6" }, "devDependencies": { "@craco/craco": "^7.1.0", - "concurrently": "^8.2.1", + "concurrently": "^8.2.2", "cross-env": "^7.0.3", - "electron": "^27.0.0", + "electron": "^27.0.4", "electron-builder": "^24.6.4", "electronmon": "^2.0.2", - "eslint": "^8.51.0", + "eslint": "^8.53.0", "eslint-plugin-react-hooks": "^4.6.0", "gh-pages": "^6.0.0", "react-app-alias": "^2.2.2", - "sass": "^1.69.4", - "wait-on": "^7.0.1", + "sass": "^1.69.5", + "wait-on": "^7.1.0", "webpack-bundle-analyzer": "^4.9.1" }, "scripts": { diff --git a/src/components/ReportSelectList.js b/src/components/ReportSelectList.js new file mode 100644 index 00000000..937a52d1 --- /dev/null +++ b/src/components/ReportSelectList.js @@ -0,0 +1,40 @@ +import React from 'react'; +import { SelectBox } from '../controls'; +import { inject } from 'src/services'; +import { useNavigate } from 'react-router-dom'; + +function ReportSelectList({ reportId, reportType, reportPath }) { + const [reportsList, setList] = React.useState(); + const navigate = useNavigate(); + + React.useEffect(() => { + getReportsList(reportType).then(setList); + }, [reportType]); + + const changeHandler = React.useCallback((reportId) => { + if (reportId) { + navigate(`${reportPath}/${reportId}`); + } + }, [navigate, reportPath]); + + if (!reportsList?.length) { + return null; + } + + return (); +} + +export default ReportSelectList; + +async function getReportsList(reportType) { + const { $report } = inject('ReportService'); + + const result = await $report.getReportsList(); + + const reportsList = result + .filter(q => q.reportType === reportType) + .map(q => ({ value: q.id, label: q.queryName })); + + return reportsList; +} \ No newline at end of file diff --git a/src/views/reports/pivot-report/Style.scss b/src/views/reports/pivot-report/Style.scss new file mode 100644 index 00000000..fe70e3df --- /dev/null +++ b/src/views/reports/pivot-report/Style.scss @@ -0,0 +1,3 @@ +.p-dropdown.report-picker { + width: 250px !important; +} \ No newline at end of file diff --git a/src/views/reports/pivot-report/index.js b/src/views/reports/pivot-report/index.js index ab9463a8..f43d2a0b 100644 --- a/src/views/reports/pivot-report/index.js +++ b/src/views/reports/pivot-report/index.js @@ -8,9 +8,11 @@ import { usePivotConfig, useReportData } from './store/pivot-config'; import { loadReport } from './utils/common'; import EditorControls from './editor/controls'; import EditorBody from './editor/body'; +import ReportSelectList from '../../../components/ReportSelectList'; +import './Style.scss'; function PivotReport() { - const { reportId } = useParams(); + const { reportId, userId } = useParams(); const [editMode, toggleEdit] = useToggler(!reportId); React.useEffect(() => { @@ -23,6 +25,7 @@ function PivotReport() { const hasParams = parameters && Object.keys(parameters).length > 0; const customActions = (<> + {hasParams &&