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

Convert FileSetModel modal to a Dialog component #4041

Open
wants to merge 3 commits into
base: deploy/staging
Choose a base branch
from

Conversation

bmquinn
Copy link
Contributor

@bmquinn bmquinn commented Jun 27, 2024

Summary

The modal window is currently being vertically cut off after a certain height, obscuring the "close" button. This PR converts the FileSetModal to a Dialog component which does a better job of handling the z-index and scrolling issues.

add_fileset_dialog

Also fixes a bug with the S3ObjectPicker when selecting an S3 object from the list (the behavior in the screenshot is visible on Meadow staging now, this commit makes it go away 😄 )

SCR-20240627-ovji

Specific Changes in this PR

  • Updates FileSetModal.jsx
  • Fixes a small bug with the S3ObjectPicker component (see screenshot above)

Version bump required by the PR

See Semantic Versioning 2.0.0 for help discerning which is required.

  • Patch
  • Minor
  • Major

Steps to Test

  • Go to the preservation and make sure the Dialog component is working properly when you hit the "Add a File Set" button

Also please let developers know if there are any special instructions to test this in the development environment.

🚀 Deployment Notes

Note - if you check any of these boxes go to the (always open) main <- staging PR and add detailed notes and instructions to help out others who may end up deploying your changes to production

  • Backward compatible API changes
    • Database Schema changes
    • GraphQL API
    • Elasticsearch API
    • Ingest Sheet
    • CSV metadata export/update API
    • Shared Links export API
  • Backwards-incompatible API changes
    • Database Schema changes
    • GraphQL API
    • Elasticsearch API
    • Ingest Sheet
    • CSV metadata export/update API
    • Shared Links export API
  • Requires data migration
  • Requires database triggers disabled during deployment/migration
  • Requires reindex
  • Terraform changes
    • Adds/requires new or changed Terraform variables
  • Pipeline configuration changes (requires mix meadow.pipeline.setup run)
  • Requires new variable added to miscellany
  • Specific deployment synchronization instructions with other apps/API's
  • Other specific instructions/tasks

Tested/Verified

  • End users/stakeholders

@kdid
Copy link
Contributor

kdid commented Jun 27, 2024

@bmquinn - The close "X" is no longer getting cut off for me.

I did notice that if I actually click it to close after I've already typed in values in the form, they are not getting cleared.
Similarly for "cancel" if I've already clicked on a file, and then cancel and try again there's an error showing that wont let you upload saying "Accepted files Uploading NaN undefined".

Should those things be happening?

For the straight shot add/replace w/out any mistakes on the users part everything seems fine.

@kdid
Copy link
Contributor

kdid commented Jun 28, 2024

@bmquinn - the form field data clearing seems fixed now, but for some reason now there is an extra "Drag 'n' drop a file here, or click to select file" below the option 2, which wasn't there before (and you can't drag and drop there...)

Also, I'm still seeing the "Accepted files Uploading NaN undefined" error that you put a screenshot of in the description if I click on a file name in S3 and then end up canceling or closing. And then try again.

Screenshot 2024-06-28 at 6 20 27 AM Screenshot 2024-06-28 at 6 23 37 AM

Copy link
Member

@mathewjordan mathewjordan left a comment

Choose a reason for hiding this comment

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

This seems much better with the Radix Dialog! I forgot we had introduced that as a component in Meadow.

Take it or leave it but one thing I noted is that we could use the disabled attribute on the button so that the footer is visible at all times, subtly indicating to the user that they have not completed the form yet. My Meadow is being goofy right now and not updating changes in the browser so I couldn't completely verify, but this should be close:

Comment on lines 281 to 295
{s3UploadLocation && (
<>
<Button
isText
type="button"
onClick={handleCancel}
data-testid="cancel-button"
>
Cancel
</Button>
<Button isPrimary type="submit" data-testid="submit-button">
Ingest fileset
</Button>
</>
)}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{s3UploadLocation && (
<>
<Button
isText
type="button"
onClick={handleCancel}
data-testid="cancel-button"
>
Cancel
</Button>
<Button isPrimary type="submit" data-testid="submit-button">
Ingest fileset
</Button>
</>
)}
<Button
isText
type="button"
onClick={handleCancel}
data-testid="cancel-button"
>
Cancel
</Button>
<Button
disabled={!s3UploadLocation}
isPrimary
type="submit"
data-testid="submit-button"
>
Ingest fileset
</Button>

)}
</section>

<footer className="modal-card-foot is-justify-content-flex-end">
Copy link
Contributor

Choose a reason for hiding this comment

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

@bmquinn I'd suggest losing the Bulma modal- specific className (modal-card-foot) on the footer component. And any other modal- specific classes if they're hanging around the new Dialog implementation, as they may depend upon sibling elements to work properly. And for multiple eyes inspecting the code moving forward, it's just a clean break of that style dependency.

@bmquinn
Copy link
Contributor Author

bmquinn commented Jul 3, 2024

Hi @mathewjordan and @adamjarling, just pushed up a commit that addresses your comments. Made a screencast to show the new DialogFooter plus the s3object validation for the buttons.

s3picker.mov

Copy link
Contributor

@adamjarling adamjarling left a comment

Choose a reason for hiding this comment

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

@bmquinn Sorry for the nitpicky updates, but it's such good work, might as well tighten it up just a tiny bit more.

In addition to the suggestions below, I'd update this style to add a bit of breathing room to the DialogTitle via paddingBottom. Maybe something like:

const DialogTitle = styled(Dialog.Title, {
fontWeight: "700",
});

const DialogTitle = styled(Dialog.Title, {
  fontWeight: "700",
  paddingBottom: "1rem",
});

@@ -43,10 +43,20 @@ const DialogTitle = styled(Dialog.Title, {
fontWeight: "700",
});

const DialogFooter = styled(Dialog.Footer, {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const DialogFooter = styled(Dialog.Footer, {
const DialogFooter = styled("footer", {

Dialog.Footer is not an export from Radix UI's Dialog (https://www.radix-ui.com/primitives/docs/components/dialog#anatomy), so you might run into a compilation error at worst, warning at best.

display: "flex",
justifyContent: "flex-end",
padding: "1rem",
borderTop: "1px solid #e5e7eb",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
borderTop: "1px solid #e5e7eb",

justifyContent: "flex-end",
padding: "1rem",
borderTop: "1px solid #e5e7eb",
marginTop: "auto", // Pushes the footer to the bottom of the dialog
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
marginTop: "auto", // Pushes the footer to the bottom of the dialog
marginTop: "1rem",

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.

None yet

4 participants