From 2a34514b03e3cfc3e41173a4feebb52e18050058 Mon Sep 17 00:00:00 2001 From: Heber Date: Sun, 5 May 2024 14:15:26 -0600 Subject: [PATCH 01/11] =?UTF-8?q?#1462=20LWC=20Wizard:=20Edit=20screen=20s?= =?UTF-8?q?houldn=E2=80=99t=20use=20collapsible=20sections=20except=20for?= =?UTF-8?q?=20=E2=80=98Advanced=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dlrs/main/lwc/rollupEditor/rollupEditor.css | 9 + dlrs/main/lwc/rollupEditor/rollupEditor.html | 876 ++++++++++--------- dlrs/main/lwc/rollupEditor/rollupEditor.js | 9 - 3 files changed, 463 insertions(+), 431 deletions(-) diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.css b/dlrs/main/lwc/rollupEditor/rollupEditor.css index 00bb00b0..0c42fbe5 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.css +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.css @@ -1,3 +1,12 @@ .testcodearea { --slds-c-textarea-sizing-min-height: 300px; } + +summary { + cursor: pointer; +} + +details:not([open]) .summary-down, +details[open] .summary-right { + display: none; +} diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.html b/dlrs/main/lwc/rollupEditor/rollupEditor.html index a8585b21..bd7bbd79 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.html +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.html @@ -19,435 +19,466 @@ > - - - - - - - - - - - - - - - - - Outstanding Scheduled Items - - - - Next Full Calculate - - - - - - - - -

- Pick the child object, the field that holds your data, and the - field that holds the reference to the parent. -

-
- - - - - - - - - - - - -
-
+

+ Information +

+ + + + + + + + + + + + + + + Outstanding Scheduled Items +   + + + + Next Full Calculate  + + + + - - - -

- Pick the parent object you want to roll up to and the field that - will hold the resulting value -

-
- - - - + - - - - -
-
- - + Child Object - - -

Define how child records will be qualified for the rollup

-
- - - - - - - - - -

Aggregate All Rows

- - -
-
-
- - - - -

Select the type and configuration of the rollup action

-
-
- - - - - - - - - - - - - - - - - - -
+ + + +

+ Select the child object, the field that contains the data, and the + field that contains the reference to the parent object. +

+
+ + + + + + + + + + + + +
- + Parent Object - - - - - - - - - - - + + + +

+ Select the parent object to rollup to and the field that will receive + the resulting value +

+
+ + + + - - - - - - - + + + + + + +

+ Relationship Criteria +

+ + +

Define how child records will be qualified for the rollup

+
+ + + + + + + + + +

Aggregate All Rows

+ + +
+
+ + +

+ Rollup Details +

+ + +

Select the type and configuration of the rollup action

+
+
+ + + + + + + + + + + + + + + + + + + +

+ Calculation Mode +

+ + + + + + + + + + + +
+ +

+ + Advanced - - - - - - - - - - +

+
+ + + + + + + + + + + + + + +
@@ -506,5 +537,6 @@

Aggregate All Rows

+
diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.js b/dlrs/main/lwc/rollupEditor/rollupEditor.js index b146de1b..3f231c62 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.js +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.js @@ -66,15 +66,6 @@ export default class RollupEditor extends LightningModal { @wire(getOutstandingScheduledItemsForLookup, { lookupID: "$rollupId" }) outstandingScheduledItems; - openAccordianSections = [ - "Information", - "ChildObject", - "ParentObject", - "Relationship", - "RollupDetails", - "CalculationMode" - ]; - @track rollup = { ...DEFAULT_ROLLUP_VALUES }; errors = {}; From 2e6464de1fcc6873f7c742a41e58aff34a65400b Mon Sep 17 00:00:00 2001 From: Heber Date: Sun, 5 May 2024 14:22:44 -0600 Subject: [PATCH 02/11] #1460 LWC Wizard: Clarify messaging for Outstanding Scheduled Rollup Items --- dlrs/main/lwc/rollupEditor/rollupEditor.html | 10 +++++++--- dlrs/main/lwc/rollupEditor/rollupEditor.js | 13 ++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.html b/dlrs/main/lwc/rollupEditor/rollupEditor.html index bd7bbd79..3d06d165 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.html +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.html @@ -14,9 +14,6 @@ -

@@ -538,5 +535,12 @@

+ + + Rollup was unable to save, please review record + + diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.js b/dlrs/main/lwc/rollupEditor/rollupEditor.js index 3f231c62..130544f9 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.js +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.js @@ -109,17 +109,12 @@ export default class RollupEditor extends LightningModal { return this.rollup.id && this.rollup.active; } - get scheduledItemsError() { - if ( - !this.outstandingScheduledItems || - !this.outstandingScheduledItems?.data - ) { - return null; + get scheduledItemsIcon() { + if (!this.rollup.id || !this.outstandingScheduledItems?.data) { + return ""; } - return [ - `This rollup has ${this.outstandingScheduledItems.data} outstanding scheduled items` - ]; + return "utility:warning"; } get relationshipCriteriaPlaceholder() { From 8841c64a39e79e629431ab19a4bafa77aaeb501c Mon Sep 17 00:00:00 2001 From: Heber Date: Sun, 5 May 2024 14:26:32 -0600 Subject: [PATCH 03/11] #1475 LWC Wizard: Limit Label and API Name to 40 character, return error if blank #1461 LWC Wizard: Overwrites record if same API name is duplicated --- dlrs/main/classes/RollupEditorController.cls | 17 +++++++++++ dlrs/main/lwc/rollupEditor/rollupEditor.css | 4 +++ dlrs/main/lwc/rollupEditor/rollupEditor.html | 5 ++++ dlrs/main/lwc/rollupEditor/rollupEditor.js | 28 +++++++++++++++++-- .../rollupEditorError/rollupEditorError.css | 3 ++ .../rollupEditorError/rollupEditorError.html | 6 ++-- 6 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 dlrs/main/lwc/rollupEditorError/rollupEditorError.css diff --git a/dlrs/main/classes/RollupEditorController.cls b/dlrs/main/classes/RollupEditorController.cls index 90b09283..cbef278b 100644 --- a/dlrs/main/classes/RollupEditorController.cls +++ b/dlrs/main/classes/RollupEditorController.cls @@ -103,10 +103,27 @@ public with sharing class RollupEditorController { RollupSummaries rollupSummaries = new RollupSummaries(mdtRecords); rollupSummaries.onValidate(); Map> errorMap; + for (RollupSummary rollupSummaryRecord : rollupSummaries.Records) { errorMap = collectErrors(rollupSummaryRecord); } + LookupRollupSummary2__mdt existing = LookupRollupSummary2__mdt.getInstance( + lookupConfig.DeveloperName + ); + if (existing != null && existing.Id != lookupConfig.Id) { + if (errorMap == null) { + errorMap = new Map>(); + } + + if (!errorMap.containsKey('developerName')) { + errorMap.put('developerName', new List()); + } + + errorMap.get('developerName') + .add('API name already in use by ' + existing.Id); + } + return errorMap; } diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.css b/dlrs/main/lwc/rollupEditor/rollupEditor.css index 0c42fbe5..c4f572d5 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.css +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.css @@ -2,6 +2,10 @@ --slds-c-textarea-sizing-min-height: 300px; } +.record-has-errors { + color: var(--lwc-colorTextError); +} + summary { cursor: pointer; } diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.html b/dlrs/main/lwc/rollupEditor/rollupEditor.html index 3d06d165..4c4a1c36 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.html +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.html @@ -34,6 +34,8 @@

onblur={onLabelBlurHandler} label="Lookup Rollup Summary Label" placeholder="My Rollup Name" + max-length="40" + required value={rollup.label} > @@ -50,6 +52,9 @@

label="Lookup Rollup Summary API Name" placeholder="My_Rollup_Name" disabled={rollup.id} + max-length="40" + required + pattern="[a-zA-Z](_?[0-9a-zA-Z])*" value={rollup.developerName} > { @@ -425,6 +431,19 @@ export default class RollupEditor extends LightningModal { `[data-name="rollup_${fieldName}"]` ); if (inputElement) { + if (inputElement.checkValidity) { + if (!inputElement.checkValidity()) { + isValid = false; + + // had a weird problem where I couldn't do multiple fields in the same loop, had to separate them + // probably a better way to do this + // eslint-disable-next-line @lwc/lwc/no-async-operation + setTimeout(() => { + inputElement.reportValidity(); + }, 20); + } + } + const attribute = checkboxFields.includes(fieldName) ? "checked" : "value"; @@ -438,6 +457,7 @@ export default class RollupEditor extends LightningModal { console.log(`fieldName (${fieldName}) : ${this.rollup[fieldName]}`); } }); + return isValid; } childObjectSelected(event) { @@ -510,4 +530,8 @@ export default class RollupEditor extends LightningModal { this.rollup.aggregateOperation ); } + + get hasErrors() { + return Object.keys(this.errors).length > 0; + } } diff --git a/dlrs/main/lwc/rollupEditorError/rollupEditorError.css b/dlrs/main/lwc/rollupEditorError/rollupEditorError.css new file mode 100644 index 00000000..8b03e07a --- /dev/null +++ b/dlrs/main/lwc/rollupEditorError/rollupEditorError.css @@ -0,0 +1,3 @@ +div { + color: var(--lwc-colorTextError); +} diff --git a/dlrs/main/lwc/rollupEditorError/rollupEditorError.html b/dlrs/main/lwc/rollupEditorError/rollupEditorError.html index 95fe5130..9c0c2fc5 100644 --- a/dlrs/main/lwc/rollupEditorError/rollupEditorError.html +++ b/dlrs/main/lwc/rollupEditorError/rollupEditorError.html @@ -1,7 +1,5 @@ diff --git a/dlrs/main/lwc/cronBuilder/cronBuilder.js b/dlrs/main/lwc/cronBuilder/cronBuilder.js index 3f5d94df..102787fc 100644 --- a/dlrs/main/lwc/cronBuilder/cronBuilder.js +++ b/dlrs/main/lwc/cronBuilder/cronBuilder.js @@ -9,6 +9,7 @@ export default class CronBuilder extends LightningElement { selectedTemplate = ""; enabledSelectors = []; + errors = []; _templates; @api @@ -305,27 +306,49 @@ export default class CronBuilder extends LightningElement { } buildCronStrings() { + this.errors = []; // for minute input, each variation requires a differen Cron String // all others can have multiple values + if (this.selectedMonths.length === 0) { + this.errors.push("Must select at least one month"); + } const months = this.selectedMonths.length === this.allMonths.length ? "*" : this.selectedMonths.join(","); + + if (this.selectedDays.length === 0) { + this.errors.push("Must select at least one day"); + } const daysOfMonth = this.selectedDays.length === this.allDays.length ? "*" : this.selectedDays.join(","); + + if (this.selectedWeekdays.length === 0) { + this.errors.push("Must select at least one weekday"); + } const daysOfWeek = this.selectedWeekdays.length === this.allWeekdays.length ? "*" : this.selectedWeekdays.join(","); + + if (this.selectedHours.length === 0) { + this.errors.push("Must select at least one hour"); + } const hours = this.selectedHours.length === this.allHours.length ? "*" : this.selectedHours.join(","); const seconds = "0"; - // TODO: error guards const crons = []; + + if (this.selectedMinutes.length === 0) { + this.errors.push("Must select at least one minute"); + } + if (this.errors.length > 0) { + return crons; + } // for every minute for (let min of this.selectedMinutes) { crons.push( From c10a06e01285af73d843952af332352b0b2d3151 Mon Sep 17 00:00:00 2001 From: Heber Date: Wed, 15 May 2024 13:32:49 -0600 Subject: [PATCH 10/11] Updates from PR feedback --- dlrs/main/classes/RollupSummaries.cls | 2 +- dlrs/main/classes/RollupSummariesTest.cls | 2 +- dlrs/main/lwc/rollupEditor/rollupEditor.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlrs/main/classes/RollupSummaries.cls b/dlrs/main/classes/RollupSummaries.cls index cc994d83..2700951b 100644 --- a/dlrs/main/classes/RollupSummaries.cls +++ b/dlrs/main/classes/RollupSummaries.cls @@ -399,7 +399,7 @@ public class RollupSummaries extends fflib_SObjectDomain { if (!operationsSupportingRowLimit.contains(operation)) { lookupRollupSummary.Fields.RowLimit.addError( error( - 'Row Limit is only supported on Last and Concatentate operators.', + 'Row Limit is only supported on Last and Concatenate operators.', lookupRollupSummary.Record, LookupRollupSummary__c.RowLimit__c ) diff --git a/dlrs/main/classes/RollupSummariesTest.cls b/dlrs/main/classes/RollupSummariesTest.cls index 352db024..ad70c696 100644 --- a/dlrs/main/classes/RollupSummariesTest.cls +++ b/dlrs/main/classes/RollupSummariesTest.cls @@ -768,7 +768,7 @@ private class RollupSummariesTest { fflib_SObjectDomain.triggerHandler(RollupSummaries.class); System.assertEquals(1, fflib_SObjectDomain.Errors.getAll().size()); System.assertEquals( - 'Row Limit is only supported on Last and Concatentate operators.', + 'Row Limit is only supported on Last and Concatenate operators.', fflib_SObjectDomain.Errors.getAll()[0].message ); System.assertEquals( diff --git a/dlrs/main/lwc/rollupEditor/rollupEditor.html b/dlrs/main/lwc/rollupEditor/rollupEditor.html index 4c4a1c36..ba05977c 100644 --- a/dlrs/main/lwc/rollupEditor/rollupEditor.html +++ b/dlrs/main/lwc/rollupEditor/rollupEditor.html @@ -74,7 +74,7 @@

> - Outstanding Scheduled Items + Outstanding Scheduled Items  Date: Wed, 15 May 2024 13:59:10 -0600 Subject: [PATCH 11/11] Repair new tests --- dlrs/main/classes/RollupEditorControllerTest.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlrs/main/classes/RollupEditorControllerTest.cls b/dlrs/main/classes/RollupEditorControllerTest.cls index 5a595017..525b8bea 100644 --- a/dlrs/main/classes/RollupEditorControllerTest.cls +++ b/dlrs/main/classes/RollupEditorControllerTest.cls @@ -94,7 +94,7 @@ public with sharing class RollupEditorControllerTest { JSON.serialize(cfg) ); Assert.areEqual( - '{"rowLimit":["Row Limit is only supported on Last and Concatentate operators."],"parentObject":["Object does not exist."],"childObject":["Object does not exist."]}', + '{"rowLimit":["Row Limit is only supported on Last and Concatenate operators."],"parentObject":["Object does not exist."],"childObject":["Object does not exist."]}', JSON.serialize(errors) ); }