mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
updated model manager to display when import item is cancelled
This commit is contained in:
committed by
psychedelicious
parent
54f1a1f952
commit
2a648da557
@ -2,6 +2,7 @@ import type { AppStartListening } from 'app/store/middleware/listenerMiddleware'
|
||||
import { api } from 'services/api';
|
||||
import { modelsApi } from 'services/api/endpoints/models';
|
||||
import {
|
||||
socketModelInstallCancelled,
|
||||
socketModelInstallCompleted,
|
||||
socketModelInstallDownloading,
|
||||
socketModelInstallError,
|
||||
@ -63,4 +64,21 @@ export const addModelInstallEventListener = (startAppListening: AppStartListenin
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
startAppListening({
|
||||
actionCreator: socketModelInstallCancelled,
|
||||
effect: (action, { dispatch }) => {
|
||||
const { id } = action.payload.data;
|
||||
|
||||
dispatch(
|
||||
modelsApi.util.updateQueryData('listModelInstalls', undefined, (draft) => {
|
||||
const modelImport = draft.find((m) => m.id === id);
|
||||
if (modelImport) {
|
||||
modelImport.status = 'cancelled';
|
||||
}
|
||||
return draft;
|
||||
})
|
||||
);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -9,6 +9,7 @@ import type {
|
||||
InvocationErrorEvent,
|
||||
InvocationRetrievalErrorEvent,
|
||||
InvocationStartedEvent,
|
||||
ModelInstallCancelledEvent,
|
||||
ModelInstallCompletedEvent,
|
||||
ModelInstallDownloadingEvent,
|
||||
ModelInstallErrorEvent,
|
||||
@ -71,6 +72,10 @@ export const socketModelInstallError = createAction<{
|
||||
data: ModelInstallErrorEvent;
|
||||
}>('socket/socketModelInstallError');
|
||||
|
||||
export const socketModelInstallCancelled = createAction<{
|
||||
data: ModelInstallCancelledEvent;
|
||||
}>('socket/socketModelInstallCancelled');
|
||||
|
||||
export const socketSessionRetrievalError = createAction<{
|
||||
data: SessionRetrievalErrorEvent;
|
||||
}>('socket/socketSessionRetrievalError');
|
||||
|
@ -69,6 +69,12 @@ export type ModelInstallErrorEvent = {
|
||||
id: number;
|
||||
};
|
||||
|
||||
export type ModelInstallCancelledEvent = {
|
||||
source: string;
|
||||
timestamp: number;
|
||||
id: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* A `generator_progress` socket.io event.
|
||||
*
|
||||
@ -264,6 +270,7 @@ export type ServerToClientEvents = {
|
||||
model_install_downloading: (payload: ModelInstallDownloadingEvent) => void;
|
||||
model_install_completed: (payload: ModelInstallCompletedEvent) => void;
|
||||
model_install_error: (payload: ModelInstallErrorEvent) => void;
|
||||
model_install_canceled: (payload: ModelInstallCancelledEvent) => void;
|
||||
session_retrieval_error: (payload: SessionRetrievalErrorEvent) => void;
|
||||
invocation_retrieval_error: (payload: InvocationRetrievalErrorEvent) => void;
|
||||
queue_item_status_changed: (payload: QueueItemStatusChangedEvent) => void;
|
||||
|
Reference in New Issue
Block a user