@evenicanpm/admin-integrate 2.0.0 → 2.3.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.
Files changed (42) hide show
  1. package/documents/ConfigImport/configuration-import.ts +1 -1
  2. package/documents/Endpoint/list.ts +3 -3
  3. package/documents/Process/list.ts +3 -3
  4. package/documents/ProcessExecution/list.ts +2 -2
  5. package/documents/ProcessExport/read.ts +1 -1
  6. package/documents/ProcessSchedule/read.ts +1 -1
  7. package/documents/ProcessScheduleGroup/read.ts +3 -3
  8. package/documents/ProcessTemplate/read.ts +1 -1
  9. package/documents/ScheduledProcess/list.ts +1 -1
  10. package/package.json +2 -2
  11. package/src/components/integration-view/animated-svg.tsx +0 -1
  12. package/src/components/integration-view/elk-types.ts +1 -1
  13. package/src/components/integration-view/integration-view.tsx +267 -175
  14. package/src/components/integration-view/nodes/execution-entry-node.tsx +3 -2
  15. package/src/components/integration-view/nodes/group-node.tsx +1 -1
  16. package/src/components/integration-view/types.ts +2 -0
  17. package/src/components/integration-view/utils/mapping.ts +62 -41
  18. package/src/components/list-filter/list-filter-types.ts +6 -0
  19. package/src/components/list-filter/list-filter.tsx +19 -15
  20. package/src/components/list-filter/multi-select-filter.tsx +7 -7
  21. package/src/components/list-filter/select-filter.tsx +6 -6
  22. package/src/components/scheduler/day-selector.tsx +1 -1
  23. package/src/components/templatesV2/inputs/form-type.ts +7 -1
  24. package/src/components/templatesV2/inputs/renderers/renderFormControl.tsx +19 -11
  25. package/src/components/templatesV2/inputs/renderers/renderSearchInput.tsx +3 -4
  26. package/src/components/templatesV2/inputs/search/useSearchInput.ts +12 -7
  27. package/src/components/templatesV2/inputs/table/InputTable.tsx +20 -11
  28. package/src/components/templatesV2/inputs/utils/arrangeInputs.ts +4 -3
  29. package/src/components/templatesV2/pageForm.tsx +9 -7
  30. package/src/components/templatesV2/validation/buildZodSchema.ts +0 -4
  31. package/src/components/templatesV2/wizard.tsx +5 -3
  32. package/src/pages/dashboard/dashboard-link-cards.tsx +0 -1
  33. package/src/pages/dashboard/dashboard-list-sections.tsx +1 -1
  34. package/src/pages/dashboard/dashboard.tsx +0 -1
  35. package/src/pages/executions/executions-list/executions-list-table.tsx +0 -1
  36. package/src/pages/executions/executions.tsx +1 -1
  37. package/src/pages/integration-create/integration-create.tsx +20 -14
  38. package/src/pages/integration-create/pre-creation-step.tsx +9 -9
  39. package/src/pages/integration-details/import-process/copy-tasks-list.tsx +1 -3
  40. package/src/pages/integration-details/integration-details.tsx +1 -1
  41. package/src/pages/integration-details/task-drawer/edit-task.tsx +2 -2
  42. package/src/pages/integration-details/task-drawer/task-drawer.tsx +2 -2
@@ -12,8 +12,9 @@ export function arrangeInputs(inputs: ProcessTemplateInput[]): InputRow[] {
12
12
  const isTableOrHidden = (inp: ProcessTemplateInput) =>
13
13
  inp.inputType === InputType.INPUT_TABLE || isHiddenInputType(inp.inputType);
14
14
 
15
- const isPairable = (inp?: ProcessTemplateInput) =>
16
- !!inp && !isTableOrHidden(inp);
15
+ const isPairable = (
16
+ inp: ProcessTemplateInput | undefined,
17
+ ): inp is ProcessTemplateInput => !!inp && !isTableOrHidden(inp);
17
18
 
18
19
  const areConsecutiveSorts = (
19
20
  a?: ProcessTemplateInput,
@@ -39,7 +40,7 @@ export function arrangeInputs(inputs: ProcessTemplateInput[]): InputRow[] {
39
40
 
40
41
  const next = ordered[i + 1];
41
42
  if (isPairable(next) && areConsecutiveSorts(curr, next)) {
42
- rows.push({ type: "pair", items: [curr, next!] });
43
+ rows.push({ type: "pair", items: [curr, next] });
43
44
  i += 2;
44
45
  } else {
45
46
  rows.push({ type: "full", item: curr });
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { Formik } from "formik";
3
+ import { Formik, type FormikProps } from "formik";
4
4
  import React, { useEffect } from "react";
5
5
  import { FormikPageBody } from "./inputs";
6
6
  import type { FlatPage, FormState } from "./types";
@@ -51,7 +51,7 @@ export default function PageForm({
51
51
  const pageKeys = React.useMemo(
52
52
  () =>
53
53
  (page.inputs ?? []).map(
54
- (inp) => templateId + "::" + (inp?.fieldName ?? ""),
54
+ (inp) => `${templateId}::${inp?.fieldName ?? ""}`,
55
55
  ),
56
56
  [page.inputs, templateId],
57
57
  );
@@ -59,7 +59,7 @@ export default function PageForm({
59
59
 
60
60
  const stepKey = `${templateId}:${page._flatIndex ?? ""}`;
61
61
 
62
- const formikRef = React.useRef<any>(null);
62
+ const formikRef = React.useRef<FormikProps<FormState> | null>(null);
63
63
 
64
64
  const submit = React.useCallback(async () => {
65
65
  const formikHelpers = formikRef.current;
@@ -69,11 +69,13 @@ export default function PageForm({
69
69
  const hasErrors = pageKeys.some(
70
70
  (k) =>
71
71
  Boolean(errors[k]) ||
72
- errorKeys.some((ek) => ek === k || ek.startsWith(k + ".")),
72
+ errorKeys.some((ek) => ek === k || ek.startsWith(`${k}.`)),
73
73
  );
74
74
  if (hasErrors) {
75
75
  const touched: Record<string, boolean> = {};
76
- pageKeys.forEach((k) => (touched[k] = true));
76
+ pageKeys.forEach((k) => {
77
+ touched[k] = true;
78
+ });
77
79
  formikHelpers.setTouched(touched);
78
80
  return false;
79
81
  }
@@ -94,7 +96,7 @@ export default function PageForm({
94
96
  onSubmit={(values) => {
95
97
  // Only pass the keys for this page back to the parent.
96
98
  const pageKeys = (page.inputs ?? []).map(
97
- (inp) => templateId + "::" + (inp?.fieldName ?? ""),
99
+ (inp) => `${templateId}::${inp?.fieldName ?? ""}`,
98
100
  );
99
101
  const filtered: FormState = {};
100
102
  for (const k of pageKeys) {
@@ -103,7 +105,7 @@ export default function PageForm({
103
105
  values !== null &&
104
106
  Object.hasOwn(values as object, k)
105
107
  ) {
106
- filtered[k] = (values as Record<string, any>)[k];
108
+ filtered[k] = (values as FormState)[k];
107
109
  }
108
110
  }
109
111
  onPageSubmit(filtered);
@@ -108,10 +108,6 @@ function buildFieldSchema(
108
108
  case InputType.MULTI_TEXT_SEARCH:
109
109
  schema = z.union([z.array(z.string()), z.undefined(), z.null()]);
110
110
  break;
111
- case InputType.TEXT:
112
- case InputType.SELECTOR:
113
- case InputType.TEXT_UNIQUE_IDENTIFIER:
114
- case InputType.TEXT_SEARCH:
115
111
  default:
116
112
  schema = z.union([z.string(), z.undefined(), z.null()]);
117
113
  break;
@@ -198,17 +198,19 @@ function buildProcessConfigMerge(
198
198
  return { input: { config } };
199
199
  }
200
200
 
201
- export function removeTemplateConfig(input: any): any {
201
+ export function removeTemplateConfig(input: unknown): unknown {
202
202
  if (Array.isArray(input)) {
203
203
  return input.map(removeTemplateConfig);
204
204
  }
205
205
  if (input == null || typeof input !== "object") {
206
206
  return input;
207
207
  }
208
- const newObj: any = {};
208
+ const newObj: Record<string, unknown> = {};
209
209
  for (const key in input) {
210
210
  if (key !== "templateConfig") {
211
- newObj[key] = removeTemplateConfig(input[key]);
211
+ newObj[key] = removeTemplateConfig(
212
+ (input as Record<string, unknown>)[key],
213
+ );
212
214
  }
213
215
  }
214
216
  return newObj;
@@ -9,7 +9,6 @@ import {
9
9
  // MUI
10
10
  import { Box, Grid2 as Grid, type Theme, useTheme } from "@mui/material";
11
11
  import { useTranslations } from "next-intl";
12
- import React from "react";
13
12
 
14
13
  const breakpoints = {
15
14
  xs: 6,
@@ -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 React, { useEffect, useState } from "react";
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 React, { useState } from "react";
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,13 +12,14 @@ import {
11
12
  IntegrateBreadcrumbs,
12
13
  } from "@evenicanpm/admin-integrate/components/breadcrumbs";
13
14
  import { IntegrationDetailsHeader } from "@evenicanpm/admin-integrate/components/header";
15
+ import type { ProcessConfigMerge } from "@evenicanpm/admin-integrate/components/templatesV2/types";
14
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";
21
23
  import { INTEGRATION_CREATE_STEPS } from "./integration-create-steps";
22
24
  import PreCreationStep from "./pre-creation-step";
23
25
  import SelectStep from "./select-step";
@@ -53,7 +55,7 @@ export default function IntegrationCreate() {
53
55
 
54
56
  const [name, setName] = useState<string>("");
55
57
  const [step, setStep] = useState<number>(INTEGRATION_CREATE_STEPS.select);
56
- const [processConfig, setProcessConfig] = useState<any | null>(null);
58
+ const [processConfig, setProcessConfig] = useState<ConfigExport | null>(null);
57
59
  const [dualSourceThenTarget, setDualSourceThenTarget] = useState(false);
58
60
 
59
61
  useEffect(() => {
@@ -80,7 +82,10 @@ export default function IntegrationCreate() {
80
82
  }
81
83
  };
82
84
 
83
- const handleProcessConfigMerge = (configMergeInput: any) => {
85
+ const handleProcessConfigMerge = (
86
+ configMergeInput: SetStateAction<ProcessConfigMerge | null>,
87
+ ) => {
88
+ if (!configMergeInput || typeof configMergeInput === "function") return;
84
89
  const newProcessConfigMerge = { ...configMergeInput };
85
90
  const code = slugify(name);
86
91
  for (const c of newProcessConfigMerge.input.config) {
@@ -91,12 +96,12 @@ export default function IntegrationCreate() {
91
96
  console.log("configMergeInput", configMergeInput);
92
97
 
93
98
  const sourceName = configMergeInput?.input?.config?.find(
94
- (item: any) => (item?.source as string)?.toLowerCase() === "source",
99
+ (item) => (item?.source as string)?.toLowerCase() === "source",
95
100
  )?.uniqueIdentifier;
96
101
 
97
102
  if (sourceName) {
98
- configMergeInput.input.config = configMergeInput.input!.config!.map(
99
- (item: any) => {
103
+ configMergeInput.input.config = configMergeInput.input.config.map(
104
+ (item) => {
100
105
  if (item?.queues) {
101
106
  return {
102
107
  ...item,
@@ -118,10 +123,7 @@ export default function IntegrationCreate() {
118
123
  {
119
124
  onSuccess: ({ configurationMerge }) => {
120
125
  console.log("configurationMerge", configurationMerge);
121
- setProcessConfig({
122
- ...configurationMerge,
123
- CreateIntegrationProc: true,
124
- });
126
+ setProcessConfig(configurationMerge ?? null);
125
127
  },
126
128
  onError: (error) => {
127
129
  console.error("Update failed:", error);
@@ -131,9 +133,10 @@ export default function IntegrationCreate() {
131
133
  };
132
134
 
133
135
  const handleProcessConfigImport = () => {
136
+ if (!processConfig) return;
134
137
  processConfigImportMutation.mutate(
135
138
  {
136
- config: processConfig,
139
+ config: processConfig as unknown as ConfigImport,
137
140
  reRoutedFromMerge: true,
138
141
  },
139
142
  {
@@ -150,11 +153,14 @@ export default function IntegrationCreate() {
150
153
  useEffect(() => {
151
154
  // Case when name of process is edited after config merge has been called (ie on pre-creation step), when sending config to import.
152
155
  // If name is changed during wizard step, name is already updated in payload to config merge.
153
- if (processConfig?.Processes) {
156
+ if (processConfig?.Processes?.[0]) {
154
157
  const newConfig = { ...processConfig };
155
158
  const code = slugify(name);
156
- newConfig.Processes[0].Name = name;
157
- newConfig.Processes[0].Process = code;
159
+ const firstProcess = newConfig.Processes?.[0];
160
+ if (firstProcess) {
161
+ firstProcess.Name = name;
162
+ firstProcess.Process = code;
163
+ }
158
164
  }
159
165
  }, [name]);
160
166
 
@@ -2,7 +2,7 @@ import { Box, useTheme } from "@mui/material";
2
2
  import { useReducer } from "react";
3
3
  import type {
4
4
  ConfigExport,
5
- EndpointExport,
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: any | null;
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 as ConfigExport}
47
+ config={props.processConfig ?? undefined}
48
48
  variant="process"
49
49
  drawerOpen={false}
50
50
  processTaskId={undefined}
51
- onTaskClick={(processTask: any) => {
52
- const endpoint = props.processConfig?.Endpoints.find(
53
- (ep: EndpointExport) => ep.Name === processTask.endpoint,
51
+ onTaskClick={(processTask: ProcessTask) => {
52
+ const endpoint = (props.processConfig?.Endpoints ?? []).find(
53
+ (ep) => ep?.Name === processTask.endpoint,
54
54
  );
55
55
 
56
- let templateConfig: any;
56
+ let templateConfig: string | undefined;
57
57
 
58
- if (typeof endpoint.TemplateConfig === "string") {
58
+ if (typeof endpoint?.TemplateConfig === "string") {
59
59
  templateConfig = endpoint.TemplateConfig;
60
- } else if (typeof endpoint.TemplateConfig === "object") {
60
+ } else if (typeof endpoint?.TemplateConfig === "object") {
61
61
  templateConfig = JSON.stringify(endpoint.TemplateConfig);
62
62
  }
63
63
 
@@ -185,9 +185,7 @@ export default function CopyTasksList(props: Readonly<Props>) {
185
185
  toggleChecked={toggleChecked}
186
186
  alert={props.importState.alert}
187
187
  />
188
- ) : (
189
- <></>
190
- ),
188
+ ) : null,
191
189
  )}
192
190
  </TableBody>
193
191
  </Table>
@@ -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}
@@ -31,7 +31,7 @@ interface Props {
31
31
  dispatch: React.Dispatch<TaskAction>;
32
32
  handleUpdateConfig: (newConfig: ConfigExport) => void;
33
33
  editable?: boolean;
34
- templateConfigInput?: any | null;
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: any;
27
+ renderKey: string | number;
28
28
  dispatch: React.Dispatch<TaskAction>;
29
29
  handleUpdateConfig?: (newConfig: ConfigExport) => void;
30
- templateConfigInput?: any | null;
30
+ templateConfigInput?: unknown;
31
31
  config: ConfigExport;
32
32
  }
33
33