feat(nimbus): add links for included/excluded experiments and message consult

Because

* summary page lacked direct links to excluded and included experiments
* message consult lacked a direct link to relevant wiki page

This commit

* adds all the relevant links

Fixes #11798
This commit is contained in:
RJAK11 2024-11-21 17:05:24 -05:00
Родитель 51540edde6
Коммит 34929f4e58
3 изменённых файлов: 66 добавлений и 35 удалений

Просмотреть файл

@ -2144,6 +2144,41 @@ class TestNimbusExperiment(TestCase):
"firefox-desktop-feature-release-mac_only-rollout",
)
def test_required_experiments_branches(self):
parent_experiment = NimbusExperimentFactory.create_with_lifecycle(
NimbusExperimentFactory.Lifecycles.CREATED
)
child_experiment = NimbusExperimentFactory.create_with_lifecycle(
NimbusExperimentFactory.Lifecycles.CREATED
)
NimbusExperimentBranchThroughRequired.objects.create(
parent_experiment=parent_experiment,
child_experiment=child_experiment,
branch_slug="branch-test",
)
required_branches = parent_experiment.required_experiments_branches.all()
self.assertEqual(len(required_branches), 1)
self.assertEqual(required_branches[0].branch_slug, "branch-test")
def test_excluded_experiments_branches(self):
parent_experiment = NimbusExperimentFactory.create_with_lifecycle(
NimbusExperimentFactory.Lifecycles.CREATED
)
child_experiment = NimbusExperimentFactory.create_with_lifecycle(
NimbusExperimentFactory.Lifecycles.CREATED
)
NimbusExperimentBranchThroughExcluded.objects.create(
parent_experiment=parent_experiment,
child_experiment=child_experiment,
)
excluded_branches = parent_experiment.excluded_experiments_branches.all()
self.assertEqual(len(excluded_branches), 1)
self.assertIsNone(excluded_branches[0].branch_slug)
def test_bucket_namespace_with_group_id(self):
feature = NimbusFeatureConfigFactory(slug="feature")
experiment = NimbusExperimentFactory.create_with_lifecycle(

Просмотреть файл

@ -207,43 +207,39 @@
<tr>
<th>Required experiments</th>
<td>
{% if experiment.required_experiments_branches.all %}
{% for branch in experiment.required_experiments_branches.all %}
<a href="{% url 'nimbus-new-detail' branch.child_experiment.slug %}"
target="_blank"
rel="noopener noreferrer">
{{ branch.child_experiment.name }}
{% if branch.branch_slug %}
({{ branch.branch_slug }} branch)
{% else %}
(All branches)
{% endif %}
</a>
<br>
{% endfor %}
{% else %}
None
{% endif %}
{% with experiment.required_experiments_branches.all as required_branches %}
{% if required_branches %}
{% for branch in required_branches %}
<a href="{% url 'nimbus-new-detail' branch.child_experiment.slug %}"
target="_blank"
rel="noopener noreferrer">
{{ branch.child_experiment.name }}
({{ branch.branch_slug|add:" branch"|default:"All branches" }})
</a>
<br>
{% endfor %}
{% else %}
None
{% endif %}
{% endwith %}
</td>
<th>Excluded experiments</th>
<td>
{% if experiment.excluded_experiments_branches.all %}
{% for branch in experiment.excluded_experiments_branches.all %}
<a href="{% url 'nimbus-new-detail' branch.child_experiment.slug %}"
target="_blank"
rel="noopener noreferrer">
{{ branch.child_experiment.name }}
{% if branch.branch_slug %}
({{ branch.branch_slug }} branch)
{% else %}
(All branches)
{% endif %}
</a>
<br>
{% endfor %}
{% else %}
None
{% endif %}
{% with experiment.excluded_experiments_branches.all as excluded_branches %}
{% if excluded_branches %}
{% for branch in excluded_branches %}
<a href="{% url 'nimbus-new-detail' branch.child_experiment.slug %}"
target="_blank"
rel="noopener noreferrer">
{{ branch.child_experiment.name }}
({{ branch.branch_slug|add:" branch"|default:"All branches" }})
</a>
<br>
{% endfor %}
{% else %}
None
{% endif %}
{% endwith %}
</td>
</tr>
<tr>

Просмотреть файл

@ -129,6 +129,7 @@ def build_experiment_context(experiment):
"primary_outcome_links": primary_outcome_links,
"secondary_outcome_links": secondary_outcome_links,
"segment_links": segment_links,
"risk_message_url": NimbusUIConstants.RISK_MESSAGE_URL,
}
return context
@ -146,7 +147,6 @@ class NimbusExperimentDetailView(NimbusExperimentViewMixin, DetailView):
context["form"] = QAStatusForm(instance=self.object)
if context["takeaways_edit_mode"]:
context["takeaways_form"] = TakeawaysForm(instance=self.object)
context["risk_message_url"] = NimbusUIConstants.RISK_MESSAGE_URL
return context