From 56e9f3181e8a68e7c2d9d3f7e3c5d3ac61133c47 Mon Sep 17 00:00:00 2001 From: Aditya Choudhari Date: Thu, 10 Oct 2024 14:35:13 -0700 Subject: [PATCH] fix: Change evaluate type in evaluation form --- .../DeploymentControl.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/webservice/src/app/[workspaceSlug]/_components/environment-policy-drawer/DeploymentControl.tsx b/apps/webservice/src/app/[workspaceSlug]/_components/environment-policy-drawer/DeploymentControl.tsx index 69f5a205..53791811 100644 --- a/apps/webservice/src/app/[workspaceSlug]/_components/environment-policy-drawer/DeploymentControl.tsx +++ b/apps/webservice/src/app/[workspaceSlug]/_components/environment-policy-drawer/DeploymentControl.tsx @@ -106,6 +106,12 @@ export const DeploymentControl: React.FC<{ .then(() => utils.environment.policy.bySystemId.invalidate(systemId)), ); + const onEvaluateChange = (v: string) => { + if (v === "none") form.setValue("evaluate", null); + if (v === "filter") form.setValue("evaluate", defaultCondition); + if (v === "regex" || v === "semver") form.setValue("evaluate", ""); + }; + const { concurrencyLimit } = form.watch(); return ( @@ -184,7 +190,13 @@ export const DeploymentControl: React.FC<{ Filter which releases can be deployed to this environment. - + { + onEvaluateChange(v); + onChange(v); + }} + value={value} + >