-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Update WebUI for metrics data changing to json string #2067
Conversation
src/webui/src/static/function.ts
Outdated
@@ -43,7 +43,7 @@ const getFinalResult = (final?: MetricDataRecord[]): number => { | |||
let acc; | |||
let showDefault = 0; | |||
if (final) { | |||
acc = JSON.parse(final[final.length - 1].data); | |||
acc = JSON5.parse(final[final.length - 1].data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to call parseMetrics here? there maybe more updates in parseMetrics later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's OK.
@@ -182,8 +182,6 @@ function formatTimestamp(timestamp?: number, placeholder?: string): string { | |||
function parseMetrics(metricData: string): any { | |||
if (metricData.includes('NaN')) { | |||
return JSON5.parse(metricData) | |||
} else { | |||
return JSON.parse(metricData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought UI only use JSON5 from the teams message.
It's misleading, I'll change this back.
src/webui/src/static/function.ts
Outdated
@@ -61,7 +61,7 @@ const getFinalResult = (final?: MetricDataRecord[]): number => { | |||
const getFinal = (final?: MetricDataRecord[]): FinalType | undefined => { | |||
let showDefault: FinalType; | |||
if (final) { | |||
showDefault = JSON.parse(final[final.length - 1].data); | |||
showDefault = JSON5.parse(final[final.length - 1].data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be replaced by parseMetrics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
Update WebUI for metrics data changing to json string