feat: node editor

squashed rebase on main after backendd refactor
This commit is contained in:
psychedelicious
2023-08-14 13:23:09 +10:00
parent d6c9bf5b38
commit f49fc7fb55
188 changed files with 8541 additions and 4660 deletions

View File

@@ -9,8 +9,8 @@ import {
ModalHeader,
ModalOverlay,
Text,
useDisclosure,
useColorMode,
useDisclosure,
} from '@chakra-ui/react';
import { createSelector } from '@reduxjs/toolkit';
import { VALID_LOG_LEVELS } from 'app/logging/logger';
@@ -23,7 +23,6 @@ import { setShouldShowAdvancedOptions } from 'features/parameters/store/generati
import {
consoleLogLevelChanged,
setEnableImageDebugging,
setIsNodesEnabled,
setShouldConfirmOnDelete,
shouldAntialiasProgressImageChanged,
shouldLogToConsoleChanged,
@@ -46,14 +45,14 @@ import {
import { useTranslation } from 'react-i18next';
import { LogLevelName } from 'roarr';
import { useGetAppConfigQuery } from 'services/api/endpoints/appInfo';
import { useFeatureStatus } from '../../hooks/useFeatureStatus';
import { LANGUAGES } from '../../store/constants';
import { languageSelector } from '../../store/systemSelectors';
import { languageChanged } from '../../store/systemSlice';
import SettingSwitch from './SettingSwitch';
import SettingsClearIntermediates from './SettingsClearIntermediates';
import SettingsSchedulers from './SettingsSchedulers';
import StyledFlex from './StyledFlex';
import { useFeatureStatus } from '../../hooks/useFeatureStatus';
import { LANGUAGES } from '../../store/constants';
import { languageChanged } from '../../store/systemSlice';
import { languageSelector } from '../../store/systemSelectors';
const selector = createSelector(
[stateSelector],
@@ -64,7 +63,6 @@ const selector = createSelector(
consoleLogLevel,
shouldLogToConsole,
shouldAntialiasProgressImage,
isNodesEnabled,
shouldUseNSFWChecker,
shouldUseWatermarker,
} = system;
@@ -87,7 +85,6 @@ const selector = createSelector(
shouldLogToConsole,
shouldAntialiasProgressImage,
shouldShowAdvancedOptions,
isNodesEnabled,
shouldUseNSFWChecker,
shouldUseWatermarker,
};
@@ -103,7 +100,6 @@ type ConfigOptions = {
shouldShowBetaLayout: boolean;
shouldShowAdvancedOptionsSettings: boolean;
shouldShowClearIntermediates: boolean;
shouldShowNodesToggle: boolean;
shouldShowLocalizationToggle: boolean;
};
@@ -125,7 +121,6 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
config?.shouldShowAdvancedOptionsSettings ?? true;
const shouldShowClearIntermediates =
config?.shouldShowClearIntermediates ?? true;
const shouldShowNodesToggle = config?.shouldShowNodesToggle ?? true;
const shouldShowLocalizationToggle =
config?.shouldShowLocalizationToggle ?? true;
@@ -167,7 +162,6 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
shouldLogToConsole,
shouldAntialiasProgressImage,
shouldShowAdvancedOptions,
isNodesEnabled,
shouldUseNSFWChecker,
shouldUseWatermarker,
} = useAppSelector(selector);
@@ -207,13 +201,6 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
[dispatch]
);
const handleToggleNodes = useCallback(
(e: ChangeEvent<HTMLInputElement>) => {
dispatch(setIsNodesEnabled(e.target.checked));
},
[dispatch]
);
const { colorMode, toggleColorMode } = useColorMode();
const isLocalizationEnabled =
@@ -320,14 +307,6 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
}
/>
)}
{shouldShowNodesToggle && (
<SettingSwitch
label={t('settings.enableNodesEditor')}
useBadge
isChecked={isNodesEnabled}
onChange={handleToggleNodes}
/>
)}
{shouldShowLocalizationToggle && (
<IAIMantineSelect
disabled={!isLocalizationEnabled}

View File

@@ -4,6 +4,7 @@ import { InvokeLogLevel } from 'app/logging/logger';
import { userInvoked } from 'app/store/actions';
import { nodeTemplatesBuilt } from 'features/nodes/store/nodesSlice';
import { t } from 'i18next';
import { startCase } from 'lodash-es';
import { LogLevelName } from 'roarr';
import {
isAnySessionRejected,
@@ -25,7 +26,6 @@ import {
import { ProgressImage } from 'services/events/types';
import { makeToast } from '../util/makeToast';
import { LANGUAGES } from './constants';
import { startCase } from 'lodash-es';
export type CancelStrategy = 'immediate' | 'scheduled';
@@ -86,7 +86,6 @@ export interface SystemState {
shouldAntialiasProgressImage: boolean;
language: keyof typeof LANGUAGES;
isUploading: boolean;
isNodesEnabled: boolean;
shouldUseNSFWChecker: boolean;
shouldUseWatermarker: boolean;
}
@@ -120,7 +119,6 @@ export const initialSystemState: SystemState = {
isPersisted: false,
language: 'en',
isUploading: false,
isNodesEnabled: false,
shouldUseNSFWChecker: false,
shouldUseWatermarker: false,
};
@@ -195,9 +193,6 @@ export const systemSlice = createSlice({
progressImageSet(state, action: PayloadAction<ProgressImage | null>) {
state.progressImage = action.payload;
},
setIsNodesEnabled(state, action: PayloadAction<boolean>) {
state.isNodesEnabled = action.payload;
},
shouldUseNSFWCheckerChanged(state, action: PayloadAction<boolean>) {
state.shouldUseNSFWChecker = action.payload;
},
@@ -425,7 +420,6 @@ export const {
shouldAntialiasProgressImageChanged,
languageChanged,
progressImageSet,
setIsNodesEnabled,
shouldUseNSFWCheckerChanged,
shouldUseWatermarkerChanged,
} = systemSlice.actions;