mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
hopefully fix server metrics refresh bug
This commit is contained in:
committed by
Aiden McClelland
parent
1b0173197f
commit
e5de786cf1
@@ -43,16 +43,19 @@ export class ServerMetricsPage {
|
|||||||
|
|
||||||
async getMetrics (): Promise<void> {
|
async getMetrics (): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const metrics = await this.apiService.getServerMetrics({ })
|
this.metrics = await this.apiService.getServerMetrics({ })
|
||||||
Object.keys(metrics).forEach(outerKey => {
|
|
||||||
if (!this.metrics[outerKey]) {
|
// @TODO keeping code in case naive approach (above) has issues
|
||||||
this.metrics[outerKey] = metrics[outerKey]
|
// Object.keys(metrics).forEach(outerKey => {
|
||||||
} else {
|
// if (!this.metrics[outerKey]) {
|
||||||
Object.entries(metrics[outerKey]).forEach(([key, value]) => {
|
// console.log('outer keys')
|
||||||
this.metrics[outerKey][key] = value
|
// this.metrics[outerKey] = metrics[outerKey]
|
||||||
})
|
// } else {
|
||||||
}
|
// Object.entries(metrics[outerKey]).forEach(([key, value]) => {
|
||||||
})
|
// this.metrics[outerKey][key] = value
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
this.error = e.message
|
this.error = e.message
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export class MockApiService extends ApiService {
|
|||||||
|
|
||||||
async getServerMetrics (params: RR.GetServerMetricsReq): Promise<RR.GetServerMetricsRes> {
|
async getServerMetrics (params: RR.GetServerMetricsReq): Promise<RR.GetServerMetricsRes> {
|
||||||
await pauseFor(2000)
|
await pauseFor(2000)
|
||||||
return Mock.ServerMetrics
|
return Mock.getServerMetrics()
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateServerRaw (params: RR.UpdateServerReq): Promise<RR.UpdateServerRes> {
|
async updateServerRaw (params: RR.UpdateServerReq): Promise<RR.UpdateServerRes> {
|
||||||
|
|||||||
@@ -783,14 +783,15 @@ export module Mock {
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
export const ServerMetrics: RR.GetServerMetricsRes = {
|
export function getServerMetrics () {
|
||||||
|
return {
|
||||||
'Group1': {
|
'Group1': {
|
||||||
'Metric1': {
|
'Metric1': {
|
||||||
value: 22.2,
|
value: Math.random(),
|
||||||
unit: 'mi/b',
|
unit: 'mi/b',
|
||||||
},
|
},
|
||||||
'Metric2': {
|
'Metric2': {
|
||||||
value: 50,
|
value: Math.random(),
|
||||||
unit: '%',
|
unit: '%',
|
||||||
},
|
},
|
||||||
'Metric3': {
|
'Metric3': {
|
||||||
@@ -812,6 +813,49 @@ export module Mock {
|
|||||||
unit: '%',
|
unit: '%',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'Group3': {
|
||||||
|
'Hmmmm1': {
|
||||||
|
value: Math.random(),
|
||||||
|
unit: 'mi/b',
|
||||||
|
},
|
||||||
|
'Hmmmm2': {
|
||||||
|
value: 50,
|
||||||
|
unit: '%',
|
||||||
|
},
|
||||||
|
'Hmmmm3': {
|
||||||
|
value: 10.1,
|
||||||
|
unit: '%',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'Group4': {
|
||||||
|
'Hmmmm1': {
|
||||||
|
value: Math.random(),
|
||||||
|
unit: 'mi/b',
|
||||||
|
},
|
||||||
|
'Hmmmm2': {
|
||||||
|
value: 50,
|
||||||
|
unit: '%',
|
||||||
|
},
|
||||||
|
'Hmmmm3': {
|
||||||
|
value: 10.1,
|
||||||
|
unit: '%',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'Group5': {
|
||||||
|
'Hmmmm1': {
|
||||||
|
value: Math.random(),
|
||||||
|
unit: 'mi/b',
|
||||||
|
},
|
||||||
|
'Hmmmm2': {
|
||||||
|
value: 50,
|
||||||
|
unit: '%',
|
||||||
|
},
|
||||||
|
'Hmmmm3': {
|
||||||
|
value: 10.1,
|
||||||
|
unit: '%',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ServerLogs: RR.GetServerLogsRes = [
|
export const ServerLogs: RR.GetServerLogsRes = [
|
||||||
|
|||||||
Reference in New Issue
Block a user