@@ -2,7 +2,7 @@ import { Messages } from '@salesforce/core';
22import { nameLocation , oldNew } from '../interfaces' ;
33import { CTASummary } from '../reportGenerator/reportInterfaces' ;
44import { IPAssessmentInfo , OSAssessmentInfo , DataRaptorAssessmentInfo , ApexAssessmentInfo } from '../interfaces' ;
5- import { callToActionMessages } from '../constants/callToActionMessages ' ;
5+ import { documentRegistry } from '../constants/documentRegistry ' ;
66import { Logger } from '../logger' ;
77
88Messages . importMessagesDirectory ( __dirname ) ;
@@ -37,14 +37,33 @@ export class reportingHelper {
3737 }
3838 }
3939
40+ public static decorateErrors ( errors : string [ ] ) : string [ ] {
41+ if ( ! errors || errors . length === 0 ) return [ ] ;
42+ const errorMessages : string [ ] = [ ] ;
43+ for ( const error of errors ) {
44+ errorMessages . push ( '<div class="slds-text-color_error">' + error + '</div>' ) ;
45+ }
46+ return errorMessages ;
47+ }
48+
49+ public static decorateStatus ( status : string ) : string {
50+ if ( status === 'Can be Automated' || status === 'Complete' ) {
51+ return '<div class="slds-text-color_success">' + status + '</div>' ;
52+ }
53+ if ( status === 'Skipped' ) {
54+ return '<div class="text-warning">' + status + '</div>' ;
55+ }
56+ return '<div class="slds-text-color_error">' + status + '</div>' ;
57+ }
58+
4059 public static getCallToAction (
4160 assessmentInfos : Array < IPAssessmentInfo | OSAssessmentInfo | DataRaptorAssessmentInfo | ApexAssessmentInfo >
4261 ) : CTASummary [ ] {
4362 const callToAction = [ ] ;
4463 assessmentInfos . forEach ( ( assessmentInfo ) => {
4564 if ( assessmentInfo . warnings && assessmentInfo . warnings . length > 0 ) {
4665 for ( const info of assessmentInfo . warnings ) {
47- for ( const key of Object . keys ( callToActionMessages ) ) {
66+ for ( const key of Object . keys ( documentRegistry ) ) {
4867 const value = assessMessages . getMessage ( key ) ;
4968 if (
5069 typeof value === 'string' &&
@@ -99,8 +118,8 @@ export class reportingHelper {
99118 }
100119
101120 private static getLink ( key : string ) : string {
102- if ( callToActionMessages [ key ] ) {
103- return callToActionMessages [ key ] as string ;
121+ if ( documentRegistry [ key ] ) {
122+ return documentRegistry [ key ] as string ;
104123 }
105124 Logger . logVerbose ( `No link found for ${ key } ` ) ;
106125 return undefined ;
0 commit comments