mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
tidy(ui): remove the ToastID enum
With the model install logic cleaned up the enum is less useful
This commit is contained in:
parent
f2b9684de8
commit
3b381b5a8c
@ -14,7 +14,7 @@ import {
|
||||
} from 'features/controlLayers/store/controlLayersSlice';
|
||||
import { CA_PROCESSOR_DATA } from 'features/controlLayers/util/controlAdapters';
|
||||
import { isImageOutput } from 'features/nodes/types/common';
|
||||
import { toast, ToastID } from 'features/toast/toast';
|
||||
import { toast } from 'features/toast/toast';
|
||||
import { t } from 'i18next';
|
||||
import { isEqual } from 'lodash-es';
|
||||
import { getImageDTO } from 'services/api/endpoints/images';
|
||||
@ -175,7 +175,7 @@ export const addControlAdapterPreprocessor = (startAppListening: AppStartListeni
|
||||
}
|
||||
|
||||
toast({
|
||||
id: ToastID.GRAPH_QUEUE_FAILED,
|
||||
id: 'GRAPH_QUEUE_FAILED',
|
||||
title: t('queue.graphFailedToQueue'),
|
||||
status: 'error',
|
||||
});
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
} from 'features/controlAdapters/store/controlAdaptersSlice';
|
||||
import { isControlNetOrT2IAdapter } from 'features/controlAdapters/store/types';
|
||||
import { isImageOutput } from 'features/nodes/types/common';
|
||||
import { toast, ToastID } from 'features/toast/toast';
|
||||
import { toast } from 'features/toast/toast';
|
||||
import { t } from 'i18next';
|
||||
import { imagesApi } from 'services/api/endpoints/images';
|
||||
import { queueApi } from 'services/api/endpoints/queue';
|
||||
@ -109,7 +109,7 @@ export const addControlNetImageProcessedListener = (startAppListening: AppStartL
|
||||
}
|
||||
|
||||
toast({
|
||||
id: ToastID.GRAPH_QUEUE_FAILED,
|
||||
id: 'GRAPH_QUEUE_FAILED',
|
||||
title: t('queue.graphFailedToQueue'),
|
||||
status: 'error',
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ import {
|
||||
isParameterWidth,
|
||||
zParameterVAEModel,
|
||||
} from 'features/parameters/types/parameterSchemas';
|
||||
import { toast, ToastID } from 'features/toast/toast';
|
||||
import { toast } from 'features/toast/toast';
|
||||
import { t } from 'i18next';
|
||||
import { modelConfigsAdapterSelectors, modelsApi } from 'services/api/endpoints/models';
|
||||
import { isNonRefinerMainModelConfig } from 'services/api/types';
|
||||
@ -108,7 +108,7 @@ export const addSetDefaultSettingsListener = (startAppListening: AppStartListeni
|
||||
}
|
||||
}
|
||||
|
||||
toast({ id: ToastID.PARAMETER_SET, title: t('toast.parameterSet', { parameter: 'Default settings' }) });
|
||||
toast({ id: 'PARAMETER_SET', title: t('toast.parameterSet', { parameter: 'Default settings' }) });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -4,7 +4,7 @@ import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'
|
||||
import { parseify } from 'common/util/serialize';
|
||||
import { buildAdHocUpscaleGraph } from 'features/nodes/util/graph/buildAdHocUpscaleGraph';
|
||||
import { createIsAllowedToUpscaleSelector } from 'features/parameters/hooks/useIsAllowedToUpscale';
|
||||
import { toast, ToastID } from 'features/toast/toast';
|
||||
import { toast } from 'features/toast/toast';
|
||||
import { t } from 'i18next';
|
||||
import { queueApi } from 'services/api/endpoints/queue';
|
||||
import type { BatchConfig, ImageDTO } from 'services/api/types';
|
||||
@ -65,7 +65,7 @@ export const addUpscaleRequestedListener = (startAppListening: AppStartListening
|
||||
return;
|
||||
} else {
|
||||
toast({
|
||||
id: ToastID.GRAPH_QUEUE_FAILED,
|
||||
id: 'GRAPH_QUEUE_FAILED',
|
||||
title: t('queue.graphFailedToQueue'),
|
||||
status: 'error',
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ import type {
|
||||
import { fetchModelConfig } from 'features/metadata/util/modelFetchingHelpers';
|
||||
import { validators } from 'features/metadata/util/validators';
|
||||
import type { ModelIdentifierField } from 'features/nodes/types/common';
|
||||
import { toast, ToastID } from 'features/toast/toast';
|
||||
import { toast } from 'features/toast/toast';
|
||||
import { t } from 'i18next';
|
||||
import { assert } from 'tsafe';
|
||||
|
||||
@ -91,7 +91,7 @@ const renderLayersValue: MetadataRenderValueFunc<Layer[]> = async (layers) => {
|
||||
|
||||
const parameterSetToast = (parameter: string) => {
|
||||
toast({
|
||||
id: ToastID.PARAMETER_SET,
|
||||
id: 'PARAMETER_SET',
|
||||
title: t('toast.parameterSet'),
|
||||
description: t('toast.parameterSetDesc', { parameter }),
|
||||
status: 'info',
|
||||
@ -461,13 +461,13 @@ export const parseAndRecallAllMetadata = async (
|
||||
|
||||
if (results.some((result) => result.status === 'fulfilled')) {
|
||||
toast({
|
||||
id: ToastID.PARAMETER_SET,
|
||||
id: 'PARAMETER_SET',
|
||||
title: t('toast.parametersSet'),
|
||||
status: 'info',
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
id: ToastID.PARAMETER_SET,
|
||||
id: 'PARAMETER_SET',
|
||||
title: t('toast.parametersNotSet'),
|
||||
status: 'warning',
|
||||
});
|
||||
|
@ -1,7 +1,6 @@
|
||||
import type { UseToastOptions } from '@invoke-ai/ui-library';
|
||||
import { createStandaloneToast, theme, TOAST_OPTIONS } from '@invoke-ai/ui-library';
|
||||
import { map } from 'nanostores';
|
||||
import { z } from 'zod';
|
||||
|
||||
const toastApi = createStandaloneToast({
|
||||
theme: theme,
|
||||
@ -99,14 +98,3 @@ const parseConfig = (id: string, arg: ToastArg, count: number): ToastConfig => {
|
||||
};
|
||||
return { ...arg, title, onCloseComplete };
|
||||
};
|
||||
|
||||
/**
|
||||
* Enum of toast IDs that are often shared between multiple components (typo insurance)
|
||||
*/
|
||||
export const ToastID = z.enum([
|
||||
'MODEL_INSTALL_QUEUED',
|
||||
'MODEL_INSTALL_QUEUE_FAILED',
|
||||
'GRAPH_QUEUE_FAILED',
|
||||
'PARAMETER_SET',
|
||||
'PARAMETER_NOT_SET',
|
||||
]).enum;
|
||||
|
Loading…
Reference in New Issue
Block a user