mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): "blacklist" -> "denylist"
This commit is contained in:
parent
75d25dd5cc
commit
0ab62b0343
@ -21,15 +21,15 @@ import nodesReducer from 'features/nodes/store/nodesSlice';
|
|||||||
|
|
||||||
import { socketioMiddleware } from './socketio/middleware';
|
import { socketioMiddleware } from './socketio/middleware';
|
||||||
import { socketMiddleware } from 'services/events/middleware';
|
import { socketMiddleware } from 'services/events/middleware';
|
||||||
import { canvasBlacklist } from 'features/canvas/store/canvasPersistBlacklist';
|
import { canvasDenylist } from 'features/canvas/store/canvasPersistDenylist';
|
||||||
import { galleryBlacklist } from 'features/gallery/store/galleryPersistBlacklist';
|
import { galleryDenylist } from 'features/gallery/store/galleryPersistDenylist';
|
||||||
import { generationBlacklist } from 'features/parameters/store/generationPersistBlacklist';
|
import { generationDenylist } from 'features/parameters/store/generationPersistDenylist';
|
||||||
import { lightboxBlacklist } from 'features/lightbox/store/lightboxPersistBlacklist';
|
import { lightboxDenylist } from 'features/lightbox/store/lightboxPersistDenylist';
|
||||||
import { modelsBlacklist } from 'features/system/store/modelsPersistBlacklist';
|
import { modelsDenylist } from 'features/system/store/modelsPersistDenylist';
|
||||||
import { nodesBlacklist } from 'features/nodes/store/nodesPersistBlacklist';
|
import { nodesDenylist } from 'features/nodes/store/nodesPersistDenylist';
|
||||||
import { postprocessingBlacklist } from 'features/parameters/store/postprocessingPersistBlacklist';
|
import { postprocessingDenylist } from 'features/parameters/store/postprocessingPersistDenylist';
|
||||||
import { systemBlacklist } from 'features/system/store/systemPersistsBlacklist';
|
import { systemDenylist } from 'features/system/store/systemPersistsDenylist';
|
||||||
import { uiBlacklist } from 'features/ui/store/uiPersistBlacklist';
|
import { uiDenylist } from 'features/ui/store/uiPersistDenylist';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redux-persist provides an easy and reliable way to persist state across reloads.
|
* redux-persist provides an easy and reliable way to persist state across reloads.
|
||||||
@ -40,9 +40,9 @@ import { uiBlacklist } from 'features/ui/store/uiPersistBlacklist';
|
|||||||
* - Connection/processing status
|
* - Connection/processing status
|
||||||
* - Availability of external libraries like ESRGAN/GFPGAN
|
* - Availability of external libraries like ESRGAN/GFPGAN
|
||||||
*
|
*
|
||||||
* These can be blacklisted in redux-persist.
|
* These can be denylisted in redux-persist.
|
||||||
*
|
*
|
||||||
* The necesssary nested persistors with blacklists are configured below.
|
* The necesssary nested persistors with denylists are configured below.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const rootReducer = combineReducers({
|
const rootReducer = combineReducers({
|
||||||
@ -66,18 +66,18 @@ const rootPersistConfig = getPersistConfig({
|
|||||||
storage,
|
storage,
|
||||||
rootReducer,
|
rootReducer,
|
||||||
blacklist: [
|
blacklist: [
|
||||||
...canvasBlacklist,
|
...canvasDenylist,
|
||||||
...galleryBlacklist,
|
...galleryDenylist,
|
||||||
...generationBlacklist,
|
...generationDenylist,
|
||||||
...lightboxBlacklist,
|
...lightboxDenylist,
|
||||||
...modelsBlacklist,
|
...modelsDenylist,
|
||||||
...nodesBlacklist,
|
...nodesDenylist,
|
||||||
...postprocessingBlacklist,
|
...postprocessingDenylist,
|
||||||
// ...resultsBlacklist,
|
// ...resultsDenylist,
|
||||||
'results',
|
'results',
|
||||||
...systemBlacklist,
|
...systemDenylist,
|
||||||
...uiBlacklist,
|
...uiDenylist,
|
||||||
// ...uploadsBlacklist,
|
// ...uploadsDenylist,
|
||||||
'uploads',
|
'uploads',
|
||||||
'hotkeys',
|
'hotkeys',
|
||||||
'config',
|
'config',
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
import { CanvasState } from './canvasTypes';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Canvas slice persist blacklist
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof CanvasState)[] = [
|
|
||||||
'cursorPosition',
|
|
||||||
'isCanvasInitialized',
|
|
||||||
'doesCanvasNeedScaling',
|
|
||||||
];
|
|
||||||
|
|
||||||
export const canvasBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `canvas.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,14 @@
|
|||||||
|
import { CanvasState } from './canvasTypes';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Canvas slice persist denylist
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof CanvasState)[] = [
|
||||||
|
'cursorPosition',
|
||||||
|
'isCanvasInitialized',
|
||||||
|
'doesCanvasNeedScaling',
|
||||||
|
];
|
||||||
|
|
||||||
|
export const canvasDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `canvas.${denylistItem}`
|
||||||
|
);
|
@ -1,9 +1,9 @@
|
|||||||
import { GalleryState } from './gallerySlice';
|
import { GalleryState } from './gallerySlice';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gallery slice persist blacklist
|
* Gallery slice persist denylist
|
||||||
*/
|
*/
|
||||||
const itemsToBlacklist: (keyof GalleryState)[] = [
|
const itemsToDenylist: (keyof GalleryState)[] = [
|
||||||
'categories',
|
'categories',
|
||||||
'currentCategory',
|
'currentCategory',
|
||||||
'currentImage',
|
'currentImage',
|
||||||
@ -12,6 +12,6 @@ const itemsToBlacklist: (keyof GalleryState)[] = [
|
|||||||
'intermediateImage',
|
'intermediateImage',
|
||||||
];
|
];
|
||||||
|
|
||||||
export const galleryBlacklist = itemsToBlacklist.map(
|
export const galleryDenylist = itemsToDenylist.map(
|
||||||
(blacklistItem) => `gallery.${blacklistItem}`
|
(denylistItem) => `gallery.${denylistItem}`
|
||||||
);
|
);
|
@ -1,12 +0,0 @@
|
|||||||
import { ResultsState } from './resultsSlice';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Results slice persist blacklist
|
|
||||||
*
|
|
||||||
* Currently blacklisting results slice entirely, see persist config in store.ts
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof ResultsState)[] = [];
|
|
||||||
|
|
||||||
export const resultsBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `results.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,12 @@
|
|||||||
|
import { ResultsState } from './resultsSlice';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Results slice persist denylist
|
||||||
|
*
|
||||||
|
* Currently denylisting results slice entirely, see persist config in store.ts
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof ResultsState)[] = [];
|
||||||
|
|
||||||
|
export const resultsDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `results.${denylistItem}`
|
||||||
|
);
|
@ -1,12 +0,0 @@
|
|||||||
import { UploadsState } from './uploadsSlice';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uploads slice persist blacklist
|
|
||||||
*
|
|
||||||
* Currently blacklisting uploads slice entirely, see persist config in store.ts
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof UploadsState)[] = [];
|
|
||||||
|
|
||||||
export const uploadsBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `uploads.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,12 @@
|
|||||||
|
import { UploadsState } from './uploadsSlice';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uploads slice persist denylist
|
||||||
|
*
|
||||||
|
* Currently denylisting uploads slice entirely, see persist config in store.ts
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof UploadsState)[] = [];
|
||||||
|
|
||||||
|
export const uploadsDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `uploads.${denylistItem}`
|
||||||
|
);
|
@ -1,10 +0,0 @@
|
|||||||
import { LightboxState } from './lightboxSlice';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lightbox slice persist blacklist
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof LightboxState)[] = ['isLightboxOpen'];
|
|
||||||
|
|
||||||
export const lightboxBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `lightbox.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,10 @@
|
|||||||
|
import { LightboxState } from './lightboxSlice';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lightbox slice persist denylist
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof LightboxState)[] = ['isLightboxOpen'];
|
||||||
|
|
||||||
|
export const lightboxDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `lightbox.${denylistItem}`
|
||||||
|
);
|
@ -1,13 +0,0 @@
|
|||||||
import { NodesState } from './nodesSlice';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nodes slice persist blacklist
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof NodesState)[] = [
|
|
||||||
'schema',
|
|
||||||
'invocationTemplates',
|
|
||||||
];
|
|
||||||
|
|
||||||
export const nodesBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `nodes.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,10 @@
|
|||||||
|
import { NodesState } from './nodesSlice';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Nodes slice persist denylist
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof NodesState)[] = ['schema', 'invocationTemplates'];
|
||||||
|
|
||||||
|
export const nodesDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `nodes.${denylistItem}`
|
||||||
|
);
|
@ -13,7 +13,7 @@ import {
|
|||||||
buildOutputFieldTemplates,
|
buildOutputFieldTemplates,
|
||||||
} from './fieldTemplateBuilders';
|
} from './fieldTemplateBuilders';
|
||||||
|
|
||||||
const invocationBlacklist = ['Graph', 'Collect', 'LoadImage'];
|
const invocationDenylist = ['Graph', 'Collect', 'LoadImage'];
|
||||||
|
|
||||||
export const parseSchema = (openAPI: OpenAPIV3.Document) => {
|
export const parseSchema = (openAPI: OpenAPIV3.Document) => {
|
||||||
// filter out non-invocation schemas, plus some tricky invocations for now
|
// filter out non-invocation schemas, plus some tricky invocations for now
|
||||||
@ -22,7 +22,7 @@ export const parseSchema = (openAPI: OpenAPIV3.Document) => {
|
|||||||
(schema, key) =>
|
(schema, key) =>
|
||||||
key.includes('Invocation') &&
|
key.includes('Invocation') &&
|
||||||
!key.includes('InvocationOutput') &&
|
!key.includes('InvocationOutput') &&
|
||||||
!invocationBlacklist.some((blacklistItem) => key.includes(blacklistItem))
|
!invocationDenylist.some((denylistItem) => key.includes(denylistItem))
|
||||||
) as (OpenAPIV3.ReferenceObject | InvocationSchemaObject)[];
|
) as (OpenAPIV3.ReferenceObject | InvocationSchemaObject)[];
|
||||||
|
|
||||||
const invocations = filteredSchemas.reduce<
|
const invocations = filteredSchemas.reduce<
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
import { GenerationState } from './generationSlice';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generation slice persist blacklist
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof GenerationState)[] = [];
|
|
||||||
|
|
||||||
export const generationBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `generation.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,10 @@
|
|||||||
|
import { GenerationState } from './generationSlice';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generation slice persist denylist
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof GenerationState)[] = [];
|
||||||
|
|
||||||
|
export const generationDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `generation.${denylistItem}`
|
||||||
|
);
|
@ -1,10 +0,0 @@
|
|||||||
import { PostprocessingState } from './postprocessingSlice';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Postprocessing slice persist blacklist
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof PostprocessingState)[] = [];
|
|
||||||
|
|
||||||
export const postprocessingBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `postprocessing.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,10 @@
|
|||||||
|
import { PostprocessingState } from './postprocessingSlice';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Postprocessing slice persist denylist
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof PostprocessingState)[] = [];
|
||||||
|
|
||||||
|
export const postprocessingDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `postprocessing.${denylistItem}`
|
||||||
|
);
|
@ -1,10 +0,0 @@
|
|||||||
import { ModelsState } from './modelSlice';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Models slice persist blacklist
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof ModelsState)[] = ['entities', 'ids'];
|
|
||||||
|
|
||||||
export const modelsBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `models.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,10 @@
|
|||||||
|
import { ModelsState } from './modelSlice';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Models slice persist denylist
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof ModelsState)[] = ['entities', 'ids'];
|
||||||
|
|
||||||
|
export const modelsDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `models.${denylistItem}`
|
||||||
|
);
|
@ -1,9 +1,9 @@
|
|||||||
import { SystemState } from './systemSlice';
|
import { SystemState } from './systemSlice';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* System slice persist blacklist
|
* System slice persist denylist
|
||||||
*/
|
*/
|
||||||
const itemsToBlacklist: (keyof SystemState)[] = [
|
const itemsToDenylist: (keyof SystemState)[] = [
|
||||||
'currentIteration',
|
'currentIteration',
|
||||||
'currentStatus',
|
'currentStatus',
|
||||||
'currentStep',
|
'currentStep',
|
||||||
@ -23,6 +23,6 @@ const itemsToBlacklist: (keyof SystemState)[] = [
|
|||||||
'wasSchemaParsed',
|
'wasSchemaParsed',
|
||||||
];
|
];
|
||||||
|
|
||||||
export const systemBlacklist = itemsToBlacklist.map(
|
export const systemDenylist = itemsToDenylist.map(
|
||||||
(blacklistItem) => `system.${blacklistItem}`
|
(denylistItem) => `system.${denylistItem}`
|
||||||
);
|
);
|
@ -1,10 +0,0 @@
|
|||||||
import { UIState } from './uiTypes';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* UI slice persist blacklist
|
|
||||||
*/
|
|
||||||
const itemsToBlacklist: (keyof UIState)[] = [];
|
|
||||||
|
|
||||||
export const uiBlacklist = itemsToBlacklist.map(
|
|
||||||
(blacklistItem) => `ui.${blacklistItem}`
|
|
||||||
);
|
|
@ -0,0 +1,10 @@
|
|||||||
|
import { UIState } from './uiTypes';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UI slice persist denylist
|
||||||
|
*/
|
||||||
|
const itemsToDenylist: (keyof UIState)[] = [];
|
||||||
|
|
||||||
|
export const uiDenylist = itemsToDenylist.map(
|
||||||
|
(denylistItem) => `ui.${denylistItem}`
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user