-
Notifications
You must be signed in to change notification settings - Fork 80
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: [FC-0070] listen to xblock interaction events #1431
base: master
Are you sure you want to change the base?
Changes from 3 commits
d2fb943
2e4cef3
1d9ac29
310421d
ea4da9f
c8382eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,8 +34,6 @@ import { | |
updateCourseVerticalChildren, | ||
updateCourseVerticalChildrenLoadingStatus, | ||
updateQueryPendingStatus, | ||
deleteXBlock, | ||
duplicateXBlock, | ||
fetchStaticFileNoticesSuccess, | ||
updateCourseOutlineInfo, | ||
updateCourseOutlineInfoLoadingStatus, | ||
|
@@ -229,7 +227,6 @@ export function deleteUnitItemQuery(itemId, xblockId) { | |
|
||
try { | ||
await deleteUnitItem(xblockId); | ||
dispatch(deleteXBlock(xblockId)); | ||
const { userClipboard } = await getCourseSectionVerticalData(itemId); | ||
dispatch(updateClipboardData(userClipboard)); | ||
const courseUnit = await getCourseUnitData(itemId); | ||
|
@@ -249,12 +246,7 @@ export function duplicateUnitItemQuery(itemId, xblockId) { | |
dispatch(showProcessingNotification(NOTIFICATION_MESSAGES.duplicating)); | ||
|
||
try { | ||
const { locator } = await duplicateUnitItem(itemId, xblockId); | ||
const newCourseVerticalChildren = await getCourseVerticalChildren(itemId); | ||
dispatch(duplicateXBlock({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [inform]: since we use legacy functionality to store xblock data, in the current implementation it makes sense to use thunks exclusively for working with the backend API, without storing data from the Redux store |
||
newId: locator, | ||
newCourseVerticalChildren, | ||
})); | ||
await duplicateUnitItem(itemId, xblockId); | ||
const courseUnit = await getCourseUnitData(itemId); | ||
dispatch(fetchCourseItemSuccess(courseUnit)); | ||
dispatch(hideProcessingNotification()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ import { | |
import ConfigureModal from '../../generic/configure-modal/ConfigureModal'; | ||
import { getCourseUnitData } from '../data/selectors'; | ||
import { updateQueryPendingStatus } from '../data/slice'; | ||
import { messageTypes } from '../constants'; | ||
import { useIframe } from '../context/hooks'; | ||
import messages from './messages'; | ||
|
||
const HeaderTitle = ({ | ||
|
@@ -26,9 +28,15 @@ const HeaderTitle = ({ | |
const currentItemData = useSelector(getCourseUnitData); | ||
const [isConfigureModalOpen, openConfigureModal, closeConfigureModal] = useToggle(false); | ||
const { selectedPartitionIndex, selectedGroupsLabel } = currentItemData.userPartitionInfo; | ||
const { sendMessageToIframe } = useIframe(); | ||
|
||
const onConfigureSubmit = (...arg) => { | ||
handleConfigureSubmit(currentItemData.id, ...arg, closeConfigureModal); | ||
// TODO: this artificial delay is a temporary solution | ||
// to ensure the iframe content is properly refreshed. | ||
setTimeout(() => { | ||
sendMessageToIframe(messageTypes.refreshXBlock, null); | ||
}, 1000); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [inform]: such delays will be removed after optimization of updating content inside the iframe, via the backbone.js |
||
}; | ||
|
||
const getVisibilityMessage = () => { | ||
|
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 mentioned this on another PR, but this contains a typo: openedx/frontend-app-learning#1500
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.
[inform] Implemented in follow-up commit: ea4da9f#diff-8e3b187293d8e7902d08eff3c650466860fe527b0c7da8ec32c1ee4a450f97c5R81