mirror of
https://github.com/hexastack/hexabot
synced 2025-02-23 04:48:51 +00:00
refactor(frontend): update visual editor categories pages
This commit is contained in:
parent
c68939945f
commit
51c3a88d01
@ -41,7 +41,7 @@ import { useQueryClient } from "react-query";
|
|||||||
|
|
||||||
import { DeleteDialog } from "@/app-components/dialogs";
|
import { DeleteDialog } from "@/app-components/dialogs";
|
||||||
import { MoveDialog } from "@/app-components/dialogs/MoveDialog";
|
import { MoveDialog } from "@/app-components/dialogs/MoveDialog";
|
||||||
import { CategoryDialog } from "@/components/categories/CategoryDialog";
|
import { CategoryFormDialog } from "@/components/categories/CategoryFormDialog";
|
||||||
import { isSameEntity } from "@/hooks/crud/helpers";
|
import { isSameEntity } from "@/hooks/crud/helpers";
|
||||||
import { useDeleteFromCache } from "@/hooks/crud/useDelete";
|
import { useDeleteFromCache } from "@/hooks/crud/useDelete";
|
||||||
import { useDeleteMany } from "@/hooks/crud/useDeleteMany";
|
import { useDeleteMany } from "@/hooks/crud/useDeleteMany";
|
||||||
@ -51,11 +51,11 @@ import { useUpdate, useUpdateCache } from "@/hooks/crud/useUpdate";
|
|||||||
import { useUpdateMany } from "@/hooks/crud/useUpdateMany";
|
import { useUpdateMany } from "@/hooks/crud/useUpdateMany";
|
||||||
import useDebouncedUpdate from "@/hooks/useDebouncedUpdate";
|
import useDebouncedUpdate from "@/hooks/useDebouncedUpdate";
|
||||||
import { getDisplayDialogs, useDialog } from "@/hooks/useDialog";
|
import { getDisplayDialogs, useDialog } from "@/hooks/useDialog";
|
||||||
|
import { useDialogs } from "@/hooks/useDialogs";
|
||||||
import { useSearch } from "@/hooks/useSearch";
|
import { useSearch } from "@/hooks/useSearch";
|
||||||
import { useTranslate } from "@/hooks/useTranslate";
|
import { useTranslate } from "@/hooks/useTranslate";
|
||||||
import { EntityType, Format, QueryType, RouterType } from "@/services/types";
|
import { EntityType, Format, QueryType, RouterType } from "@/services/types";
|
||||||
import { IBlock } from "@/types/block.types";
|
import { IBlock } from "@/types/block.types";
|
||||||
import { ICategory } from "@/types/category.types";
|
|
||||||
import { BlockPorts } from "@/types/visual-editor.types";
|
import { BlockPorts } from "@/types/visual-editor.types";
|
||||||
|
|
||||||
import BlockDialog from "../BlockDialog";
|
import BlockDialog from "../BlockDialog";
|
||||||
@ -74,9 +74,9 @@ const Diagrams = () => {
|
|||||||
const [engine, setEngine] = useState<DiagramEngine | undefined>();
|
const [engine, setEngine] = useState<DiagramEngine | undefined>();
|
||||||
const [canvas, setCanvas] = useState<JSX.Element | undefined>();
|
const [canvas, setCanvas] = useState<JSX.Element | undefined>();
|
||||||
const [selectedBlockId, setSelectedBlockId] = useState<string | undefined>();
|
const [selectedBlockId, setSelectedBlockId] = useState<string | undefined>();
|
||||||
|
const dialogs = useDialogs();
|
||||||
const deleteDialogCtl = useDialog<string[]>(false);
|
const deleteDialogCtl = useDialog<string[]>(false);
|
||||||
const moveDialogCtl = useDialog<string[] | string>(false);
|
const moveDialogCtl = useDialog<string[] | string>(false);
|
||||||
const addCategoryDialogCtl = useDialog<ICategory>(false);
|
|
||||||
const { mutateAsync: updateBlocks } = useUpdateMany(EntityType.BLOCK);
|
const { mutateAsync: updateBlocks } = useUpdateMany(EntityType.BLOCK);
|
||||||
const {
|
const {
|
||||||
buildDiagram,
|
buildDiagram,
|
||||||
@ -528,7 +528,6 @@ const Diagrams = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box sx={{ width: "100%" }}>
|
<Box sx={{ width: "100%" }}>
|
||||||
<CategoryDialog {...getDisplayDialogs(addCategoryDialogCtl)} />
|
|
||||||
<BlockDialog {...getDisplayDialogs(editDialogCtl)} />
|
<BlockDialog {...getDisplayDialogs(editDialogCtl)} />
|
||||||
<DeleteDialog<string[]> {...deleteDialogCtl} callback={onDelete} />
|
<DeleteDialog<string[]> {...deleteDialogCtl} callback={onDelete} />
|
||||||
<MoveDialog
|
<MoveDialog
|
||||||
@ -625,8 +624,8 @@ const Diagrams = () => {
|
|||||||
width: "42px",
|
width: "42px",
|
||||||
minWidth: "42px",
|
minWidth: "42px",
|
||||||
}}
|
}}
|
||||||
onClick={(e) => {
|
onClick={async (e) => {
|
||||||
addCategoryDialogCtl.openDialog();
|
await dialogs.open(CategoryFormDialog, null);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user