-
Notifications
You must be signed in to change notification settings - Fork 18
Instance metrics design tweaks #2676
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
Instance metrics design tweaks #2676
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
.licenserc.yaml
Outdated
| - '.husky' | ||
| - 'mockServiceWorker.js' | ||
| - 'app/util/format-date-range.ts' | ||
| - 'app/util/format-date-range.test.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.
This lib is MIT licensed. Unsure if there's a better way to handle this – it's so small it feels better to copy it over rather than importing.
| fn: () => void | ||
| showLastFetched?: boolean | ||
| className?: string | ||
| isSlim?: boolean |
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 gives us a version that has the dropdown but not the number...perhaps we just scrap the selected interval in the listbox all together here and we can simplify the implementation. I don't think the interval necessarily needs to be visible anywhere.
| : cn('ox-tabs', { 'full-width': fullWidth }) | ||
| const tabListClasses = sideTabs ? 'ox-side-tabs-list' : 'ox-tabs-list' | ||
| const panelClasses = cn('ox-tabs-panel', { 'flex-grow': sideTabs }) | ||
| const panelClasses = cn('ox-tabs-panel @container', { 'ml-5 flex-grow': sideTabs }) |
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.
Container query lets us move the datepicker onto the next line when we start running out of space. Flex wrap might work here, but eventually I think I'd like to do something cleverer with the layout when it reflows.
| // re-render on every render of the parent when the data is undefined | ||
| const data = useMemo(() => rawData || [], [rawData]) | ||
|
|
||
| if (!data || data.length === 0) { |
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.
Temporary empty state. We should handle errors and loading differently.
| <div className={cn('relative flex w-[17rem] items-center px-3 text-sans-md')}> | ||
| {label} | ||
| <div className="relative flex w-[16rem] items-center px-3 text-sans-md"> | ||
| <div className="truncate">{label}</div> |
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 useful more generally to stop the date picker text from wrapping
| addUtilities(colorUtilities) | ||
| addUtilities(elevationUtilities) | ||
| }), | ||
| containerQueriesPlugin, |
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.
Not necessary after we upgrade to Tailwind v4.
|
|
||
| const { intervalPicker } = useIntervalPicker({ | ||
| enabled: preset !== 'custom', | ||
| isLoading: useIsFetching({ queryKey: ['siloMetric'] }) > 0, |
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.
Need to update with query keys
|
Design changes look good. I think I have to veto Made #2682 so we don't lose track of improving the label. little-date edge cases2025-02-07-little-date.mp4react-aria
|
| const formatter = useDateFormatter({ | |
| dateStyle: 'short', | |
| timeStyle: 'short', | |
| hourCycle: 'h24', | |
| }) |
2025-02-07-aria-date-wtf.mp4
c6b858a to
b351ecc
Compare
charliepark
left a comment
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.
Thank you for getting all of these bits cleaned up, Ben. I'll merge in to oxql_disk_metrics and prep it for final reviews.
* Add stub of Disk Metrics using OxQL * Refactoring; getting chart working; needs better default situation * refacotrs; remove old DiskMetrics; add writes and flushes charts * initial stub for CPU metrics * file reorg * More CPU metrics, though we mgiht need to rethink the long-term plan * working group_by * Updates to routes to handle sub-tabs * Dropdown working on CPU charts * cleanup * more work on charts; networking * Standardize wrapper components * Reorder charts a bit * getting side tabs into place * Update side tab CSS * Consolidate SideTabs into legacy tabs, using props to control layout * refactoring; getting rollups working for disks and network interfaces * Pass pre-formed query string to metric component * Move date selector up a level, using useContext * Update routes in path-builder test * Small refactor to align approach to useState and dropdowns for network and disk metrics tabs * Add static values for metrics for testing and mock service worker * Removes TS guard that was a bit onerous; relying on casting now, though, which isn't great * Updated mock data for disks * small refactor before integrating Ben's PR * Refactoring chart logic * Add tests for OxQL charts * Better handle cumulative_u64 data with initial sum value * Instance metrics design tweaks (#2676) Co-authored-by: David Crespo <david.crespo@oxidecomputer.com> Co-authored-by: Charlie Park <charlie@oxidecomputer.com> * a little code cleanup * make getOxqlQuery args more generic and structured * view/copy oxql modal * inline oxql query modal, remove comment about showing query * NonEmptyArray whaaaaaaat * highlight oxql * Add 'More about OxQL queries' button/link to modal * test for rendered oxql in modal * Better link style for OxQL docs * slightly smaller text * clean up my weird half-finished metrics props change * CopyCode footer * handle no nics case on network metrics * small aria label fix * Add restriction to only turn on query reloading once initial data have succcessfully loaded in * Simplify CPU utilization tab * Metrics more actions (#2700) * OxQL metrics more actions * take CopyCodeModal refactor further, fix motion import * move oxql schema docs thing into links file --------- Co-authored-by: David Crespo <david.crespo@oxidecomputer.com> * tweak more actions menu copy one more time * Dynamic chart Y axis width (#2697) * Dynamic Y axis width * Remove spacing and make tick size/margin explicit * Need spacing on old cards * Updates, and better logic on utilization chart; still accounting for cpus count * Updates to incorporate nCPUs in utilization calculation * small refactor * Updated test for utilization * Move OxqlMetric files to own component directory * A few more tests * update import * tests are easier to make sense of when you can see all the data at once * Default to single state on CPU utiization tab; offer 'total' option * Update metrics schema URL * Metrics error & loading states (#2698) * Move some loaders to parent component * Update dropdown to cap at 24 hours and handle minimum mean_within * Use seconds when determining durations * remove intervalPicker until OxQL is faster * Less twitchy datepicker wrap * clean up chart loading states * init MetricsContext with null instead of dummy values * Update mock numbers so CPU utilization range is normal * use lazy imports in the routes * blarg lint * Clean up CPU charts * revert CpuStateMetric component * utils file tweaks, abstract slightly less * replace getUnit with explicit unit prop * use date-fns * use delay function for sleeps --------- Co-authored-by: Benjamin Leonard <benji@oxide.computer> Co-authored-by: David Crespo <david.crespo@oxidecomputer.com>

Quick pass to get it closer to the instance metrics designs. Will need a more vigorous going over for the following release but this is reasonable.
As usual the date range picker is a little awkward to work with because of its size. It's worth looking how we might be able to improve it outside of this PR.