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

[MINT-3221] MTO Table Action Component #1552

Merged
merged 24 commits into from
Dec 10, 2024

Conversation

garyjzhao
Copy link
Contributor

@garyjzhao garyjzhao commented Dec 4, 2024

MINT-3221

Description

  • Created MTOTableActions component, along with its copy and test
  • Add MTOTableActions to MTOTable
  • Add Solution Library link to SolutionForm
  • Remove temporary buttons on Home page

How to test this change

  1. Navigate to a Model Plan with MTO
  2. Ensure that the Table Actions is visible and matches figma
  3. Play with buttons and ensure modals still work

tablet and smaller screen sizes are still WIP as of 12/4/2024: https://cmsgov.slack.com/archives/C01B9TEC65A/p1733340956122379

PR Author Checklist

  • I have provided a detailed description of the changes in this PR.
  • I have provided clear instructions on how to test the changes in this PR.
  • I have updated tests or written new tests as appropriate in this PR.
  • Updated the Postman Collection if necessary.

PR Reviewer Guidelines

  • It's best to pull the branch locally and test it, rather than just looking at the code online!
  • When approving a PR, provide a reason why you're approving it
    • e.g. "Approving because I tested it locally and all functionality works as expected"
    • e.g. "Approving because the change is simple and matches the Figma design"
  • Don't be afraid to leave comments or ask questions, especially if you don't understand why something was done! (This is often a great time to suggest code comments or documentation updates)
  • Check that all code is adequately covered by tests - if it isn't feel free to suggest the addition of tests.

Comment on lines 271 to 273
history.push(
`/models/${modelID}/collaboration-area/model-to-operations/solution-library`
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Solution Library url does not exist, but just inferring based on the milestone library url

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 that makes sense!

@ClayBenson94
Copy link
Collaborator

If #1553 gets merged first, we could probably implement calling that mutation in here, just FYI!

@garyjzhao garyjzhao force-pushed the MINT-3221/table-actions branch from c9653d5 to 09ce599 Compare December 5, 2024 16:58
Comment on lines 44 to 51
const handleCreate = () => {
create().then(response => {
if (!response?.errors) {
alert('Standard categories created successfully');
}
});
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in createStandardCategories from #1553

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@garyjzhao garyjzhao marked this pull request as ready for review December 5, 2024 19:43
@garyjzhao garyjzhao requested a review from a team as a code owner December 5, 2024 19:43
@garyjzhao garyjzhao requested review from patrickseguraoddball and removed request for a team December 5, 2024 19:43
@garyjzhao garyjzhao force-pushed the MINT-3221/table-actions branch from 92af6b7 to d3809ef Compare December 6, 2024 17:58
Copy link
Contributor

@patrickseguraoddball patrickseguraoddball left a comment

Choose a reason for hiding this comment

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

Nice Gary

Do we want to persist the selection in localStorage to hide/show table actions? @ClayBenson94

@@ -85,7 +77,10 @@ const MTOHome = () => {
]}
/>

{!isModalOpen && message && <Expire delay={45000}>{message}</Expire>}
{
// !isModalOpen &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Can remove this commented out code

Copy link
Contributor

@patrickseguraoddball patrickseguraoddball left a comment

Choose a reason for hiding this comment

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

dupe

@@ -492,6 +493,7 @@ const MTOTable = () => {

return (
<>
<MTOTableActions />
Copy link
Contributor

@patrickseguraoddball patrickseguraoddball Dec 6, 2024

Choose a reason for hiding this comment

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

I hesitate to put the component within <MTOTable />. It can be moved as a sibling inside of the home component. This allows some flexibility and decoupling of the components if they want to be used independently elsewhere

{currentView === 'milestones' && <><MTOTableActions /><MTOTable />< />}

Copy link
Contributor

@patrickseguraoddball patrickseguraoddball left a comment

Choose a reason for hiding this comment

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

Getting some mapping errors for dupe keys on subcategories.

Screenshot 2024-12-09 at 8 33 56 AM
Screenshot 2024-12-09 at 8 34 03 AM
Screenshot 2024-12-09 at 8 34 53 AM

Also I think we need to add refetch queries to each of the mutations to update the table after a custom is added

refetchQueries: [
      {
        query: GetModelToOperationsMatrixDocument,
        variables: {
          id: modelID
        }
      }
    ]

@patrickseguraoddball
Copy link
Contributor

patrickseguraoddball commented Dec 9, 2024

I cant seem to replicate the select issue, may have been wonkiness with my unclean db. Adding the refetch queries can be done at a later time if needed. Let me know if you want to track the refetchqueries change to address later and I can approve

@garyjzhao garyjzhao force-pushed the MINT-3221/table-actions branch from 09afa80 to 1b96257 Compare December 10, 2024 15:16
Comment on lines +37 to 40
const { data, loading, error, refetch } = useGetModelToOperationsMatrixQuery({
variables: {
id: modelID
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the useGetModelToOperationsMatrixQuery is also used in <MTOTable /> component. So, I thought to pass down the data needed, instead of calling the gql again.

Also, this allowed me to pass refetch down to the sibling component <MTOTableActions />

Comment on lines -61 to -70
const {
data: queryData,
loading,
error
} = useGetModelToOperationsMatrixQuery({
variables: {
id: modelID
}
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the gql call is pushed up to the parent component and queryData is passed down as a prop. see above comment

Copy link
Contributor

@patrickseguraoddball patrickseguraoddball left a comment

Choose a reason for hiding this comment

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

LG

@garyjzhao garyjzhao merged commit c33a12b into feature/MINT-3175_mto Dec 10, 2024
10 checks passed
@garyjzhao garyjzhao deleted the MINT-3221/table-actions branch December 10, 2024 21:27
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.

3 participants