mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): disable invoke button during publish operation
This commit is contained in:
@@ -1805,7 +1805,8 @@
|
||||
"publishFailed": "Publish failed",
|
||||
"publishFailedDesc": "There was a problem publishing the workflow. Please try again.",
|
||||
"publishSuccess": "Workflow publish started",
|
||||
"publishSuccessDesc": "Your workflow is being published. Check your Project Dashboard to see its progress."
|
||||
"publishSuccessDesc": "Your workflow is being published. Check your Project Dashboard to see its progress.",
|
||||
"publishInProgress": "Publishing in Progress"
|
||||
}
|
||||
},
|
||||
"controlLayers": {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { selectSendToCanvas } from 'features/controlLayers/store/canvasSettingsS
|
||||
import { selectIterations } from 'features/controlLayers/store/paramsSlice';
|
||||
import { selectDynamicPromptsIsLoading } from 'features/dynamicPrompts/store/dynamicPromptsSlice';
|
||||
import { selectAutoAddBoardId } from 'features/gallery/store/gallerySelectors';
|
||||
import { $isInPublishFlow } from 'features/nodes/components/sidePanel/workflow/publish';
|
||||
import { selectNodesSlice } from 'features/nodes/store/selectors';
|
||||
import type { NodesState } from 'features/nodes/store/types';
|
||||
import type { BatchSizeResult } from 'features/nodes/util/node/resolveBatchValue';
|
||||
@@ -175,6 +176,7 @@ const IsReadyText = memo(({ isReady, prepend }: { isReady: boolean; prepend: boo
|
||||
const { t } = useTranslation();
|
||||
const isLoadingDynamicPrompts = useAppSelector(selectDynamicPromptsIsLoading);
|
||||
const [_, enqueueMutation] = useEnqueueBatchMutation(enqueueMutationFixedCacheKeyOptions);
|
||||
const isInPublishFlow = useStore($isInPublishFlow);
|
||||
|
||||
const text = useMemo(() => {
|
||||
if (enqueueMutation.isLoading) {
|
||||
@@ -183,6 +185,9 @@ const IsReadyText = memo(({ isReady, prepend }: { isReady: boolean; prepend: boo
|
||||
if (isLoadingDynamicPrompts) {
|
||||
return t('dynamicPrompts.loading');
|
||||
}
|
||||
if (isInPublishFlow) {
|
||||
return t('workflows.builder.publishInProgress');
|
||||
}
|
||||
if (isReady) {
|
||||
if (prepend) {
|
||||
return t('queue.queueFront');
|
||||
@@ -190,7 +195,7 @@ const IsReadyText = memo(({ isReady, prepend }: { isReady: boolean; prepend: boo
|
||||
return t('queue.queueBack');
|
||||
}
|
||||
return t('queue.notReady');
|
||||
}, [enqueueMutation.isLoading, isLoadingDynamicPrompts, isReady, prepend, t]);
|
||||
}, [enqueueMutation.isLoading, isLoadingDynamicPrompts, isInPublishFlow, isReady, prepend, t]);
|
||||
|
||||
return <Text fontWeight="semibold">{text}</Text>;
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@ import { enqueueRequestedUpscaling } from 'app/store/middleware/listenerMiddlewa
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { withResultAsync } from 'common/util/result';
|
||||
import { parseify } from 'common/util/serialize';
|
||||
import { $isInPublishFlow } from 'features/nodes/components/sidePanel/workflow/publish';
|
||||
import { useEnqueueWorkflows } from 'features/queue/hooks/useEnqueueWorkflows';
|
||||
import { $isReadyToEnqueue } from 'features/queue/store/readiness';
|
||||
import { selectActiveTab } from 'features/ui/store/uiSelectors';
|
||||
@@ -18,6 +19,7 @@ export const useInvoke = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const tabName = useAppSelector(selectActiveTab);
|
||||
const isReady = useStore($isReadyToEnqueue);
|
||||
const isInPublishFlow = useStore($isInPublishFlow);
|
||||
const enqueueWorkflows = useEnqueueWorkflows();
|
||||
|
||||
const [_, { isLoading }] = useEnqueueBatchMutation(enqueueMutationFixedCacheKeyOptions);
|
||||
@@ -60,5 +62,5 @@ export const useInvoke = () => {
|
||||
enqueue(true, false);
|
||||
}, [enqueue]);
|
||||
|
||||
return { enqueueBack, enqueueFront, isLoading, isDisabled: !isReady, enqueue };
|
||||
return { enqueueBack, enqueueFront, isLoading, isDisabled: !isReady || isInPublishFlow, enqueue };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user