Skip to content

Commit 50dce82

Browse files
authored
Merge pull request #393 from sf-kishore-kurri/u/kkurri/W-19268842
feat: @W-19268842 : Feedback and filter pop up issue
2 parents 7951a0a + 00d9427 commit 50dce82

File tree

18 files changed

+526
-74
lines changed

18 files changed

+526
-74
lines changed

messages/assess.json

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{
22
"examples": [
3-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE",
4-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=dr",
5-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=ip",
6-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=os",
7-
"omnistudio:migration:assess -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=fc"
3+
"omnistudio:migration:assess -u [email protected]",
4+
"omnistudio:migration:assess -u [email protected] --only=dm",
5+
"omnistudio:migration:assess -u [email protected] --only=ip",
6+
"omnistudio:migration:assess -u [email protected] --only=os",
7+
"omnistudio:migration:assess -u [email protected] --only=fc",
8+
"omnistudio:migration:assess -u [email protected] -r apex"
89
],
910
"commandDescription": "Assess migration of omnistudio components from custom objects to standard objects",
1011
"namespaceFlagDescription": "The namespaced of the package",
@@ -42,27 +43,27 @@
4243
"processingFlexCard": "Processing FlexCard: %s",
4344
"processingDataRaptor": "Processing DataMapper: %s",
4445
"processingOmniScript": "Processing OmniScript: %s",
45-
"foundDataRaptorsToAssess": "Found %s DataMappers to assess",
46+
"foundDataRaptorsToAssess": "Found %s Data Mappers to assess",
4647
"foundOmniScriptsToAssess": "Found %s %s to assess",
47-
"startingDataRaptorAssessment": "Starting DataMappers assessment",
48+
"startingDataRaptorAssessment": "Starting Data Mappers assessment",
4849
"startingOmniScriptAssessment": "Starting %s assessment",
4950
"allVersionsInfo": "allVersions : %s",
5051
"assessmentInitialization": "Assessment Initialization: Using namespace: %s",
5152
"apiVersionInfo": "API Version: %s",
5253
"assessmentTargets": "Assessment targets: %s",
5354
"relatedObjectsInfo": "Related objects: %s",
5455
"allVersionsFlagInfo": "All versions: %s",
55-
"assessedDataRaptorsCount": "Assessed %s DataMappers",
56-
"dataRaptorAssessmentCompleted": "DataMappers assessment completed",
57-
"flexCardAssessment": "FlexCard Assessment",
58-
"assessedFlexCardsCount": "Assessed %s FlexCards",
59-
"flexCardAssessmentCompleted": "FlexCard assessment completed",
56+
"assessedDataRaptorsCount": "Assessed %s Data Mappers",
57+
"dataRaptorAssessmentCompleted": "Data Mappers assessment completed",
58+
"flexCardAssessment": "Flexcards Assessment",
59+
"assessedFlexCardsCount": "Assessed %s Flexcards",
60+
"flexCardAssessmentCompleted": "Flexcards assessment completed",
6061
"omniScriptAssessment": "%s Assessment",
6162
"assessedOmniScriptsCount": "Assessed %s OmniScripts",
6263
"assessedIntegrationProceduresCount": "Assessed %s Integration Procedures",
6364
"omniScriptAssessmentCompleted": "%s assessment completed",
64-
"startingFlexCardAssessment": "Starting FlexCard assessment",
65-
"foundFlexCardsToAssess": "Found %s FlexCards to assess",
65+
"startingFlexCardAssessment": "Starting Flexcards assessment",
66+
"foundFlexCardsToAssess": "Found %s Flexcards to assess",
6667
"startingApexAssessment": "Starting Apex assessment in project path: %s",
6768
"processingApexFilesForAssessment": "Processing Apex files for assessment",
6869
"successfullyProcessedApexFilesForAssessment": "Successfully processed %s Apex files for assessment",
@@ -116,5 +117,6 @@
116117
"errorGeneratingHTML": "Error while generating HTML from template for %s with properties %s",
117118
"unexpectedError": "Unexpected Assessment error",
118119
"errorEvaluatingExpression": "Error evaluating expression: %s, %s",
119-
"invalidTypeAssessErrorMessage": "We couldn't assess your Omnistudio components in the %s namespace. Select the correct namespace and try again"
120+
"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"
120122
}

messages/migrate.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
{
22
"examples": [
3-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE",
4-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=dr",
5-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=ip",
6-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=os",
7-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE --only=fc",
8-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE -r apex,lwc",
9-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE -r apex",
10-
"omnistudio:migration:migrate -u [email protected] --namespace=YOUR_PACKAGE_NAMESPACE -r lwc"
3+
"omnistudio:migration:migrate -u [email protected]",
4+
"omnistudio:migration:migrate -u [email protected] --only=dm",
5+
"omnistudio:migration:migrate -u [email protected] --only=ip",
6+
"omnistudio:migration:migrate -u [email protected] --only=os",
7+
"omnistudio:migration:migrate -u [email protected] --only=fc",
8+
"omnistudio:migration:migrate -u [email protected] -r apex"
119
],
1210
"commandDescription": "Migrate omnistudio components from custom objects to standard objects",
1311
"namespaceFlagDescription": "The namespace of the package",
1412
"apiVersionFlagDescription": "The Salesforce API version to use",
1513
"errorNoOrgResults": "No results found for the org '%s'.",
16-
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dr",
17-
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dr",
14+
"onlyFlagDescription": "Migrate a single element: os | ip | fc | dm",
15+
"invalidOnlyFlag": "Invalid flag, valid options are: os | ip | fc | dm",
1816
"couldNotDeactivateOmniProcesses": "Could not deactivate current OmniProcesses",
1917
"couldNotTruncate": "Could not truncate %s",
2018
"couldNotTruncateOmnniProcess": "Could not truncate OmniProcess. Please make sure your OS/IP is not referenced in an OmniScrirpt or Flex Card.",
@@ -114,7 +112,8 @@
114112
"labelStatusFailed": "Failed",
115113
"labelStatusComplete": "Complete",
116114
"migrationConsentNotGiven": "Couldn't confirm whether assessment errors are resolved",
117-
"migrationConsentMessage": "Make sure that all records listed in the Assessment Status column in the Assessment Report are marked as Green before proceeding with the migration. Do you want to proceed? Yes or No?",
115+
"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?",
118116
"truncationFailed": "Truncation failed for %s: %s",
119-
"invalidTypeMigrateErrorMessage": "We couldn't migrate your Omnistudio components in the %s namespace. Select the correct namespace and try again"
117+
"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"
120119
}

src/commands/omnistudio/migration/assess.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import path from 'path';
12
import * as os from 'os';
23
import { flags } from '@salesforce/command';
34
import { Messages, Connection } from '@salesforce/core';
@@ -155,6 +156,12 @@ export default class Assess extends OmniStudioBaseCommand {
155156
Logger.log((error as Error).stack);
156157
}
157158
await AssessmentReporter.generate(assesmentInfo, conn.instanceUrl, orgs, assessOnly, objectsToProcess, messages);
159+
Logger.log(
160+
messages.getMessage('assessmentSuccessfulMessage', [
161+
orgs.orgDetails?.Id,
162+
path.join(process.cwd(), Constants.AssessmentReportsFolderName),
163+
])
164+
);
158165
return assesmentInfo;
159166
}
160167

src/commands/omnistudio/migration/migrate.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Licensed under the BSD 3-Clause license.
88
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
99
*/
10+
import path from 'path';
1011
import * as os from 'os';
1112
import { flags } from '@salesforce/command';
1213
import { Messages } from '@salesforce/core';
@@ -198,7 +199,12 @@ export default class Migrate extends OmniStudioBaseCommand {
198199
actionItems,
199200
objectsToProcess
200201
);
201-
202+
Logger.log(
203+
messages.getMessage('migrationSuccessfulMessage', [
204+
orgs.orgDetails?.Id,
205+
path.join(process.cwd(), Constants.MigrationReportsFolderName),
206+
])
207+
);
202208
// Return results needed for --json flag
203209
return { objectMigrationResults };
204210
}

src/javascripts/reportGeneratorUtility.js

Lines changed: 80 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,35 @@ function toggleFilterDropdown(tableId) {
1111
}
1212
}
1313

14-
function toggleDiffModal(name) {
15-
const modal = document.getElementById(`myModal_${name}`);
16-
modal.style.display = modal.style.display === 'none' ? 'flex' : 'none';
14+
function closeFilterDropdown(tableId) {
15+
const reportTable = document.getElementById(tableId);
16+
if (!reportTable) return;
17+
18+
const dropdown = reportTable.querySelector('#filter-dropdown');
19+
const chevronUp = reportTable.querySelector('#chevron-up');
20+
const chevronDown = reportTable.querySelector('#chevron-down');
21+
22+
if (dropdown && dropdown.classList.contains('show')) {
23+
dropdown.classList.remove('show');
24+
if (chevronUp) chevronUp.classList.add('hidden');
25+
if (chevronDown) chevronDown.classList.remove('hidden');
26+
}
27+
}
28+
29+
function closeAllFilterDropdowns() {
30+
const openDropdowns = document.querySelectorAll('.filter-dropdown.show');
31+
32+
openDropdowns.forEach((dropdown) => {
33+
dropdown.classList.remove('show');
34+
// Find and update chevron icons
35+
const container = dropdown.closest('.filter-dropdown-container') || dropdown.parentElement;
36+
if (container) {
37+
const chevronUp = container.querySelector('#chevron-up');
38+
const chevronDown = container.querySelector('#chevron-down');
39+
if (chevronUp) chevronUp.classList.add('hidden');
40+
if (chevronDown) chevronDown.classList.remove('hidden');
41+
}
42+
});
1743
}
1844

1945
function toggleDiffModal(name) {
@@ -153,6 +179,40 @@ document.addEventListener('DOMContentLoaded', () => {
153179
document.querySelectorAll('.rpt-table-container').forEach((tableContainer) => {
154180
filterAndSearchTable(tableContainer.id);
155181
});
182+
183+
// Attach filter dropdown event listeners after DOM is loaded
184+
// Close panel and filter dropdown on escape key
185+
document.addEventListener('keydown', function (event) {
186+
if (event.key === 'Escape' || event.keyCode === 27) {
187+
event.preventDefault();
188+
189+
try {
190+
closeCtaPanel();
191+
} catch (error) {
192+
// Silently handle error if CTA panel elements don't exist
193+
}
194+
195+
try {
196+
closeAllFilterDropdowns();
197+
} catch (error) {
198+
// Silently handle error if filter dropdown elements don't exist
199+
}
200+
}
201+
});
202+
203+
// Close filter dropdown when clicking outside
204+
document.addEventListener('click', function (event) {
205+
// Find all open filter dropdowns
206+
document.querySelectorAll('.filter-dropdown.show').forEach((dropdown) => {
207+
const reportTable = dropdown.closest('.rpt-table-container');
208+
const filterButton = reportTable?.querySelector('.filter-toggle-button');
209+
210+
// Check if click was outside the dropdown and not on the filter button
211+
if (reportTable && !dropdown.contains(event.target) && !filterButton?.contains(event.target)) {
212+
closeFilterDropdown(reportTable.id);
213+
}
214+
});
215+
});
156216
});
157217

158218
function openReport(ele) {
@@ -164,30 +224,33 @@ function toggleCtaPanel() {
164224
const panel = document.getElementById('ctaPanel');
165225
const overlay = document.getElementById('overlay');
166226

167-
if (panel.classList.contains('open')) {
168-
closeCtaPanel();
169-
} else {
170-
panel.classList.add('open');
171-
overlay.classList.add('open');
227+
// Only try to toggle if elements exist
228+
if (panel && overlay) {
229+
if (panel.classList.contains('open')) {
230+
closeCtaPanel();
231+
} else {
232+
panel.classList.add('open');
233+
overlay.classList.add('open');
234+
}
172235
}
173236
}
174237

175238
function closeCtaPanel() {
176239
const panel = document.getElementById('ctaPanel');
177240
const overlay = document.getElementById('overlay');
178241

179-
panel.classList.remove('open');
180-
overlay.classList.remove('open');
181-
}
182-
183-
// Close panel on escape key
184-
document.addEventListener('keydown', function (event) {
185-
if (event.key === 'Escape') {
186-
closeCtaPanel();
242+
// Only try to close if elements exist
243+
if (panel) {
244+
panel.classList.remove('open');
187245
}
188-
});
246+
if (overlay) {
247+
overlay.classList.remove('open');
248+
}
249+
}
189250

190251
// Expose globally so HTML inline event handlers can access them
191252
window.toggleFilterDropdown = toggleFilterDropdown;
253+
window.closeFilterDropdown = closeFilterDropdown;
254+
window.closeAllFilterDropdowns = closeAllFilterDropdowns;
192255
window.filterAndSearchTable = filterAndSearchTable;
193256
window.toggleCtaSummaryPanel = toggleCtaSummaryPanel;

src/migration/dataraptor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ export class DataRaptorMigrationTool extends BaseMigrationTool implements Migrat
302302
}
303303
if (existingDataRaptorNames.has(existingDRNameVal.cleanName())) {
304304
warnings.push(this.messages.getMessage('duplicatedName') + ' ' + existingDRNameVal.cleanName());
305-
assessmentStatus = 'Need Manual Intervention';
305+
assessmentStatus = 'Needs Manual Intervention';
306306
} else {
307307
existingDataRaptorNames.add(existingDRNameVal.cleanName());
308308
}

src/migration/flexcard.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
192192
// Check for duplicate names
193193
if (uniqueNames.has(cleanedName)) {
194194
flexCardAssessmentInfo.warnings.push(this.messages.getMessage('duplicateCardNameMessage', [cleanedName]));
195-
assessmentStatus = 'Need Manual Intervention';
195+
assessmentStatus = 'Needs Manual Intervention';
196196
}
197197
uniqueNames.add(cleanedName);
198198

@@ -260,7 +260,7 @@ export class CardMigrationTool extends BaseMigrationTool implements MigrationToo
260260
flexCardAssessmentInfo.warnings.push(
261261
this.messages.getMessage('integrationProcedureManualUpdateMessage', [originalIpMethod])
262262
);
263-
flexCardAssessmentInfo.migrationStatus = 'Need Manual Intervention';
263+
flexCardAssessmentInfo.migrationStatus = 'Needs Manual Intervention';
264264
}
265265
}
266266
} else if (dataSource.type === Constants.ApexRemoteComponentName) {

src/migration/omniscript.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export class OmniScriptMigrationTool extends BaseMigrationTool implements Migrat
291291
let migrationStatus = 'Ready for migration';
292292
if (type === 'Angular') {
293293
omniAssessmentInfo.warnings.unshift(this.messages.getMessage('angularOSWarning'));
294-
migrationStatus = 'Need Manual Intervention';
294+
migrationStatus = 'Needs Manual Intervention';
295295
}
296296
const osAssessmentInfo: OSAssessmentInfo = {
297297
name: omniAssessmentInfo.name,

src/templates/assessmentReport.template

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
<div class="report-page-header">
4040
<div class="slds-text-heading_large">
4141
<span>{{heading}}</span>
42-
<span>&nbsp;Assessment Report</span>
4342
</div>
4443
</div>
4544

src/utils/constants/stringContants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ export const Constants = {
1717
DataRaptorComponentName: 'DataRaptor',
1818
DataRaptorPluralName: 'DataRaptors',
1919
ApexRemoteComponentName: 'ApexRemote',
20+
21+
// artifacts persistance folder names
22+
AssessmentReportsFolderName: 'assessment_reports',
23+
MigrationReportsFolderName: 'migration_report',
2024
};

0 commit comments

Comments
 (0)