Skip to content

Commit bdb9e35

Browse files
committed
fix: build and lint issues
1 parent 6b16b89 commit bdb9e35

File tree

15 files changed

+596
-732
lines changed

15 files changed

+596
-732
lines changed

messages/migrate.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@
7979
"alreadyStandardModel": "The org is already on standard data model.",
8080
"cardAuthorNameChangeMessage": "Card author name has been modified to fit naming rules: {0}",
8181
"cardNameChangeMessage": "Card name has been modified to fit naming rules: {0}",
82-
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name {0} after name cleaning. This may cause conflicts during migration",
82+
"duplicateCardNameMessage": "Potential duplicate: Another card has the same name {0} after name cleaning. This may cause conflicts during migration"
8383
}

src/commands/omnistudio/migration/migrate.ts

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -142,48 +142,12 @@ export default class Migrate extends OmniStudioBaseCommand {
142142
migrationObjects = this.getMigrationObjects(migrateOnly, migrationObjects, namespace, conn, allVersions);
143143
// Migrate individual objects
144144
const debugTimer = DebugTimer.getInstance();
145-
let objectMigrationResults: MigratedObject[] = [];
146145
// We need to truncate the standard objects first
147-
let allTruncateComplete = true;
148-
for (const cls of migrationObjects.reverse()) {
149-
try {
150-
Logger.log(messages.getMessage('cleaningComponent', [cls.getName()]));
151-
debugTimer.lap('Cleaning: ' + cls.getName());
152-
await cls.truncate();
153-
Logger.log(messages.getMessage('cleaningDone', [cls.getName()]));
154-
} catch (ex: any) {
155-
allTruncateComplete = false;
156-
objectMigrationResults.push({
157-
name: cls.getName(),
158-
errors: [ex.message],
159-
});
160-
}
161-
}
146+
let objectMigrationResults = await this.truncateObjects(migrationObjects, debugTimer);
147+
const allTruncateComplete = objectMigrationResults.length === 0;
162148

163149
if (allTruncateComplete) {
164-
for (const cls of migrationObjects.reverse()) {
165-
try {
166-
Logger.log(messages.getMessage('migratingComponent', [cls.getName()]));
167-
debugTimer.lap('Migrating: ' + cls.getName());
168-
const results = await cls.migrate();
169-
Logger.log(messages.getMessage('migrationCompleted', [cls.getName()]));
170-
objectMigrationResults = objectMigrationResults.concat(
171-
results.map((r) => {
172-
return {
173-
name: r.name,
174-
data: this.mergeRecordAndUploadResults(r, cls),
175-
};
176-
})
177-
);
178-
} catch (ex: any) {
179-
Logger.error(JSON.stringify(ex));
180-
Logger.error(ex.stack);
181-
objectMigrationResults.push({
182-
name: cls.getName(),
183-
errors: [ex.message],
184-
});
185-
}
186-
}
150+
objectMigrationResults = await this.migrateObjects(migrationObjects, debugTimer);
187151
}
188152

189153
// Stop the debug timer
@@ -212,6 +176,52 @@ export default class Migrate extends OmniStudioBaseCommand {
212176
return { objectMigrationResults };
213177
}
214178

179+
private async truncateObjects(migrationObjects: MigrationTool[], debugTimer: DebugTimer): Promise<MigratedObject[]> {
180+
const objectMigrationResults: MigratedObject[] = [];
181+
for (const cls of migrationObjects.reverse()) {
182+
try {
183+
Logger.log(messages.getMessage('cleaningComponent', [cls.getName()]));
184+
debugTimer.lap('Cleaning: ' + cls.getName());
185+
await cls.truncate();
186+
Logger.log(messages.getMessage('cleaningDone', [cls.getName()]));
187+
} catch (ex: any) {
188+
objectMigrationResults.push({
189+
name: cls.getName(),
190+
errors: [ex.message],
191+
});
192+
}
193+
}
194+
return objectMigrationResults;
195+
}
196+
197+
private async migrateObjects(migrationObjects: MigrationTool[], debugTimer: DebugTimer): Promise<MigratedObject[]> {
198+
let objectMigrationResults: MigratedObject[] = [];
199+
for (const cls of migrationObjects.reverse()) {
200+
try {
201+
Logger.log(messages.getMessage('migratingComponent', [cls.getName()]));
202+
debugTimer.lap('Migrating: ' + cls.getName());
203+
const results = await cls.migrate();
204+
Logger.log(messages.getMessage('migrationCompleted', [cls.getName()]));
205+
objectMigrationResults = objectMigrationResults.concat(
206+
results.map((r) => {
207+
return {
208+
name: r.name,
209+
data: this.mergeRecordAndUploadResults(r, cls),
210+
};
211+
})
212+
);
213+
} catch (ex: any) {
214+
Logger.error(JSON.stringify(ex));
215+
Logger.error(ex.stack);
216+
objectMigrationResults.push({
217+
name: cls.getName(),
218+
errors: [ex.message],
219+
});
220+
}
221+
}
222+
return objectMigrationResults;
223+
}
224+
215225
private getMigrationObjects(
216226
migrateOnly: string,
217227
migrationObjects: MigrationTool[],

src/migration/related/ApexMigration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ export class ApexMigration extends BaseRelatedObjectMigration {
107107
} catch (err) {
108108
Logger.error(assessMessages.getMessage('errorProcessingApexFile', [file.name]));
109109
Logger.error(JSON.stringify(err));
110-
Logger.error(err.stack);
110+
if (err instanceof Error) {
111+
Logger.error(err.stack);
112+
}
111113
}
112114
Logger.logVerbose(assessMessages.getMessage('successfullyProcessedApexFile', [file.name]));
113115
}
Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
<html>
2+
3+
<head>
4+
<title>{{title}}</title>
5+
<link rel="stylesheet"
6+
href="https://cdnjs.cloudflare.com/ajax/libs/design-system/2.17.5/styles/salesforce-lightning-design-system.min.css" />
7+
<script src="./reportGeneratorUtility.js" defer></script>
8+
<link rel="stylesheet" href="./reportGenerator.css" />
9+
</head>
10+
11+
<body>
12+
<div style="margin: 20px">
13+
<div class="report-wrapper">
14+
<div id="scrollable-wrapper" class="scrollable-wrapper">
15+
<div class="table-summary-wrapper rpt-table-container" id="report-table">
16+
<div class="report-page-header">
17+
<div class="slds-text-heading_large">
18+
<span>{{heading}}</span>
19+
<span>&nbsp;Assessment Report</span>
20+
</div>
21+
</div>
22+
23+
<div class="migration-message">
24+
<svg fill="#8c4c00" width="20px" height="20px" viewBox="-3.2 -3.2 38.40 38.40"
25+
xmlns="http://www.w3.org/2000/svg" stroke="#8c4c00" stroke-width="0.0032">
26+
<path
27+
d="M31.082 27.5l-13.999-24.249c-0.237-0.352-0.633-0.58-1.083-0.58s-0.846 0.228-1.080 0.575l-0.003 0.005-14 24.249c-0.105 0.179-0.167 0.395-0.167 0.625 0 0.69 0.56 1.25 1.25 1.25h28c0.69 0 1.249-0.56 1.249-1.25 0-0.23-0.062-0.446-0.171-0.631zM4.165 26.875l11.835-20.499 11.834 20.499zM14.75 12v8.994c0 0.69 0.56 1.25 1.25 1.25s1.25-0.56 1.25-1.25V12c0-0.69-0.56-1.25-1.25-1.25s-1.25 0.56-1.25 1.25zM15.12 23.619c-0.124 0.106-0.22 0.24-0.278 0.394-0.051 0.143-0.08 0.308-0.08 0.48s0.029 0.337 0.083 0.491c0.144 0.3 0.38 0.536 0.671 0.676 0.143 0.051 0.308 0.080 0.48 0.080s0.337-0.029 0.49-0.083c0.156-0.071 0.288-0.166 0.4-0.281 0.224-0.225 0.363-0.536 0.363-0.878 0-0.687-0.557-1.244-1.244-1.244-0.343 0-0.653 0.139-0.878 0.363z" />
28+
</svg>
29+
<span>High level description of what actions were taken as part of the migration will come here</span>
30+
</div>
31+
32+
<div class="header-container">
33+
<div class="org-details-section">
34+
<div class="label-key">Org Name</div>
35+
<div class="label-value">{{org.name}}</div>
36+
</div>
37+
38+
<div class="org-details-section">
39+
<div class="label-key">Org Id</div>
40+
<div class="label-value">{{org.id}}</div>
41+
</div>
42+
43+
<div class="org-details-section">
44+
<div class="label-key">Namespace</div>
45+
<div class="label-value">{{org.namespace}}</div>
46+
</div>
47+
48+
<div class="org-details-section">
49+
<div class="label-key">Data Model</div>
50+
<div class="label-value">{{org.dataModel}}</div>
51+
</div>
52+
53+
<div class="org-details-section">
54+
<div class="label-key">Assessment Date and Time</div>
55+
<div class="label-value">{{assessmentDate}}</div>
56+
</div>
57+
</div>
58+
59+
<div class="filter-dropdown-container">
60+
<div class="filter-header-bar">
61+
<!-- Row count display -->
62+
<div class="row-count-display" id="row-count">Loading Records...</div>
63+
64+
<!-- Search and filter controls -->
65+
<div class="search-container">
66+
<svg class="search-icon" xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="black"
67+
viewBox="0 0 16 16">
68+
<path
69+
d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z" />
70+
</svg>
71+
<input type="text" id="name-search-input" class="search-input" placeholder="Search by Name"
72+
oninput="filterAndSearchTable('report-table')" />
73+
</div>
74+
<c:if exp={$filterGroups.length>0}>
75+
<div class="filter-toggle-button" onclick="toggleFilterDropdown('report-table')">
76+
Filters
77+
<svg id="chevron-down" class="chevron-icon" xmlns="http://www.w3.org/2000/svg" width="10" height="10"
78+
fill="currentColor" viewBox="0 0 16 16">
79+
<path fill-rule="none" stroke="currentColor" stroke-width="2"
80+
d="M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708" />
81+
</svg>
82+
<svg id="chevron-up" class="chevron-icon hidden" xmlns="http://www.w3.org/2000/svg" width="10"
83+
height="10" fill="currentColor" viewBox="0 0 16 16">
84+
<path fill-rule="none" stroke="currentColor" stroke-width="2"
85+
d="M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708z" />
86+
</svg>
87+
</div>
88+
</c:if>
89+
</div>
90+
91+
<div id="filter-dropdown" class="filter-dropdown">
92+
<c:for items=(filterGroups) var="filterGroup">
93+
<div class="filter-group">
94+
<div class="filter-group-label">{{filterGroup.label}}</div>
95+
<div class="filter-options">
96+
<c:for items=(filterGroup.filters) var="filter">
97+
<label>
98+
<input type="checkbox" class="filter-checkbox" data-filter-key="(filterGroup.key)"
99+
value="(filter.label)" checked onclick="filterAndSearchTable('report-table')" />
100+
{{filter.label}}
101+
</label>
102+
</c:for>
103+
</div>
104+
</div>
105+
</c:for>
106+
</div>
107+
</div>
108+
<div class="table-container">
109+
<table
110+
class="slds-table slds-table_cell-buffer slds-table_bordered slds-table_striped slds-table_col-bordered"
111+
aria-label="Data Mapper Assessment">
112+
<thead>
113+
<c:for items=(headerGroups) var="headerGroup">
114+
<tr>
115+
<c:for items=(headerGroup.header) var="header">
116+
<th style="width: auto" colspan="(header.colspan)" rowspan="(header.rowspan)">
117+
<div class="filter-header">
118+
<span class="filter-label">{{header.name}}</span>
119+
</div>
120+
</th>
121+
</c:for>
122+
</tr>
123+
</c:for>
124+
</thead>
125+
126+
<tbody id="filterable-table-body">
127+
<c:for items=(rows) var="row">
128+
<tr class="(row.rowId)">
129+
<c:for items=(row.data) var="cell">
130+
<c:if exp={!$cell.isHref}>
131+
<c:if exp={$cell.searchable}>
132+
<td data-name="(cell.value)" rowspan="(cell.rowspan)" colspan="(cell.colspan)"
133+
title="(cell.title)" key="(cell.key)" value="(cell.value)">
134+
<c:if exp={Array.isArray($cell.title)}>
135+
<c:for items=(cell.title) var="value">
136+
<div>{{value}}</div>
137+
</c:for>
138+
</c:if>
139+
<c:if exp={!Array.isArray($cell.title)}> {{cell.title}} </c:if>
140+
</td>
141+
</c:if>
142+
<c:if exp={!$cell.searchable}>
143+
<td rowspan="(cell.rowspan)" colspan="(cell.colspan)" title="(cell.title)" key="(cell.key)"
144+
value="(cell.value)">
145+
<c:if exp={Array.isArray($cell.title)}>
146+
<c:for items=(cell.title) var="value">
147+
<div>{{value}}</div>
148+
</c:for>
149+
</c:if>
150+
<c:if exp={!Array.isArray($cell.title)}> {{cell.title}} </c:if>
151+
</td>
152+
</c:if>
153+
</c:if>
154+
<c:if exp={$cell.isHref}>
155+
<c:if exp={$cell.searchable}>
156+
<td data-name="(cell.value)" rowspan="(cell.rowspan)" colspan="(cell.colspan)"
157+
title="(cell.title)" key="(cell.key)" value="(cell.value)">
158+
<c:if exp={Array.isArray($cell.title)}>
159+
<c:for items=(cell.title) var="value">
160+
<div><a href="(cell.uri)">{{value}}</a></div>
161+
</c:for>
162+
</c:if>
163+
<c:if exp={!Array.isArray($cell.title)}>
164+
<a href="(cell.uri)">{{cell.title}}</a>
165+
</c:if>
166+
</td>
167+
</c:if>
168+
<c:if exp={!$cell.searchable}>
169+
<td rowspan="(cell.rowspan)" colspan="(cell.colspan)" title="(cell.title)" key="(cell.key)"
170+
value="(cell.value)">
171+
<c:if exp={Array.isArray($cell.title)}>
172+
<c:for items=(cell.title) var="value">
173+
<div><a href="(cell.uri)">{{value}}</a></div>
174+
</c:for>
175+
</c:if>
176+
<c:if exp={!Array.isArray($cell.title)}>
177+
<a href="(cell.uri)">{{cell.title}}</a>
178+
</c:if>
179+
</td>
180+
</c:if>
181+
</c:if>
182+
</c:for>
183+
</tr>
184+
</c:for>
185+
<tr id="no-rows-message" style="display: none">
186+
<td colspan="100%" style="text-align: center; padding: 16px; color: #666">
187+
No matching records found.
188+
</td>
189+
</tr>
190+
</tbody>
191+
</table>
192+
</div>
193+
</div>
194+
<div id="cta-summary-panel" class="cta-summary-panel hidden">
195+
<div class="cta-header">
196+
<div class="cta-header-label">Call to Action Summary</div>
197+
<div class="close-icon" onclick="toggleCtaSummaryPanel()">
198+
<svg width="16px" height="16px" viewBox="-2.4 -2.4 28.80 28.80" fill="none"
199+
xmlns="http://www.w3.org/2000/svg">
200+
<g id="SVGRepo_bgCarrier" stroke-width="0"></g>
201+
<g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round" stroke="#CCCCCC"
202+
stroke-width="1.056"></g>
203+
<g id="SVGRepo_iconCarrier">
204+
<path fill-rule="evenodd" clip-rule="evenodd"
205+
d="M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z"
206+
fill="#0F1729"></path>
207+
</g>
208+
</svg>
209+
</div>
210+
</div>
211+
<div class="line-separator"></div>
212+
<c:if exp={Array.isArray($rollbackFlags)}>
213+
<div class="slds-box" style="background-color: white; margin-top: 20px">
214+
<div class="slds-text-heading_medium">Rollback Flags Disabled</div>
215+
<div style="margin-block: 15px">
216+
<p>The following rollback flag(s) will be disabled during migration:</p>
217+
<ul class="slds-list_dotted">
218+
<c:for items=(rollbackFlags) var="flag">
219+
<li class="slds-item slds-text-color_destructive">{{flag}}</li>
220+
</c:for>
221+
</ul>
222+
<p>
223+
<strong>Note:</strong>
224+
Following flag(s) will no longer be supported after migration. For assistance, please contact
225+
support.
226+
</p>
227+
</div>
228+
</div>
229+
</c:if>
230+
</div>
231+
</div>
232+
</div>
233+
</div>
234+
</body>
235+
236+
</html>

0 commit comments

Comments
 (0)