Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Update WebUI for metrics data changing to json string #2067

Merged
merged 4 commits into from
Feb 17, 2020

Conversation

lvybriage
Copy link
Contributor

@lvybriage lvybriage commented Feb 16, 2020

Update WebUI for metrics data changing to json string

@@ -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);
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

Copy link
Contributor Author

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.

@@ -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);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

@chicm-ms chicm-ms changed the title Use JSON5 to parse json Update WebUI for metrics data changing to json string Feb 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants