-
Notifications
You must be signed in to change notification settings - Fork 68
webui: fix preset sorting order and ESLint issues #1086
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: master
Are you sure you want to change the base?
Conversation
|
Thanks for your input! I don't think name list can cover all the situations. What if one wants to rename the preset? What if one adds their own preset and want to put it to the top? What if one is not happy with some preset and want to move it down? What if we delete some preset one day, e.g. Should preset have some |
|
Thanks for the thoughtful feedback! I agree that a static name-based ordering cannot cover all future scenarios For this PR, I intentionally kept the scope limited to:
This aligns with the existing backend data as it is today. Please let me know how you’d like to proceed. |
|
please take a look at #1086 (comment) |
|
Okay i got it. I will work on that. |
|
Thanks for the clarification! I've now applied the same predefined preset ordering as the default ordering Please let me know if you'd like this to be configurable in the future. |
You haven't pushed any updates; it's still the same. |
|
Hi @0xgouda, thanks for pointing that out -my apologies. |
Pull Request Test Coverage Report for Build 20452701529Details
💛 - Coveralls |
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.
Pull request overview
This PR addresses preset sorting order inconsistencies and fixes ESLint issues in the webui. The changes implement a standardized preset ordering across the application, prioritizing common presets (minimal, basic, standard, etc.) followed by cloud provider-specific presets, then special-purpose presets.
Key changes:
- Implemented custom sorting for presets in both the Presets grid and the Source form metrics step
- Refactored code to fix ESLint issues, improving type safety and code quality
- Added proper type definitions for preset options with descriptions
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| internal/webui/src/pages/PresetsPage/components/PresetsGrid/PresetsGrid.tsx | Adds PRESET_ORDER constant and implements custom sorting logic for preset display in the grid |
| internal/webui/src/containers/SourceFormDialog/components/SourceForm/components/SourceFormStepMetrics.tsx | Adds PRESET_PRIORITY constant, implements sorting for preset dropdown options, and improves type definitions |
| type PresetMeta = { | ||
| Description?: string; | ||
| }; |
Copilot
AI
Dec 22, 2025
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.
The PresetMeta type is defined inside the component function. Type definitions should be moved outside the component scope to improve code organization and prevent recreation on each render.
...i/src/containers/SourceFormDialog/components/SourceForm/components/SourceFormStepMetrics.tsx
Show resolved
Hide resolved
internal/webui/src/pages/PresetsPage/components/PresetsGrid/PresetsGrid.tsx
Show resolved
Hide resolved
...i/src/containers/SourceFormDialog/components/SourceForm/components/SourceFormStepMetrics.tsx
Show resolved
Hide resolved
| const PRESET_ORDER = [ | ||
| "minimal", | ||
| "basic", | ||
| "standard", | ||
| "exhaustive", | ||
| "full", | ||
| "aiven", | ||
| "azure", | ||
| "gce", | ||
| "rds", | ||
| "pgbouncer", | ||
| "pgpool", | ||
| "unprivileged", | ||
| "recommendations", | ||
| "prometheus-async", | ||
| "exhaustive_no_python", | ||
| "debug", | ||
| ]; |
Copilot
AI
Dec 22, 2025
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.
The constant names are inconsistent between files. This file uses PRESET_ORDER while SourceFormStepMetrics.tsx uses PRESET_PRIORITY for the same purpose. Consider using a consistent name across both files, such as PRESET_ORDER or extracting this to a shared constant to avoid duplication.
| const PRESET_PRIORITY = [ | ||
| "minimal", | ||
| "basic", | ||
| "standard", | ||
| "exhaustive", | ||
| "full", | ||
| "aiven", | ||
| "azure", | ||
| "gce", | ||
| "rds", | ||
| "pgbouncer", | ||
| "pgpool", | ||
| "unprivileged", | ||
| "recommendations", | ||
| "prometheus-async", | ||
| "exhaustive_no_python", | ||
| "debug", | ||
| ]; |
Copilot
AI
Dec 22, 2025
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 code duplicates the preset ordering list defined in PresetsGrid.tsx. The same ordering array appears in both files with different names (PRESET_PRIORITY here vs PRESET_ORDER there). Consider extracting this to a shared constant file to maintain a single source of truth and prevent inconsistencies.
|
LGTM, but please check the reviews from copilot. |
|
Thanks for the review! I’ve addressed the Copilot feedback by extracting the preset ordering into a shared constant and reusing it in both the Presets grid and Source form, removing duplication and improving consistency. Formatting issues were also cleaned up. |
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.
Why add a new constants/ folder and not use the already existing consts/ folder?
(I am not an experienced front-end dev, correct me if I am missing smth)
| export const PRESET_ORDER = [ | ||
| "minimal", | ||
| "basic", | ||
| "standard", | ||
| "exhaustive", | ||
| "full", | ||
| "aiven", | ||
| "azure", | ||
| "gce", | ||
| "rds", | ||
| "pgbouncer", | ||
| "pgpool", | ||
| "unprivileged", | ||
| "recommendations", | ||
| "prometheus-async", | ||
| "exhaustive_no_python", | ||
| "debug", | ||
| ]; |
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.
Front-end should not rely on the predefined preset list. We make assumption that no information is available at design-time. All information is available only through REST API

Hi @0xgouda, thanks for the feedback!
I’ve moved the changes to a dedicated branch as suggested and updated the preset
sorting order to:
minimal
basic
standard
exhaustive
full
aiven
azure
gce
rds
pgbouncer
pgpool
unprivileged
recommendations
prometheus-async
exhaustive_no_python
debug
The same ordering is now used as the default in the Presets tab as well.
All checks are passing locally.
Please let me know if anything else is needed 🙏