Answered step by step
Verified Expert Solution
Question
1 Approved Answer
{ { Item.payload } } / / tesplate computed: { const grouped = this.diagnostics.items.reduce ( ( acc , item ) = > { acc [
Item.payload
tesplate
computed: const grouped this.diagnostics.items.reduceacc item accitemdeviceserial weighbridgename: item.weighbridgename, deviceserial: item.deviceserial, ; Update lastofagnosticupdate if current item timestamp is more recent accitemdeviceseriallastDiagnosticUpdate item.timestamp; if laccitendeviceserialsubtypesitemsubtype timestamp: item.timestamp, object.assignaccitemdeviceserialsubtypesitemsubtypepayload, item.payload; return acc; return object.valuesgrouped; options: if this.isInitialLoad else this.options.itemsPerPage
diskUsageIconColorrootDiskUsage if rootDiskUsage return 'gray else if rootDiskUsage e return 'warning Jsync loadDiagnostics this.loading true; let sorting ; sorting null; for let e; sortBy.length; sorting sortByisortDesci 'desc' : 'asc'; try return errorasyne loadolagnosticsthisloading true;let sorting ; sorting null;for let i ; i sortly.length; i sorting sortBy: sortDesc 'desc' : 'asc';try page, this.keyword; const diagnosticsIteas response.data.data.items; const weighbridgeInfo fetchedAssets.findasset asset.id iter.weighbridgeid; item.weighbridgename weighbridgeInfo.name; this.diagnostics.itens diagnosticsItems; else this.handleErrorerror this.loading false;convertTolocalTimeutcTimestamp if utctinestamp return ; date new DateutcTinestamp; const localoate new DatedategetTime utcoffset ecog; const index this, expandedItems.indexofitem; this.expandedItems.pushitem; this.expandedItems.spliceindex; return this.diagnostics.items.filteriten item.deviceserial deviceserial;handleErrorerror if errorresponse else if errorrequest else thisexpandedItems.spliceindex;
getFilteredSubItemsdeviceserial
return this.diagnostics.items.filteritem item.deviceserial deviceserial;
handleErrorerror
console.errorerror
if errorresponse
this.snackbarMessage error.response.data.message 'Unknown error'
else if error request
this.snackbarMessage No response received
else
this.snackbarMessage error.message
this.snackbar true
sockets:
imbupdateddiagnostic: functiondata
data.items.forEachitem
console.logdiagnostic update received: data
const indexofE this.diagnostics.itens.findIndex
x xdeviceserial item.deviceserial & xsubtype item.subtype
;
If indexofEl
for const key in item
if key 'deviceserial' && key 'subtype'
this.diagnostics.itemsindexofElkey itenkey
else
this.diagnostics.items.pushitem;
;
async mounted
created
this.nodeHeartbeatUpdateTimer setInterval
this.updateNodeHeartbeat,
beforeDestroy
clearIntervalthisnodeHeartbeatUpdateTimer
my interface code which mostly works however there is a slight bug, whenever new
updated data is received by my socket code, any expanded table records displaying the subtable content automatically close, which is not what i want, my expanded tables should remain expanded unless closed by the user, not when the websocket updates data, please fix this bug
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started