@orchestrator-ui/orchestrator-ui-components 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +6 -6
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +11 -11
- package/CHANGELOG.md +17 -0
- package/dist/index.d.ts +7 -5
- package/dist/index.js +35 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/WfoPydanticForm/Footer.tsx +8 -8
- package/src/components/WfoPydanticForm/Header.tsx +2 -4
- package/src/components/WfoPydanticForm/RenderFormErrors.tsx +2 -2
- package/src/components/WfoPydanticForm/Row.tsx +2 -2
- package/src/components/WfoPydanticForm/WfoPydanticForm.tsx +18 -10
- package/src/components/WfoPydanticForm/fields/WfoArrayField/WfoArrayField.tsx +5 -2
- package/src/components/WfoPydanticForm/fields/WfoObjectField/WfoObjectField.tsx +2 -2
- package/src/components/WfoPydanticForm/fields/wfoPydanticFormUtils.ts +6 -0
- package/src/configuration/version.ts +1 -1
- package/src/pages/settings/WfoSettingsPage.tsx +1 -1
- package/src/rtk/api.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orchestrator-ui/orchestrator-ui-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Library of UI Components used to display the workflow orchestrator frontend",
|
|
6
6
|
"author": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"next-query-params": "^5.0.0",
|
|
49
49
|
"object-hash": "^3.0.0",
|
|
50
50
|
"prism-themes": "^1.9.0",
|
|
51
|
-
"pydantic-forms": "^0.
|
|
51
|
+
"pydantic-forms": "^0.9.0",
|
|
52
52
|
"react-diff-view": "^3.2.0",
|
|
53
53
|
"react-draggable": "^4.4.6",
|
|
54
54
|
"react-redux": "^9.1.2",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { useTranslations } from 'next-intl';
|
|
9
|
-
import {
|
|
9
|
+
import type { PydanticFormFooterProps } from 'pydantic-forms';
|
|
10
10
|
|
|
11
11
|
import { EuiButton, EuiHorizontalRule } from '@elastic/eui';
|
|
12
12
|
|
|
@@ -14,10 +14,12 @@ import { useOrchestratorTheme } from '@/hooks';
|
|
|
14
14
|
|
|
15
15
|
import { RenderFormErrors } from './RenderFormErrors';
|
|
16
16
|
|
|
17
|
-
export const Footer = (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
export const Footer = ({
|
|
18
|
+
onCancel,
|
|
19
|
+
onPrevious,
|
|
20
|
+
hasNext,
|
|
21
|
+
hasPrevious,
|
|
22
|
+
}: PydanticFormFooterProps) => {
|
|
21
23
|
const { theme } = useOrchestratorTheme();
|
|
22
24
|
const t = useTranslations('pydanticForms.userInputForm');
|
|
23
25
|
|
|
@@ -97,9 +99,7 @@ export const Footer = () => {
|
|
|
97
99
|
<EuiHorizontalRule />
|
|
98
100
|
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
99
101
|
<div>
|
|
100
|
-
{(
|
|
101
|
-
<PreviousButton />
|
|
102
|
-
)) || <CancelButton />}
|
|
102
|
+
{(hasPrevious && <PreviousButton />) || <CancelButton />}
|
|
103
103
|
</div>
|
|
104
104
|
|
|
105
105
|
<SubmitButton />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import type { PydanticFormHeaderProps } from 'pydantic-forms';
|
|
4
4
|
|
|
5
5
|
import { css } from '@emotion/react';
|
|
6
6
|
|
|
@@ -11,9 +11,7 @@ const headerStyling = css`
|
|
|
11
11
|
margin-bottom: 15px;
|
|
12
12
|
`;
|
|
13
13
|
|
|
14
|
-
export const Header = () => {
|
|
15
|
-
const { pydanticFormSchema } = usePydanticFormContext();
|
|
16
|
-
|
|
14
|
+
export const Header = ({ pydanticFormSchema }: PydanticFormHeaderProps) => {
|
|
17
15
|
return pydanticFormSchema?.title &&
|
|
18
16
|
pydanticFormSchema.title !== 'unknown' ? (
|
|
19
17
|
<h3 data-testid="pydantic-form-header" css={headerStyling}>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { useTranslations } from 'next-intl';
|
|
9
|
-
import {
|
|
9
|
+
import { useGetValidationErrors } from 'pydantic-forms';
|
|
10
10
|
|
|
11
11
|
import { getCommonFormFieldStyles } from '@/components';
|
|
12
12
|
import { useWithOrchestratorTheme } from '@/hooks';
|
|
@@ -14,7 +14,7 @@ import { useWithOrchestratorTheme } from '@/hooks';
|
|
|
14
14
|
export const RenderFormErrors = () => {
|
|
15
15
|
const { errorStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const errorDetails = useGetValidationErrors();
|
|
18
18
|
const t = useTranslations('pydanticForms.userInputForm');
|
|
19
19
|
if (!errorDetails) {
|
|
20
20
|
return <></>;
|
|
@@ -4,7 +4,7 @@ import type { RowRenderComponent } from 'pydantic-forms';
|
|
|
4
4
|
|
|
5
5
|
import { EuiFormRow, EuiText } from '@elastic/eui';
|
|
6
6
|
|
|
7
|
-
import { getCommonFormFieldStyles } from '@/components';
|
|
7
|
+
import { getCommonFormFieldStyles, getDataTestId } from '@/components';
|
|
8
8
|
import { useWithOrchestratorTheme } from '@/hooks';
|
|
9
9
|
|
|
10
10
|
export const Row: RowRenderComponent = ({
|
|
@@ -29,7 +29,7 @@ export const Row: RowRenderComponent = ({
|
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
31
|
<EuiFormRow
|
|
32
|
-
data-testid=
|
|
32
|
+
data-testid={getDataTestId('pydantic-form-row', title)}
|
|
33
33
|
css={formRowStyle}
|
|
34
34
|
label={<Label />}
|
|
35
35
|
labelAppend={<EuiText size="m">{description}</EuiText>}
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
import {
|
|
12
12
|
Locale,
|
|
13
13
|
PydanticForm,
|
|
14
|
+
PydanticFormConfig,
|
|
14
15
|
PydanticFormFieldFormat,
|
|
15
16
|
PydanticFormFieldType,
|
|
16
17
|
zodValidationPresets,
|
|
@@ -262,11 +263,13 @@ export const WfoPydanticForm = ({
|
|
|
262
263
|
|
|
263
264
|
const onSuccess = useCallback(
|
|
264
265
|
(_fieldValues: object, req: object) => {
|
|
265
|
-
const request = req as {
|
|
266
|
-
|
|
267
|
-
|
|
266
|
+
const request = req as {
|
|
267
|
+
status: HttpStatus;
|
|
268
|
+
data: StartProcessResponse;
|
|
269
|
+
};
|
|
270
|
+
if (request?.data?.id) {
|
|
268
271
|
const pfBasePath = isTask ? PATH_TASKS : PATH_WORKFLOWS;
|
|
269
|
-
router.replace(`${pfBasePath}/${
|
|
272
|
+
router.replace(`${pfBasePath}/${request.data.id}`);
|
|
270
273
|
}
|
|
271
274
|
},
|
|
272
275
|
[isTask, router],
|
|
@@ -277,9 +280,13 @@ export const WfoPydanticForm = ({
|
|
|
277
280
|
requestBody = [],
|
|
278
281
|
formKey,
|
|
279
282
|
}) => {
|
|
283
|
+
const userInputs = isTask
|
|
284
|
+
? [...requestBody]
|
|
285
|
+
: [{ ...startProcessPayload }, ...requestBody];
|
|
286
|
+
|
|
280
287
|
const response = startProcess({
|
|
281
288
|
workflowName: formKey,
|
|
282
|
-
userInputs
|
|
289
|
+
userInputs,
|
|
283
290
|
});
|
|
284
291
|
return response
|
|
285
292
|
.then(({ error, data }) => {
|
|
@@ -297,7 +304,10 @@ export const WfoPydanticForm = ({
|
|
|
297
304
|
});
|
|
298
305
|
}
|
|
299
306
|
} else if (data) {
|
|
300
|
-
resolve(
|
|
307
|
+
resolve({
|
|
308
|
+
data,
|
|
309
|
+
status: HttpStatus.Created,
|
|
310
|
+
});
|
|
301
311
|
}
|
|
302
312
|
|
|
303
313
|
resolve({});
|
|
@@ -316,14 +326,14 @@ export const WfoPydanticForm = ({
|
|
|
316
326
|
};
|
|
317
327
|
|
|
318
328
|
return pydanticFormProvider;
|
|
319
|
-
}, [startProcess, startProcessPayload]);
|
|
329
|
+
}, [isTask, startProcess, startProcessPayload]);
|
|
320
330
|
|
|
321
331
|
const handleCancel = useCallback(() => {
|
|
322
332
|
const pfBasePath = isTask ? PATH_TASKS : PATH_WORKFLOWS;
|
|
323
333
|
router.replace(pfBasePath);
|
|
324
334
|
}, [isTask, router]);
|
|
325
335
|
|
|
326
|
-
const config = useMemo(() => {
|
|
336
|
+
const config = useMemo((): PydanticFormConfig => {
|
|
327
337
|
const getLocale = () => {
|
|
328
338
|
if (router.locale) {
|
|
329
339
|
return router.locale as Locale;
|
|
@@ -333,10 +343,8 @@ export const WfoPydanticForm = ({
|
|
|
333
343
|
|
|
334
344
|
return {
|
|
335
345
|
apiProvider: getPydanticFormProvider(),
|
|
336
|
-
allowUntouchedSubmit: true,
|
|
337
346
|
footerRenderer: Footer,
|
|
338
347
|
headerRenderer: Header,
|
|
339
|
-
skipSuccessNotice: true,
|
|
340
348
|
componentMatcherExtender: wfoComponentMatcherExtender,
|
|
341
349
|
labelProvider: pydanticLabelProvider,
|
|
342
350
|
rowRenderer: Row,
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
disableField,
|
|
8
8
|
fieldToComponentMatcher,
|
|
9
9
|
itemizeArrayItem,
|
|
10
|
-
|
|
10
|
+
useGetConfig,
|
|
11
|
+
useGetForm,
|
|
11
12
|
} from 'pydantic-forms';
|
|
12
13
|
|
|
13
14
|
import { EuiIcon } from '@elastic/eui';
|
|
@@ -66,7 +67,9 @@ export const PlusButton = ({
|
|
|
66
67
|
export const WfoArrayField = ({
|
|
67
68
|
pydanticFormField,
|
|
68
69
|
}: PydanticFormElementProps) => {
|
|
69
|
-
const
|
|
70
|
+
const config = useGetConfig();
|
|
71
|
+
const reactHookForm = useGetForm();
|
|
72
|
+
|
|
70
73
|
const disabled = pydanticFormField.attributes?.disabled || false;
|
|
71
74
|
const { control } = reactHookForm;
|
|
72
75
|
const { id: arrayName, arrayItem } = pydanticFormField;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
RenderFields,
|
|
6
6
|
disableField,
|
|
7
7
|
getPydanticFormComponents,
|
|
8
|
-
|
|
8
|
+
useGetConfig,
|
|
9
9
|
} from 'pydantic-forms';
|
|
10
10
|
|
|
11
11
|
import { EuiFlexGroup } from '@elastic/eui';
|
|
@@ -15,7 +15,7 @@ import { getWfoObjectFieldStyles } from './styles';
|
|
|
15
15
|
export const WfoObjectField = ({
|
|
16
16
|
pydanticFormField,
|
|
17
17
|
}: PydanticFormElementProps) => {
|
|
18
|
-
const
|
|
18
|
+
const config = useGetConfig();
|
|
19
19
|
const disabled = pydanticFormField.attributes?.disabled || false;
|
|
20
20
|
const { wfoObjectFieldStyles } = getWfoObjectFieldStyles();
|
|
21
21
|
const components = getPydanticFormComponents(
|
|
@@ -17,3 +17,9 @@ export const getNestedSummaryLabel = (
|
|
|
17
17
|
}
|
|
18
18
|
return String(value);
|
|
19
19
|
};
|
|
20
|
+
|
|
21
|
+
export const getDataTestId = (base: string, title: string) => {
|
|
22
|
+
const dataTestId = base + title.toLowerCase().replace(/\s+/g, '-');
|
|
23
|
+
const generateRandomString = Math.random().toString(36).substring(2, 7);
|
|
24
|
+
return `${dataTestId}-${generateRandomString}`;
|
|
25
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '5.
|
|
1
|
+
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '5.7.0';
|
|
@@ -120,7 +120,7 @@ export const WfoEnvSettings = () => {
|
|
|
120
120
|
<h2>
|
|
121
121
|
{t('noSettingsExposed')}{' '}
|
|
122
122
|
<a
|
|
123
|
-
href="https://workfloworchestrator.org/orchestrator-core/reference-docs/app/
|
|
123
|
+
href="https://workfloworchestrator.org/orchestrator-core/reference-docs/app/settings-overview/"
|
|
124
124
|
target="_blank"
|
|
125
125
|
>
|
|
126
126
|
{t('settingsOverviewLink')}
|