From 23a22729ff9885139c68bc03e51da9b34a630343 Mon Sep 17 00:00:00 2001 From: Justin Brooks Date: Mon, 28 Oct 2024 18:20:09 -0400 Subject: [PATCH] init eph envs (#179) Co-authored-by: Aditya Choudhari --- .../DeploymentControl.tsx | 37 +- .../RolloutAndTiming.tsx | 14 +- .../releases/[versionId]/FlowPolicyNode.tsx | 84 +- packages/api/src/router/job.ts | 2 +- packages/api/src/router/release.ts | 132 +- packages/db/drizzle/0026_blushing_kang.sql | 86 + packages/db/drizzle/meta/0026_snapshot.json | 4044 +++++++++++++++++ packages/db/drizzle/meta/_journal.json | 7 + .../db/src/schema/deployment-variables.ts | 6 +- packages/db/src/schema/environment.ts | 89 +- packages/db/src/schema/release.ts | 13 + .../__test__/job-variables-deployment.test.ts | 7 + .../src/policies/gradual-rollout.ts | 2 +- .../src/policies/release-string-check.ts | 144 +- 14 files changed, 4471 insertions(+), 196 deletions(-) create mode 100644 packages/db/drizzle/0026_blushing_kang.sql create mode 100644 packages/db/drizzle/meta/0026_snapshot.json 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 9cb69dd9..a6387fa6 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 @@ -1,6 +1,5 @@ import type * as SCHEMA from "@ctrlplane/db/schema"; import React from "react"; -import _ from "lodash"; import { z } from "zod"; import { Button } from "@ctrlplane/ui/button"; @@ -11,24 +10,16 @@ import { FormField, FormItem, FormLabel, - FormMessage, useForm, } from "@ctrlplane/ui/form"; import { Input } from "@ctrlplane/ui/input"; import { RadioGroup, RadioGroupItem } from "@ctrlplane/ui/radio-group"; -import { - defaultCondition, - isEmptyCondition, - releaseCondition, -} from "@ctrlplane/validators/releases"; import { api } from "~/trpc/react"; -import { ReleaseConditionRender } from "../release-condition/ReleaseConditionRender"; const schema = z.object({ concurrencyType: z.enum(["all", "some"]), concurrencyLimit: z.number().min(1, "Must be a positive number"), - releaseFilter: releaseCondition.nullable(), }); export const DeploymentControl: React.FC<{ @@ -41,12 +32,8 @@ export const DeploymentControl: React.FC<{ const { id, systemId } = environmentPolicy; const onSubmit = form.handleSubmit((data) => { - const releaseFilter = - data.releaseFilter != null && isEmptyCondition(data.releaseFilter) - ? null - : data.releaseFilter; updatePolicy - .mutateAsync({ id, data: { ...data, releaseFilter } }) + .mutateAsync({ id, data }) .then(() => form.reset(data)) .then(() => utils.environment.policy.byId.invalidate(id)) .then(() => utils.environment.policy.bySystemId.invalidate(systemId)); @@ -118,28 +105,6 @@ export const DeploymentControl: React.FC<{ )} /> - ( - - Filter - - - - - {form.formState.isDirty && ( - - Save to apply - - )} - - )} - /> -