From 8f513a2d2d54483922d7fcf1653255780adf4e05 Mon Sep 17 00:00:00 2001 From: RJAK11 Date: Sun, 5 Jan 2025 22:15:52 -0500 Subject: [PATCH 1/4] feat(nimbus): Add tooltips to new experiment timeline Because - The new UI is missing the tooltips on the timeline This commit - Adds tooltips to the new experiment timeline explaining what each count of days on the timeline means Fixes #11748 --- .../experimenter/experiments/models.py | 6 +++++ .../experiments/tests/test_models.py | 7 +++++ .../experimenter/nimbus_ui_new/constants.py | 27 +++++++++++++++++++ .../nimbus_experiments/experiment_base.html | 21 +++++++++++++-- 4 files changed, 59 insertions(+), 2 deletions(-) diff --git a/experimenter/experimenter/experiments/models.py b/experimenter/experimenter/experiments/models.py index 72034f81a5..e78a765a33 100644 --- a/experimenter/experimenter/experiments/models.py +++ b/experimenter/experimenter/experiments/models.py @@ -876,30 +876,35 @@ def timeline(self): "date": self.draft_date, "is_active": self.is_draft, "days": self.computed_draft_days, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Draft"], }, { "label": self.Status.PREVIEW, "date": self.preview_date, "is_active": self.is_preview, "days": self.computed_preview_days, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Preview"], }, { "label": self.PublishStatus.REVIEW, "date": self.review_date, "is_active": self.is_review, "days": self.computed_review_days, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Review"], }, { "label": NimbusConstants.ENROLLMENT, "date": self.start_date, "is_active": self.is_enrollment, "days": self.computed_enrollment_days, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Enrollment"], }, { "label": self.Status.COMPLETE, "date": self.computed_end_date, "is_active": self.is_complete, "days": self.computed_duration_days, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Complete"], }, ] if not self.is_rollout: @@ -910,6 +915,7 @@ def timeline(self): "date": self._enrollment_end_date, "is_active": self.is_observation, "days": self.computed_observations_days, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Observation"], }, ) diff --git a/experimenter/experimenter/experiments/tests/test_models.py b/experimenter/experimenter/experiments/tests/test_models.py index f1e69bfb0c..7a31e69f1d 100644 --- a/experimenter/experimenter/experiments/tests/test_models.py +++ b/experimenter/experimenter/experiments/tests/test_models.py @@ -1777,36 +1777,42 @@ def test_timeline_dates_includes_correct_status_dates_and_flags(self): "date": experiment.draft_date, "is_active": False, "days": 1, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Draft"], }, { "label": "Preview", "date": experiment.preview_date, "is_active": False, "days": 0, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Preview"], }, { "label": "Review", "date": experiment.review_date, "is_active": False, "days": 2, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Review"], }, { "label": NimbusConstants.ENROLLMENT, "date": experiment.start_date, "is_active": False, "days": 2, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Enrollment"], }, { "label": NimbusConstants.OBSERVATION, "date": experiment._enrollment_end_date, "is_active": False, "days": 2, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Observation"], }, { "label": "Complete", "date": experiment.computed_end_date, "is_active": True, "days": 4, + "tooltip": NimbusUIConstants.TIMELINE_TOOLTIPS["Complete"], }, ] @@ -1815,6 +1821,7 @@ def test_timeline_dates_includes_correct_status_dates_and_flags(self): self.assertEqual(timeline[i]["date"], expected["date"]) self.assertEqual(timeline[i]["is_active"], expected["is_active"]) self.assertEqual(timeline[i].get("days"), expected["days"]) + self.assertEqual(timeline[i].get("tooltip"), expected["tooltip"]) def test_timeline_dates_complete_is_active_when_status_is_complete(self): experiment = NimbusExperimentFactory.create_with_lifecycle( diff --git a/experimenter/experimenter/nimbus_ui_new/constants.py b/experimenter/experimenter/nimbus_ui_new/constants.py index 2deb8b41ae..575ec58c6c 100644 --- a/experimenter/experimenter/nimbus_ui_new/constants.py +++ b/experimenter/experimenter/nimbus_ui_new/constants.py @@ -28,3 +28,30 @@ class NimbusUIConstants: proportion has accounted for this:""" AUDIENCE_OVERLAP_WARNING = "https://experimenter.info/faq/warnings/#audience-overlap" + + TIMELINE_TOOLTIPS = { + "Draft": ( + "The number of days between when the experiment was first drafted " + "and when it moved to either the preview stage or the review stage." + ), + "Preview": ( + "The number of days the experiment remained in the preview phase " + "before it was reviewed." + ), + "Review": ( + "The number of days from when the experiment was reviewed to when " + "participant enrollment began." + ), + "Enrollment": ( + "The number of days from when the experiment began enrolling participants " + "to when the enrollment period ended." + ), + "Complete": ( + "The total number of days from the start of participant enrollment " + "to the end of the experiment." + ), + "Observation": ( + "The number of days the experiment was observed after the enrollment " + "period ended." + ), + } diff --git a/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html b/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html index 549585dbcc..f99e735597 100644 --- a/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html +++ b/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html @@ -7,7 +7,7 @@ {% block main_content_header %}
-
+

{{ experiment.name }}

QA Status: {{ experiment.qa_status|default:"Not Set"|title }} @@ -22,15 +22,32 @@

{{ experiment.name }}

{% endif %}
-
+
    {% for status in experiment.timeline %}
  • {{ status.label }} {{ status.date|default:'---' }} + {% if status.days is not None %} +
    + {{ status.days }} day{{ status.days|pluralize }} + +
    + {% endif %}
  • {% endfor %}
{% endblock %} + +{% block extrascripts %} + +{% endblock %} From cd6eb85e650aff2120ce075d4bcae5824cac726d Mon Sep 17 00:00:00 2001 From: RJAK11 Date: Wed, 8 Jan 2025 13:24:06 -0500 Subject: [PATCH 2/4] feat(nimbus): Add tooltips to new experiment timeline Because - The new UI is missing the tooltips on the timeline This commit - Adds tooltips to the new experiment timeline explaining what each count of days on the timeline means Fixes #11748 --- .../experimenter/nimbus_ui_new/constants.py | 13 +++++-------- .../nimbus_experiments/experiment_base.html | 12 ++---------- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/experimenter/experimenter/nimbus_ui_new/constants.py b/experimenter/experimenter/nimbus_ui_new/constants.py index 575ec58c6c..40abfb8fe8 100644 --- a/experimenter/experimenter/nimbus_ui_new/constants.py +++ b/experimenter/experimenter/nimbus_ui_new/constants.py @@ -31,20 +31,17 @@ class NimbusUIConstants: TIMELINE_TOOLTIPS = { "Draft": ( - "The number of days between when the experiment was first drafted " - "and when it moved to either the preview stage or the review stage." + "The duration from the initial draft of the experiment to its entry " + "into either the preview or review stage." ), "Preview": ( "The number of days the experiment remained in the preview phase " "before it was reviewed." ), - "Review": ( - "The number of days from when the experiment was reviewed to when " - "participant enrollment began." - ), + "Review": ("The number of days the experiment has spent in the review stage."), "Enrollment": ( - "The number of days from when the experiment began enrolling participants " - "to when the enrollment period ended." + "The duration from the start to the end of the participant enrollment " + "period." ), "Complete": ( "The total number of days from the start of participant enrollment " diff --git a/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html b/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html index f99e735597..11f98d93cc 100644 --- a/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html +++ b/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html @@ -32,8 +32,8 @@

{{ experiment.name }}

{{ status.days }} day{{ status.days|pluralize }}
{% endif %} @@ -43,11 +43,3 @@

{{ experiment.name }}

{% endblock %} - -{% block extrascripts %} - -{% endblock %} From c1312f4e360d961665314452ae6ef62d18765ee8 Mon Sep 17 00:00:00 2001 From: RJAK11 Date: Wed, 8 Jan 2025 13:43:28 -0500 Subject: [PATCH 3/4] feat(nimbus): Add tooltips to new experiment timeline Because - The new UI is missing the tooltips on the timeline This commit - Adds tooltips to the new experiment timeline explaining what each count of days on the timeline means Fixes #11748 --- .../templates/nimbus_experiments/experiment_base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html b/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html index 11f98d93cc..f1640af5d9 100644 --- a/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html +++ b/experimenter/experimenter/nimbus_ui_new/templates/nimbus_experiments/experiment_base.html @@ -33,7 +33,7 @@

{{ experiment.name }}

{{ status.days }} day{{ status.days|pluralize }} {% endif %} From b62f6f27890c8687871f0ffe002f06267d6ec10c Mon Sep 17 00:00:00 2001 From: RJAK11 Date: Wed, 8 Jan 2025 14:06:51 -0500 Subject: [PATCH 4/4] feat(nimbus): Add tooltips to new experiment timeline Because - The new UI is missing the tooltips on the timeline This commit - Adds tooltips to the new experiment timeline explaining what each count of days on the timeline means Fixes #11748 --- experimenter/experimenter/nimbus_ui_new/constants.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/experimenter/experimenter/nimbus_ui_new/constants.py b/experimenter/experimenter/nimbus_ui_new/constants.py index 40abfb8fe8..5ed8a168f9 100644 --- a/experimenter/experimenter/nimbus_ui_new/constants.py +++ b/experimenter/experimenter/nimbus_ui_new/constants.py @@ -34,10 +34,7 @@ class NimbusUIConstants: "The duration from the initial draft of the experiment to its entry " "into either the preview or review stage." ), - "Preview": ( - "The number of days the experiment remained in the preview phase " - "before it was reviewed." - ), + "Preview": ("The number of days the experiment has spent in the preview stage."), "Review": ("The number of days the experiment has spent in the review stage."), "Enrollment": ( "The duration from the start to the end of the participant enrollment "