hopefully fix server metrics refresh bug

This commit is contained in:
Matt Hill
2021-06-15 11:09:48 -06:00
committed by Aiden McClelland
parent decc17fce5
commit f364202ae9
3 changed files with 82 additions and 35 deletions

View File

@@ -43,16 +43,19 @@ export class ServerMetricsPage {
async getMetrics (): Promise<void> {
try {
const metrics = await this.apiService.getServerMetrics({ })
Object.keys(metrics).forEach(outerKey => {
if (!this.metrics[outerKey]) {
this.metrics[outerKey] = metrics[outerKey]
} else {
Object.entries(metrics[outerKey]).forEach(([key, value]) => {
this.metrics[outerKey][key] = value
})
}
})
this.metrics = await this.apiService.getServerMetrics({ })
// @TODO keeping code in case naive approach (above) has issues
// Object.keys(metrics).forEach(outerKey => {
// if (!this.metrics[outerKey]) {
// console.log('outer keys')
// this.metrics[outerKey] = metrics[outerKey]
// } else {
// Object.entries(metrics[outerKey]).forEach(([key, value]) => {
// this.metrics[outerKey][key] = value
// })
// }
// })
} catch (e) {
console.error(e)
this.error = e.message