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-5049] TSF view and edit by roles #2830

Merged
merged 18 commits into from
Dec 7, 2023

Conversation

asinn134
Copy link
Collaborator

@asinn134 asinn134 commented Nov 29, 2023

Objective

MDS-5049

  • Adjusted within Core and Minespace the edit of TSF and Dam info to be available if user has core_edit_tsf or mds_minespace_proponents roles
  • User with the right roles assigned to them can edit or view TSF and Dam info
  • Changed the TSF and Dam view and edit actions to be in a drop down menu instead of icons

@asinn134
Copy link
Collaborator Author

asinn134 commented Dec 1, 2023

I ended up not moving the tailing files into the common package for this ticket

matbusby-fw
matbusby-fw previously approved these changes Dec 1, 2023
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.

Looks great! Just added a couple suggestions on importing Icons for better performance. I'm guessing moving these components into the common package just became too much of a can of worms?

@matbusby-fw matbusby-fw self-requested a review December 4, 2023 23:46
matbusby-fw
matbusby-fw previously approved these changes Dec 4, 2023
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.

👍🏻

@asinn134
Copy link
Collaborator Author

asinn134 commented Dec 5, 2023

Looks great! Just added a couple suggestions on importing Icons for better performance. I'm guessing moving these components into the common package just became too much of a can of worms?

Thanks! yah the moving of the components kind of complicated things, so I ended up just focusing on the story ac for this one.

henryoforeh-dev
henryoforeh-dev previously approved these changes Dec 5, 2023
henryoforeh-dev
henryoforeh-dev previously approved these changes Dec 5, 2023
icon: <EyeOutlined className="icon-sm padding-sm--right" />,
clickFunction: (_event, record) => {
handleNavigateToEdit(event, record, (userAction === "edit" ? "editView" : "view"));
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does editView mean? Seems like it would be simpler to just make it "edit".

Copy link
Collaborator Author

@asinn134 asinn134 Dec 5, 2023

Choose a reason for hiding this comment

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

Ah editView was setup because we have a scenario where if a user can edit tsf and dams, they will be able to see the edit and view options in the action menu. If the user with edit access clicks on the dam view button, it will bring them to a dam page with all the user inputs disabled. When the user moves back out of the dam page and into the TailingsSummaryPage we still want them to have the ability to edit things. Having the editView helps let us know the user should still be able to edit. Let me know if it doesn't make sense we can talk about it further.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like we are already tracking their permissions on the page that consumes it, so I'm not sure that we need this other variable to also indicate that they should have permission to edit. That userAction still really looks to me like it wants to be a boolean- it is always compared to a string literal. A string constant would be better than a string literal, but a boolean I really think would be best. You're either in view mode or edit mode, and the page itself can track whether the user has permission to change that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The boolean change has now been applied.

const [canEditTSF, setCanEditTSF] = useState(false);
const { renderConfig, components, routes, isCore } = useContext(TailingsContext);
const { Loading } = components;
const action = userAction ? userAction : "edit";
Copy link
Collaborator

Choose a reason for hiding this comment

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

set defaults when destructuring props like userAction="edit" on line 86.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This has been adjusted now.

matbusby-fw
matbusby-fw previously approved these changes Dec 6, 2023
henryoforeh-dev
henryoforeh-dev previously approved these changes Dec 6, 2023
@asinn134 asinn134 dismissed stale reviews from henryoforeh-dev and matbusby-fw via f2e105a December 7, 2023 00:08
henryoforeh-dev
henryoforeh-dev previously approved these changes Dec 7, 2023
@asinn134 asinn134 merged commit c33a8ca into develop Dec 7, 2023
9 checks passed
@asinn134 asinn134 deleted the mds-5049-tsf-view-and-edit-roles branch December 7, 2023 23:01
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.

4 participants