@@ -4,14 +4,18 @@ import { useNavigate, useParams } from 'react-router';
44import { FormattedMessage , useIntl } from '@edx/frontend-platform/i18n' ;
55import {
66 Stack , Container , Alert , Layout , Button ,
7+ DataTable ,
78} from '@openedx/paragon' ;
89
910import Header from '@src/header' ;
1011import { useCourseDetails } from '@src/course-outline/data/apiHooks' ;
1112import SubHeader from '@src/generic/sub-header/SubHeader' ;
12- import { ArrowForward , CheckCircle , Info } from '@openedx/paragon/icons' ;
13+ import {
14+ ArrowForward , CheckCircle , Info , WarningFilled ,
15+ } from '@openedx/paragon/icons' ;
1316import Loading from '@src/generic/Loading' ;
1417import { ToastContext } from '@src/generic/toast-context' ;
18+ import { Paragraph } from '@src/utils' ;
1519
1620import { useBulkModulestoreMigrate , useModulestoreMigrationStatus } from '@src/data/apiHooks' ;
1721import messages from './messages' ;
@@ -66,6 +70,8 @@ export const ImportDetailsPage = () => {
6670 // TODO: Update this code when using simple migration
6771 if ( courseImportDetails ?. isFailed ) {
6872 migrationStatus = 'Failed' ;
73+ } else if ( courseImportDetails ?. migrationSummary . unsupported !== 0 ) {
74+ migrationStatus = 'Partial Succeeded' ;
6975 } else {
7076 migrationStatus = 'Succeeded' ;
7177 }
@@ -128,10 +134,10 @@ export const ImportDetailsPage = () => {
128134 </ Alert >
129135 < h4 > < FormattedMessage { ...messages . importSummaryTitle } /> </ h4 >
130136 < SummaryCard
131- totalBlocks = { courseImportDetails . migrationSummary . totalBlocks }
132- totalComponents = {
133- courseImportDetails . migrationSummary . components + courseImportDetails . migrationSummary . unsupported
137+ totalBlocks = {
138+ courseImportDetails . migrationSummary . totalBlocks - courseImportDetails . migrationSummary . unsupported
134139 }
140+ totalComponents = { courseImportDetails . migrationSummary . components }
135141 sections = { courseImportDetails . migrationSummary . sections }
136142 subsections = { courseImportDetails . migrationSummary . subsections }
137143 units = { courseImportDetails . migrationSummary . units }
@@ -188,14 +194,90 @@ export const ImportDetailsPage = () => {
188194 </ div >
189195 </ Stack >
190196 ) ;
197+ } if ( migrationStatus === 'Partial Succeeded' ) {
198+ const importedSuccessfullyCount = courseImportDetails . migrationSummary . totalBlocks
199+ - courseImportDetails . migrationSummary . unsupported ;
200+
201+ return (
202+ < Stack gap = { 3 } >
203+ < Alert variant = "warning" icon = { WarningFilled } >
204+ < Alert . Heading >
205+ < FormattedMessage { ...messages . importPartialAlertTitle } />
206+ </ Alert . Heading >
207+ < p >
208+ < FormattedMessage
209+ { ...messages . importPartialAlertBody }
210+ values = { {
211+ courseName : courseDetails ?. title ,
212+ collectionName : courseImportDetails . targetCollection ?. title ,
213+ } }
214+ />
215+ </ p >
216+ </ Alert >
217+ < h4 > < FormattedMessage { ...messages . importSummaryTitle } /> </ h4 >
218+ < SummaryCard
219+ totalBlocks = {
220+ courseImportDetails . migrationSummary . totalBlocks - courseImportDetails . migrationSummary . unsupported
221+ }
222+ totalComponents = { courseImportDetails . migrationSummary . components }
223+ sections = { courseImportDetails . migrationSummary . sections }
224+ subsections = { courseImportDetails . migrationSummary . subsections }
225+ units = { courseImportDetails . migrationSummary . units }
226+ unsupportedBlocks = { courseImportDetails . migrationSummary . unsupported }
227+ />
228+ < div >
229+ < FormattedMessage
230+ { ...messages . importPartialBody }
231+ values = { {
232+ percentage : Math . floor (
233+ ( importedSuccessfullyCount * 100 ) / courseImportDetails . migrationSummary . totalBlocks ,
234+ ) ,
235+ courseName : courseDetails ?. title ,
236+ p : Paragraph ,
237+ } }
238+ />
239+ </ div >
240+ < DataTable
241+ columns = { [
242+ {
243+ Header : intl . formatMessage ( messages . importPartialReasonTableBlockName ) ,
244+ accessor : 'blockName' ,
245+
246+ } ,
247+ {
248+ Header : intl . formatMessage ( messages . importPartialReasonTableBlockType ) ,
249+ accessor : 'blockType' ,
250+ } ,
251+ {
252+ Header : intl . formatMessage ( messages . importPartialReasonTableReason ) ,
253+ accessor : 'reason' ,
254+ } ,
255+ ] }
256+ data = { courseImportDetails . unsupportedReasons }
257+ >
258+ < DataTable . Table />
259+ </ DataTable >
260+ < div className = "w-100 d-flex justify-content-end" >
261+ < Button
262+ variant = "outline-primary"
263+ iconAfter = { ArrowForward }
264+ onClick = { ( ) => navigate ( collectionLink ( ) ) }
265+ >
266+ < FormattedMessage { ...messages . viewImportedContentButton } />
267+ </ Button >
268+ </ div >
269+ </ Stack >
270+ ) ;
191271 }
272+
192273 return (
193- // In Progress
274+ // In Progress
194275 < Stack gap = { 3 } >
195276 < h4 > < FormattedMessage { ...messages . importInProgressTitle } /> </ h4 >
196277 < p >
197278 < FormattedMessage { ...messages . importInProgressBody } />
198279 </ p >
280+ < h4 > < FormattedMessage { ...messages . importSummaryTitle } /> </ h4 >
199281 < SummaryCard isPending />
200282 < div className = "w-100 d-flex justify-content-end" >
201283 < Button
0 commit comments