From 1f521040ebddfff8ec565611ef9423431670b69a Mon Sep 17 00:00:00 2001 From: Jason Syrotuck Date: Tue, 5 Mar 2024 11:47:09 -0800 Subject: [PATCH 1/5] [MDS-5562] Credential Revocation Notification (#2982) * add party_guid to url, untested revoke endpoint need to setup a local environemnt * more endpoint consistency * marshal list response * successful manual test * fix swagger, document manual testing steps * instructions * remove check that is causing test failure. * wrong bool, should both be true * log resp --- services/core-api/app/api/services/traction_service.py | 2 +- .../resources/verifiable_credential_revocation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core-api/app/api/services/traction_service.py b/services/core-api/app/api/services/traction_service.py index 98d0597fdd..c89391c1ee 100644 --- a/services/core-api/app/api/services/traction_service.py +++ b/services/core-api/app/api/services/traction_service.py @@ -94,7 +94,7 @@ def revoke_credential(self,connection_id, rev_reg_id, cred_rev_id, comment): "rev_reg_id":rev_reg_id, "cred_rev_id":cred_rev_id, "notify": True, - "publish": False + "publish": True } revoke_resp = requests.post(revoke_credential_url, json=payload,headers=self.get_headers()) assert revoke_resp.status_code == 200, f"revoke_resp={revoke_resp.json()}" diff --git a/services/core-api/app/api/verifiable_credentials/resources/verifiable_credential_revocation.py b/services/core-api/app/api/verifiable_credentials/resources/verifiable_credential_revocation.py index 7c6790db40..1dc7f15fed 100644 --- a/services/core-api/app/api/verifiable_credentials/resources/verifiable_credential_revocation.py +++ b/services/core-api/app/api/verifiable_credentials/resources/verifiable_credential_revocation.py @@ -52,5 +52,5 @@ def post(self, party_guid: str): traction_svc = TractionService() revoke_resp = traction_svc.revoke_credential(party.active_digital_wallet_connection.connection_id,credential_exchange.rev_reg_id, credential_exchange.cred_rev_id, data["comment"]) - + current_app.logger.info(f"traction revocation response={revoke_resp}") return revoke_resp \ No newline at end of file From 0e59bf73bdbb0ed918b19620f389c948edcb5190 Mon Sep 17 00:00:00 2001 From: Isuru Gunawardana <118843449+isuru-aot@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:57:20 -0800 Subject: [PATCH 2/5] [MDS-5759] Fixing permit letter and permit tag - ESUP (#2985) updating the category map --- services/common/src/constants/strings.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/common/src/constants/strings.tsx b/services/common/src/constants/strings.tsx index 503c32752f..355dd28e48 100755 --- a/services/common/src/constants/strings.tsx +++ b/services/common/src/constants/strings.tsx @@ -353,8 +353,8 @@ export const PARTY_APPOINTMENT_STATUS = { }; export const ESUP_DOCUMENT_GENERATED_TYPES = { - LET: "Explosives Storage and Use Permit", - PER: "Permit Enclosed Letter", + PER: "Explosives Storage and Use Permit", + LET: "Permit Enclosed Letter", }; export const BC_TIMEZONE_NAMES = ["Canada/Pacific", "Canada/Mountain", "Canada/Yukon"]; From b04f80c6b910f974bbb2a02ab58a9bc828bba933 Mon Sep 17 00:00:00 2001 From: Tara Epp <102187683+taraepp@users.noreply.github.com> Date: Tue, 5 Mar 2024 13:59:38 -0600 Subject: [PATCH 3/5] [MDS-5760] ESUP table "Explosives" link opens "Detonators" modal (#2986) tell it to open the explosives modal instead of the detonators --- .../mine/ExplosivesPermit/MineExplosivesPermitTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core-web/src/components/mine/ExplosivesPermit/MineExplosivesPermitTable.tsx b/services/core-web/src/components/mine/ExplosivesPermit/MineExplosivesPermitTable.tsx index 648ff71435..5b39d501e4 100644 --- a/services/core-web/src/components/mine/ExplosivesPermit/MineExplosivesPermitTable.tsx +++ b/services/core-web/src/components/mine/ExplosivesPermit/MineExplosivesPermitTable.tsx @@ -480,7 +480,7 @@ const MineExplosivesPermitTable: FC (
handleOpenViewMagazineModal(event, record, "DET")} + onClick={(event) => handleOpenViewMagazineModal(event, record, "EXP")} > {text || "0"} kg
From 7b56b87927095d8cca1dc30ac57bbfbefe1af22b Mon Sep 17 00:00:00 2001 From: Tara Epp <102187683+taraepp@users.noreply.github.com> Date: Tue, 5 Mar 2024 14:19:01 -0600 Subject: [PATCH 4/5] [MDS-5819] Unhandled Requested Report (#2983) * load mine report when it has no submissions on report details form. Submit against it, show status on tables * update data mocks to match data * add in button to allow MS user to submit against requested report * on FE make Sonar happy, on BE make mine report status null coalesce to report requested (stole method from model mine.py @work_status.expression) * add BE test for GET && POST requested report * removing case where we were checking for equality then inequality of the same field --- ..._status_to_mine_report_submission_code.sql | 4 ++ .../components/reports/ReportDetailsForm.tsx | 30 ++++++----- .../reports/reportSubmissionSlice.ts | 2 +- services/common/src/constants/enums.ts | 1 + services/common/src/constants/strings.tsx | 1 + .../reports/mineReport.interface.ts | 2 +- .../api/mines/reports/models/mine_report.py | 13 +++-- .../mine_report_submission_resource.py | 51 ++++++++++++++++-- .../core-api/app/api/mines/response_models.py | 1 + .../test_mine_report_submissions_resource.py | 52 ++++++++++++++++--- .../reportsHomePage/ReportsHomePage.js | 6 +-- .../mine/Reports/MineReportInfo.tsx | 8 +-- .../mine/Reports/MineReportTable.js | 18 +++---- services/core-web/src/constants/theme.js | 10 ++-- .../core-web/src/tests/mocks/dataMocks.tsx | 3 ++ .../dashboard/mine/reports/ReportPage.tsx | 7 +++ .../dashboard/mine/reports/ReportsTable.tsx | 17 ++---- 17 files changed, 153 insertions(+), 73 deletions(-) create mode 100644 migrations/sql/V2024.03.01.3.24__add_requested_status_to_mine_report_submission_code.sql diff --git a/migrations/sql/V2024.03.01.3.24__add_requested_status_to_mine_report_submission_code.sql b/migrations/sql/V2024.03.01.3.24__add_requested_status_to_mine_report_submission_code.sql new file mode 100644 index 0000000000..e42887e0a9 --- /dev/null +++ b/migrations/sql/V2024.03.01.3.24__add_requested_status_to_mine_report_submission_code.sql @@ -0,0 +1,4 @@ +INSERT INTO mine_report_submission_status_code +(mine_report_submission_status_code, description, display_order, active_ind, create_user, update_user) +VALUES + ('NON', 'Report Requested', 1, TRUE, 'system-mds', 'system-mds'); \ No newline at end of file diff --git a/services/common/src/components/reports/ReportDetailsForm.tsx b/services/common/src/components/reports/ReportDetailsForm.tsx index 7ad6ac0554..61800beb29 100644 --- a/services/common/src/components/reports/ReportDetailsForm.tsx +++ b/services/common/src/components/reports/ReportDetailsForm.tsx @@ -40,6 +40,7 @@ import { REPORT_REGULATORY_AUTHORITY_ENUM, IMine, IEmliContact, + MINE_REPORT_SUBMISSION_CODES, } from "../.."; import RenderAutoSizeField from "../forms/RenderAutoSizeField"; import { BaseViewInput } from "../forms/BaseInput"; @@ -67,8 +68,8 @@ import { fetchEMLIContactsByRegion } from "@mds/common/redux/actionCreators/mine import { getEMLIContactsByRegion } from "@mds/common/redux/selectors/minespaceSelector"; import { useParams } from "react-router-dom"; -const RenderContacts: FC = ({ fields, isEditMode, mineSpaceEdit }) => { - const canEdit = isEditMode && !mineSpaceEdit; +const RenderContacts: FC = ({ fields, isEditMode, mineSpaceEdit, hasSubmissions }) => { + const canEdit = isEditMode && (!mineSpaceEdit || !hasSubmissions); return (
{fields.map((contact, index) => ( @@ -149,6 +150,7 @@ const ReportDetailsForm: FC = ({ const { mine_report_category = "", mine_report_definition_guid = "", + mine_report_submission_status_code, documents = [], report_type, permit_condition_category_code, @@ -184,6 +186,7 @@ const ReportDetailsForm: FC = ({ const isPRR = report_type === REPORT_TYPE_CODES.PRR; const isMS = system === SystemFlagEnum.ms; + const hasSubmissions = mine_report_submission_status_code !== MINE_REPORT_SUBMISSION_CODES.NON; // minespace users are only allowed to add documents const mineSpaceEdit = isMS && initialValues?.mine_report_guid && isEditMode; @@ -263,9 +266,7 @@ const ReportDetailsForm: FC = ({ useEffect(() => { if (system === SystemFlagEnum.core) { const selection = mineReportDefinition?.compliance_articles[0]?.cim_or_cpo; - dispatch( - change(FORM.VIEW_EDIT_REPORT, "report_for", selection ? selection : "Not specified") - ); + dispatch(change(FORM.VIEW_EDIT_REPORT, "report_for", selection ?? "Not specified")); } }, [mineReportDefinition, !formValues?.report_for]); @@ -505,7 +506,7 @@ const ReportDetailsForm: FC = ({ id="description_comment" name="description_comment" label="Report Description" - disabled={mineSpaceEdit} + disabled={mineSpaceEdit && hasSubmissions} placeholder={`Example: "Mine X's Annual Reclamation Report, as per section 10.4.4. Spatial files included."`} props={{ maximumCharacters: 500, rows: 3 }} component={RenderAutoSizeField} @@ -555,7 +556,7 @@ const ReportDetailsForm: FC = ({ name="submitter_name" label="Submitter Name" placeholder="Enter name" - disabled={mineSpaceEdit} + disabled={mineSpaceEdit && hasSubmissions} required={isMS} component={RenderField} validate={isMS ? [required] : []} @@ -568,7 +569,7 @@ const ReportDetailsForm: FC = ({ name="submitter_email" label="Submitter Email" placeholder="Enter email" - disabled={mineSpaceEdit} + disabled={mineSpaceEdit && hasSubmissions} component={RenderField} required={isMS} validate={isMS ? [required, email] : [email]} @@ -602,11 +603,11 @@ const ReportDetailsForm: FC = ({ - {isEditMode && !mineSpaceEdit && ( + {isEditMode && (!mineSpaceEdit || !hasSubmissions) && ( )} + {!isEditMode && + latestSubmission.mine_report_submission_status_code == + MINE_REPORT_SUBMISSION_CODES.NON && ( + + )} {!isEditMode && status && ( diff --git a/services/minespace-web/src/components/dashboard/mine/reports/ReportsTable.tsx b/services/minespace-web/src/components/dashboard/mine/reports/ReportsTable.tsx index e1ea42db7c..b546cf82f7 100644 --- a/services/minespace-web/src/components/dashboard/mine/reports/ReportsTable.tsx +++ b/services/minespace-web/src/components/dashboard/mine/reports/ReportsTable.tsx @@ -130,8 +130,8 @@ export const ReportsTable: FC = (props) => { columns = columns.filter((column) => !["", "Documents"].includes(column.title as string)); const statusColumn = { title: "Status", - dataIndex: "status", - sorter: (a, b) => a.status.localeCompare(b.status), + dataIndex: "mine_report_status_code", + sorter: (a, b) => a.mine_report_status_code.localeCompare(b.mine_report_status_code), render: (text: MINE_REPORT_SUBMISSION_CODES) => { return ; }, @@ -151,17 +151,6 @@ export const ReportsTable: FC = (props) => { }); } - const transformRowData = (reports: IMineReport[]): IMineReport[] => - reports.map((report) => { - const { mine_report_submissions } = report; - const latestSubmission = mine_report_submissions?.[mine_report_submissions?.length - 1]; - - return { - ...report, - status: latestSubmission?.mine_report_submission_status_code ?? "", - }; - }); - const pagination: TablePaginationConfig = { defaultPageSize: DEFAULT_PAGE_SIZE, total: props.mineReports.length, @@ -175,7 +164,7 @@ export const ReportsTable: FC = (props) => { columns={columns} rowKey={(record) => record.mine_report_guid} emptyText="This mine has no report data." - dataSource={transformRowData(props.mineReports)} + dataSource={props.mineReports} pagination={pagination} /> ); From 5d0ed4a5d1495a3c234fda079db5832be83ea3e0 Mon Sep 17 00:00:00 2001 From: Tara Epp <102187683+taraepp@users.noreply.github.com> Date: Tue, 5 Mar 2024 14:19:11 -0600 Subject: [PATCH 5/5] [Snyk] Upgrade dotenv from 16.0.1 to 16.4.2 (#2980) * fix: upgrade dotenv from 16.0.1 to 16.4.2 Snyk has created this PR to upgrade dotenv from 16.0.1 to 16.4.2. See this package in npm: https://www.npmjs.com/package/dotenv See this project in Snyk: https://app.snyk.io/org/taraepp/project/b83f2f25-4911-4cf1-aad5-6137721dc373?utm_source=github&utm_medium=referral&page=upgrade-pr * Update automation_jira-check.yaml Allow Snyk PRs to pass format check --------- Co-authored-by: snyk-bot --- .github/workflows/automation_jira-check.yaml | 2 +- services/core-web/runner/package-lock.json | 6 +++--- services/core-web/runner/package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/automation_jira-check.yaml b/.github/workflows/automation_jira-check.yaml index ddbb623538..53b9e940d1 100644 --- a/.github/workflows/automation_jira-check.yaml +++ b/.github/workflows/automation_jira-check.yaml @@ -17,7 +17,7 @@ jobs: - name: Check for PR Title for Jira link uses: gsactions/commit-message-checker@8c8c0d18ba9b1fcfed6e7385fd2bf357dfc8dccb with: - pattern: '(\W)+(MDS)+-[0-9]+(\W)|(\W)(CHORE|FIX)(\W)' + pattern: '(\W)+(MDS)+-[0-9]+(\W)|(\W)(CHORE|FIX|Snyk)(\W)' excludeTitle: "false" # optional: this excludes the title of a pull request excludeDescription: "true" # optional: this excludes the description body of a pull request checkAllCommitMessages: "false" # optional: this checks all commits associated with a pull request diff --git a/services/core-web/runner/package-lock.json b/services/core-web/runner/package-lock.json index f7b3918dc7..2594e8db7d 100644 --- a/services/core-web/runner/package-lock.json +++ b/services/core-web/runner/package-lock.json @@ -104,9 +104,9 @@ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" }, "dotenv": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", - "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==" + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.2.tgz", + "integrity": "sha512-rZSSFxke7d9nYQ5NeMIwp5PP+f8wXgKNljpOb7KtH6SKW1cEqcXAz9VSJYVLKe7Jhup/gUYOkaeSVyK8GJ+nBg==" }, "ee-first": { "version": "1.1.1", diff --git a/services/core-web/runner/package.json b/services/core-web/runner/package.json index 59060d8090..17fb735fe6 100644 --- a/services/core-web/runner/package.json +++ b/services/core-web/runner/package.json @@ -10,7 +10,7 @@ "author": "", "license": "ISC", "dependencies": { - "dotenv": "16.0.1", + "dotenv": "16.4.2", "express": "4.18.1", "express-cache-controller": "1.1.0", "express-static-gzip": "2.1.7",