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

Commit

Permalink
Merge #1069
Browse files Browse the repository at this point in the history
1069: Add experimenter_slug to recipe details and form r=rehandalal a=glasserc

Fixes #808.

At present, Normandy server does not accept either empty strings or nulls for this field. Since the model already has `null=True`, I went with that approach, explicitly converting empty strings to nulls. I have opened mozilla/normandy#2010 to support this on the server side.

Co-authored-by: Ethan Glasser-Camp <ethan@betacantrips.com>
  • Loading branch information
bors[bot] and glasserc committed Oct 4, 2019
2 parents aa2c1fb + f46b4fb commit 94baa17
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/workflows/recipes/components/RecipeDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export default class RecipeDetails extends React.PureComponent {
<dt>Name</dt>
<ArgumentsValue name="name" value={revision.get('name')} />

<dt>Experimenter Slug</dt>
<ArgumentsValue name="experimenter_slug" value={revision.get('experimenter_slug')} />

{filterObject && filterObject.size ? <dt>Filters</dt> : null}
{filterObject && filterObject.size ? (
<ArgumentsValue name="filter_object" value={revision.get('filter_object')} />
Expand Down
12 changes: 12 additions & 0 deletions src/workflows/recipes/components/RecipeForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ export function cleanRecipeData(data) {
throw new Error('Have you have at least one filter object or a filter expression.');
}

if (data.experimenter_slug === '') {
data.experimenter_slug = null;
}

// Make sure the action ID is an integer
try {
data.action_id = parseInt(data.action_id, 10);
Expand Down Expand Up @@ -197,6 +201,14 @@ class RecipeForm extends React.PureComponent {
</FormItem>
</Col>
</Row>
<FormItem
name="experimenter_slug"
label="Experimenter Slug"
rules={[{ required: false }]}
initialValue={revision.get('experimenter_slug')}
>
<Input disabled={isLoading} />
</FormItem>
{this.renderCommentField()}
<FilterObjectForm
form={this.props.form}
Expand Down

0 comments on commit 94baa17

Please sign in to comment.