Skip to content

Commit

Permalink
Merge branch 'develop' into mds-6285-esup-detonator-magazine-missing
Browse files Browse the repository at this point in the history
  • Loading branch information
asinn134 committed Dec 17, 2024
2 parents 7497fd4 + d81622d commit 77f7ff1
Show file tree
Hide file tree
Showing 65 changed files with 2,882 additions and 835 deletions.
5 changes: 3 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
"ms-azuretools.vscode-docker",
"shd101wyy.markdown-preview-enhanced",
"esbenp.prettier-vscode",
"sonarsource.sonarlint-vscode"
"sonarsource.sonarlint-vscode",
"ms-python.vscode-pylance"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}
}
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Mines Digital Services

The technologies that support mine oversight for British Columbians need to be reimagined. This project will replace the legacy Mine Management System (MMS) with a scalable, open source, data driven system using modern and flexible technologies.
Mines Digital Services (MDS) upholds the BC Public Service’s commitment to modernization, transparency, and efficiency, enabling better governance and service delivery when it comes to mining in British Columbia.

The Mines Digital Services (MDS) will have a number of interconnections and relationships to systems across the Natural Resource Ministries and will be important not only to the Ministry of Energy, Mines and Low Carbon Innovation but also to inter-agency collaborations across ministries. The future state must be intuitive, and capable of providing meaningful data to relevant stakeholders.
This project replaced the legacy Mine Management System (MMS) with a scalable, open source, data driven system using modern and flexible technologies.

The MDS have a number of interconnections and relationships to systems across the Natural Resource Ministries and is important not only to the Ministry of Mining and Critical Minerals but also to inter-agency collaborations across ministries, industry stakeholders and the public.

[![Lifecycle:Maturing](https://img.shields.io/badge/Lifecycle-Maturing-007EC6)](Redirect-URL)
[![CORE WEB - Unit Tests](https://github.com/bcgov/mds/actions/workflows/core-web.unit.yaml/badge.svg)](https://github.com/bcgov/mds/actions/workflows/core-web.unit.yaml)
Expand All @@ -14,12 +16,14 @@ The Mines Digital Services (MDS) will have a number of interconnections and rela

## Features

The product is anticipated to include:
Key products that are maintained by MDS include Core, MineSpace and the public-facing [BC Mine Information website](https://mines.nrs.gov.bc.ca) [(github repository)](https://github.com/bcgov/NR-BCMI)

Mines Digital Services build features with these principles in mind:

1. Support for integrated analysis and decision making across the process of mine oversight
2. Support for the creation of a complex data model that can connect various components of mines. Some examples include consultation information, risk management modeling, spatial data, financial tracking and collecting and physical attributes
3. Enhancements to the public-facing [BC Mine Information website](http://mines.nrs.gov.bc.ca/) ([github repository](https://github.com/bcgov/mem-mmti-public)) to broaden the available data and create new or improved functionality to increase usability
4. Enhancements to the [BC Mine Information website's administrative console](https://mines.empr.gov.bc.ca/) ([github repository](https://github.com/bcgov/mem-admin)) , including work required to connect with other systems (e.g., the Natural Resource Inspection System, aka NRIS)
1. MDS develops tools and platforms that prioritize ease of use for mining companies, regulators, and the public.
2. MDS supports access to high-quality geoscientific data and regulatory information, empowering government bodies and mining companies to make informed decisions.
3. MDS collaborates across government agencies and industries to create cohesive solutions that integrate regulatory processes, permitting, and compliance systems.
4. Digital tools from MDS help monitor and ensure mining activities adhere to environmental and social governance standards.

## Services

Expand Down
12 changes: 7 additions & 5 deletions services/common/src/components/common/ActionMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { FC, ReactNode } from "react";
import { Button, Dropdown, Modal } from "antd";
import { Button, ButtonProps, Dropdown, Modal } from "antd";
import CaretDownOutlined from "@ant-design/icons/CaretDownOutlined";
import DownOutlined from "@ant-design/icons/DownOutlined";
import { ITableAction } from "@mds/common/components/common/CoreTableCommonColumns";
Expand All @@ -25,7 +25,7 @@ export const generateActionMenuItems = (actionItems: ITableAction[], record) =>
<button
type="button"
disabled={action.disabled}
className={`full actions-dropdown-button`}
className={`full actions-dropdown-button menu-item-button`}
data-testid={`action-button-${action.key}`}
onClick={(event) => action.clickFunction(event, record)}
>
Expand All @@ -43,15 +43,17 @@ export interface IHeaderAction {
clickFunction: () => void | Promise<void>;
}
// Looks like a button, intended for page-scope, not record-scope in the actions
export const ActionMenuButton: FC<{ buttonText?: string; actions: IHeaderAction[] }> = ({
export const ActionMenuButton: FC<{ buttonText?: string; actions: IHeaderAction[], disabled?: boolean, buttonProps?: ButtonProps }> = ({
actions,
buttonText = "Action",
buttonProps,
disabled = false
}) => {
const items = generateActionMenuItems((actions as unknown) as ITableAction[], null);

return (
<Dropdown menu={{ items }} placement="bottomLeft">
<Button type="ghost" className="actions-dropdown-button">
<Dropdown menu={{ items }} placement="bottomLeft" disabled={disabled}>
<Button type="ghost" className="actions-dropdown-button" {...buttonProps}>
{buttonText}
<DownOutlined />
</Button>
Expand Down
85 changes: 28 additions & 57 deletions services/common/src/components/documents/DocumentTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import ArchiveDocumentModal from "./ArchiveDocumentModal";
import DeleteDocumentModal from "./DeleteDocumentModal";
import ReplaceDocumentModal from "./ReplaceDocumentModal";
import { downloadFileFromDocumentManager } from "@mds/common/redux/utils/actionlessNetworkCalls";
import { ActionMenuButton } from "../common/ActionMenu";

export const DocumentTable: FC<DocumentTableProps> = ({
isViewOnly = false,
Expand Down Expand Up @@ -82,18 +83,13 @@ export const DocumentTable: FC<DocumentTableProps> = ({
const isMinimalView: boolean = view === "minimal";

const parseDocuments = (docs: any[]): MineDocument[] => {
let parsedDocs: MineDocument[];
if (docs.length && docs[0] instanceof MineDocument) {
parsedDocs = docs;
return docs;
} else {
parsedDocs = docs.map((doc) => new MineDocument(doc));
return docs.map((doc) => new MineDocument(doc));
}
return parsedDocs.map((doc) => {
doc.setAllowedActions(userRoles);
return doc;
});
};

const [documents, setDocuments] = useState<MineDocument[]>(parseDocuments(props.documents ?? []));

useEffect(() => {
Expand All @@ -108,9 +104,8 @@ export const DocumentTable: FC<DocumentTableProps> = ({
setDocuments(parseDocuments(props.documents ?? []));
}, [props.documents]);

const openArchiveModal = (event, docs: MineDocument[]) => {
const openArchiveModal = (docs: MineDocument[]) => {
const mineGuid = docs[0].mine_guid;
event.preventDefault();
dispatch(
openModal({
props: {
Expand Down Expand Up @@ -197,7 +192,7 @@ export const DocumentTable: FC<DocumentTableProps> = ({
key: "archive",
label: FileOperations.Archive,
icon: <InboxOutlined />,
clickFunction: (event, record: MineDocument) => openArchiveModal(event, [record]),
clickFunction: (_event, record: MineDocument) => openArchiveModal([record]),
},
{
key: "delete",
Expand Down Expand Up @@ -275,43 +270,25 @@ export const DocumentTable: FC<DocumentTableProps> = ({
? { size: "small" as SizeType, rowClassName: "ant-table-row-minimal" }
: null;

const bulkItems: MenuProps["items"] = [
const bulkItems = [
{
key: FileOperations.Download,
icon: <DownloadOutlined />,
label: (
<button
type="button"
className="full add-permit-dropdown-button"
onClick={() => {
setIsCompressionModal(true);
}}
>
<div>Download File(s)</div>
</button>
),
label: "Download File(s)",
clickFunction: () => setIsCompressionModal(true)
},
{
key: FileOperations.Archive,
icon: <InboxOutlined />,
label: (
<button
type="button"
className="full add-permit-dropdown-button"
onClick={(e) => {
openArchiveModal(e, rowSelection);
}}
>
<div>Archive File(s)</div>
</button>
),
},
label: "Archive File(s)",
clickFunction: () => openArchiveModal(rowSelection)
}
].filter((a) => allowedTableActions[a.key]);

const renderBulkActions = () => {
let element = (
<Button
className="ant-btn ant-btn-primary"
type="primary"
disabled={rowSelection.length === 0 || isCompressionInProgress}
onClick={() => {
setIsCompressionModal(true);
Expand All @@ -322,16 +299,10 @@ export const DocumentTable: FC<DocumentTableProps> = ({
);
if (documentsCanBulkDropDown) {
element = (
<Dropdown
menu={{ items: bulkItems }}
placement="bottomLeft"
<ActionMenuButton actions={bulkItems}
disabled={rowSelection.length === 0 || isCompressionInProgress}
>
<Button className="ant-btn ant-btn-primary">
Action
<DownOutlined />
</Button>
</Dropdown>
buttonProps={{ type: "primary", }}
/>
);
}

Expand All @@ -350,22 +321,22 @@ export const DocumentTable: FC<DocumentTableProps> = ({

const bulkActionsProps = enableBulkActions
? {
rowSelection: {
type: "checkbox",
...rowSelectionObject,
},
}
rowSelection: {
type: "checkbox",
...rowSelectionObject,
},
}
: {};

const versionProps = showVersionHistory
? {
expandProps: {
childrenColumnName: "versions",
matchChildColumnsToParent: true,
recordDescription: "version history",
rowExpandable: (record) => record.number_prev_versions > 0,
},
}
expandProps: {
childrenColumnName: "versions",
matchChildColumnsToParent: true,
recordDescription: "version history",
rowExpandable: (record) => record.number_prev_versions > 0,
},
}
: {};

const coreTableProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ exports[`ArchiveDocumentModal renders correctly and matches the snapshot 1`] = `
class="ant-modal-footer"
>
<button
aria-label="Cancel"
class="ant-btn ant-btn-default core-btn core-btn-default"
type="button"
>
Expand All @@ -155,6 +156,7 @@ exports[`ArchiveDocumentModal renders correctly and matches the snapshot 1`] = `
</span>
</button>
<button
aria-label="Submit"
class="ant-btn ant-btn-primary"
type="submit"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ exports[`DeleteDocumentModal renders correctly and matches the snapshot 1`] = `
class="ant-modal-footer"
>
<button
aria-label="Cancel"
class="ant-btn ant-btn-default core-btn core-btn-default"
type="button"
>
Expand All @@ -155,6 +156,7 @@ exports[`DeleteDocumentModal renders correctly and matches the snapshot 1`] = `
</span>
</button>
<button
aria-label="Submit"
class="ant-btn ant-btn-primary"
type="submit"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ exports[`ReplaceDocumentModal renders correctly and matches the snapshot 1`] = `
class="ant-modal-footer"
>
<button
aria-label="Cancel"
class="ant-btn ant-btn-default core-btn core-btn-default"
type="button"
>
Expand All @@ -158,6 +159,7 @@ exports[`ReplaceDocumentModal renders correctly and matches the snapshot 1`] = `
</span>
</button>
<button
aria-label="Submit"
class="ant-btn ant-btn-primary"
disabled=""
type="submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ exports[`AddSpatialDocumentsModal renders properly 1`] = `
class="ant-row ant-row-end"
>
<button
aria-label="Cancel"
class="ant-btn ant-btn-default core-btn core-btn-default"
type="button"
>
Expand All @@ -240,6 +241,7 @@ exports[`AddSpatialDocumentsModal renders properly 1`] = `
</span>
</button>
<button
aria-label="Submit"
class="ant-btn ant-btn-primary"
disabled=""
type="submit"
Expand Down
10 changes: 7 additions & 3 deletions services/common/src/components/forms/BaseInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,24 @@ export interface BaseInputProps extends WrappedFieldProps {
allowClear?: boolean;
help?: string;
showOptional?: boolean;
showNA?: boolean;
autoFocus?: boolean;
}

interface BaseViewInputProps {
label?: string | ReactNode;
value: string | number;
showNA?: boolean;
}
export const BaseViewInput: FC<BaseViewInputProps> = ({ label = "", value = "" }) => {
const displayValue = value ? value.toString() : EMPTY_FIELD;
export const BaseViewInput: FC<BaseViewInputProps> = ({ label = "", value = "", showNA = true }) => {
const hasValue = value !== "";
const displayValue = hasValue ? value.toString() : EMPTY_FIELD;
return (
<div className="view-item ant-form-item">
{label && label !== "" && (
<Typography.Paragraph className="view-item-label">{label}</Typography.Paragraph>
)}
<Typography.Paragraph className="view-item-value">{displayValue}</Typography.Paragraph>
{(hasValue || showNA) && (<Typography.Paragraph className="view-item-value">{displayValue}</Typography.Paragraph>)}
</div>
);
};
Expand Down
10 changes: 6 additions & 4 deletions services/common/src/components/forms/RenderAutoSizeField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const RenderAutoSizeField: FC<AutoSizeProps> = ({
if (!value.isEditMode) {
return <BaseViewInput value={props.input.value} label={label} />;
}
const showHelp = help || maximumCharacters !== undefined;
return (
<Form.Item
name={props.input.name}
Expand All @@ -51,8 +52,9 @@ const RenderAutoSizeField: FC<AutoSizeProps> = ({
{...props.input}
autoSize={{ minRows: minRows }}
placeholder={props.placeholder}
autoFocus={props.autoFocus}
/>
<Row
{showHelp && <Row
justify="space-between"
className={`form-item-help ${props.input.name}-form-help`}
>
Expand All @@ -61,9 +63,9 @@ const RenderAutoSizeField: FC<AutoSizeProps> = ({
) : (
<span>{`Maximum ${maximumCharacters} characters`}</span>
)}
<span className="flex-end">{`${maximumCharacters -
props.input.value.length} / ${maximumCharacters}`}</span>
</Row>
{<span className="flex-end">{`${maximumCharacters -
props.input.value.length} / ${maximumCharacters}`}</span>}
</Row>}
</>
</Form.Item>
);
Expand Down
Loading

0 comments on commit 77f7ff1

Please sign in to comment.