fantonangeli commented on code in PR #3123:
URL:
https://github.com/apache/incubator-kie-tools/pull/3123#discussion_r2079730460
##########
packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx:
##########
@@ -201,13 +201,31 @@ export function useDeployDropdownItems(props: Props) {
[devMode.isEnabled, props.workspaceFile.name]
);
+ const onDeployWarningAlert = useGlobalAlert(
+ useCallback(({ close }) => {
+ return (
+ <Alert
+ className="pf-v5-u-mb-md"
+ variant="warning"
+ title={<>Please resolve validation errors in your workflow.</>}
+ aria-live="polite"
+ data-testid="alert-dev-mode-updating"
Review Comment:
Please use a specific `data-testid` as this one is used by
`uploadToDevModeSuccessAlert`
##########
packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx:
##########
@@ -201,13 +201,31 @@ export function useDeployDropdownItems(props: Props) {
[devMode.isEnabled, props.workspaceFile.name]
);
+ const onDeployWarningAlert = useGlobalAlert(
+ useCallback(({ close }) => {
+ return (
+ <Alert
+ className="pf-v5-u-mb-md"
+ variant="warning"
+ title={<>Please resolve validation errors in your workflow.</>}
+ aria-live="polite"
+ data-testid="alert-dev-mode-updating"
+ actionClose={<AlertActionCloseButton onClose={close} />}
+ />
+ );
+ }, [])
+ );
+
const onSetup = useCallback(() => {
history.push(routes.settings.openshift.path({}));
}, [history]);
const onDeploy = useCallback(() => {
+ if (notifications.length > 0) {
+ onDeployWarningAlert.show();
+ }
openshift.setConfirmDeployModalOpen(true);
- }, [openshift]);
+ }, [openshift, onDeployWarningAlert]);
Review Comment:
```suggestion
}, [openshift, onDeployWarningAlert, notifications]);
```
As suggested by `pnpm lint` and the linting messages on this PR (just below
this comment in the GH web file review)
##########
packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx:
##########
@@ -201,13 +201,31 @@ export function useDeployDropdownItems(props: Props) {
[devMode.isEnabled, props.workspaceFile.name]
);
+ const onDeployWarningAlert = useGlobalAlert(
+ useCallback(({ close }) => {
+ return (
+ <Alert
+ className="pf-v5-u-mb-md"
+ variant="warning"
+ title={<>Please resolve validation errors in your workflow.</>}
+ aria-live="polite"
+ data-testid="alert-dev-mode-updating"
+ actionClose={<AlertActionCloseButton onClose={close} />}
+ />
+ );
+ }, [])
+ );
+
const onSetup = useCallback(() => {
history.push(routes.settings.openshift.path({}));
}, [history]);
const onDeploy = useCallback(() => {
+ if (notifications.length > 0) {
+ onDeployWarningAlert.show();
Review Comment:
To keep the logic simple, I think we can stop the process here, if there are
warning or errors, without showing the `ConfirmDeployModal`.
So we can remove the `onDeployDangerAlert`. Wdyt?
##########
packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx:
##########
@@ -201,13 +201,31 @@ export function useDeployDropdownItems(props: Props) {
[devMode.isEnabled, props.workspaceFile.name]
);
+ const onDeployWarningAlert = useGlobalAlert(
+ useCallback(({ close }) => {
+ return (
+ <Alert
+ className="pf-v5-u-mb-md"
+ variant="warning"
+ title={<>Please resolve validation errors in your workflow.</>}
Review Comment:
```suggestion
title={<>Please resolve the validation errors in your workflow.</>}
```
##########
packages/serverless-logic-web-tools/src/editor/hooks/useDeployDropdownItems.tsx:
##########
@@ -201,13 +201,31 @@ export function useDeployDropdownItems(props: Props) {
[devMode.isEnabled, props.workspaceFile.name]
);
+ const onDeployWarningAlert = useGlobalAlert(
Review Comment:
```suggestion
const validationWarningAlert = useGlobalAlert(
```
I would remove "deploy" from the name so we can use it for the dev mode
uploading also.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]