-
Notifications
You must be signed in to change notification settings - Fork 38
Feature/drilldown namespace 2942 #131
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
base: main
Are you sure you want to change the base?
Feature/drilldown namespace 2942 #131
Conversation
- Add filters support to AllocationService.fetchAllocation - Implement drilldown function in Allocations page - Make table rows clickable for drilldown navigation - Add visual feedback (hover effect) for clickable rows - Support drilldown hierarchy: namespace -> controllerKind -> controller -> pod -> container - Reset filters when navigating back to higher aggregation levels Fixes #2942 Signed-off-by: Rahim <[email protected]>
- Update recharts from 2.15.3 to 3.4.1 - Replace ResponsiveContainer with responsive prop in all chart components - Add lodash dependency - Update 5 chart components to use recharts 3.x API Signed-off-by: Rahim <[email protected]>
✅ Deploy Preview for opencost-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: Rahim <[email protected]>
e982cd8 to
11b0d02
Compare
…uble encoding Signed-off-by: Rahim <[email protected]>
Signed-off-by: Rahim <[email protected]>
…kend API Signed-off-by: Rahim <[email protected]>
|
Hey @CrazyCapislav, thanks for the contribution! I'd like to look at the code a little more in-depth before approving, and am running out of time today. But nominally, this looks great! Will aim to provide a thorough review tomorrow. Thanks again. |
Signed-off-by: Rahim <[email protected]>
8defee2 to
de4b0d2
Compare
|
@CrazyCapislav this is amazing, thanks for your contribution! Is there any way you can driver the filtering from the URL? not apparent what we have drilled into when we do it. WDYT? |
Signed-off-by: Rahim <[email protected]>
Signed-off-by: Rahim <[email protected]>
Thanks for the feedback! I've implemented URL-driven filtering for the drilldown functionality. |
023443b to
7765020
Compare
Signed-off-by: Rahim <[email protected]>
Signed-off-by: Rahim <[email protected]>
Signed-off-by: Rahim <[email protected]>
Signed-off-by: Rahim <[email protected]>
nealormsbee
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.
Apologies for the long gap in review time! I've been on vacation but am back today. Left a few requests / suggestions in code annotations.
The only high-level UX thing that I think would be nice is to indicate the applied filters in the UI somehow. Maybe in a "breadcrumb" style below the report title, since the filters are constrained to working in a specific drilldown pattern.
So, for example, if you drilled into a namespace called "Foo", you'd see something like
All Results > Foo
just below the title. And All Results would be a link that takes you back to an unfiltered view, aggregated by namespace.
Just ideas for a nice UX. I would not block the PR on not including this. If you can regenerate the package-lock.json and make a couple of small logic simplifications (or explain why I'm wrong about them), then I'm good to approve!
Thanks.
| }; | ||
|
|
||
| return ( | ||
| <ResponsiveContainer width="100%" height={height}> |
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.
Can you point me at the place where Recharts talks about the change from using ResponsiveContainer to a responsive prop?
This is more for my curiosity than anything. The graphs still exhibit the "Responsive" behavior, I just still see ResponsiveContainer referenced in their docs here and no mention of the new prop in the migration guide, so I'm wondering what I'm missing.
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.
Well, you can check recharts v3.3.0 changes: "add the responsive prop to any chart along with a height and width as if you were using ResponsiveContainer. One less component to wrap things with. ResponsiveContainer will continue to work for the life of 3.x". I think using props would be preferable, but it can be returned as it was.
| const isContainer = aggregateBy === "container"; | ||
| // Only allow drilldown if there's a next level and we're not at container level | ||
| const canDrilldown = !isIdle && !isUnallocated && !isUnmounted && !isContainer && hasNextLevel && drilldown; |
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.
Do we need an explicit isContainer check? container won't have an entry in the drilldown hierarchy, so hasNextLevel implies !isContainer, yes?
| responsive | ||
| height={height} | ||
| width="100%" |
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.
Total nit: can these match indentation with the other component props?
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.
Note to self: just create a pre-commit hook that runs Prettier against the codease.
| // Load filters from URL on initial load or when URL changes | ||
| // Also validate that filters match the current aggregateBy level | ||
| useEffect(() => { | ||
| const currentSearchParams = new URLSearchParams(routerLocation.search); |
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 all makes sense logically, and it works. You can actually simplify it a bit, unless I'm missing something.
One of the neat things about using routerLocation is that re-renders will happen when it changes, so you don't actually need to track filters in a separate piece of state. You can get rid of [filters, setFilters] = useState([]); and all the calls to setFilters(). You can just use const filters = parseFiltersFromUrl(filterParam), and then have this useEffect() update the URL directly with navigate().
| "node_modules/@standard-schema/utils": { | ||
| "version": "0.3.0", | ||
| "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", | ||
| "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", | ||
| "license": "MIT" | ||
| }, |
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 don't think this is actually used anywhere nor added to package.json. Can you regenerate the lockfile when you push?
|
|
||
| // Mock data for testing drilldown functionality when backend is not available | ||
| // Only used when REACT_APP_USE_MOCK_DATA=true is explicitly set | ||
| const getMockData = (aggregate, filters) => { |
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.
Nit: Can this function go in its own file alongside this one, so we keep test / mock utilities separate from core service logic?
What does this PR change?
ResponsiveContainerwrapper component with built-inresponsiveprop in all chart components to comply with recharts 3.x API changeslodashdependency that was required but not declared in package.jsonDoes this PR relate to any other PRs?
How will this PR impact users?
Does this PR address any GitHub or Zendesk issues?
How was this PR tested?
Does this PR require changes to documentation?
Have you labeled this PR and its corresponding Issue as "next release" if it should be part of the next OpenCost release? If not, why not?