Skip to content

Commit f56c482

Browse files
fix: mvp fixes
1 parent dde7a29 commit f56c482

File tree

7 files changed

+43
-15
lines changed

7 files changed

+43
-15
lines changed

src/utils/constants/callToActionMessages.ts renamed to src/utils/constants/documentRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const callToActionMessages = {
1+
export const documentRegistry = {
22
errorNoOrgResults:
33
'https://help.salesforce.com/s/articleView?id=xcloud.os_migrate_get_moving_run_the_omnistudio_migration_tool.htm&type=5',
44
couldNotDeactivateOmniProcesses:

src/utils/resultsbuilder/ApexAssessmentReporter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class ApexAssessmentReporter {
7474
1,
7575
false,
7676
undefined,
77-
apexAssessmentInfo.infos
77+
apexAssessmentInfo.infos ? reportingHelper.decorateErrors(apexAssessmentInfo.infos) : []
7878
),
7979
createRowDataParam(
8080
'errors',
@@ -84,7 +84,7 @@ export class ApexAssessmentReporter {
8484
1,
8585
false,
8686
undefined,
87-
apexAssessmentInfo.warnings
87+
apexAssessmentInfo.warnings ? reportingHelper.decorateErrors(apexAssessmentInfo.warnings) : []
8888
),
8989
],
9090
}));

src/utils/resultsbuilder/DRAssessmentReporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class DRAssessmentReporter {
146146
1,
147147
false,
148148
undefined,
149-
dataRaptorAssessmentInfo.warnings
149+
dataRaptorAssessmentInfo.warnings ? reportingHelper.decorateErrors(dataRaptorAssessmentInfo.warnings) : []
150150
),
151151
createRowDataParam(
152152
'customFunctionDependencies',

src/utils/resultsbuilder/IPAssessmentReporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export class IPAssessmentReporter {
7070
1,
7171
false,
7272
undefined,
73-
ipAssessmentInfo.warnings
73+
ipAssessmentInfo.warnings ? reportingHelper.decorateErrors(ipAssessmentInfo.warnings) : []
7474
),
7575
createRowDataParam(
7676
'integrationProcedureDependencies',

src/utils/resultsbuilder/OSAssessmentReporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export class OSAssessmentReporter {
8080
1,
8181
false,
8282
undefined,
83-
info.warnings
83+
info.warnings ? reportingHelper.decorateErrors(info.warnings) : []
8484
),
8585
createRowDataParam(
8686
'omniScriptDependencies',

src/utils/resultsbuilder/index.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { TemplateParser } from '../templateParser/generate';
1010
import { createFilterGroupParam, createRowDataParam } from '../reportGenerator/reportUtil';
1111
import { FileDiffUtil } from '../lwcparser/fileutils/FileDiffUtil';
1212
import { Logger } from '../logger';
13-
13+
import { reportingHelper } from './reportingHelper';
1414
const resultsDir = path.join(process.cwd(), 'migration_report');
1515
// const lwcConstants = { componentName: 'lwc', title: 'LWC Components Migration Result' };
1616
const migrationReportHTMLfileName = 'dashboard.html';
@@ -139,7 +139,16 @@ export class ResultsBuilder {
139139
createRowDataParam('name', item.name, true, 1, 1, false),
140140
createRowDataParam('migratedId', item.migratedId, false, 1, 1, true, `${instanceUrl}/${item.migratedId}`),
141141
createRowDataParam('migratedName', item.migratedName, false, 1, 1, false),
142-
createRowDataParam('status', item.status, false, 1, 1, false),
142+
createRowDataParam(
143+
'status',
144+
item.status,
145+
false,
146+
1,
147+
1,
148+
false,
149+
undefined,
150+
reportingHelper.decorateStatus(item.status)
151+
),
143152
createRowDataParam(
144153
'errors',
145154
item.errors ? 'Has Errors' : 'Has No Errors',
@@ -148,7 +157,7 @@ export class ResultsBuilder {
148157
1,
149158
false,
150159
undefined,
151-
item.errors
160+
item.errors ? reportingHelper.decorateErrors(item.errors) : []
152161
),
153162
createRowDataParam(
154163
'warnings',
@@ -158,7 +167,7 @@ export class ResultsBuilder {
158167
1,
159168
false,
160169
undefined,
161-
item.warnings || []
170+
item.warnings ? reportingHelper.decorateErrors(item.warnings) : []
162171
),
163172
],
164173
})),
@@ -263,7 +272,7 @@ export class ResultsBuilder {
263272
1,
264273
false,
265274
undefined,
266-
item.warnings
275+
item.warnings ? reportingHelper.decorateErrors(item.warnings) : []
267276
),
268277
],
269278
})),

src/utils/resultsbuilder/reportingHelper.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Messages } from '@salesforce/core';
22
import { nameLocation, oldNew } from '../interfaces';
33
import { CTASummary } from '../reportGenerator/reportInterfaces';
44
import { IPAssessmentInfo, OSAssessmentInfo, DataRaptorAssessmentInfo, ApexAssessmentInfo } from '../interfaces';
5-
import { callToActionMessages } from '../constants/callToActionMessages';
5+
import { documentRegistry } from '../constants/documentRegistry';
66
import { Logger } from '../logger';
77

88
Messages.importMessagesDirectory(__dirname);
@@ -37,14 +37,33 @@ export class reportingHelper {
3737
}
3838
}
3939

40+
public static decorateErrors(errors: string[]): string[] {
41+
if (!errors || errors.length === 0) return [];
42+
const errorMessages: string[] = [];
43+
for (const error of errors) {
44+
errorMessages.push('<div class="slds-text-color_error">' + error + '</div>');
45+
}
46+
return errorMessages;
47+
}
48+
49+
public static decorateStatus(status: string): string {
50+
if (status === 'Can be Automated' || status === 'Complete') {
51+
return '<div class="slds-text-color_success">' + status + '</div>';
52+
}
53+
if (status === 'Skipped') {
54+
return '<div class="text-warning">' + status + '</div>';
55+
}
56+
return '<div class="slds-text-color_error">' + status + '</div>';
57+
}
58+
4059
public static getCallToAction(
4160
assessmentInfos: Array<IPAssessmentInfo | OSAssessmentInfo | DataRaptorAssessmentInfo | ApexAssessmentInfo>
4261
): CTASummary[] {
4362
const callToAction = [];
4463
assessmentInfos.forEach((assessmentInfo) => {
4564
if (assessmentInfo.warnings && assessmentInfo.warnings.length > 0) {
4665
for (const info of assessmentInfo.warnings) {
47-
for (const key of Object.keys(callToActionMessages)) {
66+
for (const key of Object.keys(documentRegistry)) {
4867
const value = assessMessages.getMessage(key);
4968
if (
5069
typeof value === 'string' &&
@@ -99,8 +118,8 @@ export class reportingHelper {
99118
}
100119

101120
private static getLink(key: string): string {
102-
if (callToActionMessages[key]) {
103-
return callToActionMessages[key] as string;
121+
if (documentRegistry[key]) {
122+
return documentRegistry[key] as string;
104123
}
105124
Logger.logVerbose(`No link found for ${key}`);
106125
return undefined;

0 commit comments

Comments
 (0)