From 9f3a955ebff7925a4f4221c2dc0b6012010bcdde Mon Sep 17 00:00:00 2001 From: Kira Pilot Date: Thu, 16 Nov 2023 10:53:35 -0500 Subject: [PATCH] fix: show all experiments in deployments list if opted into (#10722) --- .../DeploySettingsLayout/optionValue.test.ts | 15 ++++++++++++++- .../DeploySettingsLayout/optionValue.ts | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/site/src/components/DeploySettingsLayout/optionValue.test.ts b/site/src/components/DeploySettingsLayout/optionValue.test.ts index 387917723e..d1cac8de19 100644 --- a/site/src/components/DeploySettingsLayout/optionValue.test.ts +++ b/site/src/components/DeploySettingsLayout/optionValue.test.ts @@ -97,7 +97,11 @@ describe("optionValue", () => { value: ["moons"], }, additionalValues: ["single_tailnet", "deployment_health_page"], - expected: { single_tailnet: false, deployment_health_page: false }, + expected: { + single_tailnet: false, + deployment_health_page: false, + moons: true, + }, }, { option: { @@ -108,6 +112,15 @@ describe("optionValue", () => { additionalValues: ["single_tailnet", "deployment_health_page"], expected: { single_tailnet: true, deployment_health_page: true }, }, + { + option: { + ...defaultOption, + name: "Experiments", + value: ["*", "moons", "single_tailnet"], + }, + additionalValues: ["single_tailnet"], + expected: { moons: true, single_tailnet: true }, + }, { option: { ...defaultOption, diff --git a/site/src/components/DeploySettingsLayout/optionValue.ts b/site/src/components/DeploySettingsLayout/optionValue.ts index 6df38820f7..1deb3a4fe1 100644 --- a/site/src/components/DeploySettingsLayout/optionValue.ts +++ b/site/src/components/DeploySettingsLayout/optionValue.ts @@ -50,8 +50,10 @@ export function optionValue( break; } + // We show all experiments (including unsafe) that are currently enabled on a deployment + // but only show safe experiments that are not. for (const v of option.value) { - if (Object.hasOwn(experimentMap, v)) { + if (v !== "*") { experimentMap[v] = true; } }