Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDS-5656] Add Report Details - CRR #2851

Merged
merged 12 commits into from
Dec 20, 2023
Merged

Conversation

isuru-aot
Copy link
Contributor

@isuru-aot isuru-aot commented Dec 13, 2023

Objective

MDS-5656

Screenshot 2023-12-13 110548

  • The dependency files associated with the change are moved to the common location
  • Added the existing vide from the modal.
  • Added new fields according to the UI (some with dummy data)
  • The file submission should be covered in the final step which is to be covered in MDS-5660.

onAfterResponse: () => {},
};

class FileUpload extends React.Component {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I really like the idea of having the fileUpload component moved to the common package, but I don't think they behave in exactly the same way.

We don't need to remove this, but we'll need to consider rendering the differences seperately for each FE if we want to use this in Core.

@@ -0,0 +1,76 @@
import React from "react";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, this might get a bit sticky. Tara has spent a bunch of time moving all of the form components into the common package and converting them to .tsx. Going to have to coordinate merging these I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary props.

@@ -0,0 +1,137 @@
import { ENVIRONMENT } from "@mds/common";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file already exists at: services/common/src/redux/utils/actionlessNetworkCalls.js

We can just use that one 😁

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

@@ -0,0 +1,45 @@
// import AddReportModal from "@/components/modalContent/reports/AddReportModal";
import EditReportModal from "@mds/common/components/modalContent/reports/EditReportModal";
// import AddVarianceModal from "@/components/modalContent/variances/AddVarianceModal";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having a shared config for this, but I think we just delete everything not being used, and add them back in as needed. (Honestly would rather get rid of the config altogether, but I don't think that's happening right away)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as these became unnecessary after addressing all the comments.


interface AddReportDetailsProps {
mineGuid: string;
updateMineReportSubmissions: any;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anything coming from the mapDispatchToProps we can add a type like this:

updateMineReportSubmissions: ActionCreator<typeof updateMineReportSubmissions>;

This will give you all the correct typing when working with it throughout the file and make it easier to maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.


const AddReportDetails: FC<AddReportDetailsProps> = (props) => {
const { mineGuid, dropdownMineReportCategoryOptions } = props;
const [state, setState] = useState({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just an artifact of coming from a class based component at one point in time?

I think it's much cleaner to seperate all states into their own useStates as you've done lower down. Makes it more consistent and readable. And pretty. It also makes it pretty.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

@@ -0,0 +1,602 @@
import {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also exists in

services/common/src/redux/utils/helpers.ts 💃🏻 🕺🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


<Col span={24}>
<Form layout="vertical">
<ReportsTable
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I think this might not be the correct table. I think the designs are just asking for a table of the documents, not the other reports.

I see you brought over the editReport modal and a few other things that are related to this table, so it would probably mean that we can leave those back where they were.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed added a new component.

Copy link
Collaborator

@matbusby-fw matbusby-fw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of awesome work here! I made a few comments, but the big one I think will need to be dealt with is the table at the bottom of your new page should just be a document table instead of the reports table.

Once that is swapped out, I think you'll find that a fair amount of the stuff moved to common doesn't need to be there (I think the reports table itself is fairly Minespace specific)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noooooo we don't need more copies of this file.
Use the antd one for actions menu.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be wrong but it doesn't seem like you are using this image in your changes? Might be able to just remove this file.

@@ -0,0 +1,280 @@
/* eslint-disable */
import React from "react";
Copy link
Collaborator

@taraepp taraepp Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that I merged my PR, I think it's just the Callout and LinkButton that aren't already in common. This one's called RenderFileUpload now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is updated accordingly

@@ -0,0 +1,19 @@
import { PropTypes, shape, arrayOf, oneOfType } from "prop-types";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about bringing in customPropTypes to common when we're phasing it out. What can we do to remove it instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed.

@taraepp
Copy link
Collaborator

taraepp commented Dec 18, 2023

Generally looks good, but I do want to avoid pulling a bunch of stuff into common that's already slated for deletion, most notably customPropTypes which we use interfaces for now instead.
I guess, when I ran into that recently, when it was too much work to convert too many files to TS, I just commented out the customPropTypes and replaced it with "any", so that you're still able to see what the object should look like when it comes time to convert it.

@@ -0,0 +1,20 @@
// Redux Forms
export const ADD_REPORT = "ADD_REPORT";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I also remade forms.js as a forms enum. Still works pretty much the same way but it only has one entry so far and doesn't trigger duplicate named import warnings/errors.

Copy link
Collaborator

@matbusby-fw matbusby-fw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for all the hard work on this one. Sorry the scope got a little out of control!

@isuru-aot isuru-aot merged commit a5c4f4c into develop Dec 20, 2023
9 checks passed
@isuru-aot isuru-aot deleted the mds-5656-add-report-crr branch December 20, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants