-
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): move and update metrics cards in the server view #2241
base: master
Are you sure you want to change the base?
Conversation
daniellacosse
commented
Oct 14, 2024
•
edited
Loading
edited
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 is very helpful to see how the API is used. I believe we will benefit a lot from merging the stats flows into one.
55108a4
to
ee8c388
Compare
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.
Updated with the new endpoint JSON: will merge methods next
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.
As discussed offline, Per-ASN breakdown was a significant gap during the Iran crisis. It's a confirmed need and and we put a lot of effort to implement it. It's more of a question of how, not whether we want to surface that.
I would like to see that surfaced somehow in this PR, to inform the UX design. We've discussed a simple table, which seems to work well.
Sure thing, working on it! |
Here's an initial PR for a data table component: #2273 |
server_manager/www/testing/models.ts
Outdated
@@ -168,6 +168,34 @@ export class FakeServer implements server.Server { | |||
getDataUsage() { | |||
return Promise.resolve(new Map<server.AccessKeyId, number>()); | |||
} | |||
getServerMetrics() { |
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.
Perhaps throw an error instead. The tests should define what to return instead.
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.
Just to be clear - by extending this mock and overriding the method? Or via injection?
I see an example below!
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.
On that note, I'd like to see some tests for the 2 scenarios (supported and unsupported), probably in app.spec.ts
?
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.
"supported" here meaning with the experimental/server/metrics
endpoint present or with getServerMetrics
method implemented?
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.
Yes basically what happens when the API doesn't return anything (it's presumably missing).
{ | ||
icon: 'timer', | ||
name: this.localize('server-metrics-user-hours'), | ||
units: this.localize('server-metrics-user-hours-unit'), |
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 is not really how we should be formatting units. Use the standard libraries instead: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#unit_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.
I think we need a follow up PR that fixes this and breaks out the units that are baked into the messages (e.g. / last 30 days
) as mentioned above. It just needs to be rethought, as I assumed relying on the localizer was enough. I'll make a ticket for it, fair?
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.
Actually, looking through the code, all I really need to do here is format the time unit with the formatter I think?
Co-authored-by: Vinicius Fortuna <[email protected]>
Co-authored-by: Vinicius Fortuna <[email protected]>
server_manager/www/testing/models.ts
Outdated
@@ -168,6 +168,34 @@ export class FakeServer implements server.Server { | |||
getDataUsage() { | |||
return Promise.resolve(new Map<server.AccessKeyId, number>()); | |||
} | |||
getServerMetrics() { |
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.
On that note, I'd like to see some tests for the 2 scenarios (supported and unsupported), probably in app.spec.ts
?
After testing with the new canary server, this is basically working, except the fact that the data flow in our UI is bad and not triggering a render as it should. (to get it to show up in the UI in the above screenshot I had to edit the code to trigger a live reload LMAO) We should be passing data through HTML attributes not via JS properties... Anyway, I'll return after the holidays to fix that, format the hourly units properly, and add a unit test. |