-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #579 from guardian/ahe/bandit-rrcp
Add editor for making epic a multi-armed bandit test
- Loading branch information
Showing
4 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
43 changes: 43 additions & 0 deletions
43
public/src/components/channelManagement/epicTests/epicBanditEditor.tsx
This file contains 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,43 @@ | ||
import React from 'react'; | ||
|
||
import { RadioGroup, FormControlLabel, Radio } from '@mui/material'; | ||
import { EpicTest } from '../../../models/epic'; | ||
|
||
interface EpicBanditEditorProps { | ||
test: EpicTest; | ||
isDisabled: boolean; | ||
onExperimentMethodologyChange: (isBanditTest?: boolean) => void; | ||
} | ||
|
||
export const EpicBanditEditor: React.FC<EpicBanditEditorProps> = ({ | ||
test, | ||
isDisabled, | ||
onExperimentMethodologyChange, | ||
}: EpicBanditEditorProps) => { | ||
const onRadioGroupChange = (event: React.ChangeEvent<HTMLInputElement>): void => { | ||
if (event.target.value === 'bandit') { | ||
onExperimentMethodologyChange(true); | ||
} else { | ||
onExperimentMethodologyChange(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<RadioGroup value={test.isBanditTest ? 'bandit' : 'abtest'} onChange={onRadioGroupChange}> | ||
<FormControlLabel | ||
value="abtest" | ||
key="abtest" | ||
control={<Radio />} | ||
label="AB Testing" | ||
disabled={isDisabled} | ||
/> | ||
<FormControlLabel | ||
value="bandit" | ||
key="bandit" | ||
control={<Radio />} | ||
label="Multi-Armed Bandit" | ||
disabled={isDisabled} | ||
/> | ||
</RadioGroup> | ||
); | ||
}; |
This file contains 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 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