From d0298b6d825336a8b2b15aa02c427764381716f9 Mon Sep 17 00:00:00 2001 From: tschug <timschug@gmail.com> Date: Sat, 4 Nov 2023 23:53:15 -0400 Subject: [PATCH] Add Object Name to Key --- force-app/main/default/classes/Cmdt.cls | 15 ++++++++++++- .../default/classes/IndicatorController.cls | 22 ++++++++++++------- force-app/main/default/lwc/key/key.html | 3 +++ force-app/main/default/lwc/key/key.js | 3 ++- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/force-app/main/default/classes/Cmdt.cls b/force-app/main/default/classes/Cmdt.cls index fb67480..345cdeb 100644 --- a/force-app/main/default/classes/Cmdt.cls +++ b/force-app/main/default/classes/Cmdt.cls @@ -4,7 +4,20 @@ public with sharing class Cmdt { public static void initializeConfiguration() { // Gather all active Bundles and put them into a Map (key: DeveloperName; Bundle) - for( Indicator_Bundle__mdt bundle : Indicator_Bundle__mdt.getAll().values() ) { + for( Indicator_Bundle__mdt bundle : [ + SELECT Id, DeveloperName, MasterLabel, Label, + Active__c, + Card_Icon__c, + Card_Icon_Background__c, + Card_Icon_Foreground__c, + Card_Text__c, + Card_Title__c, + Description__c, + sObject__c, + sObject__r.QualifiedApiName, + sObject__r.Label + FROM Indicator_Bundle__mdt + ] ) { setBundle(bundle); } diff --git a/force-app/main/default/classes/IndicatorController.cls b/force-app/main/default/classes/IndicatorController.cls index 8094246..b6eeb6f 100644 --- a/force-app/main/default/classes/IndicatorController.cls +++ b/force-app/main/default/classes/IndicatorController.cls @@ -15,6 +15,8 @@ public with sharing class IndicatorController { } public class IndicatorBundle { + @AuraEnabled + public String ObjectName {get; set;} @AuraEnabled public Boolean IsActive {get; set;} @AuraEnabled @@ -31,10 +33,10 @@ public with sharing class IndicatorController { public String BundleDescription {get; set;} @AuraEnabled public String BundleId {get; set;} - @AuraEnabled - public String BackgroundColor {get; set;} - @AuraEnabled - public String ForegroundColor {get; set;} + // @AuraEnabled + // public String BackgroundColor {get; set;} + // @AuraEnabled + // public String ForegroundColor {get; set;} @AuraEnabled public List<IndicatorItem> Items {get; set;} } @@ -164,8 +166,8 @@ public with sharing class IndicatorController { wrapper.CardTitle = 'Unbundled Items'; wrapper.BundleDescription = null; wrapper.BundleId = null; - wrapper.BackgroundColor = null; - wrapper.ForegroundColor = null; + // wrapper.BackgroundColor = null; + // wrapper.ForegroundColor = null; wrapper.Items = new List<IndicatorItem>(); for(Indicator_Item__mdt indicatorItem : Cmdt.getAllOrphanItems()){ @@ -264,8 +266,12 @@ public with sharing class IndicatorController { wrapper.CardTitle = bundle.Card_Title__c; wrapper.BundleDescription = bundle.Description__c; wrapper.BundleId = bundle.Id; - wrapper.BackgroundColor = bundle.Card_Icon_Background__c; - wrapper.ForegroundColor = bundle.Card_Icon_Foreground__c; + // wrapper.BackgroundColor = bundle.Card_Icon_Background__c; + // wrapper.ForegroundColor = bundle.Card_Icon_Foreground__c; + wrapper.ObjectName = bundle.sObject__r.Label; + if(bundle.sObject__r.Label != bundle.sObject__r.QualifiedApiName){ + wrapper.ObjectName += ' (' + bundle.sObject__r.QualifiedApiName + ')'; + } wrapper.Items = new List<IndicatorItem>(); if(!bundleItems.isEmpty()){ // TODO: Commenting out this check is a great way to test throwing an error in the LWC diff --git a/force-app/main/default/lwc/key/key.html b/force-app/main/default/lwc/key/key.html index a1b0912..ed24c4d 100644 --- a/force-app/main/default/lwc/key/key.html +++ b/force-app/main/default/lwc/key/key.html @@ -60,6 +60,9 @@ <h2>Bundle is not active.</h2> </div> </template> </div> + <div class="slds-var-p-horizontal_medium slds-text-heading_small"> + <b>Bundle Object:</b> {bundleDetails.ObjectName}<br/> + </div> </template> </lightning-layout-item> <lightning-layout-item padding="horizontal-small" size="2" class="slds-text-align_right"> diff --git a/force-app/main/default/lwc/key/key.js b/force-app/main/default/lwc/key/key.js index 27367b4..29eb16e 100644 --- a/force-app/main/default/lwc/key/key.js +++ b/force-app/main/default/lwc/key/key.js @@ -49,7 +49,8 @@ export default class Key extends LightningElement { Icon: this.bundle.CardIcon, Description: this.bundle.BundleDescription, BundleId: this.bundle.BundleId, - IsActive: this.bundle.IsActive + IsActive: this.bundle.IsActive, + ObjectName: this.bundle.ObjectName } if(this.bundle.BundleId){