Skip to content

Commit

Permalink
Added relatedLogEntries refresh button + spinner (#703)
Browse files Browse the repository at this point in the history
* Added refresh button and spinner to relatedLogEntries LWC

* Added sample Account flexipage w/ relatedLogEntries LWC to make it easy to test in a scratch org
  • Loading branch information
andrii-solokh committed Jul 7, 2024
1 parent 4d56ecb commit 88c630b
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 24 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.11
## Unlocked Package - v4.13.12

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

`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000027L98QAE`
`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015oCkQAI`

`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000027L98QAE`
`sfdx force:package:install --wait 20 --securitytype AdminsOnly --package 04t5Y0000015oCkQAI`

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,31 @@
<template>
<template if:true={showComponent}>
<lightning-card title={title} icon-name="custom:custom83" class="log-entry-card">
<div slot="actions">
<lightning-input data-id="enter-search" placeholder="Search" type="search" value={search} onchange={handleSearchChange}></lightning-input>
<div class="slds-grid" slot="actions">
<lightning-input
class="slds-m-right_xx-small"
data-id="enter-search"
placeholder="Search"
type="search"
value={search}
onchange={handleSearchChange}
variant="label-hidden"
></lightning-input>
<lightning-button-icon icon-name="utility:refresh" onclick={refresh}></lightning-button-icon>
</div>
<div class="slds-is-relative">
<lightning-datatable
key-field="id"
show-row-number-column="true"
data={queryResult.records}
columns={queryResult.fieldSet.fields}
onsort={handleSort}
sorted-by={sortBy}
sorted-direction={sortDirection}
default-sort-direction={sortDirection}
></lightning-datatable>
<lightning-spinner if:true={isLoading} size="small"></lightning-spinner>
</div>
<lightning-datatable
key-field="id"
show-row-number-column="true"
data={queryResult.records}
columns={queryResult.fieldSet.fields}
onsort={handleSort}
sorted-by={sortBy}
sorted-direction={sortDirection}
default-sort-direction={sortDirection}
></lightning-datatable>
</lightning-card>
</template>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
************************************************************************************************/

import { LightningElement, api, track, wire } from 'lwc';
import { refreshApex } from '@salesforce/apex';

import getQueryResult from '@salesforce/apex/RelatedLogEntriesController.getQueryResult';
export default class RelatedLogEntries extends LightningElement {
/* eslint-disable @lwc/lwc/no-api-reassignments */
Expand All @@ -13,10 +15,12 @@ export default class RelatedLogEntries extends LightningElement {
@api sortDirection = '';
@api rowLimit;
@api search = '';
@api queryResult;
@track showComponent = false;
@track title;
@api queryResult;
@track wiredResult;
@track isLoading = true;
@api
handleSort(event) {
Expand All @@ -26,6 +30,7 @@ export default class RelatedLogEntries extends LightningElement {
@api
handleSearchChange(event) {
this.isLoading = true;
this.search = event.target.value;
}
Expand All @@ -38,6 +43,7 @@ export default class RelatedLogEntries extends LightningElement {
search: '$search'
})
wiredLogEntries(result) {
this.wiredResult = result;
if (result.data) {
let queryResult = this.processResult(result.data);
this.queryResult = queryResult;
Expand All @@ -49,6 +55,13 @@ export default class RelatedLogEntries extends LightningElement {
/* eslint-disable-next-line no-console */
console.log(result.error);
}
this.isLoading = false;
}

async refresh() {
this.isLoading = true;
await refreshApex(this.wiredResult);
this.isLoading = false;
}

// Parse the Apex results & add any UI-specific attributes based on field metadata
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.11';
private static final String CURRENT_VERSION_NUMBER = 'v4.13.12';
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.11';
const CURRENT_VERSION_NUMBER = 'v4.13.12';

// JavaScript equivalent to the Apex class ComponentLogger.ComponentLogEntry
const ComponentLogEntry = class {
Expand Down
Loading

0 comments on commit 88c630b

Please sign in to comment.