Skip to content

feat(experiments): Create Metric page#7712

Open
Zaimwa9 wants to merge 4 commits into
mainfrom
feat/experiment-metrics-frontend
Open

feat(experiments): Create Metric page#7712
Zaimwa9 wants to merge 4 commits into
mainfrom
feat/experiment-metrics-frontend

Conversation

@Zaimwa9
Copy link
Copy Markdown
Contributor

@Zaimwa9 Zaimwa9 commented Jun 5, 2026

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Frontend for the Create Metric page.

  • New Metrics environment-sidebar item + /metrics route, gated behind the experiment_metrics flag (hidden when off; URL redirects to Features).
  • Create Metric form: name, description, measurement type (occurrence/count/sum/mean), direction (higher/lower/neither → increase/decrease/informational), and data source (event + optional filter). Posts to the experiment-metrics endpoint via a new RTK Query service; payload-building/validation are unit-tested pure helpers.
  • Adds missing font-weight design tokens (regular/medium/semibold/bold) to tokens.json + the generator — the experiments UI already referenced these but they were undefined.
  • Experiments tab: shows a Connect Warehouse CTA when experiments exist but no warehouse is connected (replacing the hidden Create Experiment button).

How did you test this code?

  • Unit tests for the form helpers (npm run test:unit — payload shape, filter omission, submit gating).
image

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Jun 5, 2026 1:08pm
flagsmith-frontend-staging Ready Ready Preview, Comment Jun 5, 2026 1:08pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 5, 2026 1:08pm

Request Review

@Zaimwa9
Copy link
Copy Markdown
Contributor Author

Zaimwa9 commented Jun 5, 2026

@gemini-code-assist review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces experiment metrics functionality, including the creation of a new CreateMetricForm component, RTK Query endpoints for metric management, and new design tokens for font weights. Feedback on the changes highlights that the redirect logic in CreateMetricPage should be wrapped in a useEffect hook to avoid side-effects during rendering. Additionally, it is recommended to redirect users back to the experiments page upon successful creation or cancellation of a metric, rather than simply resetting the form on the same page.

Comment thread frontend/web/components/pages/CreateMetricPage.tsx Outdated
Comment thread frontend/web/components/pages/CreateMetricPage.tsx Outdated
Comment thread frontend/web/components/pages/CreateMetricPage.tsx Outdated
@Zaimwa9
Copy link
Copy Markdown
Contributor Author

Zaimwa9 commented Jun 5, 2026

@gemini-code-assist review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces experiment metrics support, including a new useMetric service, type definitions, and the CreateMetricForm and MetricsPage components. It also adds new font-weight design tokens across the application and integrates a "Metrics" link into the sidebar navigation. Feedback on these changes highlights two key improvements: first, converting the measurement option buttons in CreateMetricForm to a proper radio button group to improve accessibility; second, ensuring that the search input on the MetricsPage actually filters the metrics by passing the search query (ideally debounced) to the API query, along with updating the empty state message for search results.

Comment thread frontend/web/components/experiments/CreateMetricForm/CreateMetricForm.tsx Outdated
Comment thread frontend/web/components/pages/MetricsPage.tsx
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 5, 2026
@Zaimwa9 Zaimwa9 marked this pull request as ready for review June 5, 2026 14:03
@Zaimwa9 Zaimwa9 requested a review from a team as a code owner June 5, 2026 14:03
@Zaimwa9 Zaimwa9 requested review from talissoncosta and removed request for a team June 5, 2026 14:03
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-7712 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-7712 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7712 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7712 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7712 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7712 Finished ✅ Results

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  40.7 seconds
commit  9896153
info  🔄 Run: #17296 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  44.7 seconds
commit  9896153
info  🔄 Run: #17296 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  36 seconds
commit  9896153
info  🔄 Run: #17296 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  55.3 seconds
commit  9896153
info  🔄 Run: #17296 (attempt 1)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Visual Regression

19 screenshots compared. See report for details.
View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants