diff --git a/src/utils/resultsbuilder/assessmentReporter.ts b/src/utils/resultsbuilder/assessmentReporter.ts index bde085f..62f4cac 100644 --- a/src/utils/resultsbuilder/assessmentReporter.ts +++ b/src/utils/resultsbuilder/assessmentReporter.ts @@ -1,19 +1,65 @@ import fs from 'fs'; import open from 'open'; -import { AssessmentInfo } from '../interfaces'; +import { AssessmentInfo, LWCAssessmentInfo } from '../interfaces'; export class AssessmentReporter { public static async generate(result: AssessmentInfo, instanceUrl: string): Promise { let htmlBody = ''; - htmlBody += '
' + this.generateResult(result, instanceUrl); + htmlBody += '
' + this.generateLwcAssesment(result.lwcAssessmentInfos); - const fileUrl = process.cwd() + '/migrationresults.html'; + const fileUrl = process.cwd() + '/assessmentresults.html'; fs.writeFileSync(fileUrl, htmlBody); await open('file://' + fileUrl); } - private static generateResult(_result: AssessmentInfo, _instanceUrl: string): string { - return ''; + + private static generateLwcAssesment(lwcAssessmentInfos: LWCAssessmentInfo[]): string { + let tableBody = ''; + tableBody += '
LWC Assessment
'; + for (const lwcAssessmentInfo of lwcAssessmentInfos) { + let changeInfoRows = ''; + + for (const changeInfo of lwcAssessmentInfo.changeInfos) { + changeInfoRows += ` +
${changeInfo.name}
+
${changeInfo.diff}
+ `; + } + const changeInfoTable = ` + ${changeInfoRows} +
`; + const row = ` +
${lwcAssessmentInfo.name}
+ ${changeInfoTable} + `; + tableBody += row; + } + return this.getLWCAssesmentReport(tableBody); + } + + private static getLWCAssesmentReport(tableContent: string): string { + const tableBody = ` +
+ + + + + + + + + + ${tableContent} + +
+
Name
+
+
Status
+
+
Errors
+
+
`; + return tableBody; } }