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

Austenem/CAT-386 add confirmation window #3479

Merged
merged 7 commits into from
Jul 24, 2024

Conversation

austenem
Copy link
Collaborator

Summary

This update adds a confirmation modal to the 'Delete Workspace' button to avoid accidental deletions.

Design Documentation/Original Tickets

CAT-386 JIRA ticket (dev)

CAT-780 JIRA ticket (design)

Figma mockup

Testing

Functionalities of this feature that have been tested manually:

  • "Delete workspaces" button is disabled while no workspaces are selected
  • Dialog opens when 1+ workspaces are selected and "Delete workspaces" button is clicked
  • Dialog can be exited without deletion three ways:
    • Clicking anywhere outside of the modal
    • Clicking the top right "X" button
    • Clicking the "Cancel" button
  • When "Delete" button in modal is clicked, the selected workspace(s) are deleted and the modal closes
  • The text inside the modal appropriately adjusts syntax based on how many workspaces are selected (ie "workspace 1", "workspace 1 and workspace 2", and "workspace 1, workspace 2, and workspace 3")

Screenshots/Video

Screen.Recording.2024-07-24.at.11.00.05.AM.mov

Checklist

  • Code follows the project's coding standards
    • Lint checks pass locally
    • New CHANGELOG-your-feature-name-here.md is present in the root directory, describing the change(s) in full sentences.
  • Unit tests covering the new feature have been added
  • All existing tests pass
  • Any relevant documentation in JIRA/Confluence has been updated to reflect the new feature
  • Any new functionalities have appropriate analytics functionalities added

Copy link
Collaborator

@john-conroy john-conroy left a comment

Choose a reason for hiding this comment

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

Great work! Minor comments.

@@ -176,3 +176,11 @@ export function filterObjectByKeys<O extends object, K extends keyof O>(obj: O,
export function getOriginSamplesOrgan(entity: { origin_samples_unique_mapped_organs: string[] }) {
return entity.origin_samples_unique_mapped_organs.join(', ');
}

export function generateCommaList(list: string[]): string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is meant for re-use, it would be nice to add a spec or two.

Copy link
Collaborator Author

@austenem austenem Jul 24, 2024

Choose a reason for hiding this comment

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

I used JSDoc - if there's another preferred documentation format though, let me know!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was only asking for a test or two, but this is extra helpful!

Comment on lines 43 to 46
console.error(e);
});

selectedWorkspaceIds.clear();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to only clear the selected ids if the delete was successful? Should we also add a toastSuccess?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's a good point! Adding a success indicator is also a good idea.

Copy link
Collaborator

@NickAkhmetov NickAkhmetov left a comment

Choose a reason for hiding this comment

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

Great work! I did spot some minor revisions to imports (I don't think we've had a chance to go over this in the past), and noticed an opportunity to add a test case. Let me know if I can help or clarify!

context/app/static/js/helpers/functions.ts Show resolved Hide resolved
Comment on lines 3 to 13
import {
Box,
Button,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
Divider,
IconButton,
Stack,
} from '@mui/material';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unfortunately, since the site builds as a CommonJS module, it's best to import these separately, e.g.:

import Box from '@mui/material/Box';
import Button from '@mui/material/Button';
...etc...

Basically - importing directly from @mui/material indirectly pulls in the entire @mui/material package/everything in it since webpack with CommonJS modules can't treeshake unused code.

Further reading:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh gotcha! That's good to know.

Copy link
Collaborator

@john-conroy john-conroy left a comment

Choose a reason for hiding this comment

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

Thanks for the quick changes. One minor comment.

@@ -176,3 +176,11 @@ export function filterObjectByKeys<O extends object, K extends keyof O>(obj: O,
export function getOriginSamplesOrgan(entity: { origin_samples_unique_mapped_organs: string[] }) {
return entity.origin_samples_unique_mapped_organs.join(', ');
}

export function generateCommaList(list: string[]): string {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was only asking for a test or two, but this is extra helpful!

Copy link
Collaborator

@john-conroy john-conroy left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Collaborator

@NickAkhmetov NickAkhmetov left a comment

Choose a reason for hiding this comment

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

Great job on the fixes!

@austenem austenem merged commit 4d3b69a into main Jul 24, 2024
8 checks passed
@austenem austenem deleted the austenem/cat-386-add-confirmation-window branch July 24, 2024 20:02
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