-
Notifications
You must be signed in to change notification settings - Fork 4.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
ui: Adds human formatting to nanosecond based session durations #10062
Conversation
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.
🍒 If backport labels were added before merging, cherry-picking will start automatically. To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/358197. |
🍒✅ Cherry pick of commit 345765f onto |
* ui: Adds human formatting to nanosecond based session durations
* ui: Adds human formatting to nanosecond based session durations
Little note here, I manually backported this to 1.9.x, but its pretty different in 1.8.x and in everything previous to 1.9.0 it shows the correct value just its not human formatted - so I don't think this absolutely needs to go onto 1.8 |
…) (#10141) * ui: Adds human formatting to nanosecond based session durations
This PR adds human formatting to our nanosecond based session duration values.
The functionality makes use of the
pretty-ms
JS package, which also includes an option for formatting 'subMilliseconds' which in our case is useful for formatting to nanosecond precision (used by the session duration values).We've used a new
temporal
service to do this, which uses the above package to format numbers only for the moment (we can add further types in a central place when needed, and there's a dev warning if you pass anything but a number to the method). The is a tiny bit of extra functionality on top for the above package:pretty-ms
separates units with a space, so I split-joined the spaces out.Notes:
The temporal service (and helper) naming around that is 'inspired' by the t39 temporal proposal which is in Stage 3, which hopefully gives hints to anyone reading the code what it is used for and assumptions on how it could work, its also nice not to have to think about naming things.
If we get to the point that the temporal proposal has a wide enough native support and covers our use cases, we can drop the third-party package and use that from within the service instead.
Helper documentation is also added, which was also handy to use for manual 'get it working' testing, plus I 'filled out' the ember generated automated tests. I also added the default value of the session duration to our acceptance tests.
Changelog to come. I'll try and auto backport to 1.8/1.9/1.10 but off the top of my head it will probably need a little manual intervention to get it down to 1.8.