@evenicanpm/admin-integrate 1.8.1 → 2.0.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/documents/ConfigImport/configuration-import.ts +1 -1
- package/documents/Endpoint/list.ts +3 -3
- package/documents/Process/list.ts +3 -3
- package/documents/ProcessExecution/list.ts +2 -2
- package/documents/ProcessExport/read.ts +1 -1
- package/documents/ProcessSchedule/read.ts +1 -1
- package/documents/ProcessScheduleGroup/read.ts +3 -3
- package/documents/ProcessTask/fragments.ts +4 -0
- package/documents/ProcessTemplate/fragments.ts +30 -0
- package/documents/ProcessTemplate/list.ts +29 -0
- package/documents/ProcessTemplate/read.ts +1 -1
- package/documents/ScheduledProcess/list.ts +1 -1
- package/package.json +2 -2
- package/src/api/process-config/mutation/process-config-import.mutation.ts +1 -1
- package/src/api/templates/queries/get-field-values.query.ts +48 -0
- package/src/api/templates/queries/get-field-values.server.ts +9 -0
- package/src/api/templates/queries/index.ts +4 -0
- package/src/api/templates/queries/types.ts +2 -2
- package/src/api/templates/queries/validate-field-on-check.query.ts +22 -0
- package/src/api/templates/queries/validate-field-on-check.server.ts +30 -0
- package/src/api/templates/queries/validate-field-on-submit.server.ts +18 -0
- package/src/components/data-table/table-row.tsx +1 -1
- package/src/components/icons/up-down.tsx +1 -0
- package/src/components/integration-view/animated-svg.tsx +0 -1
- package/src/components/integration-view/elk-types.ts +1 -1
- package/src/components/integration-view/integration-view.tsx +274 -187
- package/src/components/integration-view/nodes/execution-entry-node.tsx +3 -2
- package/src/components/integration-view/nodes/task-node.tsx +1 -1
- package/src/components/integration-view/types.ts +2 -0
- package/src/components/integration-view/utils/mapping.ts +68 -48
- package/src/components/list-filter/list-filter-types.ts +6 -0
- package/src/components/list-filter/list-filter.tsx +21 -15
- package/src/components/list-filter/multi-select-filter.tsx +7 -7
- package/src/components/list-filter/select-filter.tsx +6 -6
- package/src/components/scheduler/day-selector.tsx +1 -1
- package/src/components/templatesV2/inputs/FormikPageBody.tsx +191 -0
- package/src/components/templatesV2/inputs/context/FormModeContext.tsx +31 -0
- package/src/components/templatesV2/inputs/context/TemplateContext.tsx +37 -0
- package/src/components/templatesV2/inputs/field-names.ts +8 -0
- package/src/components/templatesV2/inputs/form-type.ts +54 -0
- package/src/components/templatesV2/inputs/index.tsx +33 -0
- package/src/components/templatesV2/inputs/input-type.ts +23 -0
- package/src/components/templatesV2/inputs/primitives/CheckboxInput.tsx +45 -0
- package/src/components/templatesV2/inputs/primitives/NumberInput.tsx +58 -0
- package/src/components/templatesV2/inputs/primitives/SelectorInput.tsx +111 -0
- package/src/components/templatesV2/inputs/primitives/TextInput.tsx +55 -0
- package/src/components/templatesV2/inputs/primitives/TextWithQueryInput.tsx +292 -0
- package/src/components/templatesV2/inputs/primitives/index.ts +10 -0
- package/src/components/templatesV2/inputs/renderers/index.ts +2 -0
- package/src/components/templatesV2/inputs/renderers/renderFormControl.tsx +384 -0
- package/src/components/templatesV2/inputs/renderers/renderSearchInput.tsx +128 -0
- package/src/components/templatesV2/inputs/search/MultiTextSearchInput.tsx +87 -0
- package/src/components/templatesV2/inputs/search/SearchInputWrapper.tsx +113 -0
- package/src/components/templatesV2/inputs/search/TextSearchInput.tsx +309 -0
- package/src/components/templatesV2/inputs/search/index.ts +4 -0
- package/src/components/templatesV2/inputs/search/search-query-key.ts +23 -0
- package/src/components/templatesV2/inputs/search/useFieldValuesOptions.ts +58 -0
- package/src/components/templatesV2/inputs/search/useSearchInput.ts +79 -0
- package/src/components/templatesV2/inputs/table/InputTable.tsx +268 -0
- package/src/components/templatesV2/inputs/table/index.ts +1 -0
- package/src/components/templatesV2/inputs/utils/applyTemplateConfig.ts +28 -0
- package/src/components/templatesV2/inputs/utils/arrangeInputs.ts +52 -0
- package/src/components/templatesV2/inputs/utils/index.ts +6 -0
- package/src/components/templatesV2/inputs/utils/parseQueryName.ts +20 -0
- package/src/components/templatesV2/inputs/utils/renderReadOnlyText.tsx +26 -0
- package/src/components/templatesV2/inputs/utils/selectors.ts +69 -0
- package/src/components/templatesV2/inputs/utils/toStringArray.ts +23 -0
- package/src/components/templatesV2/pageForm.tsx +153 -0
- package/src/components/{templates → templatesV2}/templates-list/templates-list-row.tsx +2 -1
- package/src/components/{templates → templatesV2}/templates-list/templates-list-table.tsx +2 -2
- package/src/components/{templates → templatesV2}/templates-list/templates-list.tsx +19 -28
- package/src/components/{templates → templatesV2}/types.tsx +12 -12
- package/src/components/templatesV2/validation/buildZodSchema.ts +212 -0
- package/src/components/templatesV2/validation/zodFormikValidate.ts +17 -0
- package/src/components/templatesV2/wizard.tsx +746 -0
- package/src/pages/dashboard/dashboard-link-cards.tsx +0 -1
- package/src/pages/dashboard/dashboard-list-sections.tsx +1 -1
- package/src/pages/dashboard/dashboard.tsx +0 -1
- package/src/pages/executions/executions-list/executions-list-table.tsx +0 -1
- package/src/pages/executions/executions.tsx +1 -1
- package/src/pages/integration-create/integration-create-steps.ts +8 -0
- package/src/pages/integration-create/integration-create.tsx +81 -28
- package/src/pages/integration-create/pre-creation-step.tsx +9 -9
- package/src/pages/integration-create/select-step.tsx +3 -3
- package/src/pages/integration-create/template-list-step.tsx +28 -3
- package/src/pages/integration-create/template-options-step.tsx +119 -0
- package/src/pages/integration-create/wizard-step.tsx +5 -4
- package/src/pages/integration-details/import-process/copy-tasks-list.tsx +1 -3
- package/src/pages/integration-details/integration-details.tsx +1 -1
- package/src/pages/integration-details/task-drawer/add-task.tsx +4 -4
- package/src/pages/integration-details/task-drawer/edit-task.tsx +5 -5
- package/src/pages/integration-details/task-drawer/task-drawer.tsx +2 -2
- package/src/components/templates/inputs/index.tsx +0 -1392
- package/src/components/templates/wizard.tsx +0 -737
- /package/src/components/{templates → templatesV2}/index.ts +0 -0
- /package/src/components/{templates → templatesV2}/template-filter.ts +0 -0
- /package/src/components/{templates → templatesV2}/templates-list/index.ts +0 -0
|
@@ -11,7 +11,7 @@ import SnackbarAlert, {
|
|
|
11
11
|
import { getProcessExecutions } from "@evenicanpm/admin-integrate/api/dashboard/queries";
|
|
12
12
|
import DashboardList from "@evenicanpm/admin-integrate/components/dashboard-list";
|
|
13
13
|
import { useTranslations } from "next-intl";
|
|
14
|
-
import
|
|
14
|
+
import { useEffect, useState } from "react";
|
|
15
15
|
|
|
16
16
|
const defaultInput: ProcessExecutionInput = {
|
|
17
17
|
sort: "startDate",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Local page components
|
|
2
2
|
import DashboardLinkCards from "@evenicanpm/admin-integrate/pages/dashboard/dashboard-link-cards";
|
|
3
3
|
import DashboardListSections from "@evenicanpm/admin-integrate/pages/dashboard/dashboard-list-sections";
|
|
4
|
-
import React from "react";
|
|
5
4
|
|
|
6
5
|
export default function IntegrateDashboard() {
|
|
7
6
|
return (
|
|
@@ -6,7 +6,6 @@ import { TableHeader } from "@evenicanpm/admin-integrate/components/data-table";
|
|
|
6
6
|
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
7
7
|
// MUI
|
|
8
8
|
import { type SxProps, Table, TableBody, TableContainer } from "@mui/material";
|
|
9
|
-
import React from "react";
|
|
10
9
|
import type { Item } from "./executions-list";
|
|
11
10
|
|
|
12
11
|
// Local components
|
|
@@ -15,7 +15,7 @@ import type { Head } from "@evenicanpm/admin-integrate/components/data-table/tab
|
|
|
15
15
|
// MUI
|
|
16
16
|
import { Box } from "@mui/material";
|
|
17
17
|
import { useTranslations } from "next-intl";
|
|
18
|
-
import
|
|
18
|
+
import { useState } from "react";
|
|
19
19
|
// Local components
|
|
20
20
|
import ExecutionsList from "./executions-list";
|
|
21
21
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
ConfigExport,
|
|
3
|
+
ConfigImport,
|
|
3
4
|
ConfigurationMergeMutationVariables,
|
|
4
5
|
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
5
6
|
import {
|
|
@@ -11,16 +12,19 @@ import {
|
|
|
11
12
|
IntegrateBreadcrumbs,
|
|
12
13
|
} from "@evenicanpm/admin-integrate/components/breadcrumbs";
|
|
13
14
|
import { IntegrationDetailsHeader } from "@evenicanpm/admin-integrate/components/header";
|
|
14
|
-
import {
|
|
15
|
+
import type { ProcessConfigMerge } from "@evenicanpm/admin-integrate/components/templatesV2/types";
|
|
16
|
+
import { removeTemplateConfig } from "@evenicanpm/admin-integrate/components/templatesV2/wizard";
|
|
15
17
|
import { slugify } from "@evenicanpm/admin-integrate/utils/slugify";
|
|
16
18
|
import { Clear, SaveOutlined } from "@mui/icons-material";
|
|
17
19
|
import { Box, Button, type Theme, useTheme } from "@mui/material";
|
|
18
20
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
19
21
|
import { useTranslations } from "next-intl";
|
|
20
|
-
import { useEffect, useState } from "react";
|
|
22
|
+
import { type SetStateAction, useEffect, useState } from "react";
|
|
23
|
+
import { INTEGRATION_CREATE_STEPS } from "./integration-create-steps";
|
|
21
24
|
import PreCreationStep from "./pre-creation-step";
|
|
22
25
|
import SelectStep from "./select-step";
|
|
23
|
-
import TemplateListStep from "./template-list-step";
|
|
26
|
+
import TemplateListStep, { DirectionType } from "./template-list-step";
|
|
27
|
+
import TemplateOptionsStep from "./template-options-step";
|
|
24
28
|
import WizardStep from "./wizard-step";
|
|
25
29
|
|
|
26
30
|
export default function IntegrationCreate() {
|
|
@@ -50,27 +54,38 @@ export default function IntegrationCreate() {
|
|
|
50
54
|
];
|
|
51
55
|
|
|
52
56
|
const [name, setName] = useState<string>("");
|
|
53
|
-
const [step, setStep] = useState<number>(
|
|
54
|
-
const [processConfig, setProcessConfig] = useState<
|
|
57
|
+
const [step, setStep] = useState<number>(INTEGRATION_CREATE_STEPS.select);
|
|
58
|
+
const [processConfig, setProcessConfig] = useState<ConfigExport | null>(null);
|
|
59
|
+
const [dualSourceThenTarget, setDualSourceThenTarget] = useState(false);
|
|
55
60
|
|
|
56
61
|
useEffect(() => {
|
|
57
62
|
if (searchParams.get("group")) {
|
|
58
|
-
setStep(
|
|
63
|
+
setStep(INTEGRATION_CREATE_STEPS.wizard);
|
|
59
64
|
}
|
|
60
65
|
}, [searchParams]);
|
|
61
66
|
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
if (step === INTEGRATION_CREATE_STEPS.templateOptions) {
|
|
69
|
+
setDualSourceThenTarget(false);
|
|
70
|
+
}
|
|
71
|
+
}, [step]);
|
|
72
|
+
|
|
62
73
|
const handleCancel = () => {
|
|
63
|
-
if (step >
|
|
74
|
+
if (step > INTEGRATION_CREATE_STEPS.select) {
|
|
64
75
|
const confirmClose = confirm(t("Common.unsavedChanges"));
|
|
65
76
|
if (!confirmClose) return;
|
|
66
|
-
setStep(
|
|
77
|
+
setStep(INTEGRATION_CREATE_STEPS.select);
|
|
78
|
+
setDualSourceThenTarget(false);
|
|
67
79
|
router.replace(pathname);
|
|
68
80
|
} else {
|
|
69
81
|
router.push("/e4integrate/integrations");
|
|
70
82
|
}
|
|
71
83
|
};
|
|
72
84
|
|
|
73
|
-
const handleProcessConfigMerge = (
|
|
85
|
+
const handleProcessConfigMerge = (
|
|
86
|
+
configMergeInput: SetStateAction<ProcessConfigMerge | null>,
|
|
87
|
+
) => {
|
|
88
|
+
if (!configMergeInput || typeof configMergeInput === "function") return;
|
|
74
89
|
const newProcessConfigMerge = { ...configMergeInput };
|
|
75
90
|
const code = slugify(name);
|
|
76
91
|
for (const c of newProcessConfigMerge.input.config) {
|
|
@@ -80,13 +95,13 @@ export default function IntegrationCreate() {
|
|
|
80
95
|
|
|
81
96
|
console.log("configMergeInput", configMergeInput);
|
|
82
97
|
|
|
83
|
-
|
|
84
|
-
(item
|
|
98
|
+
const sourceName = configMergeInput?.input?.config?.find(
|
|
99
|
+
(item) => (item?.source as string)?.toLowerCase() === "source",
|
|
85
100
|
)?.uniqueIdentifier;
|
|
86
101
|
|
|
87
102
|
if (sourceName) {
|
|
88
|
-
configMergeInput.input.config = configMergeInput.input
|
|
89
|
-
(item
|
|
103
|
+
configMergeInput.input.config = configMergeInput.input.config.map(
|
|
104
|
+
(item) => {
|
|
90
105
|
if (item?.queues) {
|
|
91
106
|
return {
|
|
92
107
|
...item,
|
|
@@ -108,10 +123,7 @@ export default function IntegrationCreate() {
|
|
|
108
123
|
{
|
|
109
124
|
onSuccess: ({ configurationMerge }) => {
|
|
110
125
|
console.log("configurationMerge", configurationMerge);
|
|
111
|
-
setProcessConfig(
|
|
112
|
-
...configurationMerge,
|
|
113
|
-
CreateIntegrationProc: true,
|
|
114
|
-
});
|
|
126
|
+
setProcessConfig(configurationMerge ?? null);
|
|
115
127
|
},
|
|
116
128
|
onError: (error) => {
|
|
117
129
|
console.error("Update failed:", error);
|
|
@@ -121,9 +133,10 @@ export default function IntegrationCreate() {
|
|
|
121
133
|
};
|
|
122
134
|
|
|
123
135
|
const handleProcessConfigImport = () => {
|
|
136
|
+
if (!processConfig) return;
|
|
124
137
|
processConfigImportMutation.mutate(
|
|
125
138
|
{
|
|
126
|
-
config: processConfig,
|
|
139
|
+
config: processConfig as unknown as ConfigImport,
|
|
127
140
|
reRoutedFromMerge: true,
|
|
128
141
|
},
|
|
129
142
|
{
|
|
@@ -140,16 +153,19 @@ export default function IntegrationCreate() {
|
|
|
140
153
|
useEffect(() => {
|
|
141
154
|
// Case when name of process is edited after config merge has been called (ie on pre-creation step), when sending config to import.
|
|
142
155
|
// If name is changed during wizard step, name is already updated in payload to config merge.
|
|
143
|
-
if (processConfig?.Processes) {
|
|
156
|
+
if (processConfig?.Processes?.[0]) {
|
|
144
157
|
const newConfig = { ...processConfig };
|
|
145
158
|
const code = slugify(name);
|
|
146
|
-
newConfig.Processes[0]
|
|
147
|
-
|
|
159
|
+
const firstProcess = newConfig.Processes?.[0];
|
|
160
|
+
if (firstProcess) {
|
|
161
|
+
firstProcess.Name = name;
|
|
162
|
+
firstProcess.Process = code;
|
|
163
|
+
}
|
|
148
164
|
}
|
|
149
165
|
}, [name]);
|
|
150
166
|
|
|
151
167
|
useEffect(() => {
|
|
152
|
-
if (step ===
|
|
168
|
+
if (step === INTEGRATION_CREATE_STEPS.preCreation && !processConfig) {
|
|
153
169
|
const blankConfig: ConfigExport = {
|
|
154
170
|
Processes: [
|
|
155
171
|
{
|
|
@@ -170,7 +186,11 @@ export default function IntegrationCreate() {
|
|
|
170
186
|
<IntegrationDetailsHeader
|
|
171
187
|
name={name || t("Templates.defaultNewName")}
|
|
172
188
|
setName={setName}
|
|
173
|
-
toolbar={
|
|
189
|
+
toolbar={
|
|
190
|
+
step === INTEGRATION_CREATE_STEPS.preCreation
|
|
191
|
+
? "disabled"
|
|
192
|
+
: "hidden"
|
|
193
|
+
}
|
|
174
194
|
draft
|
|
175
195
|
untitled={name === ""}
|
|
176
196
|
>
|
|
@@ -187,21 +207,54 @@ export default function IntegrationCreate() {
|
|
|
187
207
|
variant="contained"
|
|
188
208
|
startIcon={<SaveOutlined />}
|
|
189
209
|
onClick={handleProcessConfigImport}
|
|
190
|
-
disabled={step !==
|
|
210
|
+
disabled={step !== INTEGRATION_CREATE_STEPS.preCreation}
|
|
191
211
|
>
|
|
192
212
|
{t("Templates.create")}
|
|
193
213
|
</Button>
|
|
194
214
|
</IntegrationDetailsHeader>
|
|
195
215
|
</Box>
|
|
196
|
-
{step ===
|
|
197
|
-
|
|
198
|
-
|
|
216
|
+
{step === INTEGRATION_CREATE_STEPS.select && (
|
|
217
|
+
<SelectStep setStep={setStep} />
|
|
218
|
+
)}
|
|
219
|
+
{step === INTEGRATION_CREATE_STEPS.templateOptions && (
|
|
220
|
+
<TemplateOptionsStep
|
|
221
|
+
setStep={setStep}
|
|
222
|
+
onSourceAndTarget={() => setDualSourceThenTarget(true)}
|
|
223
|
+
/>
|
|
224
|
+
)}
|
|
225
|
+
{/* {step === INTEGRATION_CREATE_STEPS.templateList && <TemplateListStep />} */}
|
|
226
|
+
{step === INTEGRATION_CREATE_STEPS.wizard && (
|
|
199
227
|
<WizardStep
|
|
200
228
|
setStep={setStep}
|
|
201
229
|
setProcessConfigMerge={handleProcessConfigMerge}
|
|
202
230
|
/>
|
|
203
231
|
)}
|
|
204
|
-
{step ===
|
|
232
|
+
{step === INTEGRATION_CREATE_STEPS.preCreation && (
|
|
233
|
+
<PreCreationStep processConfig={processConfig} />
|
|
234
|
+
)}
|
|
235
|
+
{step === INTEGRATION_CREATE_STEPS.sourceTemplateList && (
|
|
236
|
+
<TemplateListStep
|
|
237
|
+
listStepTitle={t("Templates.SelectSource")}
|
|
238
|
+
directionType={DirectionType.Incoming}
|
|
239
|
+
onSelectTemplate={
|
|
240
|
+
dualSourceThenTarget
|
|
241
|
+
? (id) => {
|
|
242
|
+
const p = new URLSearchParams(searchParams.toString());
|
|
243
|
+
p.set(`${t("Templates.sourceGroup")}`, id);
|
|
244
|
+
p.delete(`${t("Templates.group")}`);
|
|
245
|
+
router.replace(`${pathname}?${p}`);
|
|
246
|
+
setStep(INTEGRATION_CREATE_STEPS.targetTemplateList);
|
|
247
|
+
}
|
|
248
|
+
: undefined
|
|
249
|
+
}
|
|
250
|
+
/>
|
|
251
|
+
)}
|
|
252
|
+
{step === INTEGRATION_CREATE_STEPS.targetTemplateList && (
|
|
253
|
+
<TemplateListStep
|
|
254
|
+
listStepTitle={t("Templates.SelectTarget")}
|
|
255
|
+
directionType={DirectionType.Outgoing}
|
|
256
|
+
/>
|
|
257
|
+
)}
|
|
205
258
|
{/* </Card> */}
|
|
206
259
|
</>
|
|
207
260
|
);
|
|
@@ -2,7 +2,7 @@ import { Box, useTheme } from "@mui/material";
|
|
|
2
2
|
import { useReducer } from "react";
|
|
3
3
|
import type {
|
|
4
4
|
ConfigExport,
|
|
5
|
-
|
|
5
|
+
ProcessTask,
|
|
6
6
|
} from "../../../../admin-core/src/api/e4/graphqlRequestSdk";
|
|
7
7
|
import { IntegrationView } from "../../components/integration-view";
|
|
8
8
|
import {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "../integration-details/task-drawer/task-reducer";
|
|
14
14
|
|
|
15
15
|
interface Props {
|
|
16
|
-
processConfig:
|
|
16
|
+
processConfig: ConfigExport | null;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export default function PreCreationStep(props: Readonly<Props>) {
|
|
@@ -44,20 +44,20 @@ export default function PreCreationStep(props: Readonly<Props>) {
|
|
|
44
44
|
canEdit={false}
|
|
45
45
|
//key={viewRefreshKey}
|
|
46
46
|
//data={(data as GetProcessByIdQuery)?.processById as Process}
|
|
47
|
-
config={props.processConfig
|
|
47
|
+
config={props.processConfig ?? undefined}
|
|
48
48
|
variant="process"
|
|
49
49
|
drawerOpen={false}
|
|
50
50
|
processTaskId={undefined}
|
|
51
|
-
onTaskClick={(processTask:
|
|
52
|
-
const endpoint = props.processConfig?.Endpoints.find(
|
|
53
|
-
(ep
|
|
51
|
+
onTaskClick={(processTask: ProcessTask) => {
|
|
52
|
+
const endpoint = (props.processConfig?.Endpoints ?? []).find(
|
|
53
|
+
(ep) => ep?.Name === processTask.endpoint,
|
|
54
54
|
);
|
|
55
55
|
|
|
56
|
-
let templateConfig:
|
|
56
|
+
let templateConfig: string | undefined;
|
|
57
57
|
|
|
58
|
-
if (typeof endpoint
|
|
58
|
+
if (typeof endpoint?.TemplateConfig === "string") {
|
|
59
59
|
templateConfig = endpoint.TemplateConfig;
|
|
60
|
-
} else if (typeof endpoint
|
|
60
|
+
} else if (typeof endpoint?.TemplateConfig === "object") {
|
|
61
61
|
templateConfig = JSON.stringify(endpoint.TemplateConfig);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from "@mui/material";
|
|
16
16
|
import { useTranslations } from "next-intl";
|
|
17
17
|
import type React from "react";
|
|
18
|
+
import { INTEGRATION_CREATE_STEPS } from "./integration-create-steps";
|
|
18
19
|
|
|
19
20
|
interface Props {
|
|
20
21
|
setStep: React.Dispatch<React.SetStateAction<number>>;
|
|
@@ -22,16 +23,15 @@ interface Props {
|
|
|
22
23
|
|
|
23
24
|
export default function SelectStep(props: Readonly<Props>) {
|
|
24
25
|
const t = useTranslations("Integrate.Templates");
|
|
25
|
-
|
|
26
26
|
const theme = useTheme();
|
|
27
27
|
const styles = getStyles(theme);
|
|
28
28
|
|
|
29
29
|
const handleClickBlank = () => {
|
|
30
|
-
props.setStep(
|
|
30
|
+
props.setStep(INTEGRATION_CREATE_STEPS.preCreation);
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const handleClickTemplate = () => {
|
|
34
|
-
props.setStep(
|
|
34
|
+
props.setStep(INTEGRATION_CREATE_STEPS.templateOptions);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
return (
|
|
@@ -4,13 +4,25 @@ import type {
|
|
|
4
4
|
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
5
5
|
import { getProcessTemplateGroups } from "@evenicanpm/admin-integrate/api/templates/queries";
|
|
6
6
|
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
7
|
-
import TemplatesList from "@evenicanpm/admin-integrate/components/
|
|
7
|
+
import TemplatesList from "@evenicanpm/admin-integrate/components/templatesV2/templates-list";
|
|
8
8
|
import { Box, Typography, useTheme } from "@mui/material";
|
|
9
9
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
10
10
|
import { useTranslations } from "next-intl";
|
|
11
11
|
import { useState } from "react";
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export enum DirectionType {
|
|
14
|
+
Incoming = "Incoming",
|
|
15
|
+
Outgoing = "Outgoing",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
listStepTitle?: string;
|
|
20
|
+
directionType?: DirectionType;
|
|
21
|
+
/** When set, skips default `group` URL handoff (e.g. source pick in dual flow). */
|
|
22
|
+
onSelectTemplate?: (id: string) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function TemplateListStep(props?: Props) {
|
|
14
26
|
const t = useTranslations("Integrate.Templates");
|
|
15
27
|
|
|
16
28
|
const router = useRouter();
|
|
@@ -18,6 +30,8 @@ export default function TemplateListStep() {
|
|
|
18
30
|
const searchParams = useSearchParams();
|
|
19
31
|
const theme = useTheme();
|
|
20
32
|
|
|
33
|
+
const title = props?.listStepTitle ?? t("listStepTitle");
|
|
34
|
+
|
|
21
35
|
const heading: Head[] = [
|
|
22
36
|
{
|
|
23
37
|
id: "name",
|
|
@@ -26,6 +40,12 @@ export default function TemplateListStep() {
|
|
|
26
40
|
width: "95%",
|
|
27
41
|
sortable: true,
|
|
28
42
|
},
|
|
43
|
+
// {
|
|
44
|
+
// id: "createdBy",
|
|
45
|
+
// label: t("ListHeader.createdBy"),
|
|
46
|
+
// align: "right",
|
|
47
|
+
// width: "20%",
|
|
48
|
+
// },
|
|
29
49
|
{
|
|
30
50
|
id: "view",
|
|
31
51
|
label: t("ListHeader.actions"),
|
|
@@ -47,6 +67,10 @@ export default function TemplateListStep() {
|
|
|
47
67
|
});
|
|
48
68
|
|
|
49
69
|
const handleRedirect = (id: string) => {
|
|
70
|
+
if (props?.onSelectTemplate) {
|
|
71
|
+
props.onSelectTemplate(id);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
50
74
|
const currentParams = new URLSearchParams(searchParams.toString());
|
|
51
75
|
currentParams.set("group", id);
|
|
52
76
|
router.replace(`${pathname}?${currentParams.toString()}`);
|
|
@@ -61,12 +85,13 @@ export default function TemplateListStep() {
|
|
|
61
85
|
}}
|
|
62
86
|
>
|
|
63
87
|
<Box sx={{ margin: theme.spacing(2, 0) }}>
|
|
64
|
-
<Typography variant="h6">{
|
|
88
|
+
<Typography variant="h6">{title}</Typography>
|
|
65
89
|
</Box>
|
|
66
90
|
<TemplatesList
|
|
67
91
|
heading={heading}
|
|
68
92
|
data={data as GetProcessTemplateGroupsQuery}
|
|
69
93
|
loading={isLoading}
|
|
94
|
+
// input={{ ...input, directionType: props?.directionType }}
|
|
70
95
|
input={input}
|
|
71
96
|
setInput={setInput}
|
|
72
97
|
handleRedirect={handleRedirect}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import LinkCard from "@evenicanpm/admin-integrate/components/link-cards";
|
|
2
|
+
import DownloadOutlinedIcon from "@mui/icons-material/DownloadOutlined";
|
|
3
|
+
import MobiledataOffIcon from "@mui/icons-material/MobiledataOff";
|
|
4
|
+
import UploadOutlinedIcon from "@mui/icons-material/UploadOutlined";
|
|
5
|
+
import {
|
|
6
|
+
Box,
|
|
7
|
+
Grid2 as Grid,
|
|
8
|
+
type Theme,
|
|
9
|
+
Typography,
|
|
10
|
+
useTheme,
|
|
11
|
+
} from "@mui/material";
|
|
12
|
+
import { useTranslations } from "next-intl";
|
|
13
|
+
import type React from "react";
|
|
14
|
+
import { INTEGRATION_CREATE_STEPS } from "./integration-create-steps";
|
|
15
|
+
|
|
16
|
+
interface Props {
|
|
17
|
+
setStep: React.Dispatch<React.SetStateAction<number>>;
|
|
18
|
+
/** Source + Target: go to source list first (parent enables dual flow). */
|
|
19
|
+
onSourceAndTarget?: () => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function TemplateOptionsStep(props: Props) {
|
|
23
|
+
const t = useTranslations("Integrate.Templates");
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
const styles = getStyles(theme);
|
|
26
|
+
|
|
27
|
+
const handleClickOption1 = () => {
|
|
28
|
+
props.onSourceAndTarget?.();
|
|
29
|
+
props.setStep(INTEGRATION_CREATE_STEPS.sourceTemplateList);
|
|
30
|
+
};
|
|
31
|
+
const handleClickOption2 = () =>
|
|
32
|
+
props.setStep(INTEGRATION_CREATE_STEPS.sourceTemplateList);
|
|
33
|
+
const handleClickOption3 = () =>
|
|
34
|
+
props.setStep(INTEGRATION_CREATE_STEPS.targetTemplateList);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Box sx={styles.main}>
|
|
38
|
+
<Grid container spacing={1} maxWidth={theme.spacing(110)}>
|
|
39
|
+
<Grid size={{ xs: 12 }}>
|
|
40
|
+
<Typography variant="h6" align="center">
|
|
41
|
+
{t("templateOptionsTitle")}
|
|
42
|
+
</Typography>
|
|
43
|
+
</Grid>
|
|
44
|
+
<Grid size={{ xs: 12, md: 4 }}>
|
|
45
|
+
<LinkCard
|
|
46
|
+
title={t("templateOption1")}
|
|
47
|
+
description={t("templateOption1Description")}
|
|
48
|
+
onClick={handleClickOption1}
|
|
49
|
+
>
|
|
50
|
+
<Box
|
|
51
|
+
sx={{
|
|
52
|
+
...styles.iconSquare,
|
|
53
|
+
color: "black.600",
|
|
54
|
+
backgroundColor: "#BE7374",
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<MobiledataOffIcon sx={styles.icon} />
|
|
58
|
+
</Box>
|
|
59
|
+
</LinkCard>
|
|
60
|
+
</Grid>
|
|
61
|
+
<Grid size={{ xs: 12, md: 4 }}>
|
|
62
|
+
<LinkCard
|
|
63
|
+
title={t("templateOption2")}
|
|
64
|
+
description={t("templateOption2Description")}
|
|
65
|
+
onClick={handleClickOption2}
|
|
66
|
+
>
|
|
67
|
+
<Box
|
|
68
|
+
sx={{
|
|
69
|
+
...styles.iconSquare,
|
|
70
|
+
color: "black.600",
|
|
71
|
+
backgroundColor: "bluish.500",
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
<UploadOutlinedIcon sx={styles.icon} />
|
|
75
|
+
</Box>
|
|
76
|
+
</LinkCard>
|
|
77
|
+
</Grid>
|
|
78
|
+
<Grid size={{ xs: 12, md: 4 }}>
|
|
79
|
+
<LinkCard
|
|
80
|
+
title={t("templateOption3")}
|
|
81
|
+
description={t("templateOption3Description")}
|
|
82
|
+
onClick={handleClickOption3}
|
|
83
|
+
>
|
|
84
|
+
<Box
|
|
85
|
+
sx={{
|
|
86
|
+
...styles.iconSquare,
|
|
87
|
+
color: "black.600",
|
|
88
|
+
backgroundColor: "orange.500",
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<DownloadOutlinedIcon sx={styles.icon} />
|
|
92
|
+
</Box>
|
|
93
|
+
</LinkCard>
|
|
94
|
+
</Grid>
|
|
95
|
+
</Grid>
|
|
96
|
+
</Box>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const getStyles = (theme: Theme) => ({
|
|
101
|
+
main: {
|
|
102
|
+
backgroundColor: theme.palette.grey[50],
|
|
103
|
+
padding: theme.spacing(2),
|
|
104
|
+
border: `1px solid ${theme.palette.grey[300]}`,
|
|
105
|
+
minHeight: `min(${theme.spacing(80)}, 60vh)`,
|
|
106
|
+
display: "flex",
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
justifyContent: "center",
|
|
109
|
+
},
|
|
110
|
+
iconSquare: {
|
|
111
|
+
padding: theme.spacing(1),
|
|
112
|
+
paddingBottom: theme.spacing(0.5),
|
|
113
|
+
marginBottom: theme.spacing(1),
|
|
114
|
+
borderRadius: 1,
|
|
115
|
+
},
|
|
116
|
+
icon: {
|
|
117
|
+
fontSize: "h4.fontSize",
|
|
118
|
+
},
|
|
119
|
+
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Custom components
|
|
2
|
-
import { Wizard } from "@evenicanpm/admin-integrate/components/
|
|
2
|
+
import { Wizard } from "@evenicanpm/admin-integrate/components/templatesV2";
|
|
3
3
|
// Types
|
|
4
|
-
import type { ProcessConfigMerge } from "@evenicanpm/admin-integrate/components/
|
|
4
|
+
import type { ProcessConfigMerge } from "@evenicanpm/admin-integrate/components/templatesV2/types";
|
|
5
5
|
// Mui
|
|
6
6
|
import { Box } from "@mui/material";
|
|
7
7
|
// Util
|
|
8
8
|
import { usePathname, useRouter, useSearchParams } from "next/navigation";
|
|
9
|
+
import { INTEGRATION_CREATE_STEPS } from "./integration-create-steps";
|
|
9
10
|
|
|
10
11
|
const metadata = {
|
|
11
12
|
name: "",
|
|
@@ -27,12 +28,12 @@ export default function WizardStep(props: Readonly<Props>) {
|
|
|
27
28
|
const searchParams = useSearchParams();
|
|
28
29
|
|
|
29
30
|
const handleBack = () => {
|
|
30
|
-
props.setStep(
|
|
31
|
+
props.setStep(INTEGRATION_CREATE_STEPS.templateOptions);
|
|
31
32
|
router.replace(pathname);
|
|
32
33
|
};
|
|
33
34
|
|
|
34
35
|
const handleFinish = () => {
|
|
35
|
-
props.setStep(
|
|
36
|
+
props.setStep(INTEGRATION_CREATE_STEPS.preCreation);
|
|
36
37
|
router.replace(pathname);
|
|
37
38
|
};
|
|
38
39
|
|
|
@@ -434,7 +434,7 @@ export default function IntegrationDetails() {
|
|
|
434
434
|
onClose={() => dispatchTaskState({ type: TaskActionType.CLOSE })}
|
|
435
435
|
anchor="right"
|
|
436
436
|
taskState={taskState}
|
|
437
|
-
renderKey={taskState.processTaskId}
|
|
437
|
+
renderKey={taskState.processTaskId ?? 0}
|
|
438
438
|
dispatch={dispatchTaskState}
|
|
439
439
|
handleUpdateConfig={handleUpdateConfig}
|
|
440
440
|
config={config ?? (configFromApi as any)?.configurationExport}
|
|
@@ -8,13 +8,13 @@ import type {
|
|
|
8
8
|
import { processConfigMerge } from "@evenicanpm/admin-integrate/api/process-config/mutation";
|
|
9
9
|
import { getProcessTemplates } from "@evenicanpm/admin-integrate/api/templates/queries";
|
|
10
10
|
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
11
|
-
import { Wizard } from "@evenicanpm/admin-integrate/components/
|
|
12
|
-
import TemplatesList from "@evenicanpm/admin-integrate/components/
|
|
11
|
+
import { Wizard } from "@evenicanpm/admin-integrate/components/templatesV2";
|
|
12
|
+
import TemplatesList from "@evenicanpm/admin-integrate/components/templatesV2/templates-list";
|
|
13
13
|
import type {
|
|
14
14
|
Metadata,
|
|
15
15
|
ProcessConfigMerge,
|
|
16
|
-
} from "@evenicanpm/admin-integrate/components/
|
|
17
|
-
import { removeTemplateConfig } from "@evenicanpm/admin-integrate/components/
|
|
16
|
+
} from "@evenicanpm/admin-integrate/components/templatesV2/types";
|
|
17
|
+
import { removeTemplateConfig } from "@evenicanpm/admin-integrate/components/templatesV2/wizard";
|
|
18
18
|
import { Box, Typography, useTheme } from "@mui/material";
|
|
19
19
|
import { useTranslations } from "next-intl";
|
|
20
20
|
import { useEffect, useState } from "react";
|
|
@@ -5,12 +5,12 @@ import type {
|
|
|
5
5
|
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
6
6
|
import { processConfigMerge } from "@evenicanpm/admin-integrate/api/process-config/mutation";
|
|
7
7
|
import { TitleEdit } from "@evenicanpm/admin-integrate/components/core";
|
|
8
|
-
import { Wizard } from "@evenicanpm/admin-integrate/components/
|
|
8
|
+
import { Wizard } from "@evenicanpm/admin-integrate/components/templatesV2";
|
|
9
9
|
import type {
|
|
10
10
|
Metadata,
|
|
11
11
|
ProcessConfigMerge,
|
|
12
|
-
} from "@evenicanpm/admin-integrate/components/
|
|
13
|
-
import { removeTemplateConfig } from "@evenicanpm/admin-integrate/components/
|
|
12
|
+
} from "@evenicanpm/admin-integrate/components/templatesV2/types";
|
|
13
|
+
import { removeTemplateConfig } from "@evenicanpm/admin-integrate/components/templatesV2/wizard";
|
|
14
14
|
import ReportProblemIcon from "@mui/icons-material/ReportProblem";
|
|
15
15
|
import {
|
|
16
16
|
Box,
|
|
@@ -31,7 +31,7 @@ interface Props {
|
|
|
31
31
|
dispatch: React.Dispatch<TaskAction>;
|
|
32
32
|
handleUpdateConfig: (newConfig: ConfigExport) => void;
|
|
33
33
|
editable?: boolean;
|
|
34
|
-
templateConfigInput?:
|
|
34
|
+
templateConfigInput?: unknown | null;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export default function EditTask(props: Readonly<Props>) {
|
|
@@ -136,7 +136,7 @@ export default function EditTask(props: Readonly<Props>) {
|
|
|
136
136
|
.parallelProcessingGroup as number,
|
|
137
137
|
sort: props.taskState.sort as number,
|
|
138
138
|
processTaskId: props?.taskState?.processTaskId
|
|
139
|
-
? Number.parseInt(props.taskState.processTaskId)
|
|
139
|
+
? Number.parseInt(props.taskState.processTaskId, 10)
|
|
140
140
|
: null,
|
|
141
141
|
} as Metadata
|
|
142
142
|
}
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
|
|
25
25
|
interface Props extends DrawerProps {
|
|
26
26
|
taskState: TaskState;
|
|
27
|
-
renderKey:
|
|
27
|
+
renderKey: string | number;
|
|
28
28
|
dispatch: React.Dispatch<TaskAction>;
|
|
29
29
|
handleUpdateConfig?: (newConfig: ConfigExport) => void;
|
|
30
|
-
templateConfigInput?:
|
|
30
|
+
templateConfigInput?: unknown;
|
|
31
31
|
config: ConfigExport;
|
|
32
32
|
}
|
|
33
33
|
|