feat(allocation): custom label aggregation in home + report dropdowns#274
Open
tormodmacleod wants to merge 2 commits into
Open
feat(allocation): custom label aggregation in home + report dropdowns#274tormodmacleod wants to merge 2 commits into
tormodmacleod wants to merge 2 commits into
Conversation
✅ Deploy Preview for opencost-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Replace the Aggregate-by Select with a Carbon ComboBox that accepts either a preset workload type or a free-text label key. Bare keys typed by the user are auto-prefixed with `label:` before being passed to the existing /allocation/compute API, which already supports `aggregate=label:<key>`. Add `label:app.kubernetes.io/name` as a built-in example so users discover the format without needing documentation; the Kubernetes recommended label is set by Helm on virtually all charts and is present in the vast majority of clusters. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Tormod Macleod <tormod.macleod@gmail.com>
Mirror the home-page Aggregate-by ComboBox (commit f656a97) on the Report Builder side panel. The per-row Groupings selector is replaced with a Carbon ComboBox that accepts either a preset workload type or a free-text label key. Bare keys are auto-prefixed with `label:` before being passed to the existing /allocation/compute API, which already supports `aggregate=label:<key>` in the comma-joined groupings list. Add `label:app.kubernetes.io/name` as a built-in example so users discover the format without needing documentation. The ComboBox is wrapped in `<Theme theme="white">` to match the side panel's hard-coded light styling — otherwise it would inherit the page-level Carbon theme and render dark while the surrounding panel stays light. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Tormod Macleod <tormod.macleod@gmail.com>
32689eb to
af4ef7d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR change?
label:before being passed to/allocation/compute, which already supportsaggregate=label:<key>.groupings→aggregate=path.label:app.kubernetes.io/nameas a built-in example on both surfaces so users discover the format without needing documentation — the Kubernetes recommended label is set by Helm on virtually all charts and is present in the vast majority of clusters.<Theme theme="white">so it renders light regardless of the user's OS/app theme, matching the side panel's hard-coded light Tailwind styling.Does this PR relate to any other PRs?
How will this PR impact users?
label:app.kubernetes.io/nameis now visible as a preset, hinting at thelabel:<key>format for users who don't know it.namespace,deployment, etc.) behave exactly as before.Does this PR address any GitHub or Zendesk issues?
How was this PR tested?
label:app.kubernetes.io/namepreset on both the home page and the Report Builder and confirmed/allocation/computewas called withaggregate=label:app.kubernetes.io/nameand the chart/table rendered the expected aggregation.version) and verified they submitted aslabel:version; typed prefixed values (e.g.annotation:foo) and verified they passed through unchanged.cds--whiteorcds--g100theme.npm run typecheck— no new type errors introduced (the 57 pre-existing legacy errors are unchanged).Does this PR require changes to documentation?
label:<key>form is already supported by/allocation/compute; this PR only surfaces it in the UI. The preset itself serves as inline documentation of the format.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?