From e66602aa5cb0d5652bf47dc0c0002eabd6d6f913 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Thu, 13 Mar 2025 16:44:23 +0530 Subject: [PATCH] Disable connected forms - Temporarily (#20040) --- .../routing-forms/components/FormActions.tsx | 8 ++--- .../pages/route-builder/[...appPages].tsx | 36 ++++++++++--------- .../playwright/tests/basic.e2e.ts | 3 +- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/packages/app-store/routing-forms/components/FormActions.tsx b/packages/app-store/routing-forms/components/FormActions.tsx index 03e5824f41..4bbdf8ddf2 100644 --- a/packages/app-store/routing-forms/components/FormActions.tsx +++ b/packages/app-store/routing-forms/components/FormActions.tsx @@ -1,6 +1,6 @@ import { useRouter } from "next/navigation"; import { createContext, forwardRef, useContext, useState } from "react"; -import { Controller, useForm } from "react-hook-form"; +import { useForm } from "react-hook-form"; import { v4 as uuidv4 } from "uuid"; import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider"; @@ -23,7 +23,6 @@ import { DropdownMenuItem, DropdownMenuTrigger, Form, - SettingsToggle, showToast, Switch, TextAreaField, @@ -126,7 +125,8 @@ function NewFormDialog({ placeholder={t("form_description_placeholder")} /> - {action === "duplicate" && ( + {/* Disable this feature for new forms till we get it fully working with Routing Form with Attributes. This isn't much used feature */} + {/* {action === "duplicate" && ( { @@ -142,7 +142,7 @@ function NewFormDialog({ ); }} /> - )} + )} */} diff --git a/packages/app-store/routing-forms/pages/route-builder/[...appPages].tsx b/packages/app-store/routing-forms/pages/route-builder/[...appPages].tsx index 0f84edc056..d6b5ffb2b2 100644 --- a/packages/app-store/routing-forms/pages/route-builder/[...appPages].tsx +++ b/packages/app-store/routing-forms/pages/route-builder/[...appPages].tsx @@ -952,7 +952,24 @@ const Routes = ({ }; }) || []; - const isConnectedForm = (id: string) => form.connectedForms.map((f) => f.id).includes(id); + // const isConnectedForm = (id: string) => form.connectedForms.map((f) => f.id).includes(id); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const routers: any[] = []; + /* Disable this feature for new forms till we get it fully working with Routing Form with Attributes. This isn't much used feature */ + // const routers = availableRouters.map((r) => { + // // Reset disabled state + // r.isDisabled = false; + + // // Can't select a form as router that is already a connected form. It avoids cyclic dependency + // if (isConnectedForm(r.value)) { + // r.isDisabled = true; + // } + // // A route that's already used, can't be reselected + // if (routes.find((route) => route.id === r.value)) { + // r.isDisabled = true; + // } + // return r; + // }); const routerOptions = ( [ @@ -969,22 +986,7 @@ const Routes = ({ description: string | null; isDisabled?: boolean; }[] - ).concat( - availableRouters.map((r) => { - // Reset disabled state - r.isDisabled = false; - - // Can't select a form as router that is already a connected form. It avoids cyclic dependency - if (isConnectedForm(r.value)) { - r.isDisabled = true; - } - // A route that's already used, can't be reselected - if (routes.find((route) => route.id === r.value)) { - r.isDisabled = true; - } - return r; - }) - ); + ).concat(routers); const [animationRef] = useAutoAnimate(); diff --git a/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts b/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts index f392435961..b63d08f16e 100644 --- a/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts +++ b/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts @@ -145,7 +145,8 @@ test.describe("Routing Forms", () => { await verifyFieldOptionsInRule(options, page); }); - test.describe("F1<-F2 Relationship", () => { + // This feature is disable till it is fully supported and tested with Routing Form with Attributes. + test.describe.skip("F1<-F2 Relationship", () => { test("Create relationship by adding F1 as route.Editing F1 should update F2", async ({ page }) => { const form1Id = await addForm(page, { name: "F1" }); await page.goto(`/routing-forms/forms`);