mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): invert logic to be disabled
This commit is contained in:
parent
9820829edb
commit
46aeeea29a
@ -5,28 +5,16 @@ import storage from 'redux-persist/lib/storage'; // defaults to localStorage for
|
|||||||
|
|
||||||
import { getPersistConfig } from 'redux-deep-persist';
|
import { getPersistConfig } from 'redux-deep-persist';
|
||||||
|
|
||||||
import canvasReducer, { canvasSlice } from 'features/canvas/store/canvasSlice';
|
import canvasReducer from 'features/canvas/store/canvasSlice';
|
||||||
import galleryReducer, {
|
import galleryReducer from 'features/gallery/store/gallerySlice';
|
||||||
gallerySlice,
|
import resultsReducer from 'features/gallery/store/resultsSlice';
|
||||||
} from 'features/gallery/store/gallerySlice';
|
import uploadsReducer from 'features/gallery/store/uploadsSlice';
|
||||||
import resultsReducer, {
|
import lightboxReducer from 'features/lightbox/store/lightboxSlice';
|
||||||
resultsSlice,
|
import generationReducer from 'features/parameters/store/generationSlice';
|
||||||
} from 'features/gallery/store/resultsSlice';
|
import postprocessingReducer from 'features/parameters/store/postprocessingSlice';
|
||||||
import uploadsReducer, {
|
import systemReducer from 'features/system/store/systemSlice';
|
||||||
uploadsSlice,
|
|
||||||
} from 'features/gallery/store/uploadsSlice';
|
|
||||||
import lightboxReducer, {
|
|
||||||
lightboxSlice,
|
|
||||||
} from 'features/lightbox/store/lightboxSlice';
|
|
||||||
import generationReducer, {
|
|
||||||
generationSlice,
|
|
||||||
} from 'features/parameters/store/generationSlice';
|
|
||||||
import postprocessingReducer, {
|
|
||||||
postprocessingSlice,
|
|
||||||
} from 'features/parameters/store/postprocessingSlice';
|
|
||||||
import systemReducer, { systemSlice } from 'features/system/store/systemSlice';
|
|
||||||
import uiReducer, { uiSlice } from 'features/ui/store/uiSlice';
|
import uiReducer, { uiSlice } from 'features/ui/store/uiSlice';
|
||||||
import apiReducer, { apiSlice } from 'services/apiSlice';
|
import apiReducer from 'services/apiSlice';
|
||||||
|
|
||||||
import { socketioMiddleware } from './socketio/middleware';
|
import { socketioMiddleware } from './socketio/middleware';
|
||||||
import { socketioMiddleware as nodesSocketioMiddleware } from './nodesSocketio/middleware';
|
import { socketioMiddleware as nodesSocketioMiddleware } from './nodesSocketio/middleware';
|
||||||
@ -129,21 +117,6 @@ interface InitializeStore {
|
|||||||
disabledPanels?: string[];
|
disabledPanels?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
const disablePanels = ({
|
|
||||||
disabledPanels,
|
|
||||||
enabledParameterPanels,
|
|
||||||
}: {
|
|
||||||
disabledPanels: string[];
|
|
||||||
enabledParameterPanels: { [key: string]: boolean };
|
|
||||||
}) => {
|
|
||||||
const updatedParameterPanels: { [key: string]: boolean } = {};
|
|
||||||
Object.keys(enabledParameterPanels).forEach(function (key, index) {
|
|
||||||
updatedParameterPanels[key] =
|
|
||||||
disabledPanels.indexOf(key) >= 0 ? false : true;
|
|
||||||
});
|
|
||||||
return updatedParameterPanels;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Continue with store setup
|
// Continue with store setup
|
||||||
export const initializeStore = ({ disabledPanels = [] }: InitializeStore) =>
|
export const initializeStore = ({ disabledPanels = [] }: InitializeStore) =>
|
||||||
configureStore({
|
configureStore({
|
||||||
@ -156,11 +129,7 @@ export const initializeStore = ({ disabledPanels = [] }: InitializeStore) =>
|
|||||||
preloadedState: {
|
preloadedState: {
|
||||||
ui: {
|
ui: {
|
||||||
...uiSlice.getInitialState(),
|
...uiSlice.getInitialState(),
|
||||||
enabledParameterPanels: disablePanels({
|
disabledParameterPanels: disabledPanels,
|
||||||
disabledPanels,
|
|
||||||
enabledParameterPanels:
|
|
||||||
uiSlice.getInitialState().enabledParameterPanels,
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
devTools: {
|
devTools: {
|
||||||
|
@ -24,7 +24,7 @@ const ParametersAccordion = (props: ParametersAccordionsType) => {
|
|||||||
const { system, ui } = useAppSelector((state: RootState) => state);
|
const { system, ui } = useAppSelector((state: RootState) => state);
|
||||||
|
|
||||||
const { openAccordions } = system;
|
const { openAccordions } = system;
|
||||||
const { enabledParameterPanels } = ui;
|
const { disabledParameterPanels } = ui;
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ const ParametersAccordion = (props: ParametersAccordionsType) => {
|
|||||||
accordionInfo[key];
|
accordionInfo[key];
|
||||||
|
|
||||||
// do not render if panel is disabled in global state
|
// do not render if panel is disabled in global state
|
||||||
if (enabledParameterPanels[key] !== false) {
|
if (disabledParameterPanels.indexOf(key) > -1) {
|
||||||
accordionsToRender.push(
|
accordionsToRender.push(
|
||||||
<InvokeAccordionItem
|
<InvokeAccordionItem
|
||||||
key={key}
|
key={key}
|
||||||
|
@ -44,7 +44,7 @@ const ImageToImageParameters = () => {
|
|||||||
content: <VariationsSettings />,
|
content: <VariationsSettings />,
|
||||||
additionalHeaderComponents: <GenerateVariationsToggle />,
|
additionalHeaderComponents: <GenerateVariationsToggle />,
|
||||||
},
|
},
|
||||||
faceRestore: {
|
face_restore: {
|
||||||
header: `${t('parameters.faceRestoration')}`,
|
header: `${t('parameters.faceRestoration')}`,
|
||||||
feature: Feature.FACE_CORRECTION,
|
feature: Feature.FACE_CORRECTION,
|
||||||
content: <FaceRestoreSettings />,
|
content: <FaceRestoreSettings />,
|
||||||
|
@ -38,7 +38,7 @@ const TextToImageParameters = () => {
|
|||||||
content: <VariationsSettings />,
|
content: <VariationsSettings />,
|
||||||
additionalHeaderComponents: <GenerateVariationsToggle />,
|
additionalHeaderComponents: <GenerateVariationsToggle />,
|
||||||
},
|
},
|
||||||
faceRestore: {
|
face_restore: {
|
||||||
header: `${t('parameters.faceRestoration')}`,
|
header: `${t('parameters.faceRestoration')}`,
|
||||||
feature: Feature.FACE_CORRECTION,
|
feature: Feature.FACE_CORRECTION,
|
||||||
content: <FaceRestoreSettings />,
|
content: <FaceRestoreSettings />,
|
||||||
|
@ -16,16 +16,7 @@ const initialtabsState: UIState = {
|
|||||||
addNewModelUIOption: null,
|
addNewModelUIOption: null,
|
||||||
shouldPinGallery: true,
|
shouldPinGallery: true,
|
||||||
shouldShowGallery: true,
|
shouldShowGallery: true,
|
||||||
enabledParameterPanels: {
|
disabledParameterPanels: [],
|
||||||
general: true,
|
|
||||||
seed: true,
|
|
||||||
variations: true,
|
|
||||||
faceRestore: true,
|
|
||||||
upscale: true,
|
|
||||||
symmetry: true,
|
|
||||||
other: true,
|
|
||||||
imageToImage: true,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialState: UIState = initialtabsState;
|
const initialState: UIState = initialtabsState;
|
||||||
|
@ -13,5 +13,5 @@ export interface UIState {
|
|||||||
addNewModelUIOption: AddNewModelType;
|
addNewModelUIOption: AddNewModelType;
|
||||||
shouldPinGallery: boolean;
|
shouldPinGallery: boolean;
|
||||||
shouldShowGallery: boolean;
|
shouldShowGallery: boolean;
|
||||||
enabledParameterPanels: { [key: string]: boolean };
|
disabledParameterPanels: string[];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user