mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
fix(ui): simplify logic for non-local invocation progress alerts
This commit is contained in:
committed by
Mary Hipp Rogers
parent
f01210861b
commit
f76ac1808c
@@ -2,7 +2,6 @@ import { Alert, AlertDescription, AlertIcon, AlertTitle } from '@invoke-ai/ui-li
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { useDeferredModelLoadingInvocationProgressMessage } from 'features/controlLayers/hooks/useDeferredModelLoadingInvocationProgressMessage';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
import { selectIsLocal } from 'features/system/store/configSlice';
|
||||
import { selectSystemShouldShowInvocationProgressDetail } from 'features/system/store/systemSlice';
|
||||
import { memo } from 'react';
|
||||
@@ -44,20 +43,14 @@ const CanvasAlertsInvocationProgressContentCommercial = memo(() => {
|
||||
CanvasAlertsInvocationProgressContentCommercial.displayName = 'CanvasAlertsInvocationProgressContentCommercial';
|
||||
|
||||
export const CanvasAlertsInvocationProgress = memo(() => {
|
||||
const isProgressMessageAlertEnabled = useFeatureStatus('invocationProgressAlert');
|
||||
const shouldShowInvocationProgressDetail = useAppSelector(selectSystemShouldShowInvocationProgressDetail);
|
||||
const isLocal = useAppSelector(selectIsLocal);
|
||||
|
||||
// The alert is disabled at the system level
|
||||
if (!isProgressMessageAlertEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isLocal) {
|
||||
return <CanvasAlertsInvocationProgressContentCommercial />;
|
||||
}
|
||||
|
||||
// The alert is disabled at the user level
|
||||
// OSS user setting
|
||||
if (!shouldShowInvocationProgressDetail) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import { SettingsDeveloperLogLevel } from 'features/system/components/SettingsMo
|
||||
import { SettingsDeveloperLogNamespaces } from 'features/system/components/SettingsModal/SettingsDeveloperLogNamespaces';
|
||||
import { useClearIntermediates } from 'features/system/components/SettingsModal/useClearIntermediates';
|
||||
import { StickyScrollable } from 'features/system/components/StickyScrollable';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
import {
|
||||
selectSystemShouldAntialiasProgressImage,
|
||||
selectSystemShouldConfirmOnDelete,
|
||||
@@ -59,6 +58,7 @@ type ConfigOptions = {
|
||||
shouldShowResetWebUiText?: boolean;
|
||||
shouldShowClearIntermediates?: boolean;
|
||||
shouldShowLocalizationToggle?: boolean;
|
||||
shouldShowInvocationProgressDetailSetting?: boolean;
|
||||
};
|
||||
|
||||
const defaultConfig: ConfigOptions = {
|
||||
@@ -66,6 +66,7 @@ const defaultConfig: ConfigOptions = {
|
||||
shouldShowResetWebUiText: true,
|
||||
shouldShowClearIntermediates: true,
|
||||
shouldShowLocalizationToggle: true,
|
||||
shouldShowInvocationProgressDetailSetting: true,
|
||||
};
|
||||
|
||||
type SettingsModalProps = {
|
||||
@@ -107,7 +108,6 @@ const SettingsModal = ({ config = defaultConfig, children }: SettingsModalProps)
|
||||
const shouldEnableModelDescriptions = useAppSelector(selectSystemShouldEnableModelDescriptions);
|
||||
const shouldConfirmOnNewSession = useAppSelector(selectSystemShouldConfirmOnNewSession);
|
||||
const shouldShowInvocationProgressDetail = useAppSelector(selectSystemShouldShowInvocationProgressDetail);
|
||||
const isInvocationProgressAlertEnabled = useFeatureStatus('invocationProgressAlert');
|
||||
const onToggleConfirmOnNewSession = useCallback(() => {
|
||||
dispatch(shouldConfirmOnNewSessionToggled());
|
||||
}, [dispatch]);
|
||||
@@ -233,7 +233,7 @@ const SettingsModal = ({ config = defaultConfig, children }: SettingsModalProps)
|
||||
onChange={handleChangeShouldAntialiasProgressImage}
|
||||
/>
|
||||
</FormControl>
|
||||
{isInvocationProgressAlertEnabled && (
|
||||
{Boolean(config?.shouldShowInvocationProgressDetailSetting) && (
|
||||
<FormControl>
|
||||
<FormLabel>{t('settings.showDetailedInvocationProgress')}</FormLabel>
|
||||
<Switch
|
||||
|
||||
Reference in New Issue
Block a user