From 124d4df8a23ed135722358184a627d4da0ff2cc6 Mon Sep 17 00:00:00 2001 From: Mohamed Ibrahim Date: Tue, 30 Jun 2026 17:04:28 -0400 Subject: [PATCH] feat(nimbus): add platform field to rollouts overview form --- experimenter/experimenter/nimbus_ui/new/forms.py | 10 ++++++++++ .../templates/new/rollouts/overview/card.html | 5 +++++ .../templates/new/rollouts/overview/edit_form.html | 13 +++++++++++++ .../experimenter/nimbus_ui/tests/test_new_forms.py | 5 +++++ .../experimenter/nimbus_ui/tests/test_new_views.py | 5 +++++ 5 files changed, 38 insertions(+) diff --git a/experimenter/experimenter/nimbus_ui/new/forms.py b/experimenter/experimenter/nimbus_ui/new/forms.py index b0b7a10fc6..8cf519e02d 100644 --- a/experimenter/experimenter/nimbus_ui/new/forms.py +++ b/experimenter/experimenter/nimbus_ui/new/forms.py @@ -321,6 +321,15 @@ class RolloutOverviewForm(NimbusChangeLogFormMixin, forms.ModelForm): public_description = forms.CharField( required=False, widget=forms.Textarea(attrs={"class": "form-control", "rows": 3}) ) + application = forms.ChoiceField( + disabled=True, + choices=NimbusExperiment.Application.choices, + widget=forms.widgets.Select( + attrs={ + "class": "form-select", + }, + ), + ) class Meta: model = NimbusExperiment @@ -328,6 +337,7 @@ class Meta: "name", "hypothesis", "public_description", + "application", ] def __init__(self, *args, **kwargs): diff --git a/experimenter/experimenter/nimbus_ui/templates/new/rollouts/overview/card.html b/experimenter/experimenter/nimbus_ui/templates/new/rollouts/overview/card.html index acd68c3b0a..03c9436833 100644 --- a/experimenter/experimenter/nimbus_ui/templates/new/rollouts/overview/card.html +++ b/experimenter/experimenter/nimbus_ui/templates/new/rollouts/overview/card.html @@ -9,6 +9,11 @@
Observations & Problem space
{{ experiment.hypothesis|default:"—" }}
+ {# Application #} +
+
Application
+
{{ experiment.get_application_display }}
+
{# Important Links #}
Important Links
diff --git a/experimenter/experimenter/nimbus_ui/templates/new/rollouts/overview/edit_form.html b/experimenter/experimenter/nimbus_ui/templates/new/rollouts/overview/edit_form.html index 3dd83bd576..1e1ab15749 100644 --- a/experimenter/experimenter/nimbus_ui/templates/new/rollouts/overview/edit_form.html +++ b/experimenter/experimenter/nimbus_ui/templates/new/rollouts/overview/edit_form.html @@ -22,6 +22,19 @@
{{ form.hypothesis.errors|join:", " }}
{% endif %}
+ {# Application #} +
+ + {{ form.application }} + {% if form.application.errors %} +
{{ form.application.errors|join:", " }}
+ {% endif %} +

+ Rollouts can only target one Application at a time. +
+ Application can not be changed after a rollout is created. +

+
{# Important Links #}
diff --git a/experimenter/experimenter/nimbus_ui/tests/test_new_forms.py b/experimenter/experimenter/nimbus_ui/tests/test_new_forms.py index 052a877555..fddd08c364 100644 --- a/experimenter/experimenter/nimbus_ui/tests/test_new_forms.py +++ b/experimenter/experimenter/nimbus_ui/tests/test_new_forms.py @@ -226,6 +226,7 @@ def test_valid_form_saves(self): "name": "new rollout name", "hypothesis": "new hypothesis", "public_description": "new description", + "application": NimbusExperiment.Application.FENIX, "documentation_links-TOTAL_FORMS": "1", "documentation_links-INITIAL_FORMS": "1", "documentation_links-0-id": documentation_link.id, @@ -244,6 +245,7 @@ def test_valid_form_saves(self): self.assertEqual(experiment.name, "new rollout name") self.assertEqual(experiment.hypothesis, "new hypothesis") self.assertEqual(experiment.public_description, "new description") + self.assertEqual(experiment.application, NimbusExperiment.Application.FENIX) documentation_link = experiment.documentation_links.all().get() self.assertEqual( @@ -260,6 +262,7 @@ def test_name_field_is_required(self): "name": "", "hypothesis": "new hypothesis", "public_description": "new description", + "application": NimbusExperiment.Application.DESKTOP, "documentation_links-TOTAL_FORMS": "0", "documentation_links-INITIAL_FORMS": "0", } @@ -283,6 +286,7 @@ def test_valid_form_adds_documentation_link(self): "name": "new name", "hypothesis": "new hypothesis", "public_description": "new description", + "application": experiment.application, "documentation_links-TOTAL_FORMS": "0", "documentation_links-INITIAL_FORMS": "0", }, @@ -314,6 +318,7 @@ def test_valid_form_deletes_documentation_link(self): "name": "new name", "hypothesis": "new hypothesis", "public_description": "new description", + "application": experiment.application, "documentation_links-TOTAL_FORMS": "1", "documentation_links-INITIAL_FORMS": "1", "documentation_links-0-id": documentation_link.id, diff --git a/experimenter/experimenter/nimbus_ui/tests/test_new_views.py b/experimenter/experimenter/nimbus_ui/tests/test_new_views.py index c4d3fe0b65..3346ecae00 100644 --- a/experimenter/experimenter/nimbus_ui/tests/test_new_views.py +++ b/experimenter/experimenter/nimbus_ui/tests/test_new_views.py @@ -51,6 +51,7 @@ def overview_data(self, experiment, documentation_link=None, **overrides): "name": experiment.name, "hypothesis": experiment.hypothesis, "public_description": experiment.public_description, + "application": experiment.application, "documentation_links-TOTAL_FORMS": "0", "documentation_links-INITIAL_FORMS": "0", } @@ -199,6 +200,7 @@ def test_post_valid_saves_and_returns_display_card(self): name="updated name", hypothesis="updated hypothesis", public_description="updated description", + application=NimbusExperiment.Application.FENIX, ), ) @@ -207,6 +209,7 @@ def test_post_valid_saves_and_returns_display_card(self): experiment.refresh_from_db() self.assertEqual(experiment.name, "updated name") self.assertEqual(experiment.hypothesis, "updated hypothesis") + self.assertEqual(experiment.application, NimbusExperiment.Application.FENIX) self.assertTrue(response.context["hx_swap_oob"]) def test_post_invalid_returns_edit_form_with_errors(self): @@ -438,6 +441,7 @@ def test_post_creates_link_and_returns_edit_form(self): { "name": experiment.name, "hypothesis": experiment.hypothesis, + "application": experiment.application, "risk_brand": True, "risk_message": True, "public_description": experiment.public_description, @@ -466,6 +470,7 @@ def test_post_deletes_link_and_returns_edit_form(self): { "name": experiment.name, "hypothesis": experiment.hypothesis, + "application": experiment.application, "risk_brand": True, "risk_message": True, "public_description": experiment.public_description,