Protect against accessing invalid DOM elements when metricstream callbacks occur for delete views
This commit is contained in:
@@ -69,10 +69,10 @@ async function liveRefresh() {
|
||||
for (const [id, metric] of Object.entries(data)) {
|
||||
const idx = id !== 'system' ? containers.value.findIndex(c => c.id === id) : containers.value.length;
|
||||
|
||||
cpuGraphItem.value.pushData(idx, metric.cpu);
|
||||
memoryGraphItem.value.pushData(idx*2, metric.memory, metric.swap || []); // apps have no swap
|
||||
diskGraphItem.value.pushData(idx*2, metric.blockReadRate, metric.blockWriteRate);
|
||||
networkGraphItem.value.pushData(idx*2, metric.networkReadRate, metric.networkWriteRate);
|
||||
if (cpuGraphItem.value) cpuGraphItem.value.pushData(idx, metric.cpu);
|
||||
if (memoryGraphItem.value) memoryGraphItem.value.pushData(idx*2, metric.memory, metric.swap || []); // apps have no swap
|
||||
if (diskGraphItem.value) diskGraphItem.value.pushData(idx*2, metric.blockReadRate, metric.blockWriteRate);
|
||||
if (networkGraphItem.value) networkGraphItem.value.pushData(idx*2, metric.networkReadRate, metric.networkWriteRate);
|
||||
|
||||
if (id === 'system') {
|
||||
blockReadTotal.value = prettyDecimalSize(metric.blockReadTotal);
|
||||
@@ -161,10 +161,10 @@ async function rebuild() {
|
||||
blockWriteTotal.value = prettyDecimalSize(metrics.system.blockWriteTotal);
|
||||
}
|
||||
|
||||
cpuGraphItem.value.setDatasets(datasets.cpu);
|
||||
memoryGraphItem.value.setDatasets(datasets.memory);
|
||||
diskGraphItem.value.setDatasets(datasets.disk);
|
||||
networkGraphItem.value.setDatasets(datasets.network);
|
||||
if (cpuGraphItem.value) cpuGraphItem.value.setDatasets(datasets.cpu);
|
||||
if (memoryGraphItem.value) memoryGraphItem.value.setDatasets(datasets.memory);
|
||||
if (diskGraphItem.value) diskGraphItem.value.setDatasets(datasets.disk);
|
||||
if (networkGraphItem.value) networkGraphItem.value.setDatasets(datasets.network);
|
||||
|
||||
if (period.value.hours === 0) return await liveRefresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user