Skip to content

Commit c8c4353

Browse files
Ruben van LeeuwenDutchBen
authored andcommitted
1719: PR comments
1 parent 1e99ae1 commit c8c4353

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/orchestrator-ui-components/src/components/WfoPydanticForm/Footer.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,15 @@ export const Footer = () => {
1919
const { rhf, onCancel, allowUntouchedSubmit, isLoading } =
2020
usePydanticFormContext();
2121

22+
const isDisabled: boolean =
23+
!rhf.formState.isValid ||
24+
(!allowUntouchedSubmit &&
25+
!rhf.formState.isDirty &&
26+
!rhf.formState.isSubmitting);
27+
2228
return (
2329
<div>
2430
<EuiHorizontalRule />
25-
2631
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
2732
<div
2833
onClick={() => {
@@ -34,7 +39,7 @@ export const Footer = () => {
3439
cursor: 'pointer',
3540
color: theme.colors.link,
3641
fontWeight: theme.font.weight.bold,
37-
marginLeft: '8px',
42+
marginLeft: theme.base / 2,
3843
display: 'flex',
3944
alignItems: 'center',
4045
}}
@@ -52,12 +57,7 @@ export const Footer = () => {
5257
iconType={() => <WfoPlayFill color="#FFF" />}
5358
iconSide="right"
5459
aria-label={t('startWorkflow')}
55-
disabled={
56-
!rhf.formState.isValid ||
57-
(!allowUntouchedSubmit &&
58-
!rhf.formState.isDirty &&
59-
!rhf.formState.isSubmitting)
60-
}
60+
disabled={isDisabled}
6161
>
6262
{t('startWorkflow')}
6363
</EuiButton>

packages/orchestrator-ui-components/src/components/WfoPydanticForm/Row.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ export const Row: RowRenderer = ({
1717
const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
1818
return (
1919
<EuiFormRow
20-
css={{
21-
...formRowStyle,
22-
}}
20+
css={formRowStyle}
2321
label={title}
2422
labelAppend={<EuiText size="m">{description}</EuiText>}
2523
error={error}

packages/orchestrator-ui-components/src/components/WfoPydanticForm/WfoPydanticForm.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { FetchBaseQueryError } from '@reduxjs/toolkit/query';
1717

1818
import { PATH_TASKS, PATH_WORKFLOWS, WfoLoading } from '@/components';
1919
import { StartWorkflowPayload } from '@/pages/processes/WfoStartProcessPage';
20+
import { HttpStatus } from '@/rtk';
2021
import { useStartProcessMutation } from '@/rtk/endpoints/forms';
2122

2223
import { Footer } from './Footer';
@@ -73,7 +74,9 @@ export const WfoPydanticForm = ({
7374
if (result.error) {
7475
const error =
7576
result.error as FetchBaseQueryError;
76-
if (error.status === 510) {
77+
if (
78+
error.status === HttpStatus.FormNotComplete
79+
) {
7780
const data = error.data as Record<
7881
string,
7982
object | string
@@ -91,7 +94,7 @@ export const WfoPydanticForm = ({
9194
.catch((error) => {
9295
return new Promise<Record<string, object>>(
9396
(resolve, reject) => {
94-
if (error.status === 510) {
97+
if (error.status === HttpStatus.FormNotComplete) {
9598
resolve(error.data);
9699
}
97100
reject(error);

0 commit comments

Comments
 (0)