Disable connected forms - Temporarily (#20040)

This commit is contained in:
Hariom Balhara
2025-03-13 11:14:23 +00:00
committed by GitHub
parent 082f8e1b04
commit e66602aa5c
3 changed files with 25 additions and 22 deletions
@@ -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")}
/>
</div>
{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" && (
<Controller
name="shouldConnect"
render={({ field: { value, onChange } }) => {
@@ -142,7 +142,7 @@ function NewFormDialog({
);
}}
/>
)}
)} */}
</div>
<DialogFooter showDivider className="mt-12">
<DialogClose />
@@ -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<HTMLDivElement>();
@@ -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`);