feat: Shows an alert in container sync if the only change is a local override to a text component [FC-0097] (#2516)
- Implements the alert described in https://github.com/openedx/frontend-app-authoring/issues/2438#issuecomment-3358670967
This commit is contained in:
@@ -9,7 +9,7 @@ const getStudioBaseUrl = () => getConfig().STUDIO_BASE_URL;
|
||||
|
||||
export const getXBlockBaseApiUrl = (itemId: string) => `${getStudioBaseUrl()}/xblock/${itemId}`;
|
||||
export const getCourseSectionVerticalApiUrl = (itemId: string) => `${getStudioBaseUrl()}/api/contentstore/v1/container_handler/${itemId}`;
|
||||
export const getCourseVerticalChildrenApiUrl = (itemId: string) => `${getStudioBaseUrl()}/api/contentstore/v1/container/${itemId}/children`;
|
||||
export const getCourseVerticalChildrenApiUrl = (itemId: string, getUpstreamInfo: boolean = false) => `${getStudioBaseUrl()}/api/contentstore/v1/container/${itemId}/children?get_upstream_info=${getUpstreamInfo}`;
|
||||
export const getCourseOutlineInfoUrl = (courseId: string) => `${getStudioBaseUrl()}/course/${courseId}?format=concise`;
|
||||
export const postXBlockBaseApiUrl = () => `${getStudioBaseUrl()}/xblock/`;
|
||||
export const libraryBlockChangesUrl = (blockId: string) => `${getStudioBaseUrl()}/api/contentstore/v2/downstreams/${blockId}/sync`;
|
||||
@@ -108,9 +108,12 @@ export async function handleCourseUnitVisibilityAndData(
|
||||
/**
|
||||
* Get an object containing course vertical children data.
|
||||
*/
|
||||
export async function getCourseContainerChildren(itemId: string): Promise<CourseContainerChildrenData> {
|
||||
export async function getCourseContainerChildren(
|
||||
itemId: string,
|
||||
getUpstreamInfo: boolean = false,
|
||||
): Promise<CourseContainerChildrenData> {
|
||||
const { data } = await getAuthenticatedHttpClient()
|
||||
.get(getCourseVerticalChildrenApiUrl(itemId));
|
||||
.get(getCourseVerticalChildrenApiUrl(itemId, getUpstreamInfo));
|
||||
const camelCaseData = camelCaseObject(data);
|
||||
|
||||
return updateXBlockBlockIdToId(camelCaseData) as CourseContainerChildrenData;
|
||||
|
||||
@@ -38,9 +38,18 @@ export interface ContainerChildData {
|
||||
upstreamLink: UpstreamInfo;
|
||||
}
|
||||
|
||||
export interface UpstreamReadyToSyncChildrenInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
upstream: string;
|
||||
blockType: string;
|
||||
isModified: boolean;
|
||||
}
|
||||
|
||||
export interface CourseContainerChildrenData {
|
||||
canPasteComponent: boolean;
|
||||
children: ContainerChildData[],
|
||||
children: ContainerChildData[];
|
||||
isPublished: boolean;
|
||||
displayName: string;
|
||||
upstreamReadyToSyncChildrenInfo: UpstreamReadyToSyncChildrenInfo[];
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ export interface LibraryChangesMessageData {
|
||||
isLocallyModified?: boolean,
|
||||
isContainer: boolean,
|
||||
blockType?: string | null,
|
||||
isReadyToSyncIndividually?: boolean,
|
||||
}
|
||||
|
||||
export interface PreviewLibraryXBlockChangesProps {
|
||||
@@ -143,6 +144,7 @@ export const PreviewLibraryXBlockChanges = ({
|
||||
<CompareContainersWidget
|
||||
upstreamBlockId={blockData.upstreamBlockId}
|
||||
downstreamBlockId={blockData.downstreamBlockId}
|
||||
isReadyToSyncIndividually={blockData.isReadyToSyncIndividually}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user