Skip to content

Conversation

@jongpie
Copy link
Owner

@jongpie jongpie commented Nov 30, 2021

Closes #202 by adding a new lwc, loggerSettings, as a tab in the Logger Console app. It provides several features for managing LoggerSettings__c records:

  • Provides a datatable of all LoggerSettings__c records - long-term, more optimizations may be needed for orgs that have a lot of records (currently, there is infinite scrolling or pagination)

    image

  • Provides view, create, edit and delete functionality. Anyone with access to the tab/lwc can see the datatable and the 'View' row action - but in order to access/use the 'New' button (create), and the 'Edit' & 'Delete' row actions, users must either have update access on the LoggerSettings__c object(LoggerSettings__c.SObjectType.getDescribe().isUpdateable()), or have the custom permission 'Can Modify Logger Settings' (FeatureManagement.checkPermission('CanModifyLoggerSettings')). This is useful for orgs where people may have the LoggerAdmin permission set, but aren't full System Admins.

    • The LoggerAdmin permission set has access to view, create, edit, and delete
    • The LoggerLogViewer permission set only has access to view
    • The LoggerLogCreator and LoggerEndUser permission sets do not have access to the tab/lwc

    image

  • Provides page sections to mimic the look & feel of standard page layouts. Custom settings objects do not support page layouts, so there's normally not a way to control the arrangement of fields show in the UI. Within the component, all of the fields have been arranged into 5 sections:

    • General Settings
    • Log Management Settings
    • Developer Settings
    • Security Settings
    • System Information

    image

  • Displays usernames (instead of a user's name) as the primary field for user-specific records. This is useful in orgs where multiple users may have the same first/last name - with the standard UI for custom settings, it can be difficult to select the correct user when multiple people have the same name. Since username is unique, the component provides a better method of displaying/selecting the appropriate user.

    image

  • Provides picklist-style inputs for fields that really should be picklists. Custom settings objects do not support several field types, including picklists - instead, text fields are used on the object, but this can lead to bad config data being entered (e.g., an admin/developer mistypes the name of a LoggingLevel or Logger.SaveMethod enum value. The lwc solves this by presenting these fields as picklists, using some Apex in the LoggerSettingsController class to generate the list of picklist options. This prevants any isssues with tpyos, and it simplifies the configuration process for admins/developers

    image

  • Field labels updated: previously, I had shortened the labels on several fields to try to make things better fit into the standard list views for LoggerSettings__c. I've re-expanded several of the labels to be more verbose/descriptive, since the component provides a better use of space

  • Bonus unexpected feature: using this component, you can now configure LoggerSettings__c for the the Automated Process user. When using the standard UI for custom settings, you cannot search for/select the Automated Process user, but it apparently works just fine when the settings record is created via Apex

    image


Other changes

I've also included some other changes in this PR:

  • Pipeline enhancements - I've added caching for sfdx-cli in the pipeline, and the pipeline now deploys to 2 different scratch orgs (in parallel) to confirm the metadata works in both a base org, and an experience cloud org
  • Documentation enhancements - I've added JSDoc comments for the logger lwc classes - the GitHub Pages site should now include these docs going forward (alongside the existing Apex docs). I also cleaned up a few ApexDoc comments in various classes

…LogViewer perm set, fixed updating of most fields
…me, added validity check for inputs before saving
@jongpie jongpie added Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Log Management Items related to the custom objects & Logger Console app Layer: Logger Engine Items related to the core logging engine Salesforce Feature: Security Items related to the security model (object-level access, field-level security, record sharing) labels Nov 30, 2021
@jongpie jongpie temporarily deployed to Test November 30, 2021 15:37 Inactive
@jongpie jongpie temporarily deployed to Test November 30, 2021 15:42 Inactive
@jongpie jongpie force-pushed the feature/logger-settings-lwc branch from b9df129 to 48dc235 Compare November 30, 2021 15:45
@jongpie jongpie temporarily deployed to Test November 30, 2021 15:45 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 05:06 Inactive
@jamessimone
Copy link
Collaborator

@jamessimone, I.... I think this PR is finally ready!...? If you have some more time to spare, would you mind taking another look before I merge?

Absolutely. I’ll have a look through this morning!

@jongpie jongpie temporarily deployed to Test December 16, 2021 16:44 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 16:46 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 16:46 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 16:46 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 16:55 Inactive
Repository owner deleted a comment from codecov bot Dec 16, 2021
@jongpie jongpie force-pushed the feature/logger-settings-lwc branch from 7ad06a6 to d8ccf4a Compare December 16, 2021 17:07
@jongpie jongpie temporarily deployed to Test December 16, 2021 17:07 Inactive
@codecov
Copy link

codecov bot commented Dec 16, 2021

Codecov Report

Merging #254 (ea9b4ed) into main (e9ac332) will increase coverage by 0.14%.
The diff coverage is 95.49%.

❗ Current head ea9b4ed differs from pull request most recent head 1706f35. Consider uploading reports for the commit 1706f35 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
+ Coverage   95.53%   95.67%   +0.14%     
==========================================
  Files          28       30       +2     
  Lines        2864     3168     +304     
  Branches       42       64      +22     
==========================================
+ Hits         2736     3031     +295     
- Misses        127      136       +9     
  Partials        1        1              
Flag Coverage Δ
Apex 96.17% <97.48%> (+0.06%) ⬆️
LWC 92.45% <93.67%> (+2.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...er/main/log-management/classes/LogEntryHandler.cls 97.07% <ø> (ø)
...agement/lwc/relatedLogEntries/relatedLogEntries.js 83.33% <ø> (ø)
...ula-logger/main/logger-engine/lwc/logger/logger.js 86.53% <ø> (ø)
...og-management/lwc/loggerSettings/loggerSettings.js 93.25% <93.25%> (ø)
...og-management/classes/LoggerSettingsController.cls 97.29% <97.29%> (ø)
...ger/main/configuration/classes/LoggerParameter.cls 100.00% <100.00%> (ø)
...in/log-management/classes/LogEntryEventHandler.cls 98.24% <100.00%> (ø)
...-logger/main/log-management/classes/LogHandler.cls 97.64% <100.00%> (ø)
...in/log-management/classes/LoggerSObjectHandler.cls 94.52% <100.00%> (ø)
...ent/lwc/logEntryEventStream/logEntryEventStream.js 95.71% <100.00%> (+1.26%) ⬆️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e9ac332...1706f35. Read the comment docs.

@jongpie jongpie temporarily deployed to Test December 16, 2021 17:09 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 17:09 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 17:09 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 17:18 Inactive
@jongpie jongpie force-pushed the feature/logger-settings-lwc branch from 9fcf7c1 to 7357cc3 Compare December 16, 2021 21:15
@jongpie jongpie temporarily deployed to Test December 16, 2021 21:15 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 21:17 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 21:17 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 21:17 Inactive
@jongpie jongpie temporarily deployed to Test December 16, 2021 21:26 Inactive
@jongpie jongpie merged commit 166dd93 into main Dec 16, 2021
@jongpie jongpie deleted the feature/logger-settings-lwc branch December 16, 2021 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Log Management Items related to the custom objects & Logger Console app Layer: Logger Engine Items related to the core logging engine Salesforce Feature: Security Items related to the security model (object-level access, field-level security, record sharing)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a component for managing LoggerSettings__c records

4 participants