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(gallery): add pending item visibility
joshistoastc45226c83b46
diff --git a/invokeai/frontend/webv2/src/workbench/gallery/settings.ts b/invokeai/frontend/webv2/src/workbench/gallery/settings.tsindex c09613df29..71ed1a7ef1 100644--- a/invokeai/frontend/webv2/src/workbench/gallery/settings.ts+++ b/invokeai/frontend/webv2/src/workbench/gallery/settings.ts@@ -17,6 +17,7 @@ export interface GallerySettings {showArchivedBoards: boolean;showDateBoards: boolean;showImageDimensions: boolean;+ showPendingItems: boolean;starredFirst: boolean;thumbnailFit: GalleryThumbnailFit;}@@ -30,6 +31,7 @@ export const DEFAULT_GALLERY_SETTINGS: GallerySettings = {showArchivedBoards: false,showDateBoards: false,showImageDimensions: false,+ showPendingItems: true,starredFirst: true,thumbnailFit: 'square',};@@ -58,6 +60,8 @@ export const getGallerySettings = (values: Record<string, unknown>): GallerySetttypeof values.showImageDimensions === 'boolean'? values.showImageDimensions: DEFAULT_GALLERY_SETTINGS.showImageDimensions,+ showPendingItems:+ typeof values.showPendingItems === 'boolean' ? values.showPendingItems : DEFAULT_GALLERY_SETTINGS.showPendingItems,starredFirst: typeof values.starredFirst === 'boolean' ? values.starredFirst : DEFAULT_GALLERY_SETTINGS.starredFirst,thumbnailFit: values.thumbnailFit === 'aspect' ? 'aspect' : DEFAULT_GALLERY_SETTINGS.thumbnailFit,});diff --git a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryImageGrid.tsx b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryImageGrid.tsxindex 96493e0157..42408b62ab 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryImageGrid.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryImageGrid.tsx@@ -446,6 +446,7 @@ export const GalleryImageGrid = ({ layout }: { layout: 'stacked' | 'wide' }) =>role="listbox"tabIndex={0}w="full"+ outline="none"><ScrollArea.Content><Box h={`${virtualizer.totalSize}px`} position="relative" w="full">diff --git a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryToolbar.tsx b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryToolbar.tsxindex f5993c2db8..a53a603d57 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryToolbar.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryToolbar.tsx@@ -180,8 +180,15 @@ const GalleryUploadButton = () => {const GallerySettingsMenu = () => {const { t } = useTranslation();const { actions, gallery } = useGalleryWidget();- const { imageDensityPercent, imageOrderDir, paginationMode, showImageDimensions, starredFirst, thumbnailFit } =- gallery.settings;+ const {+ imageDensityPercent,+ imageOrderDir,+ paginationMode,+ showImageDimensions,+ showPendingItems,+ starredFirst,+ thumbnailFit,+ } = gallery.settings;const handleDensityKeyDown = useCallback((event: React.KeyboardEvent) => event.stopPropagation(), []);const handleDensityChange = useCallback((event: { value: number[] }) =>@@ -194,6 +201,10 @@ const GallerySettingsMenu = () => {(showImageDimensions: boolean) => actions.updateSettings({ showImageDimensions }),[actions]);+ const handleShowPendingItemsChange = useCallback(+ (showPendingItems: boolean) => actions.updateSettings({ showPendingItems }),+ [actions]+ );const handleNewestFirst = useCallback(() => actions.updateSettings({ imageOrderDir: 'DESC' }), [actions]);const handleOldestFirst = useCallback(() => actions.updateSettings({ imageOrderDir: 'ASC' }), [actions]);const handleStarredFirstChange = useCallback(@@ -268,6 +279,11 @@ const GallerySettingsMenu = () => {label={t('widgets.gallery.alwaysShowDimensions')}onChange={handleShowDimensionsChange}/>+ <SettingSwitch+ checked={showPendingItems}+ label={t('widgets.gallery.showPendingItems')}+ onChange={handleShowPendingItemsChange}+ /></Stack><Stack gap="2"><SettingLabel>{t('widgets.gallery.imageSort')}</SettingLabel>diff --git a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryWidgetView.tsx b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryWidgetView.tsxindex e60ae0af49..033e2e09bd 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryWidgetView.tsx+++ b/invokeai/frontend/webv2/src/workbench/widgets/gallery/GalleryWidgetView.tsx@@ -59,6 +59,7 @@ const areGallerySettingsEqual = (left: GallerySettings, right: GallerySettings):left.showArchivedBoards === right.showArchivedBoards &&left.showDateBoards === right.showDateBoards &&left.showImageDimensions === right.showImageDimensions &&+ left.showPendingItems === right.showPendingItems &&left.starredFirst === right.starredFirst &&left.thumbnailFit === right.thumbnailFit;diff --git a/invokeai/frontend/webv2/src/workbench/widgets/gallery/galleryStateView.test.ts b/invokeai/frontend/webv2/src/workbench/widgets/gallery/galleryStateView.test.tsindex c5f6c74fee..58affc1240 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/gallery/galleryStateView.test.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/gallery/galleryStateView.test.ts@@ -98,6 +98,7 @@ describe('gallery state view', () => {showArchivedBoards: false,showDateBoards: false,showImageDimensions: false,+ showPendingItems: true,starredFirst: false,thumbnailFit: 'square',});@@ -216,4 +217,25 @@ describe('gallery state view', () => {getGalleryStateView({ selectedBoardId: 'none' }, boards, [], false, queueItems).pendingPlaceholders).toHaveLength(1);});++ it('hides only pending placeholders when the persisted setting is disabled', () => {+ const queueItems = [createQueueItem({ boardId: 'none', status: 'pending' })];+ const image = {+ ...createImage('completed.png'),+ boardId: 'none',+ imageCategory: 'general',+ starred: false,+ } as const;+ const gallery = getGalleryStateView(+ { selectedBoardId: 'none', showPendingItems: false },+ boards,+ [image],+ false,+ queueItems+ );++ expect(gallery.pendingPlaceholders).toEqual([]);+ expect(gallery.images).toEqual([image]);+ expect(gallery.settings.showPendingItems).toBe(false);+ });});diff --git a/invokeai/frontend/webv2/src/workbench/widgets/gallery/galleryStateView.ts b/invokeai/frontend/webv2/src/workbench/widgets/gallery/galleryStateView.tsindex f5bdb63ac6..c175cd90e8 100644--- a/invokeai/frontend/webv2/src/workbench/widgets/gallery/galleryStateView.ts+++ b/invokeai/frontend/webv2/src/workbench/widgets/gallery/galleryStateView.ts@@ -209,7 +209,9 @@ export const getGalleryStateView = (galleryView,images,isLoading,- pendingPlaceholders: getGalleryQueuePlaceholders(queueItems, { galleryView, searchTerm, selectedBoardId }),+ pendingPlaceholders: settings.showPendingItems+ ? getGalleryQueuePlaceholders(queueItems, { galleryView, searchTerm, selectedBoardId })+ : [],projectBoardId: getGalleryProjectBoardId(values),searchTerm,selectedBoardId,