Skip to content

Commit 0cb898c

Browse files
fix: merge conflicts
2 parents 11e299c + 0ecc509 commit 0cb898c

File tree

10 files changed

+469
-183
lines changed

10 files changed

+469
-183
lines changed

src/commands/omnistudio/migration/assess.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export default class Assess extends OmniStudioBaseCommand {
104104
assesmentInfo.apexAssessmentInfos = relatedObjectAssessmentResult.apexAssessmentInfos;
105105
}
106106

107-
await AssessmentReporter.generate(assesmentInfo, conn.instanceUrl);
107+
await AssessmentReporter.generate(assesmentInfo, conn.instanceUrl, orgs);
108108
return assesmentInfo;
109109
}
110110

src/migration/omniscript.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,14 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
308308
: '') +
309309
`_${omniscript[this.namespacePrefix + 'Version__c']}`;
310310

311+
const oldName =
312+
`${existingTypeVal.val}_` +
313+
`${existingSubTypeVal.val}` +
314+
(omniscript[this.namespacePrefix + 'Language__c']
315+
? `_${omniscript[this.namespacePrefix + 'Language__c']}`
316+
: '') +
317+
`_${omniscript[this.namespacePrefix + 'Version__c']}`;
318+
311319
if (!existingTypeVal.isNameCleaned()) {
312320
warnings.push(
313321
this.messages.getMessage('changeMessage', [
@@ -343,12 +351,15 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
343351

344352
if (omniProcessType === 'OmniScript') {
345353
const type = omniscript[this.namespacePrefix + 'IsLwcEnabled__c'] ? 'LWC' : 'Angular';
354+
let migrationStatus = 'Can be Automated';
346355
if (type === 'Angular') {
347356
warnings.unshift(this.messages.getMessage('angularOSWarning'));
357+
migrationStatus = 'Need Manual Intervention';
348358
}
349359
const osAssessmentInfo: OSAssessmentInfo = {
350360
name: recordName,
351361
type: type,
362+
oldName: oldName,
352363
id: omniscript['Id'],
353364
dependenciesIP: dependencyIP,
354365
missingIP: [],
@@ -361,12 +372,14 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
361372
infos: [],
362373
warnings: warnings,
363374
errors: [],
375+
migrationStatus: migrationStatus,
364376
};
365377
osAssessmentInfos.push(osAssessmentInfo);
366378
} else {
367379
const ipAssessmentInfo: IPAssessmentInfo = {
368380
name: recordName,
369381
id: omniscript['Id'],
382+
oldName: oldName,
370383
dependenciesIP: dependencyIP,
371384
dependenciesDR: dependencyDR,
372385
dependenciesOS: dependencyOS,

src/styles/reportGenerator.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@
101101

102102
.slds-table td,
103103
.slds-table th {
104-
white-space: normal;
105104
position: relative;
106105
max-width: 250px;
106+
text-align: center;
107107
}
108108

109109
.slds-table--bordered,

src/utils/interfaces.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ export interface LWCAssessmentInfo {
2525
export interface OSAssessmentInfo {
2626
name: string;
2727
id: string;
28+
oldName: string;
2829
dependenciesIP: nameLocation[];
2930
missingIP: string[];
3031
dependenciesDR: nameLocation[];
3132
missingDR: string[];
33+
migrationStatus: string;
3234
dependenciesOS: nameLocation[];
3335
missingOS: string[];
3436
dependenciesRemoteAction: nameLocation[];
@@ -42,6 +44,7 @@ export interface OSAssessmentInfo {
4244
export interface IPAssessmentInfo {
4345
name: string;
4446
id: string;
47+
oldName: string;
4548
dependenciesIP: nameLocation[];
4649
dependenciesDR: nameLocation[];
4750
dependenciesOS: nameLocation[];

src/utils/orgUtils/index.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ interface InstalledPackage {
1010
Name: string;
1111
}
1212

13+
interface OrgDetails {
14+
Name: string;
15+
Id: string;
16+
}
17+
1318
export interface OmnistudioOrgDetails {
1419
packageDetails: PackageDetail[];
1520
omniStudioOrgPermissionEnabled: boolean;
21+
orgDetails: OrgDetails;
22+
dataModel: string;
1623
}
1724

1825
export interface PackageDetail {
@@ -260,6 +267,14 @@ export class OrgUtils {
260267
// Define the object name for querying installed packages
261268
private static readonly objectName = 'Publisher';
262269

270+
// Define the fields to retrieve from the Organization object
271+
private static readonly orgFields = ['Name'];
272+
273+
// Define the object name for querying installed packages
274+
private static readonly orgObjectName = 'Organization';
275+
276+
private static readonly standardDataModel = 'Standard';
277+
private static readonly customDataModel = 'Custom';
263278
/**
264279
* Fetches package details (version and namespace) for specific installed packages.
265280
*
@@ -269,7 +284,6 @@ export class OrgUtils {
269284
public static async getOrgDetails(connection: Connection, namespace: string): Promise<OmnistudioOrgDetails> {
270285
//Execute apex rest resource to get omnistudio org permission
271286
const omniStudioOrgPermissionEnabled: boolean = await this.isOmniStudioOrgPermissionEnabled(connection, namespace);
272-
273287
// Query all installed packages and cast the result to InstalledPackage[]
274288
const allInstalledPackages = (await QueryTools.queryAll(
275289
connection,
@@ -278,6 +292,13 @@ export class OrgUtils {
278292
this.fields
279293
)) as unknown as InstalledPackage[];
280294

295+
const orgDetails = (await QueryTools.queryAll(
296+
connection,
297+
'',
298+
this.orgObjectName,
299+
this.orgFields
300+
)) as unknown as OrgDetails;
301+
281302
const packageDetails: PackageDetail[] = allInstalledPackages
282303
// Filter packages to only include those with a namespace in the predefined list
283304
.filter((pkg) => this.namespaces.has(pkg.NamespacePrefix))
@@ -290,6 +311,8 @@ export class OrgUtils {
290311
return {
291312
packageDetails: packageDetails,
292313
omniStudioOrgPermissionEnabled: omniStudioOrgPermissionEnabled,
314+
orgDetails: orgDetails[0],
315+
dataModel: omniStudioOrgPermissionEnabled ? this.standardDataModel : this.customDataModel,
293316
};
294317
}
295318

src/utils/reportGenerator/reportGenerator.ts

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1-
import { Filter, ReportHeader, TableColumn, TableHeaderCell } from './reportInterfaces';
1+
import { Filter, HeaderColumn, ReportHeader, TableColumn, TableHeaderCell } from './reportInterfaces';
22

33
export function generateHtmlTable<T>(
4-
headerRows: TableHeaderCell[][],
4+
headerRows: HeaderColumn[],
55
columns: Array<TableColumn<T>>,
66
rows: T[],
77
reportHeader: ReportHeader[],
88
filters: Filter[] = [],
99
tableClass = 'slds-table slds-table_cell-buffer slds-table_bordered slds-table_striped slds-table_col-bordered',
1010
ariaLabel = ''
1111
): string {
12+
const transformedHeader: TableHeaderCell[][] = transform(headerRows);
13+
1214
const thead = `
1315
<thead>
14-
${headerRows
16+
${transformedHeader
1517
.map(
1618
(row) => `
1719
<tr>
1820
${row
19-
.map(
20-
(cell) => `
21-
<th
22-
${cell.colspan ? `colspan="${cell.colspan}"` : ''}
23-
${cell.rowspan ? `rowspan="${cell.rowspan}"` : ''}
24-
style="width:${cell?.width || 'auto'}"
25-
>
26-
<div class="filter-header">
27-
<span class="filter-label">${cell.label}</span>
28-
</div>
29-
</th>
30-
`
31-
)
21+
.map((cell: TableHeaderCell) => {
22+
const colspanAttr = cell.colspan ? `colspan="${cell.colspan}"` : '';
23+
const rowspanAttr = cell.rowspan ? `rowspan="${cell.rowspan}"` : '';
24+
const styleAttr = `style="${cell.styles ?? 'width:auto;'}"`;
25+
return `
26+
<th ${colspanAttr} ${rowspanAttr} ${styleAttr}>
27+
<div class="filter-header">
28+
<span class="filter-label">${cell.label}</span>
29+
</div>
30+
</th>
31+
`;
32+
})
3233
.join('')}
3334
</tr>
3435
`
@@ -58,7 +59,7 @@ export function generateHtmlTable<T>(
5859
oninput="filterAndSearchTable()"
5960
/>
6061
</div>
61-
62+
6263
<div class="filter-toggle-button" onclick="toggleFilterDropdown()">
6364
Filters
6465
<svg id="chevron-down" class="chevron-icon" xmlns="http://www.w3.org/2000/svg" width="10" height="10" fill="currentColor" viewBox="0 0 16 16">
@@ -118,8 +119,9 @@ export function generateHtmlTable<T>(
118119
const title: string = col.title ? col.title(row) : '';
119120
const value: string = col.filterValue(row).toString();
120121
const cellContent: string = col.cell(row);
122+
const style: string = col.styles ? col.styles(row) : '';
121123
const dataAttr: string = ['name', 'oldName'].includes(key) ? `data-name="${value.toLowerCase()}"` : '';
122-
return `<td ${dataAttr} title="${title}" key="${key}" value="${value}">${cellContent}</td>`;
124+
return `<td ${dataAttr} title="${title}" key="${key}" value="${value}" style="${style}">${cellContent}</td>`;
123125
})
124126
.join('')}
125127
</tr>
@@ -172,3 +174,35 @@ export function generateHtmlTable<T>(
172174
</div>
173175
`;
174176
}
177+
178+
function transform(columnInput): TableHeaderCell[][] {
179+
const row1 = [];
180+
const row2 = [];
181+
182+
columnInput.forEach((item) => {
183+
if (item.subColumn && item.subColumn.length > 0) {
184+
row1.push({
185+
label: item.label,
186+
colspan: item.subColumn.length,
187+
});
188+
189+
item.subColumn.forEach((sub) => {
190+
row2.push({
191+
label: sub.label,
192+
key: sub.key,
193+
});
194+
});
195+
} else {
196+
const row1Entry: TableHeaderCell = {
197+
label: item.label,
198+
};
199+
200+
if (item.rowspan) row1Entry.rowspan = Number(item.rowspan);
201+
if (item.key) row1Entry.key = item.key;
202+
203+
row1.push(row1Entry);
204+
}
205+
});
206+
207+
return [row1, row2] as unknown as TableHeaderCell[][];
208+
}
Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
export interface TableHeaderCell {
3-
label: string;
4-
colspan?: number;
5-
rowspan?: number;
6-
key: string;
7-
width?: string;
8-
}
9-
102
export interface TableColumn<T> {
113
key: string;
124
cell: any;
135
filterValue: any;
146
title?: any;
7+
styles?: any;
158
}
169

1710
export interface Filter {
@@ -24,3 +17,26 @@ export interface ReportHeader {
2417
key: string;
2518
value: string;
2619
}
20+
21+
export interface ReportHeaderFormat {
22+
key: string;
23+
value: string;
24+
}
25+
26+
export interface HeaderColumn {
27+
label: string;
28+
key?: string;
29+
colspan?: number;
30+
rowspan?: number;
31+
styles?: string;
32+
subColumn?: HeaderColumn[]; // Recursive definition
33+
}
34+
35+
export interface TableHeaderCell {
36+
label: string;
37+
colspan?: number;
38+
rowspan?: number;
39+
key?: string;
40+
width?: string;
41+
styles?: string;
42+
}

0 commit comments

Comments
 (0)