-
Notifications
You must be signed in to change notification settings - Fork 132
feat: container delete confirmation modal #2145
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
feat: container delete confirmation modal #2145
Conversation
Thanks for the pull request, @navinkarkera! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
99684b7
to
aa37548
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2145 +/- ##
========================================
Coverage 94.13% 94.14%
========================================
Files 1164 1164
Lines 24539 24589 +50
Branches 5220 5381 +161
========================================
+ Hits 23101 23150 +49
+ Misses 1370 1362 -8
- Partials 68 77 +9 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 This is working great @navinkarkera . I left a few nits, including one UX suggestion that's open for discussion.
- I tested this on standalone containers of all types, containers with parents, and units used in courses with and without parents. Deleting and restoring all types worked as expected, and the expected messages were shown in the confirmation modal.
- I read through the code
- I checked for accessibility issues by using my keyboard to navigate
- Includes documentation
- User-facing strings are extracted for translation -- and templated beautifully :)
containerId={containerKey} | ||
displayName={displayName} | ||
/> | ||
{isConfirmingDelete && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This change looks redundant with this one -- Can we revert one or the other?
const { hits } = useContentFromSearchIndex([containerId]); | ||
const containerData = (hits as ContainerHit[])?.[0]; | ||
const { | ||
data: dataDownstreamLinks, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: While these container entity links are loading, I think we should indicate this somehow, e.g. with a spinner or by disabling the Delete button until they're loaded.
Open for discussion -- I don't know how much of an issue this might be on a real service, but I think it could prevent accidental deletion of linked containers.
}, | ||
deleteUnitCourseMessage: { | ||
id: 'course-authoring.library-authoring.unit.delete-course-usage-message', | ||
defaultMessage: 'This unit is used {courseCount, plural, one {{courseCountText} time} other {{courseCountText} times}} in courses, and will stop receiving updates there.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Any particular reason why this message has a courseCountText
variable and the others don't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, they all should have it.
return { | ||
title: intl.formatMessage(messages.deleteSectionWarningTitle), | ||
parentMessage: '', | ||
// Update below fields when sections are linked to courses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Do we actually need this comment (or the ones below)? It looks like this code will work without modification once sections are linked to courses, and it already does work for Units in courses.
@@ -1,13 +1,16 @@ | |||
import { useCallback, useContext } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think it make more sense for this ContainerDeleter
component to live under containers/
instead of components/
?
|
||
// TODO: support other container types besides 'unit' | ||
const deleteWarningTitle = intl.formatMessage(messages.deleteUnitWarningTitle); | ||
const deleteText = intl.formatMessage(messages.deleteUnitConfirm, { | ||
unitName: <b>{displayName}</b>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're now fetching the containerData
from the search index, we don't need to pass in the displayName
anymore; we can just use the containerData.displayName
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to fix a minor bug with invalidating single search index queries for this to work properly on name change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found these issues:
- When you delete a section or subsection, the message in the toast says "Unit deleted"
- For some reason I can't see the status when the unit is in a course, am I missing some configuration?
- Missing update after adding a unit to subsection: Steps:
- Create a Unit.
- Open the delete confirmation modal an close it
- Add the unit to a subsection.
- Open the delete confirmation. Bug: The message of the parent subsection doesn't appear
expect((await screen.findAllByText((_, element) => textMatch.test(element?.textContent || ''))).length).toBeGreaterThan(0); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can also reinstate this skipped test.
a33b25d
to
7c54c7b
Compare
7022a11
to
a2b3056
Compare
Did you checkout openedx/edx-platform#36911? We also probably need to reindex just to be sure. I have fixed all other issues that you have listed above. |
@navinkarkera Sorry, it was an old bad migration in my local. |
Description
Update container delete confirmation modal based on #1982 and #1981
Useful information to include:
Supporting information
Private-ref
: https://tasks.opencraft.com/browse/FAL-4167Testing instructions
Other information
Include anything else that will help reviewers and consumers understand the change.