Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
feat(ui): nodes library maintenance menu
joshistoastef3534d7a65b
diff --git a/invokeai/frontend/webv2/public/locales/en.json b/invokeai/frontend/webv2/public/locales/en.jsonindex f8a13b3b6c..34d1dde99f 100644--- a/invokeai/frontend/webv2/public/locales/en.json+++ b/invokeai/frontend/webv2/public/locales/en.json@@ -1167,8 +1167,10 @@"addCustomNodes": "Add custom nodes","addNodes": "Add Nodes","alreadyInstalledError": "'{{name}}' is already installed. Uninstall it first to reinstall.",+ "copyPath": "Copy path","couldNotReloadCustomNodes": "Could not reload custom nodes.","couldNotLoadPacks": "Could not load custom node packs",+ "libraryMaintenance": "Node pack maintenance","customNodesReloaded": "Custom nodes reloaded","dependenciesRequired": "Dependencies required","dependenciesRequiredDescription": "{{name}} requires dependencies from {{dependencyFile}}. Install them, then restart InvokeAI.",@@ -1210,6 +1212,9 @@"output": "Output","recentActivitySummary_one": "{{count}} recent activity","recentActivitySummary_other": "{{count}} recent activities",+ "pathCopied": "Path copied",+ "refreshFailed": "Refresh failed",+ "refreshList": "Refresh pack list","reloadFailed": "Reload failed","reloadNotice": "Custom nodes reload","reloading": "Reloading",diff --git a/invokeai/frontend/webv2/src/features/nodes/ui/manager/LibraryColumn.tsx b/invokeai/frontend/webv2/src/features/nodes/ui/manager/LibraryColumn.tsxindex dd4fe5d280..94e80a41f2 100644--- a/invokeai/frontend/webv2/src/features/nodes/ui/manager/LibraryColumn.tsx+++ b/invokeai/frontend/webv2/src/features/nodes/ui/manager/LibraryColumn.tsx@@ -1,11 +1,12 @@/* eslint-disable react-perf/jsx-no-jsx-as-prop, react-perf/jsx-no-new-array-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-object-as-prop */-import { Box, Flex, HStack, Text } from '@chakra-ui/react';+import { Flex, HStack, Text } from '@chakra-ui/react';import { useCustomNodesSelector } from '@features/nodes/data/nodesStore';import { NodePackList } from '@features/nodes/ui/library/NodePackList';import { openNodePackDetail, updateNodesUi, useNodesUiSelector } from '@features/nodes/ui/nodesUiStore';import { useTranslation } from 'react-i18next';import { HEADER_MIN_HEIGHT, PACK_LIBRARY_WIDTH } from './layoutConstants';+import { NodesMaintenanceMenu } from './NodesMaintenanceMenu';import { ReloadNodesButton } from './ReloadNodesButton';/** Persistent custom-node pack list, matching the model manager's library column. */@@ -34,9 +35,10 @@ export const LibraryColumn = () => {<Text color="fg.muted" fontSize="xs">{nodePacks.length}</Text>- <Box ms="auto">+ <HStack gap="0.5" ms="auto"><ReloadNodesButton />- </Box>+ <NodesMaintenanceMenu />+ </HStack></HStack><NodePackListdiff --git a/invokeai/frontend/webv2/src/features/nodes/ui/manager/NodesMaintenanceMenu.tsx b/invokeai/frontend/webv2/src/features/nodes/ui/manager/NodesMaintenanceMenu.tsxnew file mode 100644index 0000000000..c8c86c3baa--- /dev/null+++ b/invokeai/frontend/webv2/src/features/nodes/ui/manager/NodesMaintenanceMenu.tsx@@ -0,0 +1,81 @@+/* eslint-disable react-perf/jsx-no-jsx-as-prop, react-perf/jsx-no-new-function-as-prop, react-perf/jsx-no-new-object-as-prop */+import { Icon, Menu, Portal } from '@chakra-ui/react';+import {+ getCustomNodesSnapshot,+ refreshCustomNodePacks,+ useCustomNodesSelector,+} from '@features/nodes/data/nodesStore';+import { useNotify } from '@features/nodes/ui/useNodesNotify';+import { useScopedAction } from '@platform/react/useScopedAction';+import { assertAccountScopeCurrent } from '@platform/state/accountLifecycle';+import { IconButton } from '@platform/ui/Button';+import { MenuContent } from '@platform/ui/Menu';+import { ClipboardCopyIcon, MoreHorizontalIcon, RefreshCcwIcon } from 'lucide-react';+import { useTranslation } from 'react-i18next';++/**+ * Library maintenance beside the reload button: explicit list refresh (which+ * surfaces failures the store records silently while packs are loaded) and+ * copying the custom-nodes path.+ */+export const NodesMaintenanceMenu = () => {+ const { t } = useTranslation();+ const notify = useNotify();+ const customNodesPath = useCustomNodesSelector((snapshot) => snapshot.customNodesPath);+ const { run } = useScopedAction();++ const handleRefresh = () =>+ run(+ async (owner) => {+ await refreshCustomNodePacks(owner);++ assertAccountScopeCurrent(owner);+ // The store records refresh failures without dropping loaded packs+ // (the list keeps rendering); an explicit user refresh still+ // deserves a failure toast.+ const { error } = getCustomNodesSnapshot();++ if (error !== null) {+ throw new Error(error);+ }+ },+ (message) => notify.error(t('nodes.refreshFailed'), message)+ );++ const handleCopyPath = async () => {+ if (customNodesPath === null) {+ return;+ }++ try {+ await navigator.clipboard.writeText(customNodesPath);+ notify.success(t('nodes.pathCopied'));+ } catch {+ notify.error(t('common.couldNotCopy'));+ }+ };++ return (+ <Menu.Root positioning={{ placement: 'bottom-end' }}>+ <Menu.Trigger asChild>+ <IconButton aria-label={t('nodes.libraryMaintenance')} size="2xs" variant="ghost">+ <Icon as={MoreHorizontalIcon} boxSize="4" />+ </IconButton>+ </Menu.Trigger>+ <Portal>+ <Menu.Positioner>+ <MenuContent minW="14rem">+ <Menu.Item value="refresh" onClick={() => void handleRefresh()}>+ <Icon as={RefreshCcwIcon} boxSize="3.5" />+ <Menu.ItemText fontSize="xs">{t('nodes.refreshList')}</Menu.ItemText>+ </Menu.Item>+ <Menu.Item disabled={customNodesPath === null} value="copy-path" onClick={() => void handleCopyPath()}>+ <Icon as={ClipboardCopyIcon} boxSize="3.5" />+ <Menu.ItemText fontSize="xs">{t('nodes.copyPath')}</Menu.ItemText>+ </Menu.Item>+ </MenuContent>+ </Menu.Positioner>+ </Portal>+ </Menu.Root>+ );+};