Skip to content

Commit 69c7dc9

Browse files
authored
Merge pull request #394 from sf-kishore-kurri/u/kkurri/W-19268842/GA
feat: @W-19268842 : Filter pop up and feedback
2 parents c106db3 + 2ee2dd7 commit 69c7dc9

File tree

10 files changed

+487
-31
lines changed

10 files changed

+487
-31
lines changed

messages/assess.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"errorDuringFlexCardAssessment": "Error during FlexCard assessment",
4242
"errorDuringOmniScriptAssessment": "Error during Omniscript assessment",
4343
"errorDuringGlobalAutoNumberAssessment": "Error during GlobalAutoNumber assessment",
44-
"processingFlexCard": "Processing FlexCards: %s",
44+
"processingFlexCard": "Processing Flexcards: %s",
4545
"processingDataRaptor": "Processing Data Mappers: %s",
4646
"processingOmniScript": "Processing Omniscripts: %s",
4747
"processingGlobalAutoNumber": "Processing Omni Global Auto Numbers: %s",
@@ -59,9 +59,9 @@
5959
"allVersionsFlagInfo": "All versions: %s",
6060
"assessedDataRaptorsCount": "Assessed %s Data Mappers",
6161
"dataRaptorAssessmentCompleted": "Data Mappers assessment completed",
62-
"flexCardAssessment": "FlexCard Assessment",
63-
"assessedFlexCardsCount": "Assessed %s FlexCards",
64-
"flexCardAssessmentCompleted": "FlexCard assessment completed",
62+
"flexCardAssessment": "Flexcards Assessment",
63+
"assessedFlexCardsCount": "Assessed %s Flexcards",
64+
"flexCardAssessmentCompleted": "Flexcards assessment completed",
6565
"globalAutoNumberAssessment": "GlobalAutoNumber Assessment",
6666
"assessedGlobalAutoNumbersCount": "Assessed %s GlobalAutoNumbers",
6767
"globalAutoNumberAssessmentCompleted": "The assessment for Omni Global Auto Number is complete.",
@@ -194,7 +194,6 @@
194194
"dataMapperNamePrefixedWithDM": "DataMapper name '%s' starts with a number. Prefixing with 'DM_' to create valid name: %s",
195195
"integrationProcedureTypeEmptyAfterCleaning": "Integration Procedure Type '%s' becomes empty after name cleaning. Please provide a valid Type value.",
196196
"integrationProcedureSubtypeEmptyAfterCleaning": "Integration Procedure SubType '%s' becomes empty after name cleaning. Please provide a valid SubType value.",
197-
"invalidTypeAssessErrorMessage": "We couldn't assess your Omnistudio components in the %s namespace. Select the correct namespace and try again",
198197
"apexFileAlreadyHasCallMethod": "File %s already has call method, thus keeping the existing call method intact",
199198
"errorFetchingCustomLabels": "Error fetching custom labels: %s",
200199
"customLabelAssessmentSummary": "Custom Label with same name and different value is already exist without namespace.",
@@ -205,5 +204,7 @@
205204
"manualDeploymentSteps": "<a href='%s' target='_blank'>Please refer to this documentation for manual deployment process</a>",
206205
"varDeclarationUpdated": "Variable initialization will be updated for target name",
207206
"ipNameUpdateFailed": "IP reference %s can’t be updated",
208-
"dmNameUpdateFailed": "DM reference %s can’t be updated"
207+
"dmNameUpdateFailed": "DM reference %s can’t be updated",
208+
"invalidTypeAssessErrorMessage": "We couldn't assess your Omnistudio components in the %s namespace. Select the correct namespace and try again",
209+
"assessmentSuccessfulMessage": "Migration assessment for org %s is complete and reports are ready for review in the folder %s"
209210
}

messages/migrate.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"migrationFailed": "Migration failed: %s",
7070
"formulaSyntaxError": "There was some problem while updating the formula syntax, please check the all the formula's syntax once : %s",
7171
"foundDataRaptorsToMigrate": "Found %s Data Mappers to migrate",
72-
"foundFlexCardsToMigrate": "Found %s FlexCards to migrate",
72+
"foundFlexCardsToMigrate": "Found %s Flexcards to migrate",
7373
"foundOmniScriptsToMigrate": "Found %s %s to migrate",
7474
"foundGlobalAutoNumbersToMigrate": "Found %s GlobalAutoNumbers to migrate",
7575
"foundCustomLabelsToMigrate": "Found %s Custom Labels to migrate",
@@ -216,7 +216,7 @@
216216
"flexCardWithAngularOmniScriptWarning": "FlexCard has dependencies on Angular Omniscript(s) which are not migrated. Please convert Omniscript(s) to LWC before migrating this FlexCard.",
217217
"angularOmniScriptDependencyWarning": "Element '%s' references Angular Omniscript '%s' which will not be migrated. Consider converting the referenced Omniscript to LWC",
218218
"skipFlexcardAngularOmniScriptDependencyWarning": "Skipping FlexCard %s due to Angular Omniscript dependencies",
219-
"flexCardMigrationProcessingMessage": "Processing %s FlexCards for migration (%s skipped due to Angular dependencies)",
219+
"flexCardMigrationProcessingMessage": "Processing %s Flexcards for migration (%s skipped due to Angular dependencies)",
220220
"noMetadataToDeploy": "No metadata to deploy",
221221
"missingMandatoryField": "Missing mandatory field: %s for %s",
222222
"dataMapperMigrationFailed": "DataMapper migration failed for: %s",
@@ -267,5 +267,6 @@
267267
"errorFetchingCustomLabels": "Error fetching custom labels: %s",
268268
"customLabelAssessmentSummary": "Custom Label with same name and different value is already exist without namespace.",
269269
"generatedCustomLabelAssessmentReportPage": "Generated custom label assessment report page %s of %s with %s labels",
270-
"varDeclarationUpdated": "Variable initialization has been updated for target name"
271-
}
270+
"varDeclarationUpdated": "Variable initialization has been updated for target name",
271+
"migrationSuccessfulMessage": "Migration process for org %s is complete and reports are ready for review in the folder %s"
272+
}

src/commands/omnistudio/migration/assess.ts

Lines changed: 8 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';
@@ -206,6 +207,13 @@ export default class Assess extends OmniStudioBaseCommand {
206207
messages,
207208
userActionMessages
208209
);
210+
Logger.log(
211+
messages.getMessage('assessmentSuccessfulMessage', [
212+
orgs.orgDetails?.Id,
213+
path.join(process.cwd(), Constants.AssessmentReportsFolderName),
214+
])
215+
);
216+
209217
return assesmentInfo;
210218
}
211219

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 { Connection, Messages } from '@salesforce/core';
@@ -245,7 +246,12 @@ export default class Migrate extends OmniStudioBaseCommand {
245246
actionItems,
246247
objectsToProcess
247248
);
248-
249+
Logger.log(
250+
messages.getMessage('migrationSuccessfulMessage', [
251+
orgs.orgDetails?.Id,
252+
path.join(process.cwd(), Constants.MigrationReportsFolderName),
253+
])
254+
);
249255
// Return results needed for --json flag
250256
return { objectMigrationResults: [] };
251257
}

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) {
@@ -171,6 +197,40 @@ document.addEventListener('DOMContentLoaded', () => {
171197
});
172198
});
173199
});
200+
201+
// Attach filter dropdown event listeners after DOM is loaded
202+
// Close panel and filter dropdown on escape key
203+
document.addEventListener('keydown', function (event) {
204+
if (event.key === 'Escape' || event.keyCode === 27) {
205+
event.preventDefault();
206+
207+
try {
208+
closeCtaPanel();
209+
} catch (error) {
210+
// Silently handle error if CTA panel elements don't exist
211+
}
212+
213+
try {
214+
closeAllFilterDropdowns();
215+
} catch (error) {
216+
// Silently handle error if filter dropdown elements don't exist
217+
}
218+
}
219+
});
220+
221+
// Close filter dropdown when clicking outside
222+
document.addEventListener('click', function (event) {
223+
// Find all open filter dropdowns
224+
document.querySelectorAll('.filter-dropdown.show').forEach((dropdown) => {
225+
const reportTable = dropdown.closest('.rpt-table-container');
226+
const filterButton = reportTable?.querySelector('.filter-toggle-button');
227+
228+
// Check if click was outside the dropdown and not on the filter button
229+
if (reportTable && !dropdown.contains(event.target) && !filterButton?.contains(event.target)) {
230+
closeFilterDropdown(reportTable.id);
231+
}
232+
});
233+
});
174234
});
175235

176236
function openReport(ele) {
@@ -182,30 +242,33 @@ function toggleCtaPanel() {
182242
const panel = document.getElementById('ctaPanel');
183243
const overlay = document.getElementById('overlay');
184244

185-
if (panel.classList.contains('open')) {
186-
closeCtaPanel();
187-
} else {
188-
panel.classList.add('open');
189-
overlay.classList.add('open');
245+
// Only try to toggle if elements exist
246+
if (panel && overlay) {
247+
if (panel.classList.contains('open')) {
248+
closeCtaPanel();
249+
} else {
250+
panel.classList.add('open');
251+
overlay.classList.add('open');
252+
}
190253
}
191254
}
192255

193256
function closeCtaPanel() {
194257
const panel = document.getElementById('ctaPanel');
195258
const overlay = document.getElementById('overlay');
196259

197-
panel.classList.remove('open');
198-
overlay.classList.remove('open');
199-
}
200-
201-
// Close panel on escape key
202-
document.addEventListener('keydown', function (event) {
203-
if (event.key === 'Escape') {
204-
closeCtaPanel();
260+
// Only try to close if elements exist
261+
if (panel) {
262+
panel.classList.remove('open');
205263
}
206-
});
264+
if (overlay) {
265+
overlay.classList.remove('open');
266+
}
267+
}
207268

208269
// Expose globally so HTML inline event handlers can access them
209270
window.toggleFilterDropdown = toggleFilterDropdown;
271+
window.closeFilterDropdown = closeFilterDropdown;
272+
window.closeAllFilterDropdowns = closeAllFilterDropdowns;
210273
window.filterAndSearchTable = filterAndSearchTable;
211274
window.toggleCtaSummaryPanel = toggleCtaSummaryPanel;

src/utils/constants/stringContants.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@ export const Constants = {
2727
ApexComponentName: 'Apex Classes',
2828
CustomLabelComponentName: 'Custom Label',
2929
CustomLabelPluralName: 'Custom Labels',
30+
31+
// artifacts persistance folder names
32+
AssessmentReportsFolderName: 'assessment_reports',
33+
MigrationReportsFolderName: 'migration_report',
3034
};

src/utils/resultsbuilder/OSAssessmentReporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export class OSAssessmentReporter {
263263
const distinctStatuses = [...new Set(OSAssessmentInfos.map((info) => info.migrationStatus))];
264264
const statusFilterGroupParam: FilterGroupParam[] =
265265
distinctStatuses.length > 0 && distinctStatuses.filter((status) => status).length > 0
266-
? [createFilterGroupParam('Filter By Status', 'status', distinctStatuses)]
266+
? [createFilterGroupParam('Filter By Assessment Status', 'status', distinctStatuses)]
267267
: [];
268268

269269
return [...typeFilterGroupParam, ...statusFilterGroupParam];

src/utils/resultsbuilder/assessmentReporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ExperienceSiteAssessmentReporter } from './ExperienceSiteAssessmentRepo
2525
import { CustomLabelAssessmentReporter } from './CustomLabelAssessmentReporter';
2626

2727
export class AssessmentReporter {
28-
private static basePath = path.join(process.cwd(), 'assessment_reports');
28+
private static basePath = path.join(process.cwd(), Constants.AssessmentReportsFolderName);
2929
private static omniscriptAssessmentFileName = 'omniscript_assessment.html';
3030
private static flexcardAssessmentFileName = 'flexcard_assessment.html';
3131
private static integrationProcedureAssessmentFileName = 'integration_procedure_assessment.html';

src/utils/resultsbuilder/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ import { Logger } from '../logger';
3232
import { getMigrationHeading } from '../stringUtils';
3333
import { Constants } from '../constants/stringContants';
3434
import { CustomLabelMigrationInfo, CustomLabelMigrationReporter } from './CustomLabelMigrationReporter';
35-
const resultsDir = path.join(process.cwd(), 'migration_report');
35+
36+
const resultsDir = path.join(process.cwd(), Constants.MigrationReportsFolderName);
3637
const migrationReportHTMLfileName = 'dashboard.html';
3738
const flexipageFileName = 'flexipage.html';
3839
const templateDir = 'templates';

0 commit comments

Comments
 (0)