diff --git a/designer/client/src/components/modals/DeployProcessDialog.tsx b/designer/client/src/components/modals/DeployProcessDialog.tsx index 9dd5450a8c4..553266a88ff 100644 --- a/designer/client/src/components/modals/DeployProcessDialog.tsx +++ b/designer/client/src/components/modals/DeployProcessDialog.tsx @@ -3,9 +3,9 @@ import { WindowButtonProps, WindowContentProps } from "@touk/window-manager"; import React, { useCallback, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { useSelector } from "react-redux"; -import { getProcessName } from "../../reducers/selectors/graph"; +import { getProcessName, getProcessVersionId } from "../../reducers/selectors/graph"; import { getFeatureSettings } from "../../reducers/selectors/settings"; -import { ProcessName } from "../Process/types"; +import { ProcessName, ProcessVersionId } from "../Process/types"; import { PromptContent, WindowKind } from "../../windowManager"; import CommentInput from "../comment/CommentInput"; import ProcessDialogWarnings from "./ProcessDialogWarnings"; @@ -13,7 +13,7 @@ import { FormHelperText, Typography } from "@mui/material"; import { LoadingButtonTypes } from "../../windowManager/LoadingButton"; export type ToggleProcessActionModalData = { - action: (processName: ProcessName, comment: string) => Promise; + action: (processName: ProcessName, processVersionId: ProcessVersionId, comment: string) => Promise; displayWarnings?: boolean; }; @@ -23,6 +23,7 @@ export function DeployProcessDialog(props: WindowContentProps { try { - await action(processName, comment); + await action(processName, processVersionId, comment); props.close(); } catch (error) { setValidationError(error?.response?.data); } - }, [action, comment, processName, props]); + }, [action, comment, processName, props, processVersionId]); const { t } = useTranslation(); const buttons: WindowButtonProps[] = useMemo( diff --git a/designer/client/src/components/toolbars/scenarioActions/buttons/CancelDeployButton.tsx b/designer/client/src/components/toolbars/scenarioActions/buttons/CancelDeployButton.tsx index be1c506afa1..419b5154541 100644 --- a/designer/client/src/components/toolbars/scenarioActions/buttons/CancelDeployButton.tsx +++ b/designer/client/src/components/toolbars/scenarioActions/buttons/CancelDeployButton.tsx @@ -4,13 +4,14 @@ import { useDispatch, useSelector } from "react-redux"; import { loadProcessState } from "../../../../actions/nk"; import Icon from "../../../../assets/img/toolbarButtons/stop.svg"; import HttpService from "../../../../http/HttpService"; -import { getProcessName, getProcessVersionId, isCancelPossible } from "../../../../reducers/selectors/graph"; +import { getProcessName, isCancelPossible } from "../../../../reducers/selectors/graph"; import { getCapabilities } from "../../../../reducers/selectors/other"; import { WindowKind, useWindows } from "../../../../windowManager"; import { ToggleProcessActionModalData } from "../../../modals/DeployProcessDialog"; import { ToolbarButton } from "../../../toolbarComponents/toolbarButtons"; import { ToolbarButtonProps } from "../../types"; import { ACTION_DIALOG_WIDTH } from "../../../../stylesheets/variables"; +import { ProcessName, ProcessVersionId } from "../../../Process/types"; export default function CancelDeployButton(props: ToolbarButtonProps) { const { t } = useTranslation(); @@ -18,12 +19,12 @@ export default function CancelDeployButton(props: ToolbarButtonProps) { const { disabled, type } = props; const cancelPossible = useSelector(isCancelPossible); const processName = useSelector(getProcessName); - const processVersionId = useSelector(getProcessVersionId); const capabilities = useSelector(getCapabilities); const available = !disabled && cancelPossible && capabilities.deploy; const { open } = useWindows(); - const action = (p, c) => HttpService.cancel(p, c).finally(() => dispatch(loadProcessState(processName, processVersionId))); + const action = (name: ProcessName, versionId: ProcessVersionId, comment: string) => + HttpService.cancel(name, comment).finally(() => dispatch(loadProcessState(name, versionId))); const message = t("panels.actions.deploy-canel.dialog", "Cancel scenario {{name}}", { name: processName }); return ( diff --git a/designer/client/src/components/toolbars/scenarioActions/buttons/DeployButton.tsx b/designer/client/src/components/toolbars/scenarioActions/buttons/DeployButton.tsx index ab685cbe134..a2868e533c4 100644 --- a/designer/client/src/components/toolbars/scenarioActions/buttons/DeployButton.tsx +++ b/designer/client/src/components/toolbars/scenarioActions/buttons/DeployButton.tsx @@ -4,7 +4,7 @@ import { useDispatch, useSelector } from "react-redux"; import { disableToolTipsHighlight, enableToolTipsHighlight, loadProcessState } from "../../../../actions/nk"; import Icon from "../../../../assets/img/toolbarButtons/deploy.svg"; import HttpService from "../../../../http/HttpService"; -import { getProcessName, getProcessVersionId, hasError, isDeployPossible, isSaveDisabled } from "../../../../reducers/selectors/graph"; +import { getProcessName, hasError, isDeployPossible, isSaveDisabled } from "../../../../reducers/selectors/graph"; import { getCapabilities } from "../../../../reducers/selectors/other"; import { useWindows } from "../../../../windowManager"; import { WindowKind } from "../../../../windowManager"; @@ -12,6 +12,7 @@ import { ToggleProcessActionModalData } from "../../../modals/DeployProcessDialo import { ToolbarButton } from "../../../toolbarComponents/toolbarButtons"; import { ToolbarButtonProps } from "../../types"; import { ACTION_DIALOG_WIDTH } from "../../../../stylesheets/variables"; +import { ProcessName, ProcessVersionId } from "../../../Process/types"; export default function DeployButton(props: ToolbarButtonProps) { const dispatch = useDispatch(); @@ -19,12 +20,10 @@ export default function DeployButton(props: ToolbarButtonProps) { const saveDisabled = useSelector(isSaveDisabled); const hasErrors = useSelector(hasError); const processName = useSelector(getProcessName); - const processVersionId = useSelector(getProcessVersionId); const capabilities = useSelector(getCapabilities); const { disabled, type } = props; const available = !disabled && deployPossible && capabilities.deploy; - const { t } = useTranslation(); const deployToolTip = !capabilities.deploy ? t("panels.actions.deploy.tooltips.forbidden", "Deploy forbidden for current scenario.") @@ -39,7 +38,8 @@ export default function DeployButton(props: ToolbarButtonProps) { const { open } = useWindows(); const message = t("panels.actions.deploy.dialog", "Deploy scenario {{name}}", { name: processName }); - const action = (p, c) => HttpService.deploy(p, c).finally(() => dispatch(loadProcessState(processName, processVersionId))); + const action = (name: ProcessName, versionId: ProcessVersionId, comment: string) => + HttpService.deploy(name, comment).finally(() => dispatch(loadProcessState(name, versionId))); return ( HttpService.runOffSchedule(p, c).finally(() => dispatch(loadProcessState(processName, processVersionId))); + const action = (name: ProcessName, versionId: ProcessVersionId, comment: string) => + HttpService.runOffSchedule(name, comment).finally(() => dispatch(loadProcessState(name, versionId))); const message = t("panels.actions.run-of-out-schedule.dialog", "Perform single execution", { name: processName }); const defaultTooltip = t("panels.actions.run-off-schedule.tooltip", "run now"); diff --git a/designer/client/src/reducers/graph/reducer.ts b/designer/client/src/reducers/graph/reducer.ts index 333cfd8d70f..8654a50097d 100644 --- a/designer/client/src/reducers/graph/reducer.ts +++ b/designer/client/src/reducers/graph/reducer.ts @@ -348,7 +348,7 @@ const undoableReducer = undoable(reducer, { groupBy: batchGroupBy.init(), filter: combineFilters((action, nextState, prevState) => { return !isEqual(getUndoableState(nextState), getUndoableState(prevState._latestUnfiltered)); - }, excludeAction(["VALIDATION_RESULT", "UPDATE_IMPORTED_PROCESS", "PROCESS_STATE_LOADED", "UPDATE_TEST_CAPABILITIES", "UPDATE_BACKEND_NOTIFICATIONS", "PROCESS_DEFINITION_DATA", "PROCESS_TOOLBARS_CONFIGURATION_LOADED", "CORRECT_INVALID_SCENARIO", "GET_SCENARIO_ACTIVITIES", "LOGGED_USER", "REGISTER_TOOLBARS", "UI_SETTINGS"])), + }, excludeAction(["VALIDATION_RESULT", "UPDATE_IMPORTED_PROCESS", "PROCESS_STATE_LOADED", "UPDATE_TEST_CAPABILITIES", "UPDATE_BACKEND_NOTIFICATIONS", "PROCESS_DEFINITION_DATA", "PROCESS_TOOLBARS_CONFIGURATION_LOADED", "CORRECT_INVALID_SCENARIO", "GET_SCENARIO_ACTIVITIES", "LOGGED_USER", "REGISTER_TOOLBARS", "UI_SETTINGS", "MARK_BACKEND_NOTIFICATION_READ", "UPDATE_TEST_FORM_PARAMETERS"])), }); // apply only undoable changes for undo actions