feat(ui): rerender mitigation sweep

This commit is contained in:
psychedelicious
2023-04-27 17:30:21 +10:00
parent 5d8728c7ef
commit ca1cc0e2c2
16 changed files with 98 additions and 138 deletions

View File

@@ -6,14 +6,12 @@ import IAIIconButton, {
import { systemSelector } from 'features/system/store/systemSelectors';
import {
SystemState,
setCancelAfter,
setCancelType,
cancelScheduled,
cancelTypeChanged,
CancelType,
} from 'features/system/store/systemSlice';
import { isEqual } from 'lodash-es';
import { useEffect, useCallback, memo } from 'react';
import { useCallback, memo } from 'react';
import {
ButtonSpinner,
ButtonGroup,
@@ -27,16 +25,9 @@ import {
import { useHotkeys } from 'react-hotkeys-hook';
import { useTranslation } from 'react-i18next';
import {
MdArrowDropDown,
MdArrowDropUp,
MdCancel,
MdCancelScheduleSend,
} from 'react-icons/md';
import { MdCancel, MdCancelScheduleSend } from 'react-icons/md';
import IAISimpleMenu from 'common/components/IAISimpleMenu';
import { sessionCanceled } from 'services/thunks/session';
import { FaChevronDown } from 'react-icons/fa';
import { BiChevronDown } from 'react-icons/bi';
const cancelButtonSelector = createSelector(
@@ -48,8 +39,6 @@ const cancelButtonSelector = createSelector(
isCancelable: system.isCancelable,
currentIteration: system.currentIteration,
totalIterations: system.totalIterations,
// cancelType: system.cancelOptions.cancelType,
// cancelAfter: system.cancelOptions.cancelAfter,
sessionId: system.sessionId,
cancelType: system.cancelType,
isCancelScheduled: system.isCancelScheduled,
@@ -75,11 +64,8 @@ const CancelButton = (
isProcessing,
isConnected,
isCancelable,
currentIteration,
totalIterations,
cancelType,
isCancelScheduled,
// cancelAfter,
sessionId,
} = useAppSelector(cancelButtonSelector);
@@ -105,7 +91,6 @@ const CancelButton = (
},
[dispatch]
);
// const isCancelScheduled = cancelAfter === null ? false : true;
useHotkeys(
'shift+x',
@@ -117,23 +102,6 @@ const CancelButton = (
[isConnected, isProcessing, isCancelable]
);
// useEffect(() => {
// if (cancelAfter !== null && cancelAfter < currentIteration) {
// handleClickCancel();
// }
// }, [cancelAfter, currentIteration, handleClickCancel]);
// const cancelMenuItems = [
// {
// item: t('parameters.cancel.immediate'),
// onClick: () => dispatch(cancelTypeChanged('immediate')),
// },
// {
// item: t('parameters.cancel.schedule'),
// onClick: () => dispatch(cancelTypeChanged('scheduled')),
// },
// ];
return (
<ButtonGroup isAttached width={btnGroupWidth}>
{cancelType === 'immediate' ? (