-
Notifications
You must be signed in to change notification settings - Fork 523
feat(experiment): add experiments list page with filtering, pagination, and actions #7628
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
Merged
Merged
Changes from all commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
05c82fd
feat(experimentation): add Experiment model and CRUD endpoints
Zaimwa9 005ae23
feat(experimentation): rebased main
Zaimwa9 b27797d
feat(experimentation): reworked-tests
Zaimwa9 43b0897
feat(experimentation): type-linting
Zaimwa9 5d55695
feat(experimentation): changed return status when experiment exists a…
Zaimwa9 4269a8a
feat(experimentation): added test coverage
Zaimwa9 52fa070
feat(experimentation): added test coverage for existing mv features
Zaimwa9 683fc69
feat(experimentation): extracted status actions
Zaimwa9 7eef7bf
feat(experimentation): add Experiment types to frontend
Zaimwa9 c835318
feat(experimentation): add RTK Query service for experiments
Zaimwa9 17360b0
feat(experimentation): add wizard utility components
Zaimwa9 c7d0bc2
feat(experimentation): add SetupStep with feature flag selector
Zaimwa9 07905c9
feat(experimentation): add AudienceStep, MeasurementStep, and ReviewStep
Zaimwa9 f71112d
feat(experimentation): add CreateExperimentWizard container
Zaimwa9 a60444f
feat(experimentation): rewrite ExperimentsPage with list and create w…
Zaimwa9 998df3c
refactor(experimentation): remove unused onCancel prop from wizard
Zaimwa9 a4519a9
feat(experimentation): add ContentCard component and replace Panel wi…
Zaimwa9 8ef2c9b
fix(experimentation): match POC layout with proper field styling and …
Zaimwa9 0173407
fix(experimentation): match POC stepper design with connecting lines …
Zaimwa9 6e02891
fix(experimentation): white background for hypothesis textarea
Zaimwa9 6b6fffb
fix(experimentation): resolve environment API key to numeric ID for f…
Zaimwa9 49ffcfc
feat(experimentation): add VariationTable component matching POC desi…
Zaimwa9 85102ae
fix(experimentation): rename to Create Experiment, add confirm modal,…
Zaimwa9 8aab7df
fix(experimentation): guard against null initial_value in VariationTable
Zaimwa9 10603f6
feat(experimentation): show warehouse setup prompt when no connection…
Zaimwa9 99df820
feat: wip list experiments
Zaimwa9 3e5a9e9
feat(experimentation): move transition logic to service layer
Zaimwa9 39b1a5d
feat(experimentation): use admin_client_new in tests
Zaimwa9 d560403
feat(experimentation): leaked pii and misc review feedback
Zaimwa9 ed932fb
feat(experimentation): return feature object along with experiment en…
Zaimwa9 421a070
feat(experimentation): type lint
Zaimwa9 eaf6280
Merge branch 'feat/scaffold-experimentation-models-and-cruds' of gith…
Zaimwa9 86db405
feat(experimentation): fixed N+1 query and consistent actions responses
Zaimwa9 4b46cc8
feat(experimentation): added pagination transation and delete guard o…
Zaimwa9 18cc27b
feat(experiment): rebased main
Zaimwa9 4430635
feat: reverted to sequential database commits
Zaimwa9 940c99b
feat: rebased main
Zaimwa9 b81ca3e
feat: misc-details
Zaimwa9 b4f5c7c
feat: rebased-main
Zaimwa9 fba6f11
feat: added tests for create race condition
Zaimwa9 35a5db0
feat: rebased
Zaimwa9 d15efdf
Merge branch 'feat/experiment-model-robustness' of github.com:Flagsmi…
Zaimwa9 c3bee29
feat: implemented pagination
Zaimwa9 db0e867
refactor(experiments): address code review feedback from PR #7596
Zaimwa9 444cdf3
Merge branch 'main' of github.com:Flagsmith/flagsmith into feat/exper…
Zaimwa9 40add43
feat: rebased-parent
Zaimwa9 e6e784e
feat(experiment): finetuned list view and added pagination
Zaimwa9 4cc5b90
feat(experiment): review feedback
Zaimwa9 04f4557
feat(experiment): changed ionicon with icons
Zaimwa9 da6bb2a
feat(experiment): rebased froexperiment wizard
Zaimwa9 02b5faa
feat(experiment): cleanup and refacto to follow design patterns
Zaimwa9 e3b08eb
feat(experiment): cleaned up rebases
Zaimwa9 b9b3618
feat(experiment): gemini comments
Zaimwa9 8a8dbb4
feat: fixed rebase loss and tokens instructions
Zaimwa9 6aeaff1
feat: dry on scss
Zaimwa9 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
128 changes: 128 additions & 0 deletions
128
frontend/web/components/experiments/ExperimentActionDropdown/ExperimentActionDropdown.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| import { FC, useCallback, useMemo } from 'react' | ||
| import { ExperimentStatus } from 'common/types/responses' | ||
| import { | ||
| useCompleteExperimentMutation, | ||
| useDeleteExperimentMutation, | ||
| usePauseExperimentMutation, | ||
| useStartExperimentMutation, | ||
| } from 'common/services/useExperiment' | ||
| import DropdownMenu from 'components/base/DropdownMenu' | ||
|
Zaimwa9 marked this conversation as resolved.
|
||
|
|
||
| type ExperimentActionDropdownProps = { | ||
| experimentId: number | ||
| experimentName: string | ||
| status: ExperimentStatus | ||
| environmentId: string | ||
| } | ||
|
|
||
| const ExperimentActionDropdown: FC<ExperimentActionDropdownProps> = ({ | ||
| environmentId, | ||
| experimentId, | ||
| experimentName, | ||
| status, | ||
| }) => { | ||
| const [startExperiment] = useStartExperimentMutation() | ||
| const [pauseExperiment] = usePauseExperimentMutation() | ||
| const [completeExperiment] = useCompleteExperimentMutation() | ||
| const [deleteExperiment] = useDeleteExperimentMutation() | ||
|
|
||
| const params = useMemo( | ||
| () => ({ environmentId, experimentId }), | ||
| [environmentId, experimentId], | ||
| ) | ||
|
|
||
| const handleStart = useCallback(async () => { | ||
| try { | ||
| await startExperiment(params).unwrap() | ||
| toast('Experiment started') | ||
| } catch { | ||
| toast('Failed to start experiment', 'danger') | ||
| } | ||
| }, [startExperiment, params]) | ||
|
|
||
| const handlePause = useCallback(async () => { | ||
| try { | ||
| await pauseExperiment(params).unwrap() | ||
| toast('Experiment paused') | ||
| } catch { | ||
| toast('Failed to pause experiment', 'danger') | ||
| } | ||
| }, [pauseExperiment, params]) | ||
|
|
||
| const handleComplete = useCallback(() => { | ||
| openConfirm({ | ||
| body: ( | ||
| <span> | ||
| Are you sure you want to mark <strong>{experimentName}</strong> as | ||
| completed? This action cannot be undone. | ||
| </span> | ||
| ), | ||
| noText: 'Cancel', | ||
| onYes: async () => { | ||
| try { | ||
| await completeExperiment(params).unwrap() | ||
| toast('Experiment completed') | ||
| } catch { | ||
| toast('Failed to complete experiment', 'danger') | ||
| } | ||
| }, | ||
| title: 'Complete experiment?', | ||
| yesText: 'Complete', | ||
| }) | ||
| }, [completeExperiment, experimentName, params]) | ||
|
Zaimwa9 marked this conversation as resolved.
|
||
|
|
||
| const handleDelete = useCallback(() => { | ||
| openConfirm({ | ||
| body: ( | ||
| <span> | ||
| Are you sure you want to delete <strong>{experimentName}</strong>? | ||
| This action cannot be undone. | ||
| </span> | ||
| ), | ||
| destructive: true, | ||
| noText: 'Cancel', | ||
| onYes: async () => { | ||
| try { | ||
| await deleteExperiment(params).unwrap() | ||
| toast('Experiment deleted') | ||
| } catch { | ||
| toast('Failed to delete experiment', 'danger') | ||
| } | ||
| }, | ||
| title: 'Delete experiment?', | ||
| yesText: 'Delete', | ||
| }) | ||
| }, [deleteExperiment, experimentName, params]) | ||
|
Zaimwa9 marked this conversation as resolved.
|
||
|
|
||
| const items = useMemo(() => { | ||
| switch (status) { | ||
| case 'created': | ||
| return [ | ||
| { label: 'Start Experiment', onClick: handleStart }, | ||
| { | ||
| className: 'text-danger', | ||
| label: 'Delete', | ||
| onClick: handleDelete, | ||
| }, | ||
| ] | ||
| case 'running': | ||
| return [ | ||
| { label: 'Pause Experiment', onClick: handlePause }, | ||
| { label: 'Mark as Completed', onClick: handleComplete }, | ||
| ] | ||
| case 'paused': | ||
| return [ | ||
| { label: 'Resume Experiment', onClick: handleStart }, | ||
| { label: 'Mark as Completed', onClick: handleComplete }, | ||
| ] | ||
| default: | ||
| return [] | ||
| } | ||
| }, [status, handleStart, handlePause, handleComplete, handleDelete]) | ||
|
|
||
| if (status === 'completed') return null | ||
|
|
||
| return <DropdownMenu items={items} /> | ||
| } | ||
|
|
||
| export default ExperimentActionDropdown | ||
1 change: 1 addition & 0 deletions
1
frontend/web/components/experiments/ExperimentActionDropdown/index.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from './ExperimentActionDropdown' |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.