-
Notifications
You must be signed in to change notification settings - Fork 81
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: allow dragging blocks across parents in outline #859
feat: allow dragging blocks across parents in outline #859
Conversation
Thanks for the pull request, @navinkarkera! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
704792b
to
da9fd27
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #859 +/- ##
==========================================
- Coverage 91.88% 91.87% -0.02%
==========================================
Files 562 574 +12
Lines 9776 10078 +302
Branches 2085 2157 +72
==========================================
+ Hits 8983 9259 +276
- Misses 766 791 +25
- Partials 27 28 +1 ☔ View full report in Codecov by Sentry. |
da9fd27
to
4c724b6
Compare
@openedx/2u-tnl |
Is there a feature flag to set to get the new experience without going to port 2001 manually? |
Sandbox deployment successful 🚀 |
@arbrandes No, we don't have a flag yet. You can set @KristinAoki Maybe we can add a flag similar to |
@navinkarkera, ok, and yes, I think an MFE-specific environment variable would be nice to have. In the meantime, what would be the correct link from the sandbox course page? (Or from a tutor deployment, for that matter.) |
To get to the outline page you can enable |
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.
Wow, this one's a doozy! Congrats! And it works quite nicely in the sandbox, too.
I do have a couple of nits, however.
return null; | ||
}; | ||
|
||
/* istanbul ignore next */ |
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.
Was this very hard to test? I don't mean to block the PR because of it, but I feel like we should at least explain why we're not testing it in a comment.
The same goes for other instances in this PR.
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.
@arbrandes Ahh, I meant to write a comment about it, but then forgot. I have ignored two functions from coverage, i.e., unitDragOver and subsectionDragOver. For some weird reason, dragEnd handler is not being triggered by dnd-kit while testing them.
I had already spent quite some time testing the functions related to moving/dragging blocks which doesn't work with jsdom easily as it does not implement getClientBoundingRect
and renders all elements on top of each other at (0, 0) position. So I had to mock collisionDetection
function which helped me test movement of blocks inside its own parent as well as across parents.
The main functions responsible to move units & subsections across parents are tested, just these functions which determine the new index and parent are ignored.
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.
Thanks, it makes sense.
I still can't find the explanation in the code, though. Did you add it? If not, I would suggest adding it at the first occurrence of the istanbul ignore next
of each file where this occurs. (I expect it's just this file.)
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.
@arbrandes Done.
4c724b6
to
d201cb4
Compare
Sandbox deployment successful 🚀 |
@arbrandes @KristinAoki Thanks! Addressed your feedback, can you please take a look once again. |
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.
Just looking for a code comment on why we're not testing some bits.
return null; | ||
}; | ||
|
||
/* istanbul ignore next */ |
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.
Thanks, it makes sense.
I still can't find the explanation in the code, though. Did you add it? If not, I would suggest adding it at the first occurrence of the istanbul ignore next
of each file where this occurs. (I expect it's just this file.)
@@ -57,6 +57,34 @@ const messages = defineMessages({ | |||
id: 'course-authoring.course-outline.page-alert.generic-error.description', | |||
defaultMessage: 'Unable to {actionName} {type}. Please try again.', | |||
}, | |||
newFileAlertTitle: { | |||
id: 'course-authoring.course-outline.page-alert.paste-alert.new-files.title', | |||
defaultMessage: 'New {newFilesLen, plural, one {file} other {files}} added to Files.', |
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.
Pretty soon we'll start linting for messages that don't have descriptions. It's an important part of i18n, as it makes the lives of translators much easier. I'm not going to block PRs on this until openedx/frontend-build#516 merges, but consider this friendly heads-up. :)
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.
@arbrandes That is great. Although I cannot add descriptions to all messages files in the repo, I added them to this file as a start.
d201cb4
to
a75dfbd
Compare
Sandbox deployment successful 🚀 |
@KristinAoki I think this is ready to be merged (squash and merge). |
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.
Looks great, thanks! (In particular, thank you for adding descriptions to the i18n messages!)
@navinkarkera 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description:
This PR modifies drag-n-drop of elements in outline to support possibility of dragging elements across different parent elements.
Test instructions:
make {lms,cms}-up
.npm start
.Private-ref
: BB-8634Closes: #851