Skip to content

Commit

Permalink
add AppFeature for retryQueueItem in case we want to easily disable
Browse files Browse the repository at this point in the history
  • Loading branch information
Mary Hipp authored and psychedelicious committed Feb 17, 2025
1 parent 7ee636b commit ca50f81
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion invokeai/frontend/web/src/app/types/invokeai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export type AppFeature =
| 'modelCache'
| 'bulkDownload'
| 'starterModels'
| 'hfToken';
| 'hfToken'
| 'retryQueueItem';
/**
* A disable-able Stable Diffusion feature
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useOriginText } from 'features/queue/components/QueueList/useOriginText
import { useCancelQueueItem } from 'features/queue/hooks/useCancelQueueItem';
import { useRetryQueueItem } from 'features/queue/hooks/useRetryQueueItem';
import { getSecondsFromTimestamps } from 'features/queue/util/getSecondsFromTimestamps';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
import type { MouseEvent } from 'react';
import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
Expand All @@ -31,6 +32,7 @@ const sx: ChakraProps['sx'] = {

const QueueItemComponent = ({ index, item, context }: InnerItemProps) => {
const { t } = useTranslation();
const isRetryEnabled = useFeatureStatus('retryQueueItem');
const handleToggle = useCallback(() => {
context.toggleQueueItem(item.item_id);
}, [context, item.item_id]);
Expand Down Expand Up @@ -118,7 +120,7 @@ const QueueItemComponent = ({ index, item, context }: InnerItemProps) => {
</Flex>
<Flex alignItems="center" w={COLUMN_WIDTHS.actions} pe={3}>
<ButtonGroup size="xs" variant="ghost">
{!isFailed && (
{(!isFailed || !isRetryEnabled) && (
<IconButton
onClick={handleCancelQueueItem}
isDisabled={isCanceled}
Expand All @@ -127,7 +129,7 @@ const QueueItemComponent = ({ index, item, context }: InnerItemProps) => {
icon={<PiXBold />}
/>
)}
{isFailed && (
{isFailed && isRetryEnabled && (
<IconButton
onClick={handleRetryQueueItem}
isLoading={isLoadingRetryQueueItem}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useCancelBatch } from 'features/queue/hooks/useCancelBatch';
import { useCancelQueueItem } from 'features/queue/hooks/useCancelQueueItem';
import { useRetryQueueItem } from 'features/queue/hooks/useRetryQueueItem';
import { getSecondsFromTimestamps } from 'features/queue/util/getSecondsFromTimestamps';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
import { get } from 'lodash-es';
import type { ReactNode } from 'react';
import { memo, useMemo } from 'react';
Expand All @@ -21,6 +22,7 @@ type Props = {
const QueueItemComponent = ({ queueItemDTO }: Props) => {
const { session_id, batch_id, item_id, origin, destination } = queueItemDTO;
const { t } = useTranslation();
const isRetryEnabled = useFeatureStatus('retryQueueItem');
const { cancelBatch, isLoading: isLoadingCancelBatch, isCanceled: isBatchCanceled } = useCancelBatch(batch_id);

const { cancelQueueItem, isLoading: isLoadingCancelQueueItem } = useCancelQueueItem(item_id);
Expand Down Expand Up @@ -70,7 +72,7 @@ const QueueItemComponent = ({ queueItemDTO }: Props) => {
<QueueItemData label={t('queue.batch')} data={batch_id} />
<QueueItemData label={t('queue.session')} data={session_id} />
<ButtonGroup size="xs" orientation="vertical">
{!isFailed && (
{(!isFailed || !isRetryEnabled) && (
<Button
onClick={cancelQueueItem}
isLoading={isLoadingCancelQueueItem}
Expand All @@ -82,7 +84,7 @@ const QueueItemComponent = ({ queueItemDTO }: Props) => {
{t('queue.cancelItem')}
</Button>
)}
{isFailed && (
{isFailed && isRetryEnabled && (
<Button
onClick={retryQueueItem}
isLoading={isLoadingRetryQueueItem}
Expand Down

0 comments on commit ca50f81

Please sign in to comment.