-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(manager): use server metrics row #2354
base: master
Are you sure you want to change the base?
feat(manager): use server metrics row #2354
Conversation
serverView.totalInboundBytes = totalInboundBytes; | ||
const NUMBER_OF_ASES_TO_SHOW = 4; | ||
serverView.bandwidthUsageTotal = this.formatGigabyteValueAndUnit( | ||
bandwidthUsageTotal / BYTES_IN_GIGABYTES |
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.
You should pick the unit based on the value. Otherwise you will end up with zeros
.reverse() | ||
.map(server => ({ | ||
title: server.asOrg, | ||
subtitle: `${server.asn}AS`, |
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.
Swap. AS must come before the number
return ''; | ||
} | ||
|
||
return new Intl.NumberFormat(this.appRoot.language, { |
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.
Use our existing formatting library to properly pick the units
.top(NUMBER_OF_ASES_TO_SHOW) | ||
.reverse() | ||
.map(server => ({ | ||
title: server.asOrg, |
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.
You don't always have asOrg. What's the plan when it's absent?
I usually use ${asOrg} (AS${asn})
with fallback to AS${asn}
@@ -1101,11 +1172,80 @@ export class App { | |||
} | |||
} | |||
|
|||
private formatGigabyteValueAndUnit(data: number) { | |||
// This happens during app startup before we set the language |
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 think this is because we're not setting the default property properly. If you set the default value, you shouldn't need this https://polymer-library.polymer-project.org/3.0/docs/devguide/properties#configure-values
countryCode.length !== 2 || | ||
!/^[A-Z]{2}$/.test(countryCode) | ||
) { | ||
return 'Invalid country code'; |
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.
This needs localization.
private countryCodeToEmoji(countryCode: string) { | ||
if ( | ||
!countryCode || | ||
countryCode.length !== 2 || |
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.
This length check seems redundant given the regular expression also checks the length.
Screen.Recording.2025-01-31.at.3.29.41.PM.mov