Skip to content

Commit 38d3b3c

Browse files
authored
Merge pull request #400 from snehaljha-sf/mvp_backport
GA backport to MVP
2 parents 7537a5b + a29ae49 commit 38d3b3c

File tree

11 files changed

+773
-58
lines changed

11 files changed

+773
-58
lines changed

messages/assess.json

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
"couldNotTruncate": "Could not truncate %s",
1818
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
1919
"invalidNameTypeSubtypeOrLanguage": "Not a valid Name, Type, SubType or Language",
20-
"invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same OmniScript",
20+
"invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same Omniscript",
2121
"invalidDataRaptorName": "Invalid name, can not have special characters",
22-
"duplicatedCardName": "Duplicated Flex Card name",
23-
"duplicatedDrName": "Duplicated DataMapper name",
24-
"duplicatedOSName": "Duplicated OmniScript name",
22+
"duplicatedCardName": "Duplicated Flexcard name",
23+
"duplicatedDrName": "Duplicated Data Mapper name",
24+
"duplicatedOSName": "Duplicated Omniscript name",
2525
"duplicatedName": "Duplicated name",
26-
"errorWhileActivatingOs": "Could not activate OmniScript / Integration Procedure: ",
26+
"errorWhileActivatingOs": "Could not activate Omniscript / Integration Procedure: ",
2727
"errorWhileActivatingCard": "Could not activate Card: ",
2828
"errorWhileUploadingCard": "An error ocurred while uploading Card: ",
29-
"errorWhileCreatingElements": "An error ocurred while saving OmniScript elements: ",
29+
"errorWhileCreatingElements": "An error ocurred while saving Omniscript elements: ",
3030
"allVersionsDescription": "Migrate all versions of a component",
3131
"changeMessage": " %s will be changed from %s to %s",
32-
"angularOSWarning": " Angular OmniScript will not be migrated, please convert this to LWC based Omniscript",
32+
"angularOSWarning": " Angular Omniscript will not be migrated, please convert this to LWC based Omniscript",
3333
"apexLwcGA": "Please select the type of component to assess: 'apex' for Apex classes, 'lwc' for Lightning Web Components, or 'apex,lwc' if you want to include both types.",
3434
"apexLwc": "Please select the type of component to assess: 'apex' for Apex classes.",
3535
"invalidNamespace": "The namespace you have passed is not valid namespace, the valid namespace of your org is ",
@@ -38,11 +38,11 @@
3838
"invalidRelatedObjectsOptionGA": "Invalid option provided for -r: %s. Valid options are apex, lwc.",
3939
"invalidRelatedObjectsOption": "Invalid option provided for -r: %s. Valid option is apex.",
4040
"formulaSyntaxError": "There was some problem while updating the formula syntax, please check the all the formula's syntax once : %s",
41-
"errorDuringFlexCardAssessment": "Error during FlexCard assessment",
42-
"errorDuringOmniScriptAssessment": "Error during OmniScript assessment",
43-
"processingFlexCard": "Processing FlexCard: %s",
44-
"processingDataRaptor": "Processing DataMapper: %s",
45-
"processingOmniScript": "Processing OmniScript: %s",
41+
"errorDuringFlexCardAssessment": "Error during Flexcards assessment",
42+
"errorDuringOmniScriptAssessment": "Error during Omniscript assessment",
43+
"processingFlexCard": "Processing Flexcards: %s",
44+
"processingDataRaptor": "Processing Data Mappers: %s",
45+
"processingOmniScript": "Processing Omniscripts: %s",
4646
"foundDataRaptorsToAssess": "Found %s Data Mappers to assess",
4747
"foundOmniScriptsToAssess": "Found %s %s to assess",
4848
"startingDataRaptorAssessment": "Starting Data Mappers assessment",
@@ -59,7 +59,7 @@
5959
"assessedFlexCardsCount": "Assessed %s Flexcards",
6060
"flexCardAssessmentCompleted": "Flexcards assessment completed",
6161
"omniScriptAssessment": "%s Assessment",
62-
"assessedOmniScriptsCount": "Assessed %s OmniScripts",
62+
"assessedOmniScriptsCount": "Assessed %s Omniscripts",
6363
"assessedIntegrationProceduresCount": "Assessed %s Integration Procedures",
6464
"omniScriptAssessmentCompleted": "%s assessment completed",
6565
"startingFlexCardAssessment": "Starting Flexcards assessment",
@@ -90,8 +90,8 @@
9090
"methodCallBundleNameUpdated": "Method call bundle name will be updated in %s for class %s method %s",
9191
"cardNameChangeMessage": "Card name will be changed from %s to %s to follow API naming standards",
9292
"authordNameChangeMessage": "Author name will be changed from %s to %s to follow API naming standards",
93-
"omniScriptNameChangeMessage": "OmniScript reference part %s will be changed to %s during migration.",
94-
"dataRaptorNameChangeMessage": "DataMapper reference %s will be changed to %s during migration.",
93+
"omniScriptNameChangeMessage": "Omniscript reference name %s will be changed to %s during migration.",
94+
"dataRaptorNameChangeMessage": "Data Mapper reference %s will be changed to %s during migration.",
9595
"integrationProcedureNameChangeMessage": "Integration Procedure reference %s will be changed to %s during migration.",
9696
"integrationProcedureManualUpdateMessage": "Integration Procedure reference %s may need manual updates after migration.",
9797
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name %s after name cleaning. This may cause conflicts during migration",
@@ -118,5 +118,10 @@
118118
"unexpectedError": "Unexpected Assessment error",
119119
"errorEvaluatingExpression": "Error evaluating expression: %s, %s",
120120
"invalidTypeAssessErrorMessage": "We couldn't assess your Omnistudio components in the %s namespace. Select the correct namespace and try again",
121-
"assessmentSuccessfulMessage": "Migration assessment for org %s is complete and reports are ready for review in the folder %s"
121+
"assessmentSuccessfulMessage": "Migration assessment for org %s is complete and reports are ready for review in the folder %s",
122+
"inApexIpNameWillBeUpdated": "In Apex %s IP name %s will be updated to %s",
123+
"inApexVariableAssignmentWillBeUpdated": "In Apex %s variable assignment %s = '%s' will be updated to %s",
124+
"varDeclarationUpdated": "Variable initialization will be updated for target name",
125+
"ipNameUpdateFailed": "IP reference %s can’t be updated",
126+
"dmNameUpdateFailed": "DM reference %s can’t be updated"
122127
}

messages/migrate.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
"couldNotTruncate": "Could not truncate %s",
1818
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
1919
"invalidNameTypeSubtypeOrLanguage": "Not a valid Name, Type, SubType or Language",
20-
"invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same OmniScript",
20+
"invalidOrRepeatingOmniscriptElementNames": "Invalid or Repeating Element Names for Same Omniscript",
2121
"invalidDataRaptorName": "Invalid name, can not have special characters",
22-
"duplicatedCardName": "Duplicated Flex Card name",
23-
"duplicatedDrName": "Duplicated DataMapper name",
24-
"duplicatedOSName": "Duplicated OmniScript name",
25-
"errorWhileActivatingOs": "Could not activate OmniScript / Integration Procedure: ",
22+
"duplicatedCardName": "Duplicated Flexcard name",
23+
"duplicatedDrName": "Duplicated Data Mapper name",
24+
"duplicatedOSName": "Duplicated Omniscript name",
25+
"errorWhileActivatingOs": "Could not activate Omniscript / Integration Procedure: ",
2626
"errorWhileActivatingCard": "Could not activate Card: ",
2727
"errorWhileUploadingCard": "An error ocurred while uploading Card: ",
28-
"errorWhileCreatingElements": "An error ocurred while saving OmniScript elements: ",
28+
"errorWhileCreatingElements": "An error ocurred while saving Omniscript elements: ",
2929
"allVersionsDescription": "Migrate all versions of a component",
3030
"apexLwcGA": "Please select the type of components to migrate: 'apex' for Apex classes, 'lwc' for Lightning Web Components, or 'apex,lwc' if you want to include both types.",
3131
"apexLwc": "Please select the type of components to migrate: 'apex' for Apex classes.",
@@ -63,8 +63,8 @@
6363
"migratingComponent": "Migrating: %s",
6464
"migrationCompleted": "Migration completed: %s",
6565
"formulaSyntaxError": "There was some problem while updating the formula syntax, please check the all the formula's syntax once : %s",
66-
"foundDataRaptorsToMigrate": "Found %s DataMappers to migrate",
67-
"foundFlexCardsToMigrate": "Found %s FlexCards to migrate",
66+
"foundDataRaptorsToMigrate": "Found %s Data Mappers to migrate",
67+
"foundFlexCardsToMigrate": "Found %s Flexcards to migrate",
6868
"foundOmniScriptsToMigrate": "Found %s %s to migrate",
6969
"allVersionsInfo": "allVersions : %s",
7070
"migrationInitialization": "Migration Initialization: Using namespace: %s",
@@ -92,13 +92,13 @@
9292
"packageSelectionPrompt": "Enter the number of the package to use (1-%s):",
9393
"invalidPackageSelection": "Invalid selection. Please enter a number between 1 and %s.",
9494
"selectedPackage": "Selected package: %s (Version: %s)",
95-
"dataRaptorNameChangeMessage": "DataMapper reference %s will be changed to %s during migration.",
95+
"dataRaptorNameChangeMessage": "Data Mapper reference %s will be changed to %s during migration.",
9696
"integrationProcedureNameChangeMessage": "Integration Procedure reference %s will be changed to %s during migration.",
9797
"integrationProcedureManualUpdateMessage": "Integration Procedure reference %s may need manual updates after migration.",
9898
"cardAuthorNameChangeMessage": "Card author name has been modified to fit naming rules: %s",
9999
"cardNameChangeMessage": "Card name has been modified to fit naming rules: %s",
100100
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name %s after name cleaning. This may cause conflicts during migration",
101-
"angularOmniscriptWarningMessage": " Angular OmniScript will not be migrated, please convert this to LWC based Omniscript",
101+
"angularOmniscriptWarningMessage": " Angular Omniscript will not be migrated, please convert this to LWC based Omniscript",
102102
"apexFileChangesApplied": "Applied changes to Apex class %s",
103103
"generatingComponentReports": "Generating report for components",
104104
"generatingRelatedObjectReports": "Generating report for related objects",
@@ -115,5 +115,6 @@
115115
"migrationConsentMessage": "Make sure that all records listed in the Assessment Status column in the Assessment Report are marked as Ready for migration before proceeding with the migration. Do you want to proceed? Yes or No?",
116116
"truncationFailed": "Truncation failed for %s: %s",
117117
"invalidTypeMigrateErrorMessage": "We couldn't migrate your Omnistudio components in the %s namespace. Select the correct namespace and try again",
118-
"migrationSuccessfulMessage": "Migration process for org %s is complete and reports are ready for review in the folder %s"
118+
"migrationSuccessfulMessage": "Migration process for org %s is complete and reports are ready for review in the folder %s",
119+
"varDeclarationUpdated": "Variable initialization has been updated for target name"
119120
}

src/migration/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Stringutil } from '../utils/StringValue/stringutil';
77
import { Logger } from '../utils/logger';
88
import { TransformData, UploadRecordResult } from './interfaces';
99

10-
export type ComponentType = 'DataMappers' | 'Flexcards' | 'Omniscripts' | 'Integration Procedures';
10+
export type ComponentType = 'Data Mappers' | 'Flexcards' | 'Omniscripts' | 'Integration Procedures';
1111

1212
/**
1313
* Creates a progress bar for migration/assessment operations

src/migration/dataraptor.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
3232
static readonly OMNIDATATRANSFORMITEM_NAME = 'OmniDataTransformItem';
3333

3434
getName(): string {
35-
return 'DataMappers';
35+
return 'Data Mappers';
3636
}
3737

3838
getRecordName(record: string) {
@@ -101,7 +101,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
101101
(dr) => dr[this.namespacePrefix + 'Type__c'] !== 'Migration'
102102
).length;
103103
Logger.log(this.messages.getMessage('foundDataRaptorsToMigrate', [nonMigrationDataRaptors]));
104-
const progressBar = createProgressBar('Migrating', 'DataMappers');
104+
const progressBar = createProgressBar('Migrating', 'Data Mappers');
105105
progressBar.start(nonMigrationDataRaptors, progressCounter);
106106
for (let dr of dataRaptors) {
107107
// Skip if Type is "Migration"
@@ -193,7 +193,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
193193
progressBar.stop();
194194

195195
return {
196-
name: 'Data Mapper',
196+
name: 'Data Mappers',
197197
results: drUploadInfo,
198198
records: originalDrRecords,
199199
};
@@ -237,7 +237,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
237237
const existingDataRaptorNames = new Set<string>();
238238
const dataRaptorItemsMap = await this.getAllDRToItemsMap();
239239

240-
const progressBar = createProgressBar('Assessing', 'DataMappers');
240+
const progressBar = createProgressBar('Assessing', 'Data Mappers');
241241
let progressCounter = 0;
242242
let nonMigrationDataRaptors = dataRaptors.filter(
243243
(dr) => dr[this.namespacePrefix + 'Type__c'] !== 'Migration'

src/migration/related/ApexMigration.ts

Lines changed: 102 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,45 @@ export class ApexMigration extends BaseRelatedObjectMigration {
130130
parser.parse();
131131
const tokenUpdates: TokenUpdater[] = [];
132132
const tokenUpdatesForRemoteCalls = this.processApexFileForRemotecalls(file, parser);
133-
const tokeUpdatesForMethodCalls = this.processApexFileForMethodCalls(file, parser);
133+
const ipNameUpdateFailed = new Set<string>();
134+
const dmNameUpdateFailed = new Set<string>();
135+
const tokenUpdatesForMethodCalls = this.processApexFileForMethodCalls(file, parser, ipNameUpdateFailed);
136+
const tokenUpdatesForSimpleVarDeclarations = this.processApexFileForSimpleVarDeclarations(
137+
parser,
138+
ipNameUpdateFailed,
139+
dmNameUpdateFailed
140+
);
134141
const updateMessages: string[] = [];
135142

136143
if (tokenUpdatesForRemoteCalls && tokenUpdatesForRemoteCalls.length > 0) {
137144
tokenUpdates.push(...tokenUpdatesForRemoteCalls);
138145
updateMessages.push(assessMessages.getMessage('fileUpdatedToAllowRemoteCalls'));
139146
}
140-
if (tokeUpdatesForMethodCalls && tokeUpdatesForMethodCalls.length > 0) {
147+
if (tokenUpdatesForMethodCalls && tokenUpdatesForMethodCalls.length > 0) {
141148
updateMessages.push(assessMessages.getMessage('fileUpdatedToAllowCalls'));
142-
tokenUpdates.push(...tokeUpdatesForMethodCalls);
149+
tokenUpdates.push(...tokenUpdatesForMethodCalls);
150+
}
151+
152+
if (tokenUpdatesForSimpleVarDeclarations && tokenUpdatesForSimpleVarDeclarations.length > 0) {
153+
if (type === 'migration') {
154+
updateMessages.push(migrateMessages.getMessage('varDeclarationUpdated'));
155+
} else {
156+
updateMessages.push(assessMessages.getMessage('varDeclarationUpdated'));
157+
}
158+
tokenUpdates.push(...tokenUpdatesForSimpleVarDeclarations);
159+
}
160+
161+
const warnings: string[] = [];
162+
163+
if (ipNameUpdateFailed.size > 0) {
164+
ipNameUpdateFailed.forEach((name) => {
165+
warnings.push(assessMessages.getMessage('ipNameUpdateFailed', [name]));
166+
});
167+
}
168+
if (dmNameUpdateFailed.size > 0) {
169+
dmNameUpdateFailed.forEach((name) => {
170+
warnings.push(assessMessages.getMessage('dmNameUpdateFailed', [name]));
171+
});
143172
}
144173
let difference = [];
145174
if (tokenUpdates && tokenUpdates.length > 0) {
@@ -156,11 +185,11 @@ export class ApexMigration extends BaseRelatedObjectMigration {
156185
if (updateMessages.length === 0) {
157186
Logger.info(assessMessages.getMessage('fileNoOmnistudioCalls', [file.name]));
158187
}
159-
const warningMessage: string[] = this.processNonReplacableMethodCalls(file, parser);
188+
warnings.push(...this.processNonReplacableMethodCalls(file, parser));
160189
return {
161190
name: file.name,
162191
errors: [],
163-
warnings: warningMessage,
192+
warnings,
164193
infos: updateMessages,
165194
path: file.location,
166195
diff: JSON.stringify(difference),
@@ -247,7 +276,11 @@ export class ApexMigration extends BaseRelatedObjectMigration {
247276
return tokenUpdates;
248277
}
249278

250-
private processApexFileForMethodCalls(file: File, parser: ApexASTParser): TokenUpdater[] {
279+
private processApexFileForMethodCalls(
280+
file: File,
281+
parser: ApexASTParser,
282+
ipNameUpdateFailed: Set<string>
283+
): TokenUpdater[] {
251284
const namespaceChanges = parser.namespaceChanges;
252285
const tokenUpdates: TokenUpdater[] = [];
253286
if (namespaceChanges && namespaceChanges.has(this.namespace)) {
@@ -267,6 +300,24 @@ export class ApexMigration extends BaseRelatedObjectMigration {
267300
tokenUpdates.push(new SingleTokenUpdate(newName, token));
268301
}
269302
}
303+
304+
const ipParameters = methodParameters.get(ParameterType.IP_NAME);
305+
if (ipParameters) {
306+
for (const token of ipParameters) {
307+
const oldName = token.text;
308+
const parts = oldName.split('_');
309+
if (parts.length !== 2) {
310+
ipNameUpdateFailed.add(oldName);
311+
continue;
312+
}
313+
const newName = `'${parts.map((p) => Stringutil.cleanName(p)).join('_')}'`;
314+
if (newName === oldName) {
315+
continue;
316+
}
317+
Logger.info(assessMessages.getMessage('inApexIpNameWillBeUpdated', [file.name, oldName, newName]));
318+
tokenUpdates.push(new SingleTokenUpdate(newName, token));
319+
}
320+
}
270321
return tokenUpdates;
271322
}
272323

@@ -297,6 +348,51 @@ export class ApexMigration extends BaseRelatedObjectMigration {
297348
}
298349
`;
299350
}
351+
352+
private processApexFileForSimpleVarDeclarations(
353+
parser: ApexASTParser,
354+
ipNameUpdateFailed: Set<string>,
355+
dmNameUpdateFailed: Set<string>
356+
): TokenUpdater[] {
357+
const simpleVarDeclarations = parser.simpleVarDeclarations;
358+
const tokenUpdates: TokenUpdater[] = [];
359+
// check and update for DM
360+
const dmVarInMethodCalls = parser.dmVarInMethodCalls;
361+
for (const varName of dmVarInMethodCalls) {
362+
const varToken = simpleVarDeclarations.get(varName);
363+
if (!varToken) {
364+
dmNameUpdateFailed.add(varName);
365+
continue;
366+
}
367+
const newName = `'${Stringutil.cleanName(varToken.text.substring(1, varToken.text.length - 1))}'`;
368+
if (newName === varToken.text) {
369+
continue;
370+
}
371+
tokenUpdates.push(new SingleTokenUpdate(newName, varToken));
372+
}
373+
// check and update for IP
374+
const ipVarInMethodCalls = parser.ipVarInMethodCalls;
375+
for (const varName of ipVarInMethodCalls) {
376+
const varToken = simpleVarDeclarations.get(varName);
377+
if (!varToken) {
378+
ipNameUpdateFailed.add(varName);
379+
continue;
380+
}
381+
const oldName = varToken.text.substring(1, varToken.text.length - 1);
382+
const parts = oldName.split('_');
383+
if (parts.length !== 2) {
384+
ipNameUpdateFailed.add(varName);
385+
continue;
386+
}
387+
const newName = `'${parts.map((p) => Stringutil.cleanName(p)).join('_')}'`;
388+
if (newName === varToken.text) {
389+
continue;
390+
}
391+
tokenUpdates.push(new SingleTokenUpdate(newName, varToken));
392+
}
393+
394+
return tokenUpdates;
395+
}
300396
/*
301397
private mapTOName(apexAssessmentInfos: ApexAssessmentInfo[]): string[] {
302398
return apexAssessmentInfos.map((apexAssessmentInfo) => {

src/styles/reportGenerator.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ html {
265265
position: relative;
266266
overflow-y: auto;
267267
overflow-x: auto;
268+
display: flex;
269+
flex-direction: column;
268270
}
269271

270272
.closeButton {
@@ -280,6 +282,8 @@ html {
280282
align-items: center;
281283
justify-content: center;
282284
z-index: 1050;
285+
border-radius: 3px;
286+
padding-right: 0;
283287
}
284288

285289
.modalHeader {
@@ -291,6 +295,11 @@ html {
291295
}
292296

293297
.modalContent {
298+
overflow: auto;
299+
}
300+
301+
.modalContent p {
302+
margin: 0;
294303
margin-top: 20px;
295304
}
296305

@@ -393,7 +402,7 @@ html {
393402
display: flex;
394403
flex-direction: column;
395404
gap: 10px;
396-
height: 14rem;
405+
min-height: 14rem;
397406
min-width: 25rem;
398407
background-color: #fff;
399408
}

0 commit comments

Comments
 (0)