Skip to content

feat(experiments): Create Metric page#7712

Merged
Zaimwa9 merged 6 commits into
mainfrom
feat/experiment-metrics-frontend
Jun 9, 2026
Merged

feat(experiments): Create Metric page#7712
Zaimwa9 merged 6 commits into
mainfrom
feat/experiment-metrics-frontend

Conversation

@Zaimwa9

@Zaimwa9 Zaimwa9 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

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 9, 2026 8:03am
flagsmith-frontend-staging Ready Ready Preview, Comment Jun 9, 2026 8:03am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 9, 2026 8:03am

Request Review

@Zaimwa9

Zaimwa9 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

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

Copy link
Copy Markdown
Contributor

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

Zaimwa9 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

@gemini-code-assist review

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

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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-private-cloud:pr-7712 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-7712 Finished ✅ Results

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

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)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  39.8 seconds
commit  0ccb30d
info  🔄 Run: #17343 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  42.5 seconds
commit  0ccb30d
info  🔄 Run: #17343 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  42.8 seconds
commit  0ccb30d
info  🔄 Run: #17343 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  53.2 seconds
commit  0ccb30d
info  🔄 Run: #17343 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.1 seconds
commit  c1fed26
info  🔄 Run: #17361 (attempt 1)

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

passed  1 passed

Details

stats  1 test across 1 suite
duration  43.1 seconds
commit  c1fed26
info  🔄 Run: #17361 (attempt 1)

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

passed  2 passed

Details

stats  2 tests across 2 suites
duration  58.8 seconds
commit  c1fed26
info  🔄 Run: #17361 (attempt 1)

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

failed  2 failed

Details

stats  2 tests across 2 suites
duration  1 minute, 7 seconds
commit  c1fed26
info  📦 Artifacts: View test results and HTML report
🔄 Run: #17361 (attempt 1)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise
firefox › tests/project-permission-test.pw.ts › Project Permission Tests › Project-level permissions control access to features, environments, audit logs, and segments @enterprise

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

passed  3 passed

Details

stats  3 tests across 3 suites
duration  31.7 seconds
commit  c1fed26
info  🔄 Run: #17361 (attempt 2)

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Visual Regression

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

@Zaimwa9 Zaimwa9 requested a review from gagantrivedi June 5, 2026 14:31
@Zaimwa9 Zaimwa9 removed the request for review from talissoncosta June 8, 2026 11:45
talissoncosta
talissoncosta previously approved these changes Jun 9, 2026

@talissoncosta talissoncosta left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving, looks good @Zaimwa9 !

An optional thing, not blocking:

  • SCSS could lean on utilities. A lot of MetricsPage.scss (and some of CreateMetricForm.scss) re-declares stuff we already have classes for — colours (text-secondary, bg-surface-subtle, border-default), rounded-md, and flex/gap layout. Moving those to utilities trims the SCSS by roughly a third and keeps it for the genuinely custom bits (cards, pills, selected states). The blocker to going further is the few off-scale paddings/gaps (12px, 14px, 2px), if those snap to the Bootstrap scale (8/16px → gap-2/p-2/p-3), they can use utilities too.

Comment thread frontend/scripts/generate-tokens.mjs Outdated
@Zaimwa9 Zaimwa9 merged commit 416de5c into main Jun 9, 2026
41 of 43 checks passed
@Zaimwa9 Zaimwa9 deleted the feat/experiment-metrics-frontend branch June 9, 2026 08:17
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