@evenicanpm/admin-integrate 2.4.1 → 2.5.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 (46) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +9 -1
  3. package/src/api/process/mutations/copy-process.mutation.ts +3 -1
  4. package/src/api/process/mutations/index.ts +5 -2
  5. package/src/api/process/mutations/run-process.mutation.ts +3 -1
  6. package/src/api/process-config/mutation/index.ts +8 -2
  7. package/src/api/process-config/mutation/process-config-import.mutation.ts +3 -1
  8. package/src/api/process-config/mutation/process-config-merge.mutation.ts +3 -1
  9. package/src/api/scheduler/mutation/create-process-schedule-group-details.mutation.ts +4 -1
  10. package/src/api/scheduler/mutation/index.ts +8 -2
  11. package/src/api/scheduler/mutation/update-process-schedule-group-details.mutation.ts +4 -1
  12. package/src/components/data-table/table-header.tsx +32 -20
  13. package/src/components/integration-list/list/integration-list.tsx +1 -1
  14. package/src/components/integration-view/integration-view.tsx +163 -192
  15. package/src/components/integration-view/nodes/base-node.tsx +4 -2
  16. package/src/components/integration-view/nodes/task-node.tsx +3 -4
  17. package/src/components/integration-view/task-icon.tsx +12 -9
  18. package/src/components/integration-view/utils/mapping.ts +4 -6
  19. package/src/components/list-filter/list-filter.tsx +1 -1
  20. package/src/components/list-filter/multi-select-filter.tsx +9 -10
  21. package/src/components/list-filter/select-filter.tsx +6 -7
  22. package/src/components/scheduler/schedule-drawer/details-reducer.ts +2 -2
  23. package/src/components/scheduler/schedule-drawer/schedule-details-integrations.tsx +14 -25
  24. package/src/components/scheduler/schedule-drawer/schedule-details-main.tsx +2 -2
  25. package/src/components/scheduler/schedule-drawer/schedule-drawer-group.tsx +4 -4
  26. package/src/components/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +1 -1
  27. package/src/components/templatesV2/inputs/FormikPageBody.tsx +2 -2
  28. package/src/components/templatesV2/inputs/primitives/SelectorInput.tsx +6 -7
  29. package/src/components/templatesV2/inputs/renderers/renderFormControl.tsx +6 -9
  30. package/src/components/templatesV2/inputs/table/InputTable.tsx +3 -4
  31. package/src/components/templatesV2/inputs/utils/parseQueryName.ts +2 -2
  32. package/src/components/templatesV2/inputs/utils/selectors.ts +1 -1
  33. package/src/components/templatesV2/pageForm.tsx +103 -33
  34. package/src/components/templatesV2/templates-list/templates-list.tsx +2 -2
  35. package/src/components/templatesV2/wizard.tsx +3 -4
  36. package/src/pages/execution-details/execution-details.tsx +4 -4
  37. package/src/pages/executions/executions-list/executions-list.tsx +1 -1
  38. package/src/pages/integration-create/integration-create.tsx +5 -8
  39. package/src/pages/integration-create/template-list-step.tsx +1 -2
  40. package/src/pages/integration-create/template-options-step.tsx +1 -1
  41. package/src/pages/integration-details/import-process/copy-tasks-list.tsx +4 -4
  42. package/src/pages/integration-details/integration-details.tsx +66 -50
  43. package/src/pages/integration-details/task-drawer/add-task.tsx +7 -7
  44. package/src/pages/integration-details/task-drawer/edit-task.tsx +9 -9
  45. package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +3 -3
  46. package/src/components/integration-view/types.ts +0 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @evenicanpm/admin-integrate
2
2
 
3
+ ## 2.5.0
4
+
5
+ ## 2.4.2
6
+
7
+ ### Patch Changes
8
+
9
+ - fix: bumping all versions and then re-publishing to properly strip out the workspace: deps.
10
+
3
11
  ## 2.4.1
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evenicanpm/admin-integrate",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "e4Integrate Admin Panel",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,13 +19,21 @@
19
19
  "@mui/icons-material": "^6.1.7",
20
20
  "@mui/material": "^6.1.7",
21
21
  "@mui/system": "^6.3.1",
22
+ "@mui/x-date-pickers": "^6.20.2",
22
23
  "@tanstack/react-query": "^5.100.4",
23
24
  "@xyflow/react": "^12.8.4",
24
25
  "elkjs": "^0.10.0",
25
26
  "lodash": "^4.17.21",
27
+ "next": "^16.0.0",
28
+ "next-intl": "^4.3.4",
26
29
  "react": "^19.2.7",
27
30
  "react-dom": "^19.2.7"
28
31
  },
32
+ "dependencies": {
33
+ "date-fns": "^3.3.1",
34
+ "formik": "^2.4.5",
35
+ "zod": "^4.1.12"
36
+ },
29
37
  "devDependencies": {
30
38
  "@emotion/react": "^11.11.3",
31
39
  "@emotion/styled": "^11.11.0",
@@ -14,7 +14,7 @@ export const buildCopyProcessMutationKey = {
14
14
  ],
15
15
  };
16
16
 
17
- export const copyProcess = () => {
17
+ export const useCopyProcess = () => {
18
18
  const queryClient = getQueryClient();
19
19
 
20
20
  return useMutation({
@@ -43,3 +43,5 @@ export const copyProcess = () => {
43
43
  },
44
44
  });
45
45
  };
46
+
47
+ export const copyProcess = useCopyProcess;
@@ -1,2 +1,5 @@
1
- export { copyProcess } from "./copy-process.mutation";
2
- export { runProcessWebhook } from "./run-process.mutation";
1
+ export { copyProcess, useCopyProcess } from "./copy-process.mutation";
2
+ export {
3
+ runProcessWebhook,
4
+ useRunProcessWebhook,
5
+ } from "./run-process.mutation";
@@ -10,7 +10,7 @@ export const buildRunProcessMutationKey = {
10
10
  webhook: () => ["runProcessWebhook"] as const,
11
11
  };
12
12
 
13
- export const runProcessWebhook = () => {
13
+ export const useRunProcessWebhook = () => {
14
14
  const queryClient = getQueryClient();
15
15
 
16
16
  return useMutation({
@@ -39,3 +39,5 @@ export const runProcessWebhook = () => {
39
39
  },
40
40
  });
41
41
  };
42
+
43
+ export const runProcessWebhook = useRunProcessWebhook;
@@ -1,2 +1,8 @@
1
- export { processConfigImport } from "./process-config-import.mutation";
2
- export { processConfigMerge } from "./process-config-merge.mutation";
1
+ export {
2
+ processConfigImport,
3
+ useProcessConfigImport,
4
+ } from "./process-config-import.mutation";
5
+ export {
6
+ processConfigMerge,
7
+ useProcessConfigMerge,
8
+ } from "./process-config-merge.mutation";
@@ -11,7 +11,7 @@ export const buildProcessScheduleGroupDetailsQueryKey = {
11
11
  ],
12
12
  };
13
13
 
14
- export const processConfigImport = () => {
14
+ export const useProcessConfigImport = () => {
15
15
  const queryClient = useQueryClient();
16
16
 
17
17
  return useMutation({
@@ -40,3 +40,5 @@ export const processConfigImport = () => {
40
40
  },
41
41
  });
42
42
  };
43
+
44
+ export const processConfigImport = useProcessConfigImport;
@@ -10,7 +10,7 @@ export const buildProcessScheduleGroupDetailsQueryKey = {
10
10
  ],
11
11
  };
12
12
 
13
- export const processConfigMerge = () => {
13
+ export const useProcessConfigMerge = () => {
14
14
  const queryClient = useQueryClient();
15
15
 
16
16
  return useMutation({
@@ -31,3 +31,5 @@ export const processConfigMerge = () => {
31
31
  },
32
32
  });
33
33
  };
34
+
35
+ export const processConfigMerge = useProcessConfigMerge;
@@ -14,7 +14,7 @@ export const buildCreateProcessScheduleGroupDetailsMutationKey = {
14
14
  ],
15
15
  };
16
16
 
17
- export const createProcessScheduleGroupDetails = () => {
17
+ export const useCreateProcessScheduleGroupDetails = () => {
18
18
  const queryClient = getQueryClient();
19
19
 
20
20
  return useMutation({
@@ -45,3 +45,6 @@ export const createProcessScheduleGroupDetails = () => {
45
45
  },
46
46
  });
47
47
  };
48
+
49
+ export const createProcessScheduleGroupDetails =
50
+ useCreateProcessScheduleGroupDetails;
@@ -1,2 +1,8 @@
1
- export { createProcessScheduleGroupDetails } from "./create-process-schedule-group-details.mutation";
2
- export { updateProcessScheduleGroupDetails } from "./update-process-schedule-group-details.mutation";
1
+ export {
2
+ createProcessScheduleGroupDetails,
3
+ useCreateProcessScheduleGroupDetails,
4
+ } from "./create-process-schedule-group-details.mutation";
5
+ export {
6
+ updateProcessScheduleGroupDetails,
7
+ useUpdateProcessScheduleGroupDetails,
8
+ } from "./update-process-schedule-group-details.mutation";
@@ -14,7 +14,7 @@ export const buildUpdateProcessScheduleGroupDetailsMutationKey = {
14
14
  ],
15
15
  };
16
16
 
17
- export const updateProcessScheduleGroupDetails = () => {
17
+ export const useUpdateProcessScheduleGroupDetails = () => {
18
18
  const queryClient = getQueryClient();
19
19
 
20
20
  return useMutation({
@@ -45,3 +45,6 @@ export const updateProcessScheduleGroupDetails = () => {
45
45
  },
46
46
  });
47
47
  };
48
+
49
+ export const updateProcessScheduleGroupDetails =
50
+ useUpdateProcessScheduleGroupDetails;
@@ -12,7 +12,6 @@ const StyledTableCell = styled(TableCell)(({ theme }) => ({
12
12
  padding: "16px 20px",
13
13
  color: theme.palette.grey[900],
14
14
  }));
15
-
16
15
  // ==============================================================
17
16
  export type Head = {
18
17
  id: string;
@@ -29,6 +28,30 @@ interface Props {
29
28
  rowSx?: SxProps;
30
29
  }
31
30
  // ==============================================================
31
+ interface SortIconProps {
32
+ order: "asc" | "desc";
33
+ orderBy: string;
34
+ columnId: string;
35
+ sx: SxProps<Theme>;
36
+ }
37
+
38
+ function SortIconComponent({
39
+ order,
40
+ orderBy,
41
+ columnId,
42
+ sx,
43
+ }: Readonly<SortIconProps>) {
44
+ const isActive = orderBy === columnId;
45
+ const iconSx: SxProps<Theme> = {
46
+ ...sx,
47
+ visibility: isActive ? "visible" : "hidden",
48
+ };
49
+ return order === "desc" && isActive ? (
50
+ <ExpandMore sx={iconSx} />
51
+ ) : (
52
+ <ExpandLess sx={iconSx} />
53
+ );
54
+ }
32
55
 
33
56
  export default function TableHeader({
34
57
  order,
@@ -57,25 +80,14 @@ export default function TableHeader({
57
80
  onClick={() => onRequestSort(headCell.id)}
58
81
  direction={orderBy === headCell.id ? order : "asc"}
59
82
  sx={styles.sortLabel}
60
- IconComponent={() =>
61
- order === "desc" && orderBy === headCell.id ? (
62
- <ExpandMore
63
- sx={{
64
- ...styles.sortIcon,
65
- visibility:
66
- orderBy === headCell.id ? "visible" : "hidden",
67
- }}
68
- />
69
- ) : (
70
- <ExpandLess
71
- sx={{
72
- ...styles.sortIcon,
73
- visibility:
74
- orderBy === headCell.id ? "visible" : "hidden",
75
- }}
76
- />
77
- )
78
- }
83
+ IconComponent={() => (
84
+ <SortIconComponent
85
+ order={order}
86
+ orderBy={orderBy}
87
+ columnId={headCell.id}
88
+ sx={styles.sortIcon}
89
+ />
90
+ )}
79
91
  >
80
92
  {headCell.label}
81
93
  </TableSortLabel>
@@ -90,7 +90,7 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
90
90
  integrationTags:
91
91
  filters?.multiSelectFilter?.map((f) => `${f.id}`) || null,
92
92
  });
93
- setPerPage(itemsPerPage as number);
93
+ setPerPage(itemsPerPage || 10);
94
94
  setPage(1);
95
95
  };
96
96
 
@@ -37,7 +37,6 @@ import type { ElkExtendedEdgeWithFlow, ElkNodeWithFlow } from "./elk-types";
37
37
  import { edgeTypes, nodeTypes } from "./flow-types";
38
38
 
39
39
  import {
40
- type AddHandler,
41
40
  mapEmptyNodesAndEdges,
42
41
  mapProcessConfigToNodesAndEdges,
43
42
  mapProcessTasksToNodesAndEdges,
@@ -157,8 +156,6 @@ const calcYOffset = () => {
157
156
  };
158
157
 
159
158
  interface Props {
160
- title?: string; // e.g. Executions
161
- section?: string; // e.g. e4Integrate
162
159
  data?: ProcessExecutionDetails;
163
160
  config?: ConfigExport;
164
161
  variant?: "process" | "process-execution";
@@ -169,7 +166,7 @@ interface Props {
169
166
  drawerOpen?: boolean;
170
167
  processTaskId?: string;
171
168
  onConfigChange?: (processConfig: ConfigExport) => void;
172
- onAdd?: AddHandler;
169
+ onAdd?: unknown;
173
170
  canEdit?: boolean;
174
171
  }
175
172
 
@@ -206,6 +203,145 @@ function getOverlapX(
206
203
  }
207
204
  }
208
205
 
206
+ function findZoneY(
207
+ zonesY: ZoneY[],
208
+ nodeY: number,
209
+ nodeH: number,
210
+ ): ZoneY | undefined {
211
+ const direct = zonesY.find(
212
+ (z) =>
213
+ getOverlapY({ y: z.y, height: z.height }, { y: nodeY, height: nodeH }) >
214
+ 0,
215
+ );
216
+ if (direct) return direct;
217
+ if (zonesY.length === 0) return undefined;
218
+
219
+ const maxZone = _.maxBy(zonesY, "y");
220
+ const minZone = _.minBy(zonesY, "y");
221
+ if (!minZone || !maxZone) return undefined;
222
+
223
+ if (nodeH && nodeY + nodeH < minZone.y) {
224
+ return { ...minZone, sort: minZone.sort - 1 };
225
+ }
226
+ if (nodeY > maxZone.y + maxZone.height) {
227
+ return { ...maxZone, sort: maxZone.sort + 1 };
228
+ }
229
+
230
+ const localZones = _.sortBy(zonesY, "y");
231
+ for (let i = 0; i < localZones.length - 1; i++) {
232
+ const currentZone = localZones[i];
233
+ const nextZone = localZones[i + 1];
234
+ if (nodeY > currentZone.y + currentZone.height && nodeY < nextZone.y) {
235
+ return { ...currentZone, sort: currentZone.sort + 0.5 };
236
+ }
237
+ }
238
+ return undefined;
239
+ }
240
+
241
+ function findZoneX(
242
+ zonesX: ZoneX[],
243
+ groupX: number,
244
+ nodeWidth: number,
245
+ ): ZoneX | undefined {
246
+ let zoneX: ZoneX | undefined;
247
+ let overlapX = 0;
248
+
249
+ for (const zone of zonesX) {
250
+ const overlap = getOverlapX(
251
+ { x: zone.x, width: zone.width },
252
+ { x: groupX, width: nodeWidth },
253
+ );
254
+ if (overlap > overlapX) {
255
+ overlapX = overlap;
256
+ zoneX = zone;
257
+ }
258
+ }
259
+ if (zoneX) return zoneX;
260
+ if (zonesX.length === 0) return undefined;
261
+
262
+ const maxZone = _.maxBy(zonesX, "x");
263
+ const minZone = _.minBy(zonesX, "x");
264
+ if (!minZone || !maxZone) return undefined;
265
+
266
+ if (groupX + nodeWidth < minZone.x) {
267
+ return {
268
+ ...minZone,
269
+ parallelProcessingGroup: minZone.parallelProcessingGroup - 1,
270
+ };
271
+ }
272
+ if (groupX > maxZone.x + maxZone.width) {
273
+ return {
274
+ ...maxZone,
275
+ parallelProcessingGroup: maxZone.parallelProcessingGroup + 1,
276
+ };
277
+ }
278
+
279
+ const localZones = _.sortBy(zonesX, "x");
280
+ for (let i = 0; i < localZones.length - 1; i++) {
281
+ const currentZone = localZones[i];
282
+ const nextZone = localZones[i + 1];
283
+ if (groupX > currentZone.x && groupX < nextZone.x + nextZone.width) {
284
+ return {
285
+ ...currentZone,
286
+ parallelProcessingGroup: currentZone.parallelProcessingGroup + 0.5,
287
+ };
288
+ }
289
+ }
290
+ return undefined;
291
+ }
292
+
293
+ function reindexTasks(
294
+ tasks: Maybe<ProcessTaskExport>[] | undefined,
295
+ ): Maybe<ProcessTaskExport>[] {
296
+ if (!tasks) return [];
297
+
298
+ let prevParallelProcessingGroup: number | null = null;
299
+ let index = 0;
300
+
301
+ const sorted = _.sortBy(tasks, ["ParallelProcessingGroup", "Sort"]).map(
302
+ (task: Maybe<ProcessTaskExport>) => {
303
+ if (task) {
304
+ const ppg = task.ParallelProcessingGroup ?? null;
305
+ if (ppg !== prevParallelProcessingGroup) {
306
+ prevParallelProcessingGroup = ppg;
307
+ index++;
308
+ }
309
+ task.ParallelProcessingGroup = index;
310
+ }
311
+ return task;
312
+ },
313
+ );
314
+
315
+ const partitionedTasks = _.values(
316
+ _.groupBy(sorted, "ParallelProcessingGroup"),
317
+ );
318
+
319
+ let result: Maybe<ProcessTaskExport>[] = [];
320
+
321
+ partitionedTasks.forEach((partition: Maybe<ProcessTaskExport>[]) => {
322
+ let partIndex = 0;
323
+ let prevSort: number | null = null;
324
+
325
+ const sortedPartition = _.sortBy(partition, ["Sort", "Name"]).map(
326
+ (task: Maybe<ProcessTaskExport>) => {
327
+ if (task) {
328
+ const sortVal = task.Sort ?? null;
329
+ if (sortVal !== prevSort) {
330
+ prevSort = sortVal;
331
+ partIndex++;
332
+ }
333
+ task.Sort = partIndex;
334
+ }
335
+ return task;
336
+ },
337
+ );
338
+
339
+ result = result.concat(sortedPartition as Maybe<ProcessTaskExport>[]);
340
+ });
341
+
342
+ return result;
343
+ }
344
+
209
345
  const IntegrationView: React.FC<Props> = ({
210
346
  data: processExecutionInput,
211
347
  variant,
@@ -217,9 +353,7 @@ const IntegrationView: React.FC<Props> = ({
217
353
  onAdd,
218
354
  canEdit,
219
355
  }: Props) => {
220
- const [processExecutionDetails, _setProcess] = useState<
221
- ProcessExecutionDetails | undefined
222
- >(processExecutionInput);
356
+ const processExecutionDetails = processExecutionInput;
223
357
 
224
358
  const [nodes, setNodes, onNodesChange] = useNodesState<FlowNode>([]);
225
359
  const [edges, setEdges, onEdgesChange] = useEdgesState<FlowEdge>([]);
@@ -230,7 +364,7 @@ const IntegrationView: React.FC<Props> = ({
230
364
 
231
365
  const onConnect = useCallback(() => {}, []);
232
366
  const onLayout = useCallback(
233
- (processInput: unknown) => {
367
+ (processInput: ConfigExport | ProcessExecutionDetails | undefined) => {
234
368
  let tasks: (ProcessTask | ProcessTaskExecution)[] | undefined;
235
369
 
236
370
  if (variant === "process") {
@@ -266,9 +400,9 @@ const IntegrationView: React.FC<Props> = ({
266
400
  }
267
401
 
268
402
  const mapped =
269
- variant === "process"
403
+ variant === "process" && processInput && "Processes" in processInput
270
404
  ? mapProcessConfigToNodesAndEdges(
271
- processInput as ConfigExport,
405
+ processInput,
272
406
  width,
273
407
  variant,
274
408
  onAdd,
@@ -276,7 +410,7 @@ const IntegrationView: React.FC<Props> = ({
276
410
  : mapProcessTasksToNodesAndEdges(
277
411
  executionDetails as ProcessExecutionDetails,
278
412
  width,
279
- variant as "process" | "process-execution",
413
+ variant ?? "process-execution",
280
414
  );
281
415
 
282
416
  const opts = { ...elkOptions };
@@ -482,111 +616,13 @@ const IntegrationView: React.FC<Props> = ({
482
616
  const handleNodeDragEnd = (_e: MouseEvent | TouchEvent, node: Node) => {
483
617
  const nodeY = node?.position?.y ?? 0;
484
618
  const nodeH = node?.height ?? 0;
485
-
486
- let zoneY = zonesY.find(
487
- (z) =>
488
- getOverlapY({ y: z.y, height: z.height }, { y: nodeY, height: nodeH }) >
489
- 0,
490
- );
491
-
492
- if (!zoneY && zonesY.length > 0) {
493
- const maxZone = _.maxBy(zonesY, "y");
494
- const minZone = _.minBy(zonesY, "y");
495
-
496
- if (minZone && maxZone) {
497
- if (nodeH && nodeY + nodeH < minZone.y) {
498
- zoneY = {
499
- ...minZone,
500
- sort: minZone.sort - 1,
501
- };
502
- } else if (nodeY > maxZone.y + maxZone.height) {
503
- zoneY = {
504
- ...maxZone,
505
- sort: maxZone.sort + 1,
506
- };
507
- } else {
508
- const localZones = _.sortBy(zonesY, "y");
509
-
510
- for (let i = 0; i < localZones.length - 1; i++) {
511
- const currentZone = localZones[i];
512
- const nextZone = localZones[i + 1];
513
-
514
- if (
515
- nodeY > currentZone.y + currentZone.height &&
516
- nodeY < nextZone.y
517
- ) {
518
- zoneY = {
519
- ...currentZone,
520
- sort: currentZone.sort + 0.5,
521
- };
522
- break;
523
- }
524
- }
525
- }
526
- }
527
- }
528
-
529
619
  const currentGroup = node?.parentId
530
620
  ? nodes.find((n) => n.id === node?.parentId)
531
621
  : null;
622
+ const groupX = (currentGroup?.position?.x ?? 0) + node.position.x;
532
623
 
533
- let zoneX: ZoneX | undefined;
534
- let overlapX = 0;
535
-
536
- for (const zone of zonesX) {
537
- const overlap = getOverlapX(
538
- { x: zone.x, width: zone.width },
539
- {
540
- x: (currentGroup?.position?.x ?? 0) + node.position.x,
541
- width: node.width ?? 0,
542
- },
543
- );
544
-
545
- if (overlap > overlapX) {
546
- overlapX = overlap;
547
- zoneX = zone;
548
- }
549
- }
550
-
551
- if (!zoneX && zonesX.length > 0) {
552
- const maxZone = _.maxBy(zonesX, "x");
553
- const minZone = _.minBy(zonesX, "x");
554
-
555
- if (minZone && maxZone) {
556
- const groupX = (currentGroup?.position?.x ?? 0) + node.position.x;
557
-
558
- if (groupX + (node.width ?? 0) < minZone.x) {
559
- zoneX = {
560
- ...minZone,
561
- parallelProcessingGroup: minZone.parallelProcessingGroup - 1,
562
- };
563
- } else if (groupX > maxZone.x + maxZone.width) {
564
- zoneX = {
565
- ...maxZone,
566
- parallelProcessingGroup: maxZone.parallelProcessingGroup + 1,
567
- };
568
- } else {
569
- const localZones = _.sortBy(zonesX, "x");
570
-
571
- for (let i = 0; i < localZones.length - 1; i++) {
572
- const currentZone = localZones[i];
573
- const nextZone = localZones[i + 1];
574
-
575
- if (
576
- groupX > currentZone.x &&
577
- groupX < nextZone.x + nextZone.width
578
- ) {
579
- zoneX = {
580
- ...currentZone,
581
- parallelProcessingGroup:
582
- currentZone.parallelProcessingGroup + 0.5,
583
- };
584
- break;
585
- }
586
- }
587
- }
588
- }
589
- }
624
+ const zoneY = findZoneY(zonesY, nodeY, nodeH);
625
+ const zoneX = findZoneX(zonesX, groupX, node.width ?? 0);
590
626
 
591
627
  if (!zoneY && !zoneX) {
592
628
  onLayout(processExecutionDetails);
@@ -600,93 +636,28 @@ const IntegrationView: React.FC<Props> = ({
600
636
  const modifiedProcess: ConfigExport =
601
637
  globalThis.structuredClone(configInput);
602
638
 
603
- let updatedTasks = modifiedProcess.Processes?.[0]?.ProcessTasks?.map(
604
- (task) => {
605
- if (task && zoneX) {
606
- const pt = (node?.data as { processTask?: ProcessTask })?.processTask;
607
- const matches = pt?.id
608
- ? task.ProcessTaskId === pt.id
609
- : task.Name === pt?.name;
610
- if (matches) {
611
- return {
612
- ...task,
613
- ParallelProcessingGroup: zoneX.parallelProcessingGroup,
614
- };
615
- }
616
- }
617
- return task;
618
- },
619
- );
639
+ const pt = (node?.data as { processTask?: ProcessTask })?.processTask;
620
640
 
621
- updatedTasks = updatedTasks?.map((task) => {
622
- if (task && zoneY) {
623
- const pt = (node?.data as { processTask?: ProcessTask })?.processTask;
641
+ const updatedTasks = modifiedProcess.Processes?.[0]?.ProcessTasks?.map(
642
+ (task) => {
643
+ if (!task) return task;
624
644
  const matches = pt?.id
625
645
  ? task.ProcessTaskId === pt.id
626
646
  : task.Name === pt?.name;
627
- if (matches) {
628
- return {
629
- ...task,
630
- Sort: zoneY.sort,
631
- };
632
- }
633
- }
634
- return task;
635
- });
636
-
637
- let prevParallelProcessingGroup: number | null = null;
638
- let index = 0;
639
-
640
- updatedTasks = _.sortBy(updatedTasks, [
641
- "ParallelProcessingGroup",
642
- "Sort",
643
- ])?.map((task) => {
644
- if (task) {
645
- const ppg = task.ParallelProcessingGroup ?? null;
646
- if (ppg !== prevParallelProcessingGroup) {
647
- prevParallelProcessingGroup = ppg;
648
- index++;
649
- }
650
-
651
- task.ParallelProcessingGroup = index;
652
- }
653
-
654
- return task;
655
- });
656
-
657
- const partitionedTasks = _.values(
658
- _.groupBy(updatedTasks, "ParallelProcessingGroup"),
647
+ if (!matches) return task;
648
+
649
+ return {
650
+ ...task,
651
+ ...(zoneX && {
652
+ ParallelProcessingGroup: zoneX.parallelProcessingGroup,
653
+ }),
654
+ ...(zoneY && { Sort: zoneY.sort }),
655
+ };
656
+ },
659
657
  );
660
658
 
661
- let processTaskValue: Maybe<ProcessTaskExport>[] = [];
662
-
663
- partitionedTasks.forEach((partition) => {
664
- index = 0;
665
- let prevSort: number | null = null;
666
-
667
- const sortedPartition = _.sortBy(partition, ["Sort", "Name"]).map(
668
- (task) => {
669
- if (task) {
670
- const sortVal = task.Sort ?? null;
671
- if (sortVal !== prevSort) {
672
- prevSort = sortVal;
673
- index++;
674
- }
675
-
676
- task.Sort = index;
677
- }
678
-
679
- return task;
680
- },
681
- );
682
-
683
- processTaskValue = processTaskValue.concat(
684
- sortedPartition as Maybe<ProcessTaskExport>[],
685
- );
686
- });
687
-
688
659
  if (modifiedProcess?.Processes?.[0])
689
- modifiedProcess.Processes[0].ProcessTasks = processTaskValue;
660
+ modifiedProcess.Processes[0].ProcessTasks = reindexTasks(updatedTasks);
690
661
 
691
662
  if (onConfigChange) onConfigChange(modifiedProcess);
692
663
  };