Skip to content

Commit

Permalink
Fixed logEntryMetadataViewer LWC's 'View Full Source' button not show…
Browse files Browse the repository at this point in the history
…ing for non-admins (#671)

* Added access for the Apex class LogEntryMetdataViewerController to the permission sets LoggerAdmin, LoggerLogViewer, LoggerEndUser to fix some permission errors that could occur in some orgs/situations

* Fixed some excessively large whitespace in the LWC caused by a present-but-not-visible spinner

* Updated the logEntryMetadataViewer LWC to imperatively call Apex controller methods - using the @wire annotation caused weird, silent failures when calling the Apex methods, calling it imperatively seems to work wonderfully (and is more consistent with how the other LWCs in Nebula Logger are written)
  • Loading branch information
jongpie committed Apr 18, 2024
1 parent f4addfd commit de8088d
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 28 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.

## Unlocked Package - v4.13.7
## Unlocked Package - v4.13.8

[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001MkHRQA0)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001MkHRQA0)
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001MkHbQAK)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y000001MkHbQAK)
[![View Documentation](./images/btn-view-documentation.png)](https://jongpie.github.io/NebulaLogger/)

`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y000001MkHRQA0`
`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y000001MkHbQAK`

`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y000001MkHRQA0`
`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y000001MkHbQAK`

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<template>
<template if:false={hasLoaded}>
<div class="slds-is-relative" style="min-height: 6em">
<lightning-spinner variant="inverse"></lightning-spinner>
<lightning-spinner></lightning-spinner>
</div>
</template>
<template if:true={hasLoaded}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class LogEntryMetadataViewer extends LightningElement {
@api sourceMetadata;

objectApiName = LOG_ENTRY_OBJECT;
hasLoaded = false;
sourceSnippet;

showFullSourceMetadataModal = false;
Expand All @@ -43,10 +44,6 @@ export default class LogEntryMetadataViewer extends LightningElement {
_logEntry;
_logEntryMetadata;

get hasLoaded() {
return !!this._logEntry && !!this._logEntryMetadata;
}

get sectionTitle() {
if (this.sourceMetadata === 'Exception') {
return 'Exception Source Metadata';
Expand Down Expand Up @@ -76,18 +73,6 @@ export default class LogEntryMetadataViewer extends LightningElement {
: 'This Apex code has not been modified since this log entry was generated.';
}

@wire(getMetadata, {
recordId: '$recordId',
sourceMetadata: '$sourceMetadata'
})
wiredGetLogEntryMetadata({ error, data }) {
if (data) {
this._logEntryMetadata = data;
} else if (error) {
this._logEntryMetadata = undefined;
}
}

@wire(getRecord, {
recordId: '$recordId',
fields: LOG_ENTRY_FIELDS
Expand All @@ -110,6 +95,12 @@ export default class LogEntryMetadataViewer extends LightningElement {
const sourceApiVersion = getFieldValue(this._logEntry, sourceApiVersionField);
const sourceName = `${sourceApiName}.${sourceExtension} - ${sourceApiVersion}`;
this.sourceSnippet = { ...JSON.parse(sourceSnippetJson), ...{ Title: sourceName } };

this.hasLoaded = true;
this._logEntryMetadata = await getMetadata({
recordId: this.recordId,
sourceMetadata: this.sourceMetadata
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<apexClass>LogEntryEventStreamController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>LogEntryMetadataViewerController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>LogMassDeleteExtension</apexClass>
<enabled>true</enabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<apexClass>FlowRecordLogEntry</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>LogEntryMetadataViewerController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>LogMassDeleteExtension</apexClass>
<enabled>true</enabled>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<apexClass>LogEntryEventStreamController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>LogEntryMetadataViewerController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>LogMassDeleteExtension</apexClass>
<enabled>true</enabled>
Expand Down
2 changes: 1 addition & 1 deletion nebula-logger/core/main/logger-engine/classes/Logger.cls
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
global with sharing class Logger {
// There's no reliable way to get the version number dynamically in Apex
@TestVisible
private static final String CURRENT_VERSION_NUMBER = 'v4.13.7';
private static final String CURRENT_VERSION_NUMBER = 'v4.13.8';
private static final System.LoggingLevel FALLBACK_LOGGING_LEVEL = System.LoggingLevel.DEBUG;
private static final List<LogEntryEventBuilder> LOG_ENTRIES_BUFFER = new List<LogEntryEventBuilder>();
private static final String MISSING_SCENARIO_ERROR_MESSAGE = 'No logger scenario specified. A scenario is required for logging in this org.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//------------------------------------------------------------------------------------------------//
import FORM_FACTOR from '@salesforce/client/formFactor';

const CURRENT_VERSION_NUMBER = 'v4.13.7';
const CURRENT_VERSION_NUMBER = 'v4.13.8';

// JavaScript equivalent to the Apex class ComponentLogger.ComponentLogEntry
const ComponentLogEntry = class {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nebula-logger",
"version": "4.13.7",
"version": "4.13.8",
"description": "The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.",
"author": "Jonathan Gillespie",
"license": "MIT",
Expand Down
7 changes: 4 additions & 3 deletions sfdx-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"path": "./nebula-logger/core",
"definitionFile": "./config/scratch-orgs/base-scratch-def.json",
"scopeProfiles": true,
"versionNumber": "4.13.7.NEXT",
"versionName": "Fixed function setScenario() in logger LWC",
"versionDescription": "Fixed an issue in the logger LWC's function setScenario() where the value was sometimes (often?) incorrectly set to null",
"versionNumber": "4.13.8.NEXT",
"versionName": "logEntryMetadataViewer LWC Bugfixes",
"versionDescription": "Fixed some additional issues in the logEntryMetadataViewer LWC that prevented the 'view full source' btn from showing up for non-admins",
"releaseNotesUrl": "https://github.com/jongpie/NebulaLogger/releases",
"unpackagedMetadata": {
"path": "./nebula-logger/extra-tests"
Expand Down Expand Up @@ -175,6 +175,7 @@
"Nebula Logger - Core@4.13.5-performance-improvements": "04t5Y000001MkGnQAK",
"Nebula Logger - Core@4.13.6-view-log-entry-metadata-custom-permission": "04t5Y000001MkGxQAK",
"Nebula Logger - Core@4.13.7-fixed-function-setscenario()-in-logger-lwc": "04t5Y000001MkHRQA0",
"Nebula Logger - Core@4.13.8-logentrymetadataviewer-lwc-bugfixes": "04t5Y000001MkHbQAK",
"Nebula Logger - Core Plugin - Async Failure Additions": "0Ho5Y000000blO4SAI",
"Nebula Logger - Core Plugin - Async Failure Additions@1.0.0": "04t5Y0000015lhiQAA",
"Nebula Logger - Core Plugin - Async Failure Additions@1.0.1": "04t5Y0000015lhsQAA",
Expand Down

0 comments on commit de8088d

Please sign in to comment.