Skip to content

Commit 63ab799

Browse files
committed
feat: Add counts to summary in success
1 parent 5667744 commit 63ab799

3 files changed

Lines changed: 68 additions & 3 deletions

File tree

src/data/api.mocks.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ mockGetMigrationStatus.migrationStatusData = {
3939
forwardSourceToTarget: true,
4040
isFailed: false,
4141
targetCollection: null,
42+
migrationSummary: {
43+
totalBlocks: 0,
44+
sections: 0,
45+
subsections: 0,
46+
units: 0,
47+
components: 0,
48+
unsupported: 0,
49+
},
4250
},
4351
],
4452
} as api.MigrateTaskStatusData;
@@ -65,6 +73,14 @@ mockGetMigrationStatus.migrationStatusFailedData = {
6573
forwardSourceToTarget: true,
6674
isFailed: true,
6775
targetCollection: null,
76+
migrationSummary: {
77+
totalBlocks: 0,
78+
sections: 0,
79+
subsections: 0,
80+
units: 0,
81+
components: 0,
82+
unsupported: 0,
83+
},
6884
},
6985
],
7086
} as api.MigrateTaskStatusData;
@@ -91,6 +107,14 @@ mockGetMigrationStatus.migrationStatusFailedMultipleData = {
91107
forwardSourceToTarget: true,
92108
isFailed: true,
93109
targetCollection: null,
110+
migrationSummary: {
111+
totalBlocks: 0,
112+
sections: 0,
113+
subsections: 0,
114+
units: 0,
115+
components: 0,
116+
unsupported: 0,
117+
},
94118
},
95119
{
96120
id: 2,
@@ -103,6 +127,14 @@ mockGetMigrationStatus.migrationStatusFailedMultipleData = {
103127
forwardSourceToTarget: true,
104128
isFailed: true,
105129
targetCollection: null,
130+
migrationSummary: {
131+
totalBlocks: 0,
132+
sections: 0,
133+
subsections: 0,
134+
units: 0,
135+
components: 0,
136+
unsupported: 0,
137+
},
106138
},
107139
],
108140
} as api.MigrateTaskStatusData;
@@ -129,6 +161,14 @@ mockGetMigrationStatus.migrationStatusFailedOneLibraryData = {
129161
forwardSourceToTarget: true,
130162
isFailed: true,
131163
targetCollection: null,
164+
migrationSummary: {
165+
totalBlocks: 0,
166+
sections: 0,
167+
subsections: 0,
168+
units: 0,
169+
components: 0,
170+
unsupported: 0,
171+
},
132172
},
133173
{
134174
id: 2,
@@ -141,6 +181,14 @@ mockGetMigrationStatus.migrationStatusFailedOneLibraryData = {
141181
forwardSourceToTarget: true,
142182
isFailed: false,
143183
targetCollection: null,
184+
migrationSummary: {
185+
totalBlocks: 0,
186+
sections: 0,
187+
subsections: 0,
188+
units: 0,
189+
components: 0,
190+
unsupported: 0,
191+
},
144192
},
145193
],
146194
} as api.MigrateTaskStatusData;

src/data/api.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ export interface MigrateParameters {
9797
key: string;
9898
title: string;
9999
} | null;
100+
migrationSummary: {
101+
totalBlocks: number;
102+
sections: number;
103+
subsections: number;
104+
units: number;
105+
components: number;
106+
unsupported: number;
107+
}
100108
}
101109

102110
export interface MigrateTaskStatusData {

src/library-authoring/import-course/ImportDetailsPage.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export const ImportDetailsPage = () => {
105105
};
106106

107107
const renderBody = () => {
108-
if (isPending) {
108+
if (isPending || !courseImportDetails) {
109109
return <Loading />;
110110
}
111111

@@ -121,13 +121,22 @@ export const ImportDetailsPage = () => {
121121
{...messages.importSuccessfulAlertBody}
122122
values={{
123123
courseName: courseDetails?.title,
124-
collectionName: courseImportDetails?.targetCollection?.title,
124+
collectionName: courseImportDetails.targetCollection?.title,
125125
}}
126126
/>
127127
</p>
128128
</Alert>
129129
<h4><FormattedMessage {...messages.importSummaryTitle} /></h4>
130-
<SummaryCard isPending />
130+
<SummaryCard
131+
totalBlocks={courseImportDetails.migrationSummary.totalBlocks}
132+
totalComponents={
133+
courseImportDetails.migrationSummary.components + courseImportDetails.migrationSummary.unsupported
134+
}
135+
sections={courseImportDetails.migrationSummary.sections}
136+
subsections={courseImportDetails.migrationSummary.subsections}
137+
units={courseImportDetails.migrationSummary.units}
138+
unsupportedBlocks={courseImportDetails.migrationSummary.unsupported}
139+
/>
131140
<p>
132141
<FormattedMessage
133142
{...messages.importSuccessfulBody}

0 commit comments

Comments
 (0)