Skip to content

Commit

Permalink
New 'Log Entry Event Stream' tab & lwc (#191)
Browse files Browse the repository at this point in the history
* Created new lwc logEntryEventStream for streaming LogEntryEvent__e

* Added new tab to perm sets

* Added stream section to README

* Created new package version 4.6.8

* Fixed #204 - Improved approach for querying for an Apex class in `LogEntryHandler_Tests` to handle orgs that have 2 `Logger` classes (one with namespace and another without namespace)

* Fixed #205 - Eliminated DML on LoggerSettings__c, improved in-memory creation of defaults

* Fixed some issues reported by lint

* Add husky pre-commit setup, fixed some tests

* Added package-lock.json to repo

* Added npm caching in deploy.yml

* Added step to auto-delete unvalidated package version ID

* Added husky pre-commit hook, using lint-staged

* Removed install step for sfdx-scanner and using npm version instead

* Cleaned up ordering of sections in package.json

* Added GitHub issue templates to the repo

* Updated npm scripts "lint" and "prettier" to "lint:fix" and "prettier:fix" for clarity

* Changed a few lint rules to 'warn' instead of 'off'
  • Loading branch information
jongpie authored Sep 22, 2021
1 parent 408580f commit e4af34d
Show file tree
Hide file tree
Showing 50 changed files with 24,015 additions and 1,350 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
"plugins": ["@lwc/eslint-plugin-lwc", "@salesforce/eslint-plugin-aura"],
"extends": ["@salesforce/eslint-config-lwc/recommended"],
"rules": {
"eqeqeq": "off",
"eqeqeq": "warn",
"no-console": "off",
"no-unused-expressions": "off",
"semi": "off",
"no-unused-expressions": "warn",
"semi": "warn",
"@lwc/lwc/consistent-component-name": "error",
"@lwc/lwc/no-api-reassignments": "off",
"@lwc/lwc/no-async-operation": "off",
"@lwc/lwc/no-async-operation": "warn",
"@lwc/lwc/no-deprecated": "error",
"@lwc/lwc/no-document-query": "error",
"@lwc/lwc/valid-api": "error"
Expand Down
1 change: 1 addition & 0 deletions .forceignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ nebula-logger/main/default/**

# LWC Jest
**/__tests__/**
**/jest-mocks/**
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Bug Report
description: File a bug report for Nebula Logger
labels: ['bug']
body:
- type: dropdown
id: package-edition
attributes:
label: Package Edition of Nebula Logger
description: Which package are you using?
options:
- Unlocked Package
- Managed Package
validations:
required: true

- type: input
id: package-version
attributes:
label: Package Version of Nebula Logger
description: The package version number (displayed under Setup --> Installed Packages)
placeholder: v4.6.0, v4.6.1, etc.
validations:
required: true

- type: textarea
id: summary
attributes:
label: New Bug Summary
description: A description of what issue you are experiencing with Nebula Logger
validations:
required: true
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Feature Request
description: Suggest an enhancement for Nebula Logger
labels: ['enhancement']
body:
- type: textarea
attributes:
label: New Feature Summary
description: A description of what feature you'd like to be added to Nebula Logger.
placeholder: |
Example: I'd like to be able to [...]
validations:
required: true
124 changes: 61 additions & 63 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,27 +47,31 @@ jobs:
- name: 'Checkout source code'
uses: actions/checkout@v2

- name: 'Setup node'
uses: actions/setup-node@v2
- name: 'Restore node_modules cache'
id: cache-npm
uses: actions/cache@v2
with:
node-version: '14'
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-
- name: 'Install npm'
run: npm install
- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

- name: 'Lint Lightning Components'
run: npm run lint:lwc
- name: 'Install Salesforce CLI'
run: npm install sfdx-cli --global

- name: 'Prettier code formatting verification'
run: npm run prettier:verify
- name: 'LWC Lint verification'
run: npm run lint:verify

- name: Install Salesforce CLI
run: npm install sfdx-cli --global
- name: 'Apex SFDX Scanner verification'
run: npm run prepare && npm run scan

- name: Install & run SFDX Scanner
run: |
sfdx plugins:install @salesforce/sfdx-scanner
sfdx scanner:run --pmdconfig config/pmd-ruleset.xml --target . --engine pmd --severity-threshold 3
- name: 'Prettier formatting verification'
run: npm run prettier:verify

lwc-tests:
name: 'LWC Tests'
Expand All @@ -78,16 +82,19 @@ jobs:
- name: 'Checkout source code'
uses: actions/checkout@v2

- name: 'Setup node'
uses: actions/setup-node@v2
- name: 'Restore node_modules cache'
id: cache-npm
uses: actions/cache@v2
with:
node-version: '14'

- name: 'Install npm'
run: npm install
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-
- name: Install Salesforce CLI
run: npm install sfdx-cli --global
- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

- name: 'Run LWC Tests'
run: npm run test:lwc
Expand All @@ -107,15 +114,21 @@ jobs:
- name: 'Checkout source code'
uses: actions/checkout@v2

- name: 'Setup node'
uses: actions/setup-node@v2
- name: 'Restore node_modules cache'
id: cache-npm
uses: actions/cache@v2
with:
node-version: '14'
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-
- name: 'Install npm'
run: npm install
- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

- name: Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: npm install sfdx-cli --global

- name: 'Populate DevHub Auth Files'
Expand Down Expand Up @@ -146,8 +159,11 @@ jobs:
with:
args: '120'

- name: 'Push Metadata'
run: sfdx force:source:push --forceoverwrite
- name: 'Push Source to Scratch Org'
run: npm run source:push

- name: 'Assign Logger Admin Permission Set'
run: npm run permset:assign:admin

- name: 'Run Apex Tests'
run: npm run test:apex
Expand Down Expand Up @@ -175,15 +191,21 @@ jobs:
- name: 'Checkout source code'
uses: actions/checkout@v2

- name: 'Setup node'
uses: actions/setup-node@v2
- name: 'Restore node_modules cache'
id: cache-npm
uses: actions/cache@v2
with:
node-version: '14'
path: node_modules
key: npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
npm-${{ env.cache-name }}-
npm-
- name: 'Install npm'
run: npm install
- name: 'Install npm dependencies'
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci

- name: Install Salesforce CLI
- name: 'Install Salesforce CLI'
run: npm install sfdx-cli --global

- name: 'Populate Org Auth Files'
Expand All @@ -206,29 +228,5 @@ jobs:
- name: 'Reinstall Latest Released Package Version'
run: npx pwsh ./scripts/install-latest-released-unlocked-package-version.ps1 -targetusername nebula-logger-package-demo

# TODO finish auto-creation & promotion of unlocked package + committing changes to docs
# create-package-version:
# name: 'Create Package Version'
# needs: [code-quality-tests, lwc-tests, scratch-org-tests]
# runs-on: ubuntu-latest
# environment: Test
# steps:
# # Checkout the code
# - name: 'Checkout source code'
# uses: actions/checkout@v2

# - name: 'Setup node'
# uses: actions/setup-node@v2
# with:
# node-version: '14'

# - name: 'Install npm'
# run: npm install

# - name: 'Generate Docs'
# run: npm run docs:generate
# TODO need to commit & push any changes to ./docs/*

# TODO uncomment
# - name: 'Create unlocked package version'
# run: npm run package:version:create:unlocked
- name: 'Delete Unvalidated Package Version'
run: npx pwsh ./scripts/delete-unvalidated-package-version.ps1
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ tests/apex/

# NPM
node_modules/
package-lock.json
yarn.lock

# Files to exclude
*.log
*.log
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run husky:pre-commit
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

Designed for Salesforce admins, developers & architects. A robust logger for Apex, Lightning Components, Flow, Process Builder & Integrations.

[![Install Unlocked Package](./content/btn-install-unlocked-package.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015klZQAQ)
[![Install Unlocked Package](./content/btn-install-unlocked-package.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015kplQAA)
[![Install Managed Package](./content/btn-install-managed-package.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015keOQAQ)
[![View Documentation](./content/btn-view-documentation.png)](https://jongpie.github.io/NebulaLogger/)

Expand Down Expand Up @@ -594,6 +594,14 @@ Everyone loves JSON - so to make it easy to see a JSON version of a `Log__c` rec

---

### Real-Time Monitoring with Log Entry Event Stream

Within Logger Console app, the Log Entry Event Stream tab provides real-time monitoring of `LogEntryEvent__e` platform events. Simply open the tab to start monitoring, and use the filters to further refine with `LogEntryEvent__e` records display in the stream.

![Log Entry Event Stream](./content/log-entry-event-stream.png)

---

### View Related Log Entries on a Record Page

Within App Builder, admins can add the 'Related Log Entries' lightning web component (lwc) to any record page. Admins can also control which columns are displayed be creating & selecting a field set on `LogEntry__c` with the desired fields.
Expand Down
Binary file modified content/btn-install-unlocked-package.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added content/log-entry-event-stream.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Schedulable class used to schedule the batch job `LogBatchPurger`

### [LogBatchPurger](log-management/LogBatchPurger)

Batch class used to delete old logs, based on `Log__c.LogRetentionDate__c <= :System.today()`
Batch class used to delete old logs, based on `Log__c.LogRetentionDate__c &lt;= :System.today()`

### [LogEntryEventHandler](log-management/LogEntryEventHandler)

Expand All @@ -58,15 +58,15 @@ Dynamically returns `LogEntry__c` field sets in App Builder when configuring the

### [LogEntryHandler](log-management/LogEntryHandler)

Manages setting fields on `LogEntry__c` before insert & before update
Manages setting fields on `LogEntry__c` before insert &amp; before update

### [LogEntryTagHandler](log-management/LogEntryTagHandler)

Handles trigger events for the `LogEntryTag__c` object

### [LogHandler](log-management/LogHandler)

Manages setting fields on `Log__c` before insert & before update
Manages setting fields on `Log__c` before insert &amp; before update

### [LogMassDeleteExtension](log-management/LogMassDeleteExtension)

Expand All @@ -88,7 +88,7 @@ Controller class for the lightning web component `related-log-entries`

### [LoggerParameter](plugin-framework/LoggerParameter)

Provides a centralized way to load T parameters for SObject handlers & plugins, and casts the parameters to common data types
Provides a centralized way to load T parameters for SObject handlers &amp; plugins, and casts the parameters to common data types

### [LoggerSObjectHandlerPlugin](plugin-framework/LoggerSObjectHandlerPlugin)

Expand Down
2 changes: 1 addition & 1 deletion docs/log-management/LogBatchPurger.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ layout: default

## LogBatchPurger class

Batch class used to delete old logs, based on `Log__c.LogRetentionDate__c <= :System.today()`
Batch class used to delete old logs, based on `Log__c.LogRetentionDate__c &lt;= :System.today()`

### Related

Expand Down
2 changes: 1 addition & 1 deletion docs/log-management/LogEntryHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ layout: default

## LogEntryHandler class

Manages setting fields on `LogEntry__c` before insert & before update
Manages setting fields on `LogEntry__c` before insert &amp; before update

---

Expand Down
2 changes: 1 addition & 1 deletion docs/log-management/LogHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ layout: default

## LogHandler class

Manages setting fields on `Log__c` before insert & before update
Manages setting fields on `Log__c` before insert &amp; before update

---

Expand Down
2 changes: 1 addition & 1 deletion docs/log-management/LogMassDeleteExtension.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Filters the list of selected `Log__c` records to only include records that the c

**Type**

List<Log\_\_c>
List&lt;Log\_\_c&gt;

**Description**

Expand Down
2 changes: 1 addition & 1 deletion docs/log-management/LoggerSObjectHandler.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Abstract class used by trigger handlers for shared logic

#### `execute()``void`

Runs the handler class's logic
Runs the handler class&apos;s logic

#### `getSObjectType()``SObjectType`

Expand Down
Loading

0 comments on commit e4af34d

Please sign in to comment.