From 731e7953d6b6402a3eb54fe38d0c4253165d1ce9 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Mon, 29 Apr 2024 16:35:28 +0000 Subject: [PATCH] feat: add refresh button and spinner to relatedLogEntries lwc --- .../relatedLogEntries/relatedLogEntries.html | 36 ++++++++++++------- .../relatedLogEntries/relatedLogEntries.js | 15 +++++++- 2 files changed, 38 insertions(+), 13 deletions(-) diff --git a/nebula-logger/core/main/log-management/lwc/relatedLogEntries/relatedLogEntries.html b/nebula-logger/core/main/log-management/lwc/relatedLogEntries/relatedLogEntries.html index fc9d23652..69b03b6db 100644 --- a/nebula-logger/core/main/log-management/lwc/relatedLogEntries/relatedLogEntries.html +++ b/nebula-logger/core/main/log-management/lwc/relatedLogEntries/relatedLogEntries.html @@ -6,19 +6,31 @@ diff --git a/nebula-logger/core/main/log-management/lwc/relatedLogEntries/relatedLogEntries.js b/nebula-logger/core/main/log-management/lwc/relatedLogEntries/relatedLogEntries.js index 08cf00c7c..397db7026 100644 --- a/nebula-logger/core/main/log-management/lwc/relatedLogEntries/relatedLogEntries.js +++ b/nebula-logger/core/main/log-management/lwc/relatedLogEntries/relatedLogEntries.js @@ -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 */ @@ -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) { @@ -26,6 +30,7 @@ export default class RelatedLogEntries extends LightningElement { @api handleSearchChange(event) { + this.isLoading = true; this.search = event.target.value; } @@ -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; @@ -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