diff --git a/dlrs/main/classes/LookupRollupStatusCheckController.cls b/dlrs/main/classes/LookupRollupStatusCheckController.cls index 3f020563..5a76bbc4 100644 --- a/dlrs/main/classes/LookupRollupStatusCheckController.cls +++ b/dlrs/main/classes/LookupRollupStatusCheckController.cls @@ -1,45 +1,4 @@ public with sharing class LookupRollupStatusCheckController { - // Global variables - public static LookupRollupSummary2__mdt LookupRollupSummary; - public static List rollups; - public static Map mapRollups; - - /** - * Check if the rollup has any error logs - */ - @AuraEnabled(Cacheable=true) - public static Integer getAssociatedErrorLogs(String lookupID) { - return [ - SELECT COUNT() - FROM LookupRollupSummaryLog__c - WHERE ParentId__c = :lookupID - ]; - } - - /** - * Check if the rollup has a failed calculate rollup jobs - */ - @AuraEnabled(Cacheable=true) - public static Integer getCalculateJobs(String lookupID) { - return [ - SELECT COUNT() - FROM LookupRollupCalculateJob__c - WHERE LookupRollupSummaryId__c = :lookupID - ]; - } - - /** - * Check if the rollup has any schedule items - */ - @AuraEnabled(Cacheable=true) - public static Integer getSpecificScheduledItems(String lookupID) { - return [ - SELECT COUNT() - FROM LookupRollupSummaryScheduleItems__c - WHERE LookupRollupSummary2__c = :lookupID - ]; - } - /** * Get count of scheduled items older than yesterday * The assumption is that normal processing should have handled these @@ -56,10 +15,10 @@ public with sharing class LookupRollupStatusCheckController { /** * Check if the rollup has a Full Calculate schedule */ - @AuraEnabled(Cacheable=true) + @AuraEnabled public static Datetime getScheduledFullCalculates(String lookupID) { try { - LookupRollupSummary = (LookupRollupSummary2__mdt) new RollupSummariesSelector.CustomMetadataSelector( + LookupRollupSummary2__mdt LookupRollupSummary = (LookupRollupSummary2__mdt) new RollupSummariesSelector.CustomMetadataSelector( false, true ) @@ -86,7 +45,7 @@ public with sharing class LookupRollupStatusCheckController { @AuraEnabled public static Boolean hasChildTriggerDeployed(String lookupID) { try { - LookupRollupSummary = (LookupRollupSummary2__mdt) new RollupSummariesSelector.CustomMetadataSelector( + LookupRollupSummary2__mdt LookupRollupSummary = (LookupRollupSummary2__mdt) new RollupSummariesSelector.CustomMetadataSelector( false, true ) @@ -108,50 +67,10 @@ public with sharing class LookupRollupStatusCheckController { return false; } - @AuraEnabled(Cacheable=true) - public static Boolean hasParentTriggerDeployed(String lookupID) { - try { - LookupRollupSummary = (LookupRollupSummary2__mdt) new RollupSummariesSelector.CustomMetadataSelector( - false, - true - ) - .selectById(new Set{ lookupID })[0] - .Record; - - if (LookupRollupSummary != null) { - RollupSummary rs = new RollupSummary(LookupRollupSummary); - String parentTrigger = RollupSummaries.makeParentTriggerName(rs); - ApexTriggersSelector selector = new ApexTriggersSelector(); - Map loadTriggers = selector.selectByName( - new Set{ ParentTrigger } - ); - - if (loadTriggers.size() > 0) { - return true; - } - } - } catch (Exception e) { - } - return false; - } - - /* - * Rollup - General Status Information - * - */ - - /** - * Check if there are any schedule items in the system - */ - @AuraEnabled(Cacheable=true) - public static Integer getAllScheduledItems() { - return [SELECT COUNT() FROM LookupRollupSummaryScheduleItems__c]; - } - /** * Check if cron job is running for DLRS */ - @AuraEnabled(Cacheable=true) + @AuraEnabled public static Integer getScheduledJobs() { return new AsyncApexJobsSelector() .getScheduledInstancesOfType(RollupJob.class) diff --git a/dlrs/main/lwc/flexiblePath/flexiblePath.html b/dlrs/main/lwc/flexiblePath/flexiblePath.html index dc6d209f..ec97b8b0 100644 --- a/dlrs/main/lwc/flexiblePath/flexiblePath.html +++ b/dlrs/main/lwc/flexiblePath/flexiblePath.html @@ -28,6 +28,8 @@ href="#" role="option" tabindex="-1" + data-step={step.name} + onclick={handlePathStepClick} > s.name === event.currentTarget.dataset.step + ); + if (step) { + this.dispatchEvent( + new CustomEvent("nextactionclick", { + detail: { + label: step.label, + name: step.name + } + }) + ); + } + } + handleNextActionClick() { const nextAction = this.nextAction; this.dispatchEvent( diff --git a/dlrs/main/lwc/manageRollups/manageRollups.html b/dlrs/main/lwc/manageRollups/manageRollups.html index 561b3b02..a4c17446 100644 --- a/dlrs/main/lwc/manageRollups/manageRollups.html +++ b/dlrs/main/lwc/manageRollups/manageRollups.html @@ -41,6 +41,7 @@ onsort={handleOnSort} > + diff --git a/dlrs/main/lwc/manageRollups/manageRollups.js b/dlrs/main/lwc/manageRollups/manageRollups.js index b170d02d..abb7a177 100644 --- a/dlrs/main/lwc/manageRollups/manageRollups.js +++ b/dlrs/main/lwc/manageRollups/manageRollups.js @@ -101,6 +101,7 @@ export default class ManageRollups extends NavigationMixin(LightningElement) { rollups = {}; rollupList = []; searchFilter = ""; + isLoading = true; selectedRollup = undefined; connectedCallback() { @@ -111,6 +112,7 @@ export default class ManageRollups extends NavigationMixin(LightningElement) { } async refreshRollups() { + this.isLoading = true; this.rollups = await getAllRollupConfigs(); Object.keys(this.rollups).forEach((k) => { @@ -127,6 +129,7 @@ export default class ManageRollups extends NavigationMixin(LightningElement) { this.openEditor(null); } this.calcRollupList(); + this.isLoading = false; } calcRollupList() { diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.html b/dlrs/main/lwc/rollupEditor/rollupEditor.html index 7dd5ba75..de0ed215 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.html +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.html @@ -75,11 +75,23 @@ errors={errors.Description__c} > - - + + Outstanding Scheduled Items + + + + Next Full Calculate + diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.js b/dlrs/main/lwc/rollupEditor/rollupEditor.js index 9368b8e8..08f8f8c3 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.js +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.js @@ -12,6 +12,7 @@ import getManageTriggerPageUrl from "@salesforce/apex/RollupEditorController.get import getFullCalculatePageUrl from "@salesforce/apex/RollupEditorController.getFullCalculatePageUrl"; import getScheduleCalculatePageUrl from "@salesforce/apex/RollupEditorController.getScheduleCalculatePageUrl"; import hasChildTriggerDeployed from "@salesforce/apex/LookupRollupStatusCheckController.hasChildTriggerDeployed"; +import getScheduledFullCalculates from "@salesforce/apex/LookupRollupStatusCheckController.getScheduledFullCalculates"; import getScheduledJobs from "@salesforce/apex/LookupRollupStatusCheckController.getScheduledJobs"; import getOutstandingScheduledItemsForLookup from "@salesforce/apex/LookupRollupStatusCheckController.getOutstandingScheduledItemsForLookup"; import ClassSchedulerModal from "c/classSchedulerModal"; @@ -59,6 +60,7 @@ export default class RollupEditor extends LightningModal { isLoading = false; childTriggerIsDeployed = false; rollupId; + nextFullCalculateAt = ""; @wire(getOutstandingScheduledItemsForLookup, { lookupID: "$rollupId" }) outstandingScheduledItems; @@ -147,6 +149,10 @@ export default class RollupEditor extends LightningModal { rollupName: this.rollupName }); this.rollupId = this.rollup.Id; + this.nextFullCalculateAt = + (await getScheduledFullCalculates({ + lookupId: this.rollupId + })) ?? "Not Scheduled"; } catch (error) { this.errors.record = [error.message]; } @@ -263,7 +269,26 @@ export default class RollupEditor extends LightningModal { label: "Schedule Rollup Job", description: "Scheduled RollupJob to process Scheduled Items", className: "RollupJob", - size: "small" + size: "small", + templates: [ + { + label: "Once Every Day", + value: "daily", + selectors: ["single-hour"], + presets: { hours: ["3"] } + }, + { + label: "Once Every Hour", + value: "hourly", + selectors: ["single-minute"] + }, + { + label: "Every 15 minutes", + value: "every15", + selectors: [], + presets: { minutes: ["0", "15", "30", "45"] } + } + ] }); // recalculate Path after Schedule is created this.configureSteps(); diff --git a/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.html b/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.html deleted file mode 100644 index da653c53..00000000 --- a/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.html +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.js b/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.js deleted file mode 100644 index b164b84e..00000000 --- a/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.js +++ /dev/null @@ -1,129 +0,0 @@ -import { LightningElement, api, wire, track } from "lwc"; - -import getAllScheduledItems from "@salesforce/apex/LookupRollupStatusCheckController.getAllScheduledItems"; -import getSpecificScheduledItems from "@salesforce/apex/LookupRollupStatusCheckController.getSpecificScheduledItems"; -import hasChildTriggerDeployed from "@salesforce/apex/LookupRollupStatusCheckController.hasChildTriggerDeployed"; -import hasParentTriggerDeployed from "@salesforce/apex/LookupRollupStatusCheckController.hasParentTriggerDeployed"; -import getScheduledFullCalculates from "@salesforce/apex/LookupRollupStatusCheckController.getScheduledFullCalculates"; -import getCalculateJobs from "@salesforce/apex/LookupRollupStatusCheckController.getCalculateJobs"; -import getScheduledJobs from "@salesforce/apex/LookupRollupStatusCheckController.getScheduledJobs"; - -const mockLookupRollupSummary2 = ""; - -export default class rollupStatusCheck extends LightningElement { - lookupID; - - // General status check variables - scheduledCronJobs = "No Rollup Jobs Found"; - recordCountAll = "0"; - - // Rollup Specific Status Check Variables - recordCount = 0; - nextFullCalculateDate; - triggerCount = 0; - parentTrigger = false; - childTrigger = false; - calculateJobErrors = 0; - - // Error Handling - error = []; - - connectedCallback() { - console.log("connectedCallback"); - console.log("my lookup id is :" + this._name); - this.allScheduleItems(); - this.scheduleJobs(); - } - - // Get record lookup from parent component - @track _name = mockLookupRollupSummary2; - @api - get name() { - return this._name; - } - set name(value) { - this._name = value; - } - - get nextFullCalculateAt() { - if (this.nextFullCalculateDate) { - return this.nextFullCalculateDate; - } - return "Not Scheduled"; - } - - get parentTriggerStatus() { - if (this.parentTrigger) { - return "Deployed"; - } - return "Not Deployed"; - } - - get childTriggerStatus() { - if (this.childTrigger) { - return "Deployed"; - } - return "Not Deployed"; - } - - // Method to check if there are any failed calculate jobs for the specific rollup - @wire(getCalculateJobs, { lookupID: "$_name" }) - wiredGetCalculateJobs({ error, data }) { - this.handleApexResponse(data, error, "calculateJobErrors"); - } - - // Method to check if there are any scheduled full calculates for the specific rollup - @wire(getScheduledFullCalculates, { lookupID: "$_name" }) - wiredGetScheduledFullCalculates({ error, data }) { - this.handleApexResponse(data, error, "nextFullCalculateDate"); - } - - // Method to check if there are any scheduled items for the specific rollup - @wire(getSpecificScheduledItems, { lookupID: "$_name" }) - wiredGetSpecificScheduledItems({ error, data }) { - this.handleApexResponse(data, error, "recordCount"); - } - - // Method to check if child triggers are present - @wire(hasChildTriggerDeployed, { lookupID: "$_name" }) - wiredHasChildTriggerDeployed({ error, data }) { - this.handleApexResponse(data, error, "childTrigger"); - } - - // Method to check if child triggers are present - @wire(hasParentTriggerDeployed, { lookupID: "$_name" }) - wiredHasParentTriggerDeployed({ error, data }) { - this.handleApexResponse(data, error, "parentTrigger"); - } - - // General status method to grab all scheduled items regardless of rollup - async allScheduleItems() { - let data, error; - try { - data = await getAllScheduledItems(); - } catch (err) { - error = err; - } - this.handleApexResponse(data, error, "recordCountAll"); - } - - async scheduleJobs() { - let data, error; - try { - data = await getScheduledJobs(); - } catch (err) { - error = err; - } - this.handleApexResponse(data, error, "scheduledCronJobs"); - } - - // *** Utility *** - handleApexResponse(data, error, propertyName) { - if (error) { - console.log(propertyName + "- error: " + error); - this.error.push(error); - } - console.log(propertyName + "- data: " + data); - this[propertyName] = data; - } -} diff --git a/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.js-meta.xml b/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.js-meta.xml deleted file mode 100644 index d84be43c..00000000 --- a/dlrs/main/lwc/rollupStatusCheck/rollupStatusCheck.js-meta.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - 60.0 - true - - lightning__RecordPage - lightning__AppPage - lightning__HomePage - - - - - - - - - - - - - - - \ No newline at end of file