fix: change access_type to fit new ENUM (#7145)

*  (deploy-dropdown.tsx): Update access_type values to uppercase for consistency and clarity
♻️ (use-patch-update-flow.ts): Refactor access_type values to uppercase for consistency with other files
♻️ (index.ts): Refactor access_type values to uppercase for consistency with other files
🔧 (publish-flow.spec.ts): Remove redundant click event on 'blank-flow' element
🔧 (floatComponent.spec.ts): Add missing click event on 'fit_view' element

*  (publish-flow.spec.ts): fix duplicate click on 'blank-flow' element to prevent unexpected behavior

* 🐛 (Playground/index.tsx): fix access_type comparison to use uppercase "PUBLIC" instead of lowercase "public" for consistency and accuracy

*  (publish-flow.spec.ts): add delays before clicking on elements to ensure proper interaction and prevent race conditions
This commit is contained in:
Cristhian Zanforlin Lousa 2025-03-18 18:26:07 -03:00 committed by GitHub
commit ff5a49d66f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 10 additions and 18 deletions

View file

@ -30,7 +30,7 @@ export default function PublishDropdown() {
const flows = useFlowsManagerStore((state) => state.flows);
const setFlows = useFlowsManagerStore((state) => state.setFlows);
const setCurrentFlow = useFlowStore((state) => state.setCurrentFlow);
const isPublished = currentFlow?.access_type === "public";
const isPublished = currentFlow?.access_type === "PUBLIC";
const hasIO = useFlowStore((state) => state.hasIO);
const isAuth = useAuthStore((state) => !!state.autoLogin);
const [openApiModal, setOpenApiModal] = useState(false);
@ -39,7 +39,7 @@ export default function PublishDropdown() {
mutateAsync(
{
id: flowId ?? "",
access_type: checked ? "private" : "public",
access_type: checked ? "PRIVATE" : "PUBLIC",
},
{
onSuccess: (updatedFlow) => {
@ -179,19 +179,6 @@ export default function PublishDropdown() {
</div>
</div>
</ShadTooltipComponent>
{/* <DropdownMenuItem className="deploy-dropdown-item group">
<div className="group-hover:bg-accent">
<IconComponent
name="FileCode2"
className={`${groupStyle} icon-size mr-2`}
/>
<span>Langflow SDK</span>
<IconComponent
name="ExternalLink"
className={`icon-size ml-auto mr-3 ${externalUrlStyle} text-foreground`}
/>
</div>
</DropdownMenuItem> */}
</DropdownMenuContent>
</DropdownMenu>
<ApiModal open={openApiModal} setOpen={setOpenApiModal}>

View file

@ -13,7 +13,7 @@ interface IPatchUpdateFlow {
folder_id?: string | null | undefined;
endpoint_name?: string | null | undefined;
locked?: boolean | null | undefined;
access_type?: "public" | "private" | "protected";
access_type?: "PUBLIC" | "PRIVATE" | "PROTECTED";
}
export const usePatchUpdateFlow: useMutationFunctionType<

View file

@ -66,7 +66,7 @@ export default function PlaygroundPage() {
);
if (
(inputs.length === 0 && outputs.length === 0) ||
currentSavedFlow?.access_type !== "public"
currentSavedFlow?.access_type !== "PUBLIC"
) {
// redirect to the home page
navigate("/");

View file

@ -32,7 +32,7 @@ export type FlowType = {
webhook?: boolean;
locked?: boolean | null;
public?: boolean;
access_type?: "public" | "private" | "protected";
access_type?: "PUBLIC" | "PRIVATE" | "PROTECTED";
};
export type GenericNodeType = Node<NodeDataType, "genericNode">;

View file

@ -60,8 +60,11 @@ test(
await newPage.close();
await page.bringToFront();
// check if deactivate the publishworks
await page.waitForTimeout(500);
await page.getByTestId("publish-button").click();
await page.waitForTimeout(500);
await page.getByTestId("publish-switch").click();
await page.waitForTimeout(500);
await expect(page.getByTestId("rf__wrapper")).toBeVisible();
await expect(page.getByTestId("publish-switch")).toBeChecked({
checked: false,

View file

@ -33,6 +33,8 @@ test(
await page.getByText("Close").last().click();
await page.getByTestId("fit_view").click();
await page.locator('//*[@id="int_int_seed"]').click();
await page.locator('//*[@id="int_int_seed"]').fill("");
await page.locator('//*[@id="int_int_seed"]').fill("3");