feat: container delete confirmation modal (#2145)

Update container delete confirmation modal based on #1982 and #1981
This commit is contained in:
Navin Karkera
2025-06-24 19:37:14 +02:00
committed by GitHub
parent 60cebf703d
commit 4905f3bbc7
21 changed files with 802 additions and 256 deletions

View File

@@ -4,6 +4,7 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
const getApiBaseUrl = () => getConfig().STUDIO_BASE_URL;
export const getEntityLinksByDownstreamContextUrl = () => `${getApiBaseUrl()}/api/contentstore/v2/downstreams/`;
export const getContainerEntityLinksByDownstreamContextUrl = () => `${getApiBaseUrl()}/api/contentstore/v2/downstream-containers/`;
export const getEntityLinksSummaryByDownstreamContextUrl = (downstreamContextKey: string) => `${getApiBaseUrl()}/api/contentstore/v2/downstreams/${downstreamContextKey}/summary`;
@@ -18,9 +19,8 @@ export interface PaginatedData<T> {
results: T,
}
export interface PublishableEntityLink {
export interface BasePublishableEntityLink {
id: number;
upstreamUsageKey: string;
upstreamContextKey: string;
upstreamContextTitle: string;
upstreamVersion: number;
@@ -33,6 +33,14 @@ export interface PublishableEntityLink {
readyToSync: boolean;
}
export interface PublishableEntityLink extends BasePublishableEntityLink {
upstreamUsageKey: string;
}
export interface ContainerPublishableEntityLink extends BasePublishableEntityLink {
upstreamContainerKey: string;
}
export interface PublishableEntityLinkSummary {
upstreamContextKey: string;
upstreamContextTitle: string;
@@ -58,6 +66,23 @@ export const getEntityLinks = async (
return camelCaseObject(data);
};
export const getContainerEntityLinks = async (
downstreamContextKey?: string,
readyToSync?: boolean,
upstreamContainerKey?: string,
): Promise<ContainerPublishableEntityLink[]> => {
const { data } = await getAuthenticatedHttpClient()
.get(getContainerEntityLinksByDownstreamContextUrl(), {
params: {
course_id: downstreamContextKey,
ready_to_sync: readyToSync,
upstream_container_key: upstreamContainerKey,
no_page: true,
},
});
return camelCaseObject(data);
};
export const getEntityLinksSummaryByDownstreamContext = async (
downstreamContextKey: string,
): Promise<PublishableEntityLinkSummary[]> => {