@evenicanpm/admin-integrate 2.3.1 → 2.4.1
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-biome$colon$format.log +7 -0
- package/CHANGELOG.md +9 -0
- package/documents/Process/get-process-details.ts +0 -2
- package/documents/ProcessConfig/fragments.ts +2 -2
- package/documents/ProcessExport/read.ts +0 -2
- package/documents/ProcessTemplate/fragments.ts +0 -8
- package/package.json +43 -24
- package/src/components/integration-view/edges/default-edge.tsx +2 -1
- package/src/components/integration-view/integration-view.tsx +2 -2
- package/src/components/integration-view/nodes/add-node.tsx +2 -1
- package/src/components/integration-view/nodes/connection-node.tsx +2 -1
- package/src/components/integration-view/nodes/empty-node.tsx +2 -1
- package/src/components/integration-view/nodes/entry-node.tsx +2 -1
- package/src/components/integration-view/nodes/execution-entry-node.tsx +2 -1
- package/src/components/integration-view/nodes/execution-task-node.tsx +2 -1
- package/src/components/integration-view/nodes/group-node.tsx +2 -1
- package/src/components/integration-view/nodes/row-node.tsx +2 -1
- package/src/components/integration-view/nodes/task-node.tsx +2 -1
- package/src/components/list-filter/list-filter.tsx +0 -2
- package/src/components/templatesV2/inputs/FormikPageBody.tsx +0 -1
- package/src/components/templatesV2/inputs/primitives/TextWithQueryInput.tsx +1 -20
- package/src/components/templatesV2/inputs/renderers/renderFormControl.tsx +0 -4
- package/src/components/templatesV2/pageForm.tsx +1 -1
- package/src/components/templatesV2/types.tsx +2 -2
- package/src/components/templatesV2/wizard.tsx +12 -61
- package/src/global.d.ts +3 -0
- package/src/pages/integration-create/integration-create.tsx +33 -41
- package/src/pages/integration-create/pre-creation-step.tsx +1 -1
- package/src/pages/integration-create/template-list-step.tsx +13 -8
- package/src/pages/integration-create/template-options-step.tsx +10 -30
- package/src/pages/integration-create/wizard-step.tsx +1 -15
- package/src/pages/integration-details/integration-details.tsx +13 -42
- package/src/pages/integration-details/task-drawer/add-task.tsx +0 -1
- package/src/pages/integration-details/task-drawer/edit-task.tsx +6 -25
- package/src/pages/integration-details/task-drawer/task-reducer.ts +0 -6
- package/tsconfig.json +6 -20
- package/src/components/templatesV2/utils/parseTemplateValuesFromConfig.ts +0 -311
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
[43m[30m WARN [39m[49m Failed to replace env in config: ${NPM_TOKEN}
|
|
3
|
+
../../apps/strapi | [43m[30m WARN [39m[49m Unsupported engine: wanted: {"node":">=18.0.0 <=22.x.x"} (current: {"node":"v24.16.0","pnpm":"11.0.0"})
|
|
4
|
+
[2m$ pnpm dlx @biomejs/biome check --write .[22m
|
|
5
|
+
[43m[30m WARN [39m[49m Failed to replace env in config: ${NPM_TOKEN}
|
|
6
|
+
[43m[30m WARN [39m[49m Failed to replace env in config: ${NPM_TOKEN}
|
|
7
|
+
[0m[34mChecked 275 files in 489[0m[0m[2m[34mms[0m[0m[34m.[0m[0m[34m No fixes applied.[0m
|
package/CHANGELOG.md
ADDED
|
@@ -63,6 +63,8 @@ export const ENDPOINT_EXPORT_FRAGMENT = gql`
|
|
|
63
63
|
Enabled
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
TemplateConfig
|
|
67
|
+
ProcessTemplateId
|
|
66
68
|
}
|
|
67
69
|
`;
|
|
68
70
|
|
|
@@ -107,8 +109,6 @@ export const PROCESS_EXPORT_FRAGMENT = gql`
|
|
|
107
109
|
Sort
|
|
108
110
|
Params
|
|
109
111
|
ParallelProcessingGroup
|
|
110
|
-
DirectionTypeId
|
|
111
|
-
ProcessTemplateId
|
|
112
112
|
}
|
|
113
113
|
ProcessIcon
|
|
114
114
|
IsTriggered
|
|
@@ -7,7 +7,6 @@ export const PROCESS_TEMPLATE_FRAGMENT = gql`
|
|
|
7
7
|
isActive
|
|
8
8
|
created
|
|
9
9
|
modified
|
|
10
|
-
directionTypeId
|
|
11
10
|
pages {
|
|
12
11
|
id
|
|
13
12
|
title
|
|
@@ -48,13 +47,6 @@ export const PROCESS_TEMPLATE_FRAGMENT = gql`
|
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
|
-
mappings {
|
|
52
|
-
fieldName
|
|
53
|
-
jsonPath
|
|
54
|
-
jsonValuePath
|
|
55
|
-
format
|
|
56
|
-
inputTypeCode
|
|
57
|
-
}
|
|
58
50
|
}
|
|
59
51
|
`;
|
|
60
52
|
|
package/package.json
CHANGED
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
2
|
+
"name": "@evenicanpm/admin-integrate",
|
|
3
|
+
"version": "2.4.1",
|
|
4
|
+
"description": "e4Integrate Admin Panel",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./*": "./*"
|
|
9
|
+
},
|
|
10
|
+
"author": "Evenica",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"@dnd-kit/core": "^6.3.1",
|
|
14
|
+
"@dnd-kit/modifiers": "^9.0.0",
|
|
15
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
16
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
17
|
+
"@emotion/react": "^11.11.3",
|
|
18
|
+
"@emotion/styled": "^11.11.0",
|
|
19
|
+
"@mui/icons-material": "^6.1.7",
|
|
20
|
+
"@mui/material": "^6.1.7",
|
|
21
|
+
"@mui/system": "^6.3.1",
|
|
22
|
+
"@tanstack/react-query": "^5.100.4",
|
|
23
|
+
"@xyflow/react": "^12.8.4",
|
|
24
|
+
"elkjs": "^0.10.0",
|
|
25
|
+
"lodash": "^4.17.21",
|
|
26
|
+
"react": "^19.2.7",
|
|
27
|
+
"react-dom": "^19.2.7"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@emotion/react": "^11.11.3",
|
|
31
|
+
"@emotion/styled": "^11.11.0",
|
|
32
|
+
"@mui/icons-material": "^6.1.7",
|
|
33
|
+
"@mui/material": "^6.1.7",
|
|
34
|
+
"@mui/system": "^6.3.1",
|
|
35
|
+
"@types/react": "^19.2.2",
|
|
36
|
+
"@types/react-dom": "^19.2.2",
|
|
37
|
+
"react": "^19.2.7",
|
|
38
|
+
"react-dom": "^19.2.7",
|
|
39
|
+
"typescript": "5.9.2"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseEdge, type EdgeProps, getSmoothStepPath } from "@xyflow/react";
|
|
2
|
+
import type React from "react";
|
|
2
3
|
|
|
3
4
|
export function DefaultEdge({
|
|
4
5
|
id,
|
|
@@ -7,7 +8,7 @@ export function DefaultEdge({
|
|
|
7
8
|
targetX,
|
|
8
9
|
targetY,
|
|
9
10
|
markerEnd,
|
|
10
|
-
}: EdgeProps):
|
|
11
|
+
}: EdgeProps): React.ReactElement {
|
|
11
12
|
const [edgePath] = getSmoothStepPath({
|
|
12
13
|
sourceX,
|
|
13
14
|
sourceY,
|
|
@@ -432,7 +432,7 @@ const IntegrationView: React.FC<Props> = ({
|
|
|
432
432
|
);
|
|
433
433
|
}, [drawerOpen, selectedProcessTaskId]);
|
|
434
434
|
|
|
435
|
-
const handleNodeDragStart = (_e:
|
|
435
|
+
const handleNodeDragStart = (_e: MouseEvent | TouchEvent, node: Node) => {
|
|
436
436
|
let edgesFiltered = [];
|
|
437
437
|
|
|
438
438
|
const edgeList: FlowEdge[] = [];
|
|
@@ -479,7 +479,7 @@ const IntegrationView: React.FC<Props> = ({
|
|
|
479
479
|
setNodes(nodesFiltered);
|
|
480
480
|
};
|
|
481
481
|
|
|
482
|
-
const handleNodeDragEnd = (_e:
|
|
482
|
+
const handleNodeDragEnd = (_e: MouseEvent | TouchEvent, node: Node) => {
|
|
483
483
|
const nodeY = node?.position?.y ?? 0;
|
|
484
484
|
const nodeH = node?.height ?? 0;
|
|
485
485
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
|
|
2
2
|
import { IconButton, useTheme } from "@mui/material";
|
|
3
|
+
import type React from "react";
|
|
3
4
|
|
|
4
|
-
export function AddNode():
|
|
5
|
+
export function AddNode(): React.ReactElement {
|
|
5
6
|
const theme = useTheme();
|
|
6
7
|
|
|
7
8
|
return (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Handle, Position } from "@xyflow/react";
|
|
2
|
+
import type React from "react";
|
|
2
3
|
|
|
3
|
-
export function ConnectionNode():
|
|
4
|
+
export function ConnectionNode(): React.ReactElement {
|
|
4
5
|
return (
|
|
5
6
|
<div>
|
|
6
7
|
<Handle type="source" position={Position.Bottom} style={{ opacity: 1 }} />
|
|
@@ -2,8 +2,9 @@ import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
|
|
|
2
2
|
import { Box, Card, CardContent, CardHeader, Typography } from "@mui/material";
|
|
3
3
|
import { Handle, type NodeProps, Position } from "@xyflow/react";
|
|
4
4
|
import { useTranslations } from "next-intl";
|
|
5
|
+
import type React from "react";
|
|
5
6
|
|
|
6
|
-
export function EmptyNode(props: NodeProps):
|
|
7
|
+
export function EmptyNode(props: NodeProps): React.ReactElement {
|
|
7
8
|
const t = useTranslations("Integrate.IntegrationDetails.View.EmptyNode");
|
|
8
9
|
return (
|
|
9
10
|
<Box sx={{ opacity: props.data.disabled ? 0.5 : 1 }}>
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
} from "@mui/material";
|
|
10
10
|
import { Handle, type NodeProps, Position } from "@xyflow/react";
|
|
11
11
|
import { useTranslations } from "next-intl";
|
|
12
|
+
import type React from "react";
|
|
12
13
|
import { inputIcon, timerIcon, triggerIcon } from "../task-icon";
|
|
13
14
|
|
|
14
|
-
export function EntryNode(props: NodeProps):
|
|
15
|
+
export function EntryNode(props: NodeProps): React.ReactElement {
|
|
15
16
|
const t = useTranslations("Integrate.IntegrationDetails.View.EntryNode");
|
|
16
17
|
|
|
17
18
|
const theme = useTheme();
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
useTheme,
|
|
10
10
|
} from "@mui/material";
|
|
11
11
|
import { Handle, type NodeProps, Position } from "@xyflow/react";
|
|
12
|
+
import type React from "react";
|
|
12
13
|
import type { ReactNode } from "react";
|
|
13
14
|
|
|
14
|
-
export function ExecutionEntryNode(props: NodeProps):
|
|
15
|
+
export function ExecutionEntryNode(props: NodeProps): React.ReactElement {
|
|
15
16
|
const theme = useTheme();
|
|
16
17
|
const styles = getStyles(theme, props);
|
|
17
18
|
|
|
@@ -2,9 +2,10 @@ import type { ProcessTaskExecution } from "@evenicanpm/admin-core/api/e4/graphql
|
|
|
2
2
|
import { ExecutionTag } from "@evenicanpm/admin-integrate/components/execution";
|
|
3
3
|
import { Box, Card, CardContent, Typography, useTheme } from "@mui/material";
|
|
4
4
|
import { Handle, type NodeProps, Position } from "@xyflow/react";
|
|
5
|
+
import type React from "react";
|
|
5
6
|
import { mapIconByOrchestrationType } from "../task-icon";
|
|
6
7
|
|
|
7
|
-
export function ExecutionTaskNode(props: NodeProps):
|
|
8
|
+
export function ExecutionTaskNode(props: NodeProps): React.ReactElement {
|
|
8
9
|
const theme = useTheme();
|
|
9
10
|
|
|
10
11
|
const borderColor = () => {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
|
|
2
2
|
import { Box, Card, CardContent, CardHeader, Typography } from "@mui/material";
|
|
3
3
|
import { Handle, type NodeProps, Position } from "@xyflow/react";
|
|
4
|
+
import type React from "react";
|
|
4
5
|
|
|
5
|
-
export function GroupNode(props: NodeProps):
|
|
6
|
+
export function GroupNode(props: NodeProps): React.ReactElement {
|
|
6
7
|
return (
|
|
7
8
|
<Box sx={{ opacity: props.data.disabled ? 0.5 : 1 }}>
|
|
8
9
|
<Card
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Box } from "@mui/material";
|
|
2
2
|
import type { NodeProps } from "@xyflow/react";
|
|
3
|
+
import type React from "react";
|
|
3
4
|
|
|
4
|
-
export function RowNode(props: NodeProps):
|
|
5
|
+
export function RowNode(props: NodeProps): React.ReactElement {
|
|
5
6
|
return (
|
|
6
7
|
// <Box sx={{ opacity: props.data.disabled ? 0.5 : 1 }}>
|
|
7
8
|
<Box>
|
|
@@ -8,10 +8,11 @@ import {
|
|
|
8
8
|
useTheme,
|
|
9
9
|
} from "@mui/material";
|
|
10
10
|
import { Handle, type NodeProps, Position } from "@xyflow/react";
|
|
11
|
+
import type React from "react";
|
|
11
12
|
import type { ProcessTask } from "../../../../../admin-core/src/api/e4/graphqlRequestSdk";
|
|
12
13
|
import { mapIconByOrchestrationType } from "../task-icon";
|
|
13
14
|
|
|
14
|
-
export function TaskNode(props: NodeProps):
|
|
15
|
+
export function TaskNode(props: NodeProps): React.ReactElement {
|
|
15
16
|
const theme = useTheme();
|
|
16
17
|
|
|
17
18
|
return (
|
|
@@ -74,14 +74,12 @@ const ListFilter = function ListFilter<FilterShape extends Filters>(
|
|
|
74
74
|
(values, [key, filter]) => {
|
|
75
75
|
if (filter.type === "select" && filter.value) {
|
|
76
76
|
return Object.assign(values, {
|
|
77
|
-
// @ts-expect-error
|
|
78
77
|
[key]: filter.options.find((o) => o.id === filter.value[0].id),
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
80
|
if (filter.type === "multiSelect" && filter.value) {
|
|
82
81
|
return Object.assign(values, {
|
|
83
82
|
[key]: filter.options.filter((o) =>
|
|
84
|
-
// @ts-expect-error
|
|
85
83
|
filter.value.find((v) => v.id === o.id),
|
|
86
84
|
),
|
|
87
85
|
});
|
|
@@ -66,8 +66,6 @@ interface DisplayStateInput {
|
|
|
66
66
|
helpText?: string | null;
|
|
67
67
|
validating: boolean;
|
|
68
68
|
readOnly?: boolean;
|
|
69
|
-
isEditableAfterCreate?: boolean;
|
|
70
|
-
isCreateMode?: boolean;
|
|
71
69
|
}
|
|
72
70
|
|
|
73
71
|
function getInputDisplayState({
|
|
@@ -77,14 +75,11 @@ function getInputDisplayState({
|
|
|
77
75
|
helpText,
|
|
78
76
|
validating,
|
|
79
77
|
readOnly,
|
|
80
|
-
isEditableAfterCreate,
|
|
81
|
-
isCreateMode,
|
|
82
78
|
}: DisplayStateInput): {
|
|
83
79
|
displayError: string | undefined;
|
|
84
80
|
displayHelpText: string;
|
|
85
81
|
formHelperTextSx: SxProps<Theme>;
|
|
86
82
|
isDisabled: boolean;
|
|
87
|
-
isCreateMode: boolean;
|
|
88
83
|
} {
|
|
89
84
|
const showError = Boolean(error);
|
|
90
85
|
const effectiveValidation = getEffectiveValidation(
|
|
@@ -99,11 +94,7 @@ function getInputDisplayState({
|
|
|
99
94
|
const isError = showError || effectiveValidation?.isValid === false;
|
|
100
95
|
const displayError = getDisplayError(validating, isError, helperMessage);
|
|
101
96
|
const displayHelpText = validating ? "Checking…" : helperMessage;
|
|
102
|
-
const isDisabled = Boolean(
|
|
103
|
-
readOnly ||
|
|
104
|
-
validating ||
|
|
105
|
-
(isEditableAfterCreate === false && !isCreateMode),
|
|
106
|
-
);
|
|
97
|
+
const isDisabled = Boolean(readOnly || validating);
|
|
107
98
|
const formHelperTextSx: SxProps<Theme> = {
|
|
108
99
|
...(validating && { color: "text.secondary" }),
|
|
109
100
|
...(isSuccess && !validating && { color: "success.main" }),
|
|
@@ -114,7 +105,6 @@ function getInputDisplayState({
|
|
|
114
105
|
displayHelpText,
|
|
115
106
|
formHelperTextSx,
|
|
116
107
|
isDisabled,
|
|
117
|
-
isCreateMode: isCreateMode || false,
|
|
118
108
|
};
|
|
119
109
|
}
|
|
120
110
|
|
|
@@ -138,8 +128,6 @@ export interface TextWithQueryInputProps {
|
|
|
138
128
|
options?: SelectorOption[];
|
|
139
129
|
/** Result from validateFieldOnSubmit (on Next click); shown below field. */
|
|
140
130
|
submitValidationResult?: SubmitValidationResult | null;
|
|
141
|
-
isEditableAfterCreate?: boolean;
|
|
142
|
-
isCreateMode?: boolean;
|
|
143
131
|
}
|
|
144
132
|
|
|
145
133
|
export function TextWithQueryInput({
|
|
@@ -159,8 +147,6 @@ export function TextWithQueryInput({
|
|
|
159
147
|
placeholder,
|
|
160
148
|
options = [],
|
|
161
149
|
submitValidationResult,
|
|
162
|
-
isEditableAfterCreate,
|
|
163
|
-
isCreateMode,
|
|
164
150
|
}: Readonly<TextWithQueryInputProps>) {
|
|
165
151
|
const [validation, setValidation] = React.useState<{
|
|
166
152
|
isValid: boolean;
|
|
@@ -170,7 +156,6 @@ export function TextWithQueryInput({
|
|
|
170
156
|
|
|
171
157
|
const handleBlur = React.useCallback(async () => {
|
|
172
158
|
onBlur?.();
|
|
173
|
-
if (isEditableAfterCreate === false && !isCreateMode) return;
|
|
174
159
|
const strValue = valueToString(value);
|
|
175
160
|
if (!strValue && inputType !== InputType.CHECKBOX) {
|
|
176
161
|
setValidation(null);
|
|
@@ -210,8 +195,6 @@ export function TextWithQueryInput({
|
|
|
210
195
|
onBlur,
|
|
211
196
|
validateFormikBeforeApi,
|
|
212
197
|
setFieldValidationInProgress,
|
|
213
|
-
isEditableAfterCreate,
|
|
214
|
-
isCreateMode,
|
|
215
198
|
]);
|
|
216
199
|
|
|
217
200
|
if (readOnly) {
|
|
@@ -233,8 +216,6 @@ export function TextWithQueryInput({
|
|
|
233
216
|
helpText,
|
|
234
217
|
validating,
|
|
235
218
|
readOnly,
|
|
236
|
-
isEditableAfterCreate,
|
|
237
|
-
isCreateMode,
|
|
238
219
|
});
|
|
239
220
|
|
|
240
221
|
const clearValidationAndSet = (v: TextWithQueryValue) => {
|
|
@@ -200,7 +200,6 @@ export function renderFormControl({
|
|
|
200
200
|
disabledFields,
|
|
201
201
|
setFieldValidationInProgress,
|
|
202
202
|
submitValidationResults,
|
|
203
|
-
isCreateMode,
|
|
204
203
|
}: {
|
|
205
204
|
input: ProcessTemplateInput;
|
|
206
205
|
templateId: string;
|
|
@@ -222,7 +221,6 @@ export function renderFormControl({
|
|
|
222
221
|
string,
|
|
223
222
|
{ isValid: boolean; message: string }
|
|
224
223
|
>;
|
|
225
|
-
isCreateMode?: boolean;
|
|
226
224
|
}) {
|
|
227
225
|
const k = templateFieldKey(templateId, input.fieldName ?? "");
|
|
228
226
|
const err = errors[k] ?? null;
|
|
@@ -265,8 +263,6 @@ export function renderFormControl({
|
|
|
265
263
|
setFieldValidationInProgress={setFieldValidationInProgress}
|
|
266
264
|
options={getSelectorOptionsFromInput(input)}
|
|
267
265
|
submitValidationResult={submitValidationResult}
|
|
268
|
-
isEditableAfterCreate={input.isEditableAfterCreate ?? true}
|
|
269
|
-
isCreateMode={isCreateMode}
|
|
270
266
|
/>
|
|
271
267
|
)}
|
|
272
268
|
</Field>
|
|
@@ -19,8 +19,8 @@ export type ProcessTemplateInputSchema = ArrayElement<
|
|
|
19
19
|
export type Data = { processTemplate: ProcessTemplate[] };
|
|
20
20
|
|
|
21
21
|
export type ProcessTemplateFilter = {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
processTemplateGroupId?: string | null;
|
|
23
|
+
processTemplateId?: string | null;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export type FieldValue =
|
|
@@ -21,10 +21,6 @@ import {
|
|
|
21
21
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
22
22
|
import React, { useEffect, useRef, useState } from "react";
|
|
23
23
|
import { applyTemplateConfig, InputType } from "./inputs";
|
|
24
|
-
import {
|
|
25
|
-
parseWithMappings,
|
|
26
|
-
type Mapping,
|
|
27
|
-
} from "./utils/parseTemplateValuesFromConfig";
|
|
28
24
|
import PageForm from "./pageForm";
|
|
29
25
|
import {
|
|
30
26
|
type FieldValue,
|
|
@@ -281,8 +277,7 @@ function PageNav({
|
|
|
281
277
|
|
|
282
278
|
interface Props {
|
|
283
279
|
readonly metadata: Metadata;
|
|
284
|
-
readonly
|
|
285
|
-
readonly targetTemplateId?: string;
|
|
280
|
+
readonly processTemplateGroupId?: string;
|
|
286
281
|
readonly processTemplateId?: string;
|
|
287
282
|
readonly handleBack?: (event?: React.MouseEventHandler) => void;
|
|
288
283
|
readonly handleFinish?: (event?: React.MouseEventHandler) => void;
|
|
@@ -295,7 +290,6 @@ interface Props {
|
|
|
295
290
|
readonly isCreateMode?: boolean;
|
|
296
291
|
readonly readOnly?: boolean;
|
|
297
292
|
readonly sharedCount?: (count: number) => void;
|
|
298
|
-
readonly config: Record<string, unknown>;
|
|
299
293
|
}
|
|
300
294
|
|
|
301
295
|
export default function Wizard({ metadata, sharedCount, ...props }: Props) {
|
|
@@ -310,54 +304,11 @@ export default function Wizard({ metadata, sharedCount, ...props }: Props) {
|
|
|
310
304
|
|
|
311
305
|
const { data, isLoading } = getProcessTemplate.useData({
|
|
312
306
|
input: {
|
|
313
|
-
|
|
314
|
-
|
|
307
|
+
processTemplateGroupId: props.processTemplateGroupId || null,
|
|
308
|
+
processTemplateId: props.processTemplateId || null,
|
|
315
309
|
},
|
|
316
310
|
});
|
|
317
311
|
|
|
318
|
-
const parsedTemplateConfigs = React.useMemo((): Array<
|
|
319
|
-
Record<string, unknown>
|
|
320
|
-
> => {
|
|
321
|
-
if (props.config == null) return [];
|
|
322
|
-
type TemplateEntry = {
|
|
323
|
-
id?: unknown;
|
|
324
|
-
processTemplateId?: unknown;
|
|
325
|
-
mappings?: unknown[];
|
|
326
|
-
};
|
|
327
|
-
const allTemplates =
|
|
328
|
-
(data as { processTemplate?: TemplateEntry[] })?.processTemplate ?? [];
|
|
329
|
-
return allTemplates.flatMap((template) => {
|
|
330
|
-
const mappings = (template?.mappings ?? []) as Mapping[];
|
|
331
|
-
if (!mappings.length) return [];
|
|
332
|
-
const processTemplateId = template?.processTemplateId ?? template?.id;
|
|
333
|
-
return [
|
|
334
|
-
{
|
|
335
|
-
...parseWithMappings(
|
|
336
|
-
props.config as { json: Record<string, unknown> },
|
|
337
|
-
mappings,
|
|
338
|
-
),
|
|
339
|
-
processTemplateId,
|
|
340
|
-
},
|
|
341
|
-
];
|
|
342
|
-
});
|
|
343
|
-
}, [data, props.config]);
|
|
344
|
-
|
|
345
|
-
const parsedTemplateConfigString = React.useMemo(
|
|
346
|
-
() =>
|
|
347
|
-
parsedTemplateConfigs.length > 0
|
|
348
|
-
? JSON.stringify(parsedTemplateConfigs[0])
|
|
349
|
-
: null,
|
|
350
|
-
[parsedTemplateConfigs],
|
|
351
|
-
);
|
|
352
|
-
|
|
353
|
-
const parsedAllTemplateConfigsString = React.useMemo(
|
|
354
|
-
() =>
|
|
355
|
-
parsedTemplateConfigs.length > 0
|
|
356
|
-
? JSON.stringify(parsedTemplateConfigs)
|
|
357
|
-
: null,
|
|
358
|
-
[parsedTemplateConfigs],
|
|
359
|
-
);
|
|
360
|
-
|
|
361
312
|
const [initialValues, setInitialValues] = React.useState<FormState>({});
|
|
362
313
|
// aggregated form values across pages
|
|
363
314
|
const [aggregatedValues, setAggregatedValues] =
|
|
@@ -389,6 +340,7 @@ export default function Wizard({ metadata, sharedCount, ...props }: Props) {
|
|
|
389
340
|
const typedData = data as GetProcessTemplateQuery;
|
|
390
341
|
if (typedData?.processTemplate) {
|
|
391
342
|
const templates = typedData.processTemplate as ProcessTemplate[];
|
|
343
|
+
|
|
392
344
|
setTemplates(templates);
|
|
393
345
|
setTemplatesSorted(
|
|
394
346
|
templates.map((t) => ({
|
|
@@ -473,12 +425,12 @@ export default function Wizard({ metadata, sharedCount, ...props }: Props) {
|
|
|
473
425
|
);
|
|
474
426
|
|
|
475
427
|
useEffect(() => {
|
|
476
|
-
if (
|
|
477
|
-
|
|
428
|
+
if (props.templateConfig) {
|
|
429
|
+
const config = JSON.parse(props.templateConfig);
|
|
478
430
|
applyTemplateConfig(
|
|
479
431
|
{
|
|
480
|
-
name:
|
|
481
|
-
templateConfig:
|
|
432
|
+
name: config.taskName as string,
|
|
433
|
+
templateConfig: props.templateConfig,
|
|
482
434
|
} as SearchOption,
|
|
483
435
|
(templateId: string, fieldName: string, value: FieldValue) => {
|
|
484
436
|
const key = templateFieldKey(templateId, fieldName);
|
|
@@ -486,7 +438,7 @@ export default function Wizard({ metadata, sharedCount, ...props }: Props) {
|
|
|
486
438
|
},
|
|
487
439
|
);
|
|
488
440
|
}
|
|
489
|
-
}, [
|
|
441
|
+
}, [props.templateConfig]);
|
|
490
442
|
|
|
491
443
|
const clearTemplateFields = (templateId: string) => {
|
|
492
444
|
setAggregatedValues((prev) => {
|
|
@@ -648,9 +600,8 @@ export default function Wizard({ metadata, sharedCount, ...props }: Props) {
|
|
|
648
600
|
isLoading &&
|
|
649
601
|
!currentFlat &&
|
|
650
602
|
!currentTemplate &&
|
|
651
|
-
!
|
|
652
|
-
!props.
|
|
653
|
-
!props.targetTemplateId;
|
|
603
|
+
!props.templateConfig &&
|
|
604
|
+
(!props.processTemplateGroupId || !props.processTemplateId);
|
|
654
605
|
if (showLoading) {
|
|
655
606
|
return (
|
|
656
607
|
<Box sx={{ padding: theme.spacing(10, 3) }}>
|
|
@@ -725,7 +676,7 @@ export default function Wizard({ metadata, sharedCount, ...props }: Props) {
|
|
|
725
676
|
isCreateMode={props.isCreateMode}
|
|
726
677
|
disabledFields={disabledFields}
|
|
727
678
|
setFieldsDisabled={setFieldsDisabled}
|
|
728
|
-
templateConfig={
|
|
679
|
+
templateConfig={props.templateConfig || ""}
|
|
729
680
|
setFieldValidationInProgress={setIsFieldValidationInProgress}
|
|
730
681
|
submitValidationResults={submitValidationResults ?? undefined}
|
|
731
682
|
/>
|
package/src/global.d.ts
ADDED