Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Merge #806
Browse files Browse the repository at this point in the history
806: Addon Studies should submit both extension ID and addon URL r=mythmon a=rehandalal

r?

Co-authored-by: Rehan Dalal <rehandalal@gmail.com>
  • Loading branch information
bors[bot] and rehandalal committed Mar 5, 2019
2 parents 34dfd1b + a5c90b5 commit 76529ba
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { List, Map } from 'immutable';
import OptOutStudyFields from 'console/workflows/recipes/components/OptOutStudyFields';
import AddonStudyFields from 'console/workflows/recipes/components/AddonStudyFields';

describe('<OptOutStudyFields>', () => {
describe('<AddonStudyFields>', () => {
const props = {
disabled: false,
extensions: new List(),
recipeArguments: new Map(),
};

it('should work', () => {
const wrapper = () => shallow(<OptOutStudyFields {...props} />);
const wrapper = () => shallow(<AddonStudyFields {...props} />);

expect(wrapper).not.toThrow();
});
Expand Down
5 changes: 3 additions & 2 deletions src/workflows/extensions/components/ExtensionSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ class ExtensionSelect extends React.Component {
>
<OptGroup label={optGroupLabel}>
{displayedList.map(item => {
const xpi = item.get('xpi');
const id = item.get('id');
const name = item.get('name');
const xpi = item.get('xpi');

return (
<Option key={xpi} value={xpi} title={name}>
<Option key={id} value={id} title={name} url={xpi}>
{name}
</Option>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ExtensionSelect from 'console/workflows/extensions/components/ExtensionSe
import { connectFormProps } from 'console/utils/forms';

@connectFormProps
class OptOutStudyFields extends React.Component {
class AddonStudyFields extends React.Component {
static propTypes = {
disabled: PropTypes.bool,
recipeArguments: PropTypes.instanceOf(Map).isRequired,
Expand Down Expand Up @@ -49,10 +49,22 @@ class OptOutStudyFields extends React.Component {
<Col xs={24} md={12}>
<FormItem
label="Extension"
name="arguments.addonUrl"
initialValue={recipeArguments.get('addonUrl', '')}
name="arguments.extensionApiId"
initialValue={recipeArguments.get('extensionApiId', '')}
>
<ExtensionSelect disabled={disabled} />
<ExtensionSelect
disabled={disabled}
onChange={(value, option) => {
const { form } = this.props;
form.setFieldsValue({
'arguments.addonUrl': option.props.url,
});
}}
/>
</FormItem>

<FormItem name="arguments.addonUrl" style={{ display: 'none' }}>
<Input />
</FormItem>

<FormItem
Expand All @@ -72,4 +84,4 @@ class OptOutStudyFields extends React.Component {
}
}

export default OptOutStudyFields;
export default AddonStudyFields;
4 changes: 2 additions & 2 deletions src/workflows/recipes/components/RecipeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import PreferenceRolloutFields, {
} from 'console/workflows/recipes/components/PreferenceRolloutFields';
import PreferenceRollbackFields from 'console/workflows/recipes/components/PreferenceRollbackFields';
import ShowHeartbeatFields from 'console/workflows/recipes/components/ShowHeartbeatFields';
import OptOutStudyFields from 'console/workflows/recipes/components/OptOutStudyFields';
import AddonStudyFields from 'console/workflows/recipes/components/AddonStudyFields';
import { getAction } from 'console/state/actions/selectors';
import { getRecipeFilters } from 'console/state/recipes/selectors';
import { areAnyRequestsInProgress } from 'console/state/network/selectors';
Expand Down Expand Up @@ -103,7 +103,7 @@ class RecipeForm extends React.PureComponent {
'preference-experiment': PreferenceExperimentFields,
'preference-rollout': PreferenceRolloutFields,
'preference-rollback': PreferenceRollbackFields,
'opt-out-study': OptOutStudyFields,
'opt-out-study': AddonStudyFields,
};

constructor(props) {
Expand Down

0 comments on commit 76529ba

Please sign in to comment.