Skip to content

feat(FR-2451): add Prometheus Query Preset create modal#7085

Open
agatha197 wants to merge 1 commit into04-27-feat_fr-2451_implement_prometheus_query_preset_list_tablefrom
04-27-feat_fr-2451_add_prometheus_query_preset_create_modal
Open

feat(FR-2451): add Prometheus Query Preset create modal#7085
agatha197 wants to merge 1 commit into04-27-feat_fr-2451_implement_prometheus_query_preset_list_tablefrom
04-27-feat_fr-2451_add_prometheus_query_preset_create_modal

Conversation

@agatha197
Copy link
Copy Markdown
Contributor

@agatha197 agatha197 commented Apr 27, 2026

Resolves #6357 (FR-2451)

Stacked on top of #7084.

Summary

Sub-task 3 of the Prometheus Query Preset Admin feature (.specs/draft-auto-scaling-rule-management/dev-plan.md -> Sub-task 3). Adds the Create Preset modal and wires it to the toolbar's "Add Preset" button (which was disabled in #7084).

  • New PrometheusQueryPresetEditorModal.tsx: a unified Create/Edit modal driven by an optional fragment ref. This PR ships the Create path; Sub-task 4 (next PR in the stack) will fill in the Edit path on the same modal.
  • Form fields (Antd Form, layout="vertical"):
    • name (required, with "must be unique" hint)
    • description (optional, TextArea)
    • categoryId (optional, Select driven by a sibling prometheusQueryPresetCategories query)
    • rank (InputNumber, default 0)
    • metricName (required)
    • queryTemplate (required, multi-line TextArea)
    • timeWindow (optional plain Input, e.g. 5m)
    • options.filterLabels / options.groupLabels (Select mode="tags")
  • Wires adminCreatePrometheusQueryPreset(input: CreateQueryDefinitionInput!) via Relay useMutation. On success: success toast, transition-driven updateFetchKey() to refetch the list, and modal close. On error: keep modal open and surface the error.
  • Hooks the toolbar Add button (added disabled in Sub-task 2) to open the modal in create mode.

Notes / risk callouts

  • Empty categories: prometheusQueryPresetCategories may return [] in dev environments. The form still submits cleanly with categoryId = null and the Select shows a "No category" empty-state message.
  • filterLabels / groupLabels are required [String!]! in CreateQueryDefinitionInput but accept []. We submit [] whenever the user leaves the tags input untouched.
  • The categories query (prometheusQueryPresetCategory(id: UUID!)/prometheusQueryPresetCategories) returns QueryPresetCategory.id: UUID!, which matches the CreateQueryDefinitionInput.categoryId: UUID field. No toLocalId() conversion is needed.
  • The fragment includes the same fields the list fragment already exposes; Sub-task 4 will reuse this fragment for the edit path.

i18n keys added (prometheusQueryPreset.*)

Description, Category, NoCategory, Rank, FilterLabels, GroupLabels, CreatePreset, EditPreset, NameRequired, NameMustBeUnique, MetricNameRequired, QueryTemplateRequired, SuccessfullyCreated. English source only.

Verification

--- Relay: PASS ---
--- Lint: PASS ---
--- Format: PASS ---
--- TypeScript: PASS ---
=== ALL PASS ===

Copy link
Copy Markdown
Contributor Author

agatha197 commented Apr 27, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

Coverage report for ./react

St.
Category Percentage Covered / Total
🔴 Statements
8.99% (-0.02% 🔻)
1858/20673
🔴 Branches
8.15% (-0.03% 🔻)
1187/14571
🔴 Functions
5.28% (-0.01% 🔻)
296/5607
🔴 Lines
8.72% (-0.02% 🔻)
1749/20056
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🔴
... / PrometheusQueryPresetEditorModal.tsx
0% 0% 0% 0%

Test suite run success

865 tests passing in 40 suites.

Report generated by 🧪jest coverage report action from 66852a9

Comment thread react/src/components/PrometheusQueryPresetEditorModal.tsx Outdated
@agatha197 agatha197 force-pushed the 04-27-feat_fr-2451_implement_prometheus_query_preset_list_table branch from ebd1d50 to 31cd4e2 Compare April 28, 2026 06:06
@agatha197 agatha197 force-pushed the 04-27-feat_fr-2451_add_prometheus_query_preset_create_modal branch from 98a23f6 to f34e805 Compare April 28, 2026 06:06
@agatha197 agatha197 requested a review from nowgnuesLee April 28, 2026 06:11
Comment thread react/src/components/AutoScalingRulePresetTab.tsx
@agatha197 agatha197 requested a review from nowgnuesLee April 28, 2026 06:31
@agatha197 agatha197 marked this pull request as draft April 28, 2026 06:31
@agatha197 agatha197 marked this pull request as ready for review April 28, 2026 06:42
@agatha197 agatha197 force-pushed the 04-27-feat_fr-2451_implement_prometheus_query_preset_list_table branch from 31cd4e2 to c074b00 Compare April 28, 2026 07:14
@agatha197 agatha197 force-pushed the 04-27-feat_fr-2451_add_prometheus_query_preset_create_modal branch from f34e805 to 57c25be Compare April 28, 2026 07:14
Comment thread react/src/components/PrometheusQueryPresetEditorModal.tsx Outdated
@agatha197 agatha197 force-pushed the 04-27-feat_fr-2451_add_prometheus_query_preset_create_modal branch from 57c25be to 8f6b3c7 Compare April 28, 2026 11:38
@agatha197 agatha197 force-pushed the 04-27-feat_fr-2451_implement_prometheus_query_preset_list_table branch from c074b00 to 0eebe06 Compare April 28, 2026 11:38
@agatha197 agatha197 force-pushed the 04-27-feat_fr-2451_add_prometheus_query_preset_create_modal branch from 8f6b3c7 to 66852a9 Compare April 28, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:i18n Localization area:ux UI / UX issue. size:L 100~500 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants