Answered step by step
Verified Expert Solution
Link Copied!

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.reduce((acc, item)=>{ acc[item.device_serial]={ weighbridge_name: item.weighbridge_name, device_serial: item.device_serial, }; // Update lastofagnosticupdate if current item timestamp is more recent acc[item.device_serial].lastDiagnosticUpdate = item.timestamp; if (lacc[iten.device_serial].sub_types[item.sub_type]){ timestamp: item.timestamp, } object.assign(acc[item.device_serial].sub_types[item.sub_type].payload, item.payload); return acc; return object.values(grouped);}, options: { if (!this.isInitialLoad){} else { this.options.itemsPerPage =20},}
}, diskUsageIconColor(rootDiskUsage){ if (rootDiskUsage ==255) return 'gray else if (rootDiskUsage =9e) return 'warning Jsync loadDiagnostics(){ this.loading = true; let sorting ='`; sorting = null; for (let 1= e; 1 sortBy.length; 1++){ sorting += sortBy[i]+'?+(sortDesc[i]? 'desc' : 'asc'); try { return errorasyne loadolagnostics(){this.loading = true;let sorting =''; sorting = null;for (let i =0; i sortly.length; i++){ sorting += sortBy[1]+': +(sortDesc[1]? 'desc' : 'asc');try { page, this.keyword); const diagnosticsIteas = response.data.data.items; const weighbridgeInfo = fetchedAssets.find(asset => asset.id === iter.weighbridge_id); item.weighbridge_name = weighbridgeInfo.name; this.diagnostics.itens = diagnosticsItems;} else {} this.handleError(error) this.loading = false;convertTolocalTime(utcTimestamp){ if (!utctinestamp) return ; \ date = new Date(utcTinestamp); const localoate = new Date(date.getTime()+ utcoffset *6ecog);}, const index = this, expandedItems.indexof(item); this.expandedItems.push(item); this.expandedItems.splice(index,1);}, return this.diagnostics.items.filter(iten => item.device_serial === device_serial);handleError(error){ if (error.response){} else if (error.request){} else {this.expandedItems.splice(index,1);
},
getFilteredSubItems(device_serial){
return this.diagnostics.items.filter(item => item.device_serial === device_serial);
},
handleError(error){
console.error(error)
if (error.response){
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: {
imb_updated_diagnostic: function(data){
data.items.forEach((item)=>{
console.log('diagnostic update received: ',data)
const indexofE1= this.diagnostics.itens.findIndex(
x => x.device_serial === item.device_serial 8& x.sub_type === item.sub_type
;
If (indexofEl >=0){
for (const key in item){
if (key !== 'device_serial' && key !== 'sub_type'){
this.diagnostics.items[indexofEl][key]= iten[key]
}
} else {
this.diagnostics.items.push(item);
}
});
},
},
async mounted()
},
created(){
this.nodeHeartbeatUpdateTimer = setInterval(
this.updateNodeHeartbeat,
,
},beforeDestroy(){
clearInterval(this.nodeHeartbeatUpdateTimer)
},
}
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
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions