-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace "run now" CustomAction with standard action PerformSingleExec…
…ution (#7165)
- Loading branch information
Showing
61 changed files
with
687 additions
and
399 deletions.
There are no files selected for viewing
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 0 additions & 50 deletions
50
designer/client/src/components/toolbars/actions/buttons/CustomActionButton.tsx
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
...r/client/src/components/toolbars/scenarioActions/buttons/PerformSingleExecutionButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from "react"; | ||
import { useTranslation } from "react-i18next"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { loadProcessState } from "../../../../actions/nk"; | ||
import Icon from "../../../../assets/img/toolbarButtons/perform-single-execution.svg"; | ||
import HttpService from "../../../../http/HttpService"; | ||
import { getProcessName, isPerformSingleExecutionPossible, isPerformSingleExecutionVisible } from "../../../../reducers/selectors/graph"; | ||
import { getCapabilities } from "../../../../reducers/selectors/other"; | ||
import { useWindows, WindowKind } from "../../../../windowManager"; | ||
import { ToggleProcessActionModalData } from "../../../modals/DeployProcessDialog"; | ||
import { ToolbarButton } from "../../../toolbarComponents/toolbarButtons"; | ||
import { ToolbarButtonProps } from "../../types"; | ||
import { ACTION_DIALOG_WIDTH } from "../../../../stylesheets/variables"; | ||
import ProcessStateUtils from "../../../Process/ProcessStateUtils"; | ||
import { RootState } from "../../../../reducers"; | ||
import { getProcessState } from "../../../../reducers/selectors/scenarioState"; | ||
import { PredefinedActionName } from "../../../Process/types"; | ||
|
||
export default function PerformSingleExecutionButton(props: ToolbarButtonProps) { | ||
const { t } = useTranslation(); | ||
const dispatch = useDispatch(); | ||
const { disabled, type } = props; | ||
const scenarioState = useSelector((state: RootState) => getProcessState(state)); | ||
const isVisible = useSelector(isPerformSingleExecutionVisible); | ||
const isPossible = useSelector(isPerformSingleExecutionPossible); | ||
const processName = useSelector(getProcessName); | ||
const capabilities = useSelector(getCapabilities); | ||
const available = !disabled && isPossible && capabilities.deploy; | ||
|
||
const { open } = useWindows(); | ||
const action = (p, c) => HttpService.performSingleExecution(p, c).finally(() => dispatch(loadProcessState(processName))); | ||
const message = t("panels.actions.perform-single-execution.dialog", "Perform single execution", { name: processName }); | ||
|
||
const defaultTooltip = t("panels.actions.perform-single-execution.tooltip", "run now"); | ||
const tooltip = ProcessStateUtils.getActionCustomTooltip(scenarioState, PredefinedActionName.PerformSingleExecution) ?? defaultTooltip; | ||
|
||
if (isVisible) { | ||
return ( | ||
<ToolbarButton | ||
name={t("panels.actions.perform-single-execution.button", "run now")} | ||
title={tooltip} | ||
disabled={!available} | ||
icon={<Icon />} | ||
onClick={() => | ||
open<ToggleProcessActionModalData>({ | ||
title: message, | ||
kind: WindowKind.deployProcess, | ||
width: ACTION_DIALOG_WIDTH, | ||
meta: { action }, | ||
}) | ||
} | ||
type={type} | ||
/> | ||
); | ||
} else return <></>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.