fix: update project description, update alerts animation, fix delete and duplicate loading (#3835)
* Deleted "personal" from manage your projects * Removed animations from alerts on the dropdown * Changed useDeleteFlow to return isPending as well * Added delete loading to components and added filter of components not present in "flows" for deletion * added isDuplicating as a isMutating with the postAddFlow
This commit is contained in:
parent
a7d1449e9d
commit
bad009c0fa
7 changed files with 167 additions and 156 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import { CustomLink } from "@/customization/components/custom-link";
|
import { CustomLink } from "@/customization/components/custom-link";
|
||||||
import { Transition } from "@headlessui/react";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import IconComponent from "../../../../components/genericIconComponent";
|
import IconComponent from "../../../../components/genericIconComponent";
|
||||||
import { SingleAlertComponentType } from "../../../../types/alerts";
|
import { SingleAlertComponentType } from "../../../../types/alerts";
|
||||||
|
|
@ -11,19 +10,7 @@ export default function SingleAlert({
|
||||||
const [show, setShow] = useState(true);
|
const [show, setShow] = useState(true);
|
||||||
const type = dropItem.type;
|
const type = dropItem.type;
|
||||||
|
|
||||||
return (
|
return type === "error" ? (
|
||||||
<Transition
|
|
||||||
className="noflow nowheel nopan nodelete nodrag relative"
|
|
||||||
show={show}
|
|
||||||
appear={true}
|
|
||||||
enter="transition-transform duration-500 ease-out"
|
|
||||||
enterFrom={"transform translate-x-[-100%]"}
|
|
||||||
enterTo={"transform translate-x-0"}
|
|
||||||
leave="transition-transform duration-500 ease-in"
|
|
||||||
leaveFrom={"transform translate-x-0"}
|
|
||||||
leaveTo={"transform translate-x-[-100%]"}
|
|
||||||
>
|
|
||||||
{type === "error" ? (
|
|
||||||
<div
|
<div
|
||||||
className="mx-2 mb-2 flex rounded-md bg-error-background p-3"
|
className="mx-2 mb-2 flex rounded-md bg-error-background p-3"
|
||||||
key={dropItem.id}
|
key={dropItem.id}
|
||||||
|
|
@ -165,7 +152,5 @@ export default function SingleAlert({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</Transition>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -703,7 +703,7 @@ export const CHAT_INPUT_PLACEHOLDER =
|
||||||
export const CHAT_INPUT_PLACEHOLDER_SEND = "Send a message...";
|
export const CHAT_INPUT_PLACEHOLDER_SEND = "Send a message...";
|
||||||
export const EDIT_CODE_TITLE = "Edit Code";
|
export const EDIT_CODE_TITLE = "Edit Code";
|
||||||
export const MY_COLLECTION_DESC =
|
export const MY_COLLECTION_DESC =
|
||||||
"Manage your personal projects. Download and upload entire collections.";
|
"Manage your projects. Download and upload entire collections.";
|
||||||
export const STORE_DESC = "Explore community-shared flows and components.";
|
export const STORE_DESC = "Explore community-shared flows and components.";
|
||||||
export const STORE_TITLE = "Langflow Store";
|
export const STORE_TITLE = "Langflow Store";
|
||||||
export const NO_API_KEY = "You don't have an API key.";
|
export const NO_API_KEY = "You don't have an API key.";
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ const useAddFlow = () => {
|
||||||
);
|
);
|
||||||
const flows = useFlowsManagerStore((state) => state.flows);
|
const flows = useFlowsManagerStore((state) => state.flows);
|
||||||
const setFlows = useFlowsManagerStore((state) => state.setFlows);
|
const setFlows = useFlowsManagerStore((state) => state.setFlows);
|
||||||
const deleteFlow = useDeleteFlow();
|
const { deleteFlow } = useDeleteFlow();
|
||||||
|
|
||||||
const { folderId } = useParams();
|
const { folderId } = useParams();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const useDeleteFlow = () => {
|
||||||
const flows = useFlowsManagerStore((state) => state.flows);
|
const flows = useFlowsManagerStore((state) => state.flows);
|
||||||
const setFlows = useFlowsManagerStore((state) => state.setFlows);
|
const setFlows = useFlowsManagerStore((state) => state.setFlows);
|
||||||
|
|
||||||
const { mutate } = useDeleteDeleteFlows();
|
const { mutate, isPending } = useDeleteDeleteFlows();
|
||||||
|
|
||||||
const deleteFlow = async ({
|
const deleteFlow = async ({
|
||||||
id,
|
id,
|
||||||
|
|
@ -45,7 +45,7 @@ const useDeleteFlow = () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return deleteFlow;
|
return { deleteFlow, isDeleting: isPending };
|
||||||
};
|
};
|
||||||
|
|
||||||
export default useDeleteFlow;
|
export default useDeleteFlow;
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ export const SidebarDraggableComponent = forwardRef(
|
||||||
ref,
|
ref,
|
||||||
) => {
|
) => {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const deleteFlow = useDeleteFlow();
|
const { deleteFlow } = useDeleteFlow();
|
||||||
const flows = useFlowsManagerStore((state) => state.flows);
|
const flows = useFlowsManagerStore((state) => state.flows);
|
||||||
|
|
||||||
const version = useDarkStore((state) => state.version);
|
const version = useDarkStore((state) => state.version);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import { usePostDownloadMultipleFlows } from "@/controllers/API/queries/flows";
|
import { usePostDownloadMultipleFlows } from "@/controllers/API/queries/flows";
|
||||||
import useDeleteFlow from "@/hooks/flows/use-delete-flow";
|
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { FormProvider, useForm, useWatch } from "react-hook-form";
|
import { FormProvider, useForm, useWatch } from "react-hook-form";
|
||||||
import { useLocation, useParams } from "react-router-dom";
|
import { useLocation, useParams } from "react-router-dom";
|
||||||
|
|
@ -29,10 +28,12 @@ export default function ComponentsComponent({
|
||||||
type = "all",
|
type = "all",
|
||||||
currentFolder,
|
currentFolder,
|
||||||
isLoading,
|
isLoading,
|
||||||
|
deleteFlow,
|
||||||
}: {
|
}: {
|
||||||
type?: string;
|
type?: string;
|
||||||
currentFolder?: FolderType;
|
currentFolder?: FolderType;
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
|
deleteFlow: ({ id }: { id: string[] }) => Promise<void>;
|
||||||
}) {
|
}) {
|
||||||
const { folderId } = useParams();
|
const { folderId } = useParams();
|
||||||
|
|
||||||
|
|
@ -176,8 +177,6 @@ export default function ComponentsComponent({
|
||||||
handleExport,
|
handleExport,
|
||||||
);
|
);
|
||||||
|
|
||||||
const deleteFlow = useDeleteFlow();
|
|
||||||
|
|
||||||
const handleDeleteMultiple = () => {
|
const handleDeleteMultiple = () => {
|
||||||
deleteFlow({ id: selectedFlowsComponentsCards })
|
deleteFlow({ id: selectedFlowsComponentsCards })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { useGetFolderQuery } from "@/controllers/API/queries/folders/use-get-folder";
|
import { useGetFolderQuery } from "@/controllers/API/queries/folders/use-get-folder";
|
||||||
|
import useDeleteFlow from "@/hooks/flows/use-delete-flow";
|
||||||
|
import useFlowsManagerStore from "@/stores/flowsManagerStore";
|
||||||
import { useFolderStore } from "@/stores/foldersStore";
|
import { useFolderStore } from "@/stores/foldersStore";
|
||||||
import { useIsFetching } from "@tanstack/react-query";
|
import { useIsFetching, useIsMutating } from "@tanstack/react-query";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
import ComponentsComponent from "../componentsComponent";
|
import ComponentsComponent from "../componentsComponent";
|
||||||
import HeaderTabsSearchComponent from "./components/headerTabsSearchComponent";
|
import HeaderTabsSearchComponent from "./components/headerTabsSearchComponent";
|
||||||
|
|
@ -13,27 +15,52 @@ const MyCollectionComponent = ({ type }: MyCollectionComponentProps) => {
|
||||||
const { folderId } = useParams();
|
const { folderId } = useParams();
|
||||||
const myCollectionId = useFolderStore((state) => state.myCollectionId);
|
const myCollectionId = useFolderStore((state) => state.myCollectionId);
|
||||||
|
|
||||||
const { data, isFetching } = useGetFolderQuery(
|
const flows = useFlowsManagerStore((state) => state.flows);
|
||||||
|
|
||||||
|
const { data: folderData, isFetching } = useGetFolderQuery(
|
||||||
{
|
{
|
||||||
id: folderId ?? myCollectionId ?? "",
|
id: folderId ?? myCollectionId ?? "",
|
||||||
},
|
},
|
||||||
{ enabled: !!folderId || !!myCollectionId },
|
{ enabled: !!folderId || !!myCollectionId },
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
flows:
|
||||||
|
folderData?.flows.filter((flow) =>
|
||||||
|
flows?.find((f) => f.id === flow.id),
|
||||||
|
) ?? [],
|
||||||
|
name: folderData?.name ?? "",
|
||||||
|
description: folderData?.description ?? "",
|
||||||
|
parent_id: folderData?.parent_id ?? "",
|
||||||
|
components: folderData?.components ?? [],
|
||||||
|
};
|
||||||
|
|
||||||
const isLoadingFolders = !!useIsFetching({
|
const isLoadingFolders = !!useIsFetching({
|
||||||
queryKey: ["useGetFolders"],
|
queryKey: ["useGetFolders"],
|
||||||
exact: false,
|
exact: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { deleteFlow, isDeleting } = useDeleteFlow();
|
||||||
|
|
||||||
|
const isAddingFlow = !!useIsMutating({
|
||||||
|
mutationKey: ["usePostAddFlow"],
|
||||||
|
exact: true,
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<HeaderTabsSearchComponent loading={isFetching || isLoadingFolders} />
|
<HeaderTabsSearchComponent
|
||||||
|
loading={isFetching || isLoadingFolders || isDeleting || isAddingFlow}
|
||||||
|
/>
|
||||||
<div className="mt-5 flex h-full flex-col">
|
<div className="mt-5 flex h-full flex-col">
|
||||||
<ComponentsComponent
|
<ComponentsComponent
|
||||||
key={type}
|
key={type}
|
||||||
type={type}
|
type={type}
|
||||||
currentFolder={data}
|
currentFolder={data}
|
||||||
isLoading={isFetching || isLoadingFolders}
|
deleteFlow={deleteFlow}
|
||||||
|
isLoading={
|
||||||
|
isFetching || isLoadingFolders || isDeleting || isAddingFlow
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue