Skip to content

Commit

Permalink
Add Object Name to Key
Browse files Browse the repository at this point in the history
  • Loading branch information
tschug committed Nov 5, 2023
1 parent 1163a0c commit d0298b6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
15 changes: 14 additions & 1 deletion force-app/main/default/classes/Cmdt.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
22 changes: 14 additions & 8 deletions force-app/main/default/classes/IndicatorController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;}
}
Expand Down Expand Up @@ -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()){
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions force-app/main/default/lwc/key/key.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
3 changes: 2 additions & 1 deletion force-app/main/default/lwc/key/key.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit d0298b6

Please sign in to comment.