Skip to content

Commit e8908f2

Browse files
Merge pull request #439 from sf-aastha-paruthi/u/aparuthi/TestingIteration01Fix
@W-19821896 Testing fixes
2 parents 08dbecd + 61fbd5a commit e8908f2

File tree

11 files changed

+78
-43
lines changed

11 files changed

+78
-43
lines changed

src/commands/omnistudio/migration/migrate.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,14 @@ export default class Migrate extends OmniStudioBaseCommand {
180180
const debugTimer = DebugTimer.getInstance();
181181
// We need to truncate the standard objects first (in reverse order for cleanup)
182182
let objectMigrationResults;
183-
const IS_STANDARD_DATA_MODEL = isStandardDataModel();
184183

185-
if (!IS_STANDARD_DATA_MODEL) {
186-
objectMigrationResults = await this.truncateObjects([...migrationObjects].reverse(), debugTimer);
187-
const allTruncateComplete = objectMigrationResults.length === 0;
184+
objectMigrationResults = await this.truncateObjects([...migrationObjects].reverse(), debugTimer);
185+
const allTruncateComplete = objectMigrationResults.length === 0;
188186

189-
// Log truncation errors if any exist
190-
if (!allTruncateComplete) {
191-
this.logTruncationErrors(objectMigrationResults);
192-
return;
193-
}
187+
// Log truncation errors if any exist
188+
if (!allTruncateComplete) {
189+
this.logTruncationErrors(objectMigrationResults);
190+
return;
194191
}
195192

196193
objectMigrationResults = await this.migrateObjects(migrationObjects, debugTimer, namespace);

src/javascripts/reportGeneratorUtility.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ function applySingleColumnFreeze(table, headerCell, columnWidth = 180) {
318318
// Default to 180px for Custom Labels, but can be overridden for other reports
319319

320320
// Apply styles to first header cell
321-
applyStickyStyles(headerCell, columnWidth, 0, 20, '#f3f3f3', true);
321+
applyStickyStyles(headerCell, columnWidth, 0, 50, '#f3f3f3', true);
322322

323323
// Ensure all other header cells in both rows are NOT sticky
324324
const thead = table.querySelector('thead');
@@ -336,17 +336,19 @@ function applySingleColumnFreeze(table, headerCell, columnWidth = 180) {
336336
if (tbody) {
337337
const rows = tbody.querySelectorAll('tr');
338338
rows.forEach((row) => {
339-
const firstCell = row.querySelector('td:first-child');
339+
// Use key="name" selector to handle rowspan correctly
340+
const firstCell = row.querySelector('td[key="name"]');
340341
if (firstCell) {
341-
applyStickyStyles(firstCell, columnWidth, 0, 10, '#fff', true);
342+
applyStickyStyles(firstCell, columnWidth, 0, 30, '#fff', true);
342343
}
343344
});
344345

345346
// Ensure all other columns are NOT sticky
346347
rows.forEach((row) => {
347348
const cells = Array.from(row.querySelectorAll('td'));
348-
cells.forEach((cell, index) => {
349-
if (index > 0) {
349+
cells.forEach((cell) => {
350+
// Remove sticky from any cell that's NOT the name column
351+
if (cell.getAttribute('key') !== 'name') {
350352
removeStickyStyles(cell);
351353
}
352354
});
@@ -355,14 +357,14 @@ function applySingleColumnFreeze(table, headerCell, columnWidth = 180) {
355357
// Add hover effect for first column
356358
rows.forEach((row) => {
357359
row.addEventListener('mouseenter', () => {
358-
const firstCell = row.querySelector('td:first-child');
360+
const firstCell = row.querySelector('td[key="name"]');
359361
if (firstCell) {
360362
firstCell.style.setProperty('background-color', '#f3f3f3', 'important');
361363
}
362364
});
363365

364366
row.addEventListener('mouseleave', () => {
365-
const firstCell = row.querySelector('td:first-child');
367+
const firstCell = row.querySelector('td[key="name"]');
366368
if (firstCell) {
367369
firstCell.style.setProperty('background-color', '#fff', 'important');
368370
}
@@ -419,7 +421,7 @@ function applyMultiColumnHeaderFreeze(firstHeaderCell, secondRow, colspan, baseC
419421
// Freeze this column
420422
const columnWidth = i === 0 ? firstColumnWidth : baseColumnWidth;
421423
const isLastFrozen = i === colspan - 1;
422-
applyStickyStyles(header, columnWidth, cumulativeLeft, 20, '#f3f3f3', isLastFrozen);
424+
applyStickyStyles(header, columnWidth, cumulativeLeft, 50, '#f3f3f3', isLastFrozen);
423425
cumulativeLeft += columnWidth;
424426
} else {
425427
// Ensure non-frozen columns are NOT sticky
@@ -455,7 +457,7 @@ function applyMultiColumnBodyFreeze(tbody, colspan, baseColumnWidth, firstColumn
455457
// Freeze this column
456458
const columnWidth = i === 0 ? firstColumnWidth : baseColumnWidth;
457459
const isLastFrozen = i === colspan - 1;
458-
applyStickyStyles(cell, columnWidth, cumulativeLeft, 10, '#fff', isLastFrozen);
460+
applyStickyStyles(cell, columnWidth, cumulativeLeft, 30, '#fff', isLastFrozen);
459461
cumulativeLeft += columnWidth;
460462
} else {
461463
// Ensure non-frozen columns are NOT sticky

src/migration/dataraptor.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
5656
}
5757

5858
async truncate(): Promise<void> {
59+
if (this.IS_STANDARD_DATA_MODEL) {
60+
return;
61+
}
5962
await super.truncate(DataRaptorMigrationTool.OMNIDATATRANSFORM_NAME);
6063
}
6164

src/migration/flexcard.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
6464

6565
// Perform Delete of OmniUiCard Records to start migration from scratch
6666
async truncate(): Promise<void> {
67+
if (this.IS_STANDARD_DATA_MODEL) {
68+
return;
69+
}
6770
const objectName = CardMigrationTool.OMNIUICARD_NAME;
6871
DebugTimer.getInstance().lap('Truncating ' + objectName);
6972

src/migration/omniscript.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
118118
}
119119

120120
async truncate(): Promise<void> {
121+
// Truncation is needed when we migrate from custom to standard data model, when on custom data model, no truncation is required
122+
if (this.IS_STANDARD_DATA_MODEL) {
123+
return;
124+
}
125+
121126
const objectName = OmniScriptMigrationTool.OMNIPROCESS_NAME;
122127
const allIds = await this.deactivateRecord(objectName);
123128
await this.truncateElements(objectName, allIds.os.parents);

src/styles/reportGenerator.css

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,13 @@ body {
322322

323323
.expandModalButton {
324324
position: absolute;
325-
top: 5px;
326-
right: 1.5rem;
325+
top: 8px;
326+
right: 8px;
327327
width: 30px;
328328
height: 30px;
329329
opacity: 0.7;
330330
display: none;
331+
z-index: 10;
331332
}
332333

333334
.report-wrapper {
@@ -601,9 +602,18 @@ td {
601602

602603
.diff-cell {
603604
min-width: 30rem;
605+
max-width: none !important;
606+
padding: 0 !important;
607+
overflow: visible !important;
604608
}
605609

606-
.diff-cell:hover .expandModalButton {
610+
.diff-content-wrapper {
611+
position: relative;
612+
display: block;
613+
width: 100%;
614+
}
615+
616+
.diff-content-wrapper:hover .expandModalButton {
607617
display: block;
608618
}
609619

src/utils/lwcparser/fileutils/FileDiffUtil.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export class FileDiffUtil {
1212
return '';
1313
}
1414
const diffArray: DiffPair[] = JSON.parse(diff) as DiffPair[];
15-
let result = '<div style="height: 120px; text-align: left; overflow-x: auto;">';
15+
// Wrap everything in a positioned container so button positions correctly within table cell
16+
let result = '<div class="diff-content-wrapper">';
17+
result += '<div style="height: 120px; text-align: left; overflow-x: auto; padding: 0.5rem;">';
1618
if (diffArray.length <= 6) {
1719
result += this.getDiffContent(diff) + '</div>';
1820
} else {
@@ -30,6 +32,7 @@ export class FileDiffUtil {
3032
</div>
3133
</div>`;
3234
}
35+
result += '</div>'; // Close diff-content-wrapper
3336
return result;
3437
}
3538

src/utils/resultsbuilder/CustomLabelMigrationReporter.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ export class CustomLabelMigrationReporter {
7575
}
7676

7777
public static generateCustomTemplateForPage(page: number, totalPages: number): string {
78+
// Don't show pagination if there's only 1 page
79+
if (totalPages === 1) {
80+
return '';
81+
}
82+
7883
// Calculate the range of pages to show around current page
7984
const range = 2; // Show 2 pages on each side of current page
8085
const start = Math.max(2, page - range);

src/utils/resultsbuilder/assessmentReporter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ export class AssessmentReporter {
305305
): void {
306306
const pageSize = 1000;
307307
const totalLabels = customLabels.length;
308-
const totalPages = Math.ceil(totalLabels / pageSize);
308+
// Always generate at least 1 page, even if there are no labels with issues
309+
const totalPages = Math.max(1, Math.ceil(totalLabels / pageSize));
309310

310311
// Generate paginated reports
311312
for (let page = 1; page <= totalPages; page++) {
@@ -333,7 +334,8 @@ export class AssessmentReporter {
333334

334335
private static getCustomLabelAssessmentFileName(totalLabels: number): string {
335336
const pageSize = 1000;
336-
const totalPages = Math.ceil(totalLabels / pageSize);
337+
// Always generate at least 1 page, even if there are no labels with issues
338+
const totalPages = Math.max(1, Math.ceil(totalLabels / pageSize));
337339
return totalPages > 1 ? `customlabel_assessment_Page_1_of_${totalPages}.html` : this.customLabelAssessmentFileName;
338340
}
339341

src/utils/resultsbuilder/index.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,14 @@ export class ResultsBuilder {
113113
// Determine which rollback flag to use based on component type
114114
let rollbackFlagNames: string[] = [];
115115
const componentName = result.name.toLowerCase();
116+
const isGlobalAutoNumber =
117+
componentName.includes('global auto number') || componentName.includes('globalautonumber');
118+
116119
if (componentName.includes('datamapper') || componentName.includes('data mapper')) {
117120
rollbackFlagNames = ['RollbackDRChanges'];
118121
} else if (componentName.includes('omniscript') || componentName.includes('integration procedure')) {
119122
rollbackFlagNames = ['RollbackOSChanges', 'RollbackIPChanges'];
120-
} else if (componentName.includes('global auto number') || componentName.includes('globalautonumber')) {
123+
} else if (isGlobalAutoNumber) {
121124
rollbackFlagNames = ['RollbackDRChanges', 'RollbackIPChanges'];
122125
}
123126
const rollbackFlags = orgDetails.rollbackFlags || [];
@@ -134,15 +137,15 @@ export class ResultsBuilder {
134137
assessmentDate: new Date().toLocaleString(),
135138
total: result.data?.length || 0,
136139
filterGroups: [...this.getStatusFilterGroup(result.data?.map((item) => item.status) || [])],
137-
headerGroups: [...this.getHeaderGroupsForReport(componentName)],
140+
headerGroups: [...this.getHeaderGroupsForReport(componentName, isGlobalAutoNumber)],
138141
rows: [
139142
...(result.data || []).map((item) => ({
140143
rowId: `${this.rowClass}${this.rowId++}`,
141144
data: [
142145
createRowDataParam('id', item.id, false, 1, 1, true, `${instanceUrl}/${item.id}`),
143146
createRowDataParam('name', item.name, true, 1, 1, false),
144-
// Only include migratedId for custom data model
145-
...(isStandardDataModel()
147+
// Include migratedId for custom data model OR Global Auto Number
148+
...(isStandardDataModel() && !isGlobalAutoNumber
146149
? []
147150
: [
148151
createRowDataParam(
@@ -198,9 +201,12 @@ export class ResultsBuilder {
198201
fs.writeFileSync(path.join(resultsDir, result.name.replace(/ /g, '_').replace(/\//g, '_') + '.html'), html);
199202
}
200203

201-
private static getHeaderGroupsForReport(componentName: string): ReportHeaderGroupParam[] {
204+
private static getHeaderGroupsForReport(
205+
componentName: string,
206+
isGlobalAutoNumber: boolean
207+
): ReportHeaderGroupParam[] {
202208
const firstRowHeaders = [
203-
...this.getNameHeaders(componentName),
209+
...this.getNameHeaders(componentName, isGlobalAutoNumber),
204210
{ name: 'Status', colspan: 1, rowspan: 2 },
205211
{ name: 'Errors', colspan: 1, rowspan: 2 },
206212
{ name: 'Summary', colspan: 1, rowspan: 2 },
@@ -221,19 +227,18 @@ export class ResultsBuilder {
221227
{ name: nameLabel, colspan: 1, rowspan: 1 },
222228
];
223229

224-
if (isStandardDataModel()) {
230+
// Global Auto Number always needs 4 columns (Managed Package + Standard), even in standard data model
231+
if (isStandardDataModel() && !isGlobalAutoNumber) {
225232
return [{ header: firstRowHeaders }, { header: secondRowHeadersForStandard }];
226233
} else {
227234
return [{ header: firstRowHeaders }, { header: secondRowHeadersForCustom }];
228235
}
229236
}
230237

231-
private static getNameHeaders(componentName: string): Array<{ name: string; colspan: number; rowspan: number }> {
232-
let isGlobalAutoNumber = false;
233-
if (componentName.includes('global auto number') || componentName.includes('globalautonumber')) {
234-
isGlobalAutoNumber = true;
235-
}
236-
238+
private static getNameHeaders(
239+
componentName: string,
240+
isGlobalAutoNumber: boolean
241+
): Array<{ name: string; colspan: number; rowspan: number }> {
237242
if (isStandardDataModel() && !isGlobalAutoNumber) {
238243
return [{ name: 'Standard', colspan: 3, rowspan: 1 }];
239244
} else {
@@ -287,7 +292,7 @@ export class ResultsBuilder {
287292

288293
const pageSize = 1000; // Smaller page size for better performance
289294
const totalLabels = customLabelMigrationInfos.length;
290-
const totalPages = Math.ceil(totalLabels / pageSize);
295+
const totalPages = Math.max(1, Math.ceil(totalLabels / pageSize));
291296

292297
Logger.logVerbose(messages.getMessage('generatingCustomLabelsReport', [totalLabels, totalPages, pageSize]));
293298

@@ -827,7 +832,7 @@ export class ResultsBuilder {
827832
const totalLabels = result.totalCount || result.data?.length || 0;
828833
// Use actual processed records for file naming, not total count
829834
const processedRecords = result.data?.length || 0;
830-
const totalPages = Math.ceil(processedRecords / 1000);
835+
const totalPages = Math.max(1, Math.ceil(processedRecords / 1000));
831836
const fileName = totalPages > 1 ? `Custom_Labels_Page_1_of_${totalPages}.html` : 'Custom_Labels.html';
832837

833838
return {

0 commit comments

Comments
 (0)