From bcede2fc71bf6eb4cac9421519e3ea14bd54facb Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Sun, 7 Apr 2024 23:48:28 +0800 Subject: [PATCH 1/2] compact list --- ui/src/RecentFilesDrawer/MoreActionMenu.tsx | 10 ++++- ui/src/RecentFilesDrawer/WorkflowListItem.tsx | 38 +++++++++++-------- .../WorkflowListItemActionButtons.tsx | 14 +------ ui/src/components/DeleteConfirm.tsx | 2 +- ui/src/utils.tsx | 3 +- 5 files changed, 35 insertions(+), 32 deletions(-) diff --git a/ui/src/RecentFilesDrawer/MoreActionMenu.tsx b/ui/src/RecentFilesDrawer/MoreActionMenu.tsx index d8c8e01..c9f4e74 100644 --- a/ui/src/RecentFilesDrawer/MoreActionMenu.tsx +++ b/ui/src/RecentFilesDrawer/MoreActionMenu.tsx @@ -11,6 +11,7 @@ import { import { IconCopy, IconDotsVertical, + IconExternalLink, IconLock, IconLockOpen, IconUpload, @@ -19,6 +20,7 @@ import AddTagToWorkflowPopover from "./AddTagToWorkflowPopover"; import { Workflow } from "../types/dbTypes"; import { mediaTable, workflowsTable } from "../db-tables/WorkspaceDB"; import { WorkspaceContext } from "../WorkspaceContext"; +import { openWorkflowInNewTab } from "../utils"; type Props = { workflow: Workflow; @@ -71,7 +73,7 @@ export default function MoreActionMenu({ workflow }: Props) { return ( <> - + Duplicate + } + onClick={() => openWorkflowInNewTab(workflow.id)} + > + Open in new tab + {/* */} setDraggingFile?.(workflow)} borderRadius={6} px={1} - py={"3px"} + py={"5px"} onClick={() => { !isMultiSelecting && loadWorkflowID(workflow.id); }} @@ -53,7 +52,7 @@ export default memo(function WorkflowListItem({ workflow }: Props) { bg: hoverBgColor, }} > - + {!userSettingsTable?.settings?.hideCoverImage && (workflow.coverMediaPath?.length || workflow.latestImage?.length) && ( )} - + - + {workflow.name ?? "untitled"} {workflow.saveLock && ( )} - - - Updated: {formatTimestamp(workflow.updateTime)} - - + ); @@ -91,9 +87,11 @@ export default memo(function WorkflowListItem({ workflow }: Props) { return ( setIsHovering(true)} + onMouseLeave={() => setIsHovering(false)} > {isMultiSelecting ? ( {basicInfoComp} - {isHovering && } +
+ {isHovering ? ( + + ) : ( + + {formatTimestamp(workflow.updateTime, false, false, "/")} + + )} +
)}
diff --git a/ui/src/RecentFilesDrawer/WorkflowListItemActionButtons.tsx b/ui/src/RecentFilesDrawer/WorkflowListItemActionButtons.tsx index 86b093e..8d932d6 100644 --- a/ui/src/RecentFilesDrawer/WorkflowListItemActionButtons.tsx +++ b/ui/src/RecentFilesDrawer/WorkflowListItemActionButtons.tsx @@ -1,8 +1,6 @@ import { Flex, IconButton, Tooltip } from "@chakra-ui/react"; -import { IconExternalLink } from "@tabler/icons-react"; import DeleteConfirm from "../components/DeleteConfirm"; import MoreActionMenu from "./MoreActionMenu"; -import { openWorkflowInNewTab } from "../utils"; import { useContext } from "react"; import { RecentFilesContext } from "../WorkspaceContext"; import { Workflow } from "../types/dbTypes"; @@ -14,17 +12,7 @@ export default function WorkflowListItemActionButtons({ }) { const { onDeleteFlow } = useContext(RecentFilesContext); return ( - - - openWorkflowInNewTab(workflow.id)} - icon={} - /> - - + { diff --git a/ui/src/components/DeleteConfirm.tsx b/ui/src/components/DeleteConfirm.tsx index b5c1948..4efc008 100644 --- a/ui/src/components/DeleteConfirm.tsx +++ b/ui/src/components/DeleteConfirm.tsx @@ -40,7 +40,7 @@ export default function DeleteConfirm(props: Props) { } + icon={} isDisabled={isDisabled} variant={variant} /> diff --git a/ui/src/utils.tsx b/ui/src/utils.tsx index b3fe6ab..1a58475 100644 --- a/ui/src/utils.tsx +++ b/ui/src/utils.tsx @@ -103,6 +103,7 @@ export function formatTimestamp( unixTimestamp: number, showHourMinue: boolean = true, showSec: boolean = false, + splitChar: string = "-", ) { // Create a new Date object from the UNIX timestamp const date = new Date(unixTimestamp); @@ -115,7 +116,7 @@ export function formatTimestamp( const minutes = String(date.getMinutes()).padStart(2, "0"); const seconds = String(date.getSeconds()).padStart(2, "0"); // Format the date and time string - const res = `${month}-${day}-${year}`; + const res = `${month}${splitChar}${day}${splitChar}${year}`; if (showHourMinue) { return res + ` ${hours}:${minutes}`; } From b38c8ffbf8bfc1a6ddb88e00b587dff0ef3de830 Mon Sep 17 00:00:00 2001 From: Weixuan Fu Date: Mon, 8 Apr 2024 03:15:57 +0800 Subject: [PATCH 2/2] use async thread for dedup so it wont block main --- service/file_sync_service.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/file_sync_service.py b/service/file_sync_service.py index 805b763..e671df4 100644 --- a/service/file_sync_service.py +++ b/service/file_sync_service.py @@ -176,7 +176,7 @@ def dedupe_workflow_ids(): @server.PromptServer.instance.routes.get('/workspace/deduplicate_workflow_ids') async def deduplicate_workflow_ids(request): - dedupe_workflow_ids() + await asyncio.to_thread(dedupe_workflow_ids) return web.json_response(text="success", content_type='application/json') @server.PromptServer.instance.routes.post('/workspace/get_workflow_file')