-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace "run now" CustomAction with standard action PerformSingleExecution #7165
Open
mgoworko
wants to merge
10
commits into
staging
Choose a base branch
from
improve-run-now-state-handling
base: staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6374e6e
Rebased run now improvements
mgoworko d3c0e7d
qs
mgoworko daa96bd
review changes
mgoworko 9d20653
added state tests
mgoworko aeaec47
review changes
mgoworko 10f2268
Merge remote-tracking branch 'origin/staging' into improve-run-now-st…
mgoworko 6c9fa55
fixes
mgoworko cb6085c
Revert "review changes"
mgoworko cbd42a5
Review changes
mgoworko 53f65bb
Merge remote-tracking branch 'origin/staging' into improve-run-now-st…
mgoworko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { css } from "@mui/material"; | ||
|
||
export const nodeInputCss = css({ | ||
height: "35px", | ||
width: "100%", | ||
|
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I see, there is no option to disable a custom action based on FE types. Do we need this
disabled
flag?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is part of common
ToolbarButtonProps
, used for all buttons. AFAIK this value must be provided. I guess at the moment it is the only button, that is never disabled on FE side, so constantfalse
provided hereAfter Arek's comments I added internationalization of tooltip messages, I think it needs FE review too.<-this change is reverted