From 07b4e66cac7c4007d378b9748d38ddbeb28c4891 Mon Sep 17 00:00:00 2001 From: abhinavkumar2 Date: Wed, 6 Nov 2024 15:54:10 +0530 Subject: [PATCH] feat: added summary --- messages/assess.json | 6 +- src/commands/omnistudio/migration/assess.ts | 2 +- src/migration/base.ts | 4 +- src/migration/omniscript.ts | 128 +++++++--- src/utils/StringValue/stringutil.ts | 6 + src/utils/StringValue/stringval.ts | 18 ++ src/utils/interfaces.ts | 24 +- src/utils/json/jsonutil.ts | 46 ++++ .../resultsbuilder/IPAssessmentReporter.ts | 71 ++++++ .../resultsbuilder/OSAssessmentReporter.ts | 89 +++++++ .../resultsbuilder/assessmentReporter.ts | 240 ++++-------------- src/utils/resultsbuilder/reportingHelper.ts | 21 ++ 12 files changed, 410 insertions(+), 245 deletions(-) create mode 100644 src/utils/StringValue/stringutil.ts create mode 100644 src/utils/StringValue/stringval.ts create mode 100644 src/utils/json/jsonutil.ts create mode 100644 src/utils/resultsbuilder/IPAssessmentReporter.ts create mode 100644 src/utils/resultsbuilder/OSAssessmentReporter.ts create mode 100644 src/utils/resultsbuilder/reportingHelper.ts diff --git a/messages/assess.json b/messages/assess.json index 6e4ea736..ef21e25b 100644 --- a/messages/assess.json +++ b/messages/assess.json @@ -25,5 +25,7 @@ "errorWhileActivatingCard": "Could not activate Card: ", "errorWhileUploadingCard": "An error ocurred while uploading Card: ", "errorWhileCreatingElements": "An error ocurred while saving OmniScript elements: ", - "allVersionsDescription": "Migrate all versions of a component" -} \ No newline at end of file + "allVersionsDescription": "Migrate all versions of a component", + "changeMessage": " %s will be changed from %s to %s", + "angularOSWarning": " Angular OmniScript will not be migrated, please convert this to LWC based Omniscript" +} diff --git a/src/commands/omnistudio/migration/assess.ts b/src/commands/omnistudio/migration/assess.ts index e97f6aba..dc5dc675 100644 --- a/src/commands/omnistudio/migration/assess.ts +++ b/src/commands/omnistudio/migration/assess.ts @@ -45,7 +45,7 @@ export default class Assess extends OmniStudioBaseCommand { DebugTimer.getInstance().start(); const namespace = (this.flags.namespace || 'vlocity_ins') as string; const apiVersion = (this.flags.apiversion || '55.0') as string; - const allVersions = true; + const allVersions = (this.flags.allversions || false) as boolean; const conn = this.org.getConnection(); Logger.initialiseLogger(this.ux, this.logger); const projectDirectory = OmnistudioRelatedObjectMigrationFacade.intializeProject(); diff --git a/src/migration/base.ts b/src/migration/base.ts index bb4ee6fd..982455f3 100644 --- a/src/migration/base.ts +++ b/src/migration/base.ts @@ -3,6 +3,7 @@ import { Connection, Logger, Messages } from '@salesforce/core'; import { DebugTimer, QueryTools } from '../utils'; import { NetUtils } from '../utils/net'; +import { Stringutil } from '../utils/StringValue/stringutil'; import { TransformData, UploadRecordResult } from './interfaces'; export class BaseMigrationTool { @@ -57,8 +58,7 @@ export class BaseMigrationTool { } protected cleanName(name: string, allowUnderscores = false): string { - if (!name) return ''; - return allowUnderscores ? name.replace(/[^a-z0-9_]+/gi, '') : name.replace(/[^a-z0-9]+/gi, ''); + return Stringutil.cleanName(name, allowUnderscores); } protected async truncate(objectName: string): Promise { diff --git a/src/migration/omniscript.ts b/src/migration/omniscript.ts index b11aef63..d1a32e52 100644 --- a/src/migration/omniscript.ts +++ b/src/migration/omniscript.ts @@ -4,7 +4,14 @@ import { AnyJson } from '@salesforce/ts-types'; import OmniScriptMappings from '../mappings/OmniScript'; import ElementMappings from '../mappings/Element'; import OmniScriptDefinitionMappings from '../mappings/OmniScriptDefinition'; -import { DataRaptorAssessmentInfo, DebugTimer, FlexCardAssessmentInfo, QueryTools, SortDirection } from '../utils'; +import { + DataRaptorAssessmentInfo, + DebugTimer, + FlexCardAssessmentInfo, + nameLocation, + QueryTools, + SortDirection, +} from '../utils'; import { BaseMigrationTool } from './base'; import { MigrationResult, MigrationTool, TransformData, UploadRecordResult } from './interfaces'; import { ObjectMapping } from './interfaces'; @@ -13,6 +20,7 @@ import { Connection, Messages, Logger } from '@salesforce/core'; import { UX } from '@salesforce/command'; import { OSAssessmentInfo, OmniAssessmentInfo, IPAssessmentInfo } from '../../src/utils'; import { getAllFunctionMetadata, getReplacedString } from '../utils/formula/FormulaUtil'; +import { StringVal } from '../utils/StringValue/stringval'; export class OmniScriptMigrationTool extends BaseMigrationTool implements MigrationTool { private readonly exportType: OmniScriptExportType; @@ -190,30 +198,24 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat const osAssessmentInfos: OSAssessmentInfo[] = []; const ipAssessmentInfos: IPAssessmentInfo[] = []; - const limitedOmniscripts = omniscripts.slice(0, 200); - // Create a set to store existing OmniScript names and also extract DataRaptor and FlexCard names const existingOmniscriptNames = new Set(); const existingDataRaptorNames = new Set(dataRaptorAssessmentInfos.map((info) => info.name)); const existingFlexCardNames = new Set(flexCardAssessmentInfos.map((info) => info.name)); // First, collect all OmniScript names from the omniscripts array - for (const omniscript of limitedOmniscripts) { - const omniScriptName = `${omniscript[this.namespacePrefix + 'Name']}`; - existingOmniscriptNames.add(omniScriptName); - } - // Now process each OmniScript and its elements - for (const omniscript of limitedOmniscripts) { + for (const omniscript of omniscripts) { const elements = await this.getAllElementsForOmniScript(omniscript['Id']); - const dependencyIP: string[] = []; + const dependencyIP: nameLocation[] = []; const missingIP: string[] = []; - const dependencyDR: string[] = []; + const dependencyDR: nameLocation[] = []; const missingDR: string[] = []; - const dependencyOS: string[] = []; + const dependencyOS: nameLocation[] = []; const missingOS: string[] = []; - const dependenciesRA: string[] = []; + const dependenciesRA: nameLocation[] = []; + const dependenciesLWC: nameLocation[] = []; //const missingRA: string[] = []; for (const elem of elements) { @@ -223,12 +225,15 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat // Check for OmniScript dependencies if (type === 'OmniScript') { - const nameVal = `${elemName}_OmniScript`; + const nameVal = `${elemName}`; const type = propertySet['Type']; const subtype = propertySet['Sub Type']; const language = propertySet['Language']; const osName = type + '_' + subtype + '_' + language; - dependencyOS.push(osName + ' ( ' + nameVal + ' )
'); + dependencyOS.push({ + name: osName, + location: nameVal, + }); if (!existingOmniscriptNames.has(nameVal)) { missingOS.push(nameVal); } @@ -236,8 +241,8 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat // Check for Integration Procedure Action dependencies if (type === 'Integration Procedure Action') { - const nameVal = `${elemName}_Integration Procedure Action`; - dependencyIP.push(propertySet['integrationProcedureKey'] + ' (' + nameVal + ')
'); + const nameVal = `${elemName}`; + dependencyIP.push({ name: propertySet['integrationProcedureKey'], location: nameVal }); if (!existingOmniscriptNames.has(nameVal) && !existingFlexCardNames.has(nameVal)) { missingIP.push(nameVal); } @@ -245,33 +250,94 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat // Check for DataRaptor dependencies if (['DataRaptor Extract Action', 'DataRaptor Turbo Action', 'DataRaptor Post Action'].includes(type)) { - const nameVal = `${elemName}_${type}`; - dependencyDR.push(propertySet['bundle'] + ' ( ' + nameVal + ' )
'); + const nameVal = `${elemName}`; + dependencyDR.push({ name: propertySet['bundle'], location: nameVal }); if (!existingOmniscriptNames.has(nameVal) && !existingDataRaptorNames.has(nameVal)) { missingDR.push(nameVal); } } if (type === 'Remote Action') { - const nameVal = `${elemName}_${type}`; + const nameVal = `${elemName}`; const className = propertySet['remoteClass']; const methodName = propertySet['remoteMethod']; - dependenciesRA.push(className + '.' + methodName + ' (' + nameVal + ')
'); + dependenciesRA.push({ name: className + '.' + methodName, location: nameVal }); + } + // To handle radio , multiselect + if (propertySet['optionSource'] && propertySet['optionSource']['type'] === 'Custom') { + const nameVal = `${elemName}`; + dependenciesRA.push({ name: propertySet['optionSource']['source'], location: nameVal }); } - } - /*const recordName = `${omniscript[this.namespacePrefix + 'Type__c']}_` + - `${omniscript[this.namespacePrefix + 'SubType__c']}` + - (omniscript[this.namespacePrefix + 'Language__c'] ? `_${omniscript[this.namespacePrefix + 'Language__c']}` : '') + - `_${omniscript[this.namespacePrefix + 'Version__c']}`;*/ + if (type === 'Custom Lightning Web Component') { + const nameVal = `${elemName}`; + const lwcName = propertySet['lwcName']; + dependenciesLWC.push({ name: lwcName, location: nameVal }); + } + } const omniProcessType = omniscript[this.namespacePrefix + 'IsProcedure__c'] ? 'Integration Procedure' : 'OmniScript'; + const existingType = omniscript[this.namespacePrefix + 'Type__c']; + const existingTypeVal = new StringVal(existingType, 'type'); + const existingSubType = omniscript[this.namespacePrefix + 'SubType__c']; + const existingSubTypeVal = new StringVal(existingSubType, 'sub type'); + const omniScriptName = omniscript[this.namespacePrefix + 'Name']; + const existingOmniScriptNameVal = new StringVal(omniScriptName, 'name'); + + const warnings: string[] = []; + + const recordName = + `${existingTypeVal.cleanName()}_` + + `${existingSubTypeVal.cleanName()}` + + (omniscript[this.namespacePrefix + 'Language__c'] + ? `_${omniscript[this.namespacePrefix + 'Language__c']}` + : '') + + `_${omniscript[this.namespacePrefix + 'Version__c']}`; + + if (!existingTypeVal.isNameCleaned()) { + warnings.push( + this.messages.getMessage('changeMessage', [ + existingTypeVal.type, + existingTypeVal.val, + existingTypeVal.cleanName(), + ]) + ); + } + if (!existingSubTypeVal.isNameCleaned()) { + warnings.push( + this.messages.getMessage('changeMessage', [ + existingSubTypeVal.type, + existingSubTypeVal.val, + existingSubTypeVal.cleanName(), + ]) + ); + } + if (!existingOmniScriptNameVal.isNameCleaned()) { + warnings.push( + this.messages.getMessage('changeMessage', [ + existingOmniScriptNameVal.type, + existingOmniScriptNameVal.val, + existingOmniScriptNameVal.cleanName(), + ]) + ); + } + if (existingOmniscriptNames.has(recordName)) { + warnings.push(this.messages.getMessage('duplicatedName') + recordName); + } else { + existingOmniscriptNames.add(recordName); + } + if (omniProcessType === 'OmniScript') { + const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular'; + if (type === 'Angular') { + warnings.unshift(this.messages.getMessage('angularOSWarning')); + } const osAssessmentInfo: OSAssessmentInfo = { - name: omniscript['Name'], + name: recordName, + type: type, id: omniscript['Id'], dependenciesIP: dependencyIP, missingIP: [], @@ -280,22 +346,22 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat dependenciesOS: dependencyOS, missingOS: missingOS, dependenciesRemoteAction: dependenciesRA, + dependenciesLWC: dependenciesLWC, infos: [], - warnings: [], + warnings: warnings, errors: [], - path: '', }; osAssessmentInfos.push(osAssessmentInfo); } else { const ipAssessmentInfo: IPAssessmentInfo = { - name: omniscript['Name'], + name: recordName, id: omniscript['Id'], dependenciesIP: dependencyIP, dependenciesDR: dependencyDR, dependenciesOS: dependencyOS, dependenciesRemoteAction: dependenciesRA, infos: [], - warnings: [], + warnings: warnings, errors: [], path: '', }; diff --git a/src/utils/StringValue/stringutil.ts b/src/utils/StringValue/stringutil.ts new file mode 100644 index 00000000..9eb4b8e7 --- /dev/null +++ b/src/utils/StringValue/stringutil.ts @@ -0,0 +1,6 @@ +export class Stringutil { + public static cleanName(name: string, allowUnderscores = false): string { + if (!name) return ''; + return allowUnderscores ? name.replace(/[^a-z0-9_]+/gi, '') : name.replace(/[^a-z0-9]+/gi, ''); + } +} diff --git a/src/utils/StringValue/stringval.ts b/src/utils/StringValue/stringval.ts new file mode 100644 index 00000000..30e2ce85 --- /dev/null +++ b/src/utils/StringValue/stringval.ts @@ -0,0 +1,18 @@ +import { Stringutil } from './stringutil'; + +export class StringVal { + public val: string; + public type: string; + + public constructor(val: string, type?: string) { + this.val = val; + this.type = type; + } + + public cleanName(allowUnderscores = false): string { + return Stringutil.cleanName(this.val, allowUnderscores); + } + public isNameCleaned(): boolean { + return !this.val || this.val === this.cleanName(); + } +} diff --git a/src/utils/interfaces.ts b/src/utils/interfaces.ts index 9c72d529..9fdbb0af 100644 --- a/src/utils/interfaces.ts +++ b/src/utils/interfaces.ts @@ -25,27 +25,27 @@ export interface LWCAssessmentInfo { export interface OSAssessmentInfo { name: string; id: string; - dependenciesIP: string[]; + dependenciesIP: nameLocation[]; missingIP: string[]; - dependenciesDR: string[]; + dependenciesDR: nameLocation[]; missingDR: string[]; - dependenciesOS: string[]; + dependenciesOS: nameLocation[]; missingOS: string[]; - dependenciesRemoteAction: string[]; - // missingRemoteAction: AnyJson[]; + dependenciesRemoteAction: nameLocation[]; + dependenciesLWC: nameLocation[]; + type: string; infos: string[]; warnings: string[]; errors: string[]; - path: string; } export interface IPAssessmentInfo { name: string; id: string; - dependenciesIP: string[]; - dependenciesDR: string[]; - dependenciesOS: string[]; - dependenciesRemoteAction: string[]; + dependenciesIP: nameLocation[]; + dependenciesDR: nameLocation[]; + dependenciesOS: nameLocation[]; + dependenciesRemoteAction: nameLocation[]; infos: string[]; warnings: string[]; errors: string[]; @@ -120,7 +120,7 @@ export interface FileProcessor { process(file: File, type: string, namespace: string): string; } -export interface nameUrl { +export interface nameLocation { name: string; - url: string; + location: string; } diff --git a/src/utils/json/jsonutil.ts b/src/utils/json/jsonutil.ts new file mode 100644 index 00000000..f342d7bf --- /dev/null +++ b/src/utils/json/jsonutil.ts @@ -0,0 +1,46 @@ +/* eslint-disable no-prototype-builtins */ +/* eslint-disable @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unsafe-assignment */ +export class jsonutil { + // Recursive method to find a property in the JSON + public static findProperty(obj: any, propertyName: string): any { + if (obj === null || typeof obj !== 'object') { + return null; + } + + // Check if the property exists in the current object + if (propertyName in obj) { + return obj[propertyName]; + } + + // If it's an array, use findInArray + if (Array.isArray(obj)) { + return this.findInArray(obj, propertyName); + } + + // Otherwise, search through all keys + for (const key in obj) { + if (obj.hasOwnProperty(key)) { + const result = this.findProperty(obj[key], propertyName); + if (result !== null) { + return result; + } + } + } + + return null; // Property not found + } + + // Method to find a property in an array + public static findInArray(arr: any[], propertyName: string): any { + for (const item of arr) { + const result = jsonutil.findProperty(item, propertyName); + if (result !== null) { + return result; + } + } + return null; // Property not found in the array + } +} diff --git a/src/utils/resultsbuilder/IPAssessmentReporter.ts b/src/utils/resultsbuilder/IPAssessmentReporter.ts new file mode 100644 index 00000000..d94a45a2 --- /dev/null +++ b/src/utils/resultsbuilder/IPAssessmentReporter.ts @@ -0,0 +1,71 @@ +import { IPAssessmentInfo } from '../interfaces'; +import { reportingHelper } from './reportingHelper'; + +export class IPAssessmentReporter { + public static generateIPAssesment(ipAssessmentInfos: IPAssessmentInfo[], instanceUrl: string): string { + let tableBody = ''; + tableBody += '
Integration Procedure Components Assessment
'; + + for (const ipAssessmentInfo of ipAssessmentInfos) { + const row = ` + + +
${ipAssessmentInfo.name}
+ + + + + + ${reportingHelper.convertToBuletedList(ipAssessmentInfo.warnings)} + + + ${reportingHelper.decorate(ipAssessmentInfo.dependenciesIP)} + + + ${reportingHelper.decorate(ipAssessmentInfo.dependenciesDR)} + + + ${reportingHelper.decorate(ipAssessmentInfo.dependenciesRemoteAction)} + + `; + tableBody += row; + } + + return this.getIPAssessmentReport(tableBody); + } + private static getIPAssessmentReport(tableContent: string): string { + const tableBody = ` +
+ + + + + + + + + + + + + ${tableContent} + +
+
Name
+
+
ID
+
+
Summary
+
+
Integration Procedures Dependencies
+
+
Data Raptor dependencies
+
+
Remote Action Dependencies
+
+
`; + return tableBody; + } +} diff --git a/src/utils/resultsbuilder/OSAssessmentReporter.ts b/src/utils/resultsbuilder/OSAssessmentReporter.ts new file mode 100644 index 00000000..34b52c4b --- /dev/null +++ b/src/utils/resultsbuilder/OSAssessmentReporter.ts @@ -0,0 +1,89 @@ +import { OSAssessmentInfo } from '../interfaces'; +import { reportingHelper } from './reportingHelper'; + +export class OSAssesmentReporter { + public static generateOSAssesment(osAssessmentInfos: OSAssessmentInfo[], instanceUrl: string): string { + let tableBody = ''; + tableBody += '
Omniscript Components Assessment
'; + + for (const osAssessmentInfo of osAssessmentInfos) { + const row = ` + + +
${osAssessmentInfo.name}
+ + +
+ + + ${osAssessmentInfo.type} + + + ${reportingHelper.convertToBuletedList(osAssessmentInfo.warnings)} + + + ${reportingHelper.decorate(osAssessmentInfo.dependenciesOS)} + + + ${reportingHelper.decorate(osAssessmentInfo.dependenciesIP)} + + + ${reportingHelper.decorate(osAssessmentInfo.dependenciesDR)} + + + ${reportingHelper.decorate(osAssessmentInfo.dependenciesRemoteAction)} + + + ${reportingHelper.decorate(osAssessmentInfo.dependenciesLWC)} + + `; + tableBody += row; + } + + return this.getOSAssessmentReport(tableBody); + } + + private static getOSAssessmentReport(tableContent: string): string { + const tableBody = ` +
+ + + + + + + + + + + + + + + + ${tableContent} + +
+
Name
+
+
ID
+
+
Type
+
+
Summary
+
+
Omniscript Dependencies
+
+
Integration Procedures Dependencies
+
+
Data Raptor Dependencies
+
+
Remote Action dependencies
+
+
custom LWC Dependencies
+
+
`; + return tableBody; + } +} diff --git a/src/utils/resultsbuilder/assessmentReporter.ts b/src/utils/resultsbuilder/assessmentReporter.ts index bd0f4734..2eb32568 100644 --- a/src/utils/resultsbuilder/assessmentReporter.ts +++ b/src/utils/resultsbuilder/assessmentReporter.ts @@ -6,13 +6,13 @@ import { ApexAssessmentInfo, AssessmentInfo, LWCAssessmentInfo, - OSAssessmentInfo, - IPAssessmentInfo, OmniAssessmentInfo, FlexCardAssessmentInfo, DataRaptorAssessmentInfo, - nameUrl, + nameLocation, } from '../interfaces'; +import { OSAssesmentReporter } from './OSAssessmentReporter'; +import { IPAssessmentReporter } from './IPAssessmentReporter'; export class AssessmentReporter { public static async generate(result: AssessmentInfo, instanceUrl: string): Promise { @@ -35,7 +35,7 @@ export class AssessmentReporter { ); this.createDocument( integrationProcedureAssessmentFilePath, - this.generateIPAssesment(result?.omniAssessmentInfo.ipAssessmentInfos, instanceUrl) + IPAssessmentReporter.generateIPAssesment(result.omniAssessmentInfo.ipAssessmentInfos, instanceUrl) ); this.createDocument( dataMapperAssessmentFilePath, @@ -46,37 +46,37 @@ export class AssessmentReporter { const nameUrls = [ { name: 'omnscript assessment report', - url: 'omniscript_assessment.html', + location: 'omniscript_assessment.html', }, { name: 'flexcard assessment report', - url: 'flexcard_assessment.html', + location: 'flexcard_assessment.html', }, { name: 'Integration Procedure assessment report', - url: 'integration_procedure_assessment.html', + location: 'integration_procedure_assessment.html', }, { name: 'DataMapper assessment report', - url: 'datamapper_assessment.html', + location: 'datamapper_assessment.html', }, { name: 'Apex assessment report', - url: 'apex_assessment.html', + location: 'apex_assessment.html', }, { name: 'LWC assessment report', - url: 'lwc_assessment.html', + location: 'lwc_assessment.html', }, ]; await this.createMasterDocument(nameUrls, basePath); } - private static async createMasterDocument(reports: nameUrl[], basePath: string): Promise { + private static async createMasterDocument(reports: nameLocation[], basePath: string): Promise { let listBody = ''; for (const report of reports) { listBody += `
  • - ${report.name} + ${report.name}
  • `; } const body = ` @@ -165,88 +165,42 @@ export class AssessmentReporter { return this.getApexAssessmentReport(tableBody); } + private static getApexAssessmentReport(tableContent: string): string { + const tableBody = ` +
    + + + + + + + + + + + + ${tableContent} + +
    +
    Name
    +
    +
    File reference
    +
    +
    Diff
    +
    +
    Comments
    +
    +
    Errors
    +
    +
    `; + return tableBody; + } private static generateOmniAssesment(omniAssessmentInfo: OmniAssessmentInfo, instanceUrl: string): string { let htmlBody = ''; - - // htmlBody += '
    ' + this.generateLwcAssesment(result.lwcAssessmentInfos); - htmlBody += '
    ' + this.generateOSAssesment(omniAssessmentInfo.osAssessmentInfos, instanceUrl); - // htmlBody += '
    ' + this.generateIPAssesment(omniAssessmentInfo.ipAssessmentInfos, instanceUrl); + htmlBody += '
    ' + OSAssesmentReporter.generateOSAssesment(omniAssessmentInfo.osAssessmentInfos, instanceUrl); return htmlBody; } - private static generateOSAssesment(osAssessmentInfos: OSAssessmentInfo[], instanceUrl: string): string { - let tableBody = ''; - tableBody += '
    Omniscript Components Assessment
    '; - - for (const osAssessmentInfo of osAssessmentInfos) { - const row = ` - - -
    ${osAssessmentInfo.name}
    - - - - - -
    ${osAssessmentInfo.dependenciesOS}
    - - - -
    ${osAssessmentInfo.dependenciesIP}
    - - - -
    ${osAssessmentInfo.dependenciesDR}
    - - - -
    ${osAssessmentInfo.dependenciesRemoteAction}
    - - `; - tableBody += row; - } - - return this.getOSAssessmentReport(tableBody); - } - - private static generateIPAssesment(ipAssessmentInfos: IPAssessmentInfo[], instanceUrl: string): string { - let tableBody = ''; - tableBody += '
    Integration Procedure Components Assessment
    '; - - for (const ipAssessmentInfo of ipAssessmentInfos) { - const row = ` - - -
    ${ipAssessmentInfo.name}
    - - -
    - - - -
    ${ipAssessmentInfo.dependenciesIP}
    - - -
    ${ipAssessmentInfo.dependenciesDR}
    - - -
    ${ipAssessmentInfo.dependenciesRemoteAction}
    - - `; - tableBody += row; - } - - return this.getIPAssessmentReport(tableBody); - } - private static generateCardAssesment(flexCardAssessmentInfos: FlexCardAssessmentInfo[], instanceUrl: string): string { let tableBody = ''; tableBody += '
    Flexcard Components Assessment
    '; @@ -319,114 +273,6 @@ export class AssessmentReporter { return document; } - private static getApexAssessmentReport(tableContent: string): string { - const tableBody = ` -
    - - - - - - - - - - - - ${tableContent} - -
    -
    Name
    -
    -
    File reference
    -
    -
    Diff
    -
    -
    Comments
    -
    -
    Errors
    -
    -
    `; - return tableBody; - } - - private static getOSAssessmentReport(tableContent: string): string { - const tableBody = ` -
    - - - - - - - - - - - - - - - - ${tableContent} - -
    -
    Name
    -
    -
    ID
    -
    -
    Omniscript Dependencies
    -
    -
    Integration Procedures Dependencies
    -
    -
    Data Raptor Dependencies
    -
    -
    Remote Action dependencies
    -
    -
    `; - return tableBody; - } - - private static getIPAssessmentReport(tableContent: string): string { - const tableBody = ` -
    - - - - - - - - - - - - - ${tableContent} - -
    -
    Name
    -
    -
    ID
    -
    -
    Integration Procedures Dependencies
    -
    -
    Data Raptor dependencies
    -
    -
    Remote Action Dependencies
    -
    -
    `; - return tableBody; - } - private static getCardAssessmentReport(tableContent: string): string { const tableBody = `
    diff --git a/src/utils/resultsbuilder/reportingHelper.ts b/src/utils/resultsbuilder/reportingHelper.ts new file mode 100644 index 00000000..d478f7f2 --- /dev/null +++ b/src/utils/resultsbuilder/reportingHelper.ts @@ -0,0 +1,21 @@ +import { nameLocation } from '../interfaces'; + +export class reportingHelper { + public static decorate(nameLocations: nameLocation[]): string { + let htmlContent = '
      '; + for (const nameLoc of nameLocations) { + htmlContent += `
    • ${nameLoc.name}
    • `; + } + htmlContent += '
    '; + return htmlContent; + } + + public static convertToBuletedList(messages: string[]): string { + let htmlContent = '
      '; + for (const msg of messages) { + htmlContent += `
    • ${msg}
    • `; + } + htmlContent += '
    '; + return htmlContent; + } +}