@evenicanpm/admin-integrate 1.2.2 → 1.4.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 (215) hide show
  1. package/documents/ConfigImport/configuration-import.ts +54 -0
  2. package/documents/CopyProcess/copy.ts +25 -0
  3. package/documents/Endpoint/fragments.ts +9 -0
  4. package/documents/Endpoint/list.ts +30 -0
  5. package/documents/Process/fragments.ts +22 -0
  6. package/documents/Process/get-process-details.ts +72 -0
  7. package/documents/Process/list.ts +24 -0
  8. package/documents/ProcessConfig/fragments.ts +116 -0
  9. package/documents/ProcessConfig/read.ts +35 -0
  10. package/documents/ProcessExecution/fragments.ts +12 -0
  11. package/documents/ProcessExecution/list.ts +30 -1
  12. package/documents/ProcessExecutionDetails/fragments.ts +96 -0
  13. package/documents/ProcessExecutionDetails/read.ts +12 -0
  14. package/documents/ProcessExport/read.ts +108 -0
  15. package/documents/ProcessScheduleGroup/read.ts +43 -0
  16. package/documents/ProcessTask/fragments.ts +288 -0
  17. package/documents/ProcessTask/read.ts +12 -0
  18. package/documents/ProcessTemplate/fragments.ts +74 -0
  19. package/documents/ProcessTemplate/list.ts +67 -0
  20. package/documents/ProcessTemplate/read.ts +12 -0
  21. package/documents/RunProcess/run.ts +11 -0
  22. package/package.json +4 -3
  23. package/src/api/Integrations/queries/get-process.query.ts +12 -12
  24. package/src/api/Integrations/queries/get-process.server.ts +7 -2
  25. package/src/api/configuration/queries/configuration-export.query.ts +48 -0
  26. package/src/api/configuration/queries/configuration-export.server.ts +9 -0
  27. package/src/api/configuration/queries/index.ts +1 -0
  28. package/src/api/dashboard/queries/get-process-executions.query.ts +6 -3
  29. package/src/api/dashboard/queries/get-process-executions.server.ts +1 -1
  30. package/src/api/execution-details/queries/get-process-execution-details.query.ts +46 -0
  31. package/src/api/execution-details/queries/get-process-execution-details.server.ts +11 -0
  32. package/src/api/execution-details/queries/get-process-executions-by-process.query.ts +48 -0
  33. package/src/api/execution-details/queries/get-process-executions-by-process.server.ts +11 -0
  34. package/src/api/execution-details/queries/index.ts +2 -0
  35. package/src/api/process/mutations/copy-process.mutation.ts +45 -0
  36. package/src/api/process/mutations/copy-process.server.ts +14 -0
  37. package/src/api/process/mutations/index.ts +2 -0
  38. package/src/api/process/mutations/run-process.mutation.ts +41 -0
  39. package/src/api/process/mutations/run-process.server.ts +14 -0
  40. package/src/api/process/queries/get-process-by-id.query.ts +85 -0
  41. package/src/api/process/queries/get-process-by-id.server.ts +20 -0
  42. package/src/api/process/queries/index.ts +4 -0
  43. package/src/api/process-config/mutation/index.ts +2 -0
  44. package/src/api/process-config/mutation/process-config-import.mutation.ts +42 -0
  45. package/src/api/process-config/mutation/process-config-import.server.ts +14 -0
  46. package/src/api/process-config/mutation/process-config-merge.mutation.ts +33 -0
  47. package/src/api/process-config/mutation/process-config-merge.server.ts +14 -0
  48. package/src/api/process-task/queries/get-process-task-by-id.query.ts +46 -0
  49. package/src/api/process-task/queries/get-process-task-by-id.server.ts +9 -0
  50. package/src/api/process-task/queries/index.ts +1 -0
  51. package/src/api/scheduler/mutation/create-process-schedule-group-details.mutation.ts +47 -0
  52. package/src/api/scheduler/mutation/create-process-schedule-group-details.server.ts +14 -0
  53. package/src/api/scheduler/mutation/index.ts +2 -0
  54. package/src/api/scheduler/mutation/update-process-schedule-group-details.mutation.ts +47 -0
  55. package/src/api/scheduler/mutation/update-process-schedule-group-details.server.ts +14 -0
  56. package/src/api/scheduler/queries/get-non-scheduled-processes.query.ts +48 -0
  57. package/src/api/scheduler/queries/get-non-scheduled-processes.server.ts +11 -0
  58. package/src/api/scheduler/queries/get-process-schedule-group-details.query.ts +6 -3
  59. package/src/api/scheduler/queries/get-process-schedule-group-details.server.ts +3 -3
  60. package/src/api/scheduler/queries/get-process-schedule.query.ts +6 -3
  61. package/src/api/scheduler/queries/get-process-schedule.server.ts +3 -3
  62. package/src/api/scheduler/queries/get-scheduled-processes.query.ts +6 -3
  63. package/src/api/scheduler/queries/get-scheduled-processes.server.ts +1 -1
  64. package/src/api/scheduler/queries/index.ts +3 -2
  65. package/src/api/templates/queries/get-process-template-groups.query.ts +48 -0
  66. package/src/api/templates/queries/get-process-template-groups.server.ts +11 -0
  67. package/src/api/templates/queries/get-process-template-records.query.ts +48 -0
  68. package/src/api/templates/queries/get-process-template-records.server.ts +11 -0
  69. package/src/api/templates/queries/get-process-template.query.ts +48 -0
  70. package/src/api/templates/queries/get-process-template.server.ts +9 -0
  71. package/src/api/templates/queries/get-process-templates.query.ts +45 -0
  72. package/src/api/templates/queries/get-process-templates.server.ts +9 -0
  73. package/src/api/templates/queries/index.ts +5 -0
  74. package/src/api/templates/queries/template-input-search.query.ts +39 -0
  75. package/src/api/templates/queries/template-input-search.server.ts +42 -0
  76. package/src/api/templates/queries/types.ts +34 -0
  77. package/src/components/breadcrumbs/breadcrumbs.tsx +33 -6
  78. package/src/components/button/outlined-icon-button.tsx +2 -2
  79. package/src/components/core/date-time-popover.tsx +12 -5
  80. package/src/components/core/drawer-buttons.tsx +52 -0
  81. package/src/components/core/edited-typography.tsx +2 -2
  82. package/src/components/core/index.ts +4 -2
  83. package/src/components/core/loading.tsx +1 -1
  84. package/src/components/core/status-tag.tsx +97 -0
  85. package/src/components/core/title-edit.tsx +31 -22
  86. package/src/components/dashboard-list/dashboard-list-row.tsx +22 -29
  87. package/src/components/dashboard-list/dashboard-list.tsx +20 -16
  88. package/src/components/data-table/table-header.tsx +6 -8
  89. package/src/components/data-table/table-pagination.tsx +1 -1
  90. package/src/components/data-table/table-row.tsx +1 -1
  91. package/src/components/data-table/table-skeleton.tsx +10 -5
  92. package/src/components/execution/execution-filter.ts +1 -1
  93. package/src/components/execution/execution-status-icon.tsx +7 -7
  94. package/src/components/execution/execution-tag.tsx +12 -77
  95. package/src/components/execution/index.ts +1 -1
  96. package/src/components/execution-history-drawer/execution-history-drawer.tsx +202 -0
  97. package/src/components/execution-history-drawer/executions-card.tsx +85 -0
  98. package/src/components/execution-history-drawer/index.ts +1 -0
  99. package/src/components/footer/footer.tsx +10 -6
  100. package/src/components/header/dashboard-list-header.tsx +12 -7
  101. package/src/components/header/execution-details-header.tsx +35 -26
  102. package/src/components/header/header.tsx +10 -3
  103. package/src/components/header/index.ts +1 -1
  104. package/src/components/header/integration-details-header.tsx +108 -45
  105. package/src/components/integration-list/index.ts +2 -1
  106. package/src/components/integration-list/integration-filter.ts +1 -1
  107. package/src/components/integration-list/integration-status-icon.tsx +7 -8
  108. package/src/components/integration-list/integration-tag.tsx +6 -50
  109. package/src/components/integration-list/list/integration-list-row.tsx +161 -0
  110. package/src/components/integration-list/list/integration-list-table.tsx +62 -0
  111. package/src/{pages/integrations/integration-list → components/integration-list/list}/integration-list.tsx +47 -51
  112. package/src/components/integration-view/animated-svg.tsx +31 -0
  113. package/src/components/integration-view/edges/default-edge.tsx +2 -6
  114. package/src/components/integration-view/elk-layout-options.ts +2 -2
  115. package/src/components/integration-view/elk-types.ts +35 -6
  116. package/src/components/integration-view/flow-types.tsx +12 -0
  117. package/src/components/integration-view/integration-view.tsx +562 -56
  118. package/src/components/integration-view/nodes/add-node.tsx +20 -0
  119. package/src/components/integration-view/nodes/empty-node.tsx +65 -0
  120. package/src/components/integration-view/nodes/entry-node.tsx +98 -4
  121. package/src/components/integration-view/nodes/execution-entry-node.tsx +107 -0
  122. package/src/components/integration-view/nodes/execution-task-node.tsx +88 -0
  123. package/src/components/integration-view/nodes/group-node.tsx +33 -13
  124. package/src/components/integration-view/nodes/row-node.tsx +19 -0
  125. package/src/components/integration-view/nodes/task-node.tsx +50 -16
  126. package/src/components/integration-view/task-icon.tsx +193 -0
  127. package/src/components/integration-view/temp-data/initialElements.tsx +34 -32
  128. package/src/components/integration-view/types.ts +2 -2
  129. package/src/components/integration-view/utils/mapping.ts +404 -0
  130. package/src/components/layouts/main-layout.tsx +3 -4
  131. package/src/components/layouts/root-container.tsx +5 -11
  132. package/src/components/link-cards/link-card.tsx +15 -4
  133. package/src/components/link-cards/styles.ts +1 -1
  134. package/src/components/list-filter/date-filter.tsx +7 -4
  135. package/src/components/list-filter/date-range-filter.tsx +15 -7
  136. package/src/components/list-filter/index.ts +1 -1
  137. package/src/components/list-filter/list-filter.tsx +31 -26
  138. package/src/components/list-filter/multi-select-filter.tsx +11 -10
  139. package/src/components/list-filter/select-filter.tsx +23 -12
  140. package/src/components/scheduler/day-selector.tsx +29 -15
  141. package/src/components/scheduler/day-tag.tsx +14 -51
  142. package/src/components/scheduler/index.ts +2 -1
  143. package/src/components/scheduler/schedule-drawer/details-reducer.ts +217 -0
  144. package/src/components/scheduler/schedule-drawer/schedule-details-integrations.tsx +501 -0
  145. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details-main.tsx +137 -100
  146. package/src/components/scheduler/schedule-drawer/schedule-details-name.tsx +94 -0
  147. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details-skeleton.tsx +1 -2
  148. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details.tsx +10 -14
  149. package/src/components/scheduler/schedule-drawer/schedule-drawer-group.tsx +214 -0
  150. package/src/{pages → components}/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +7 -26
  151. package/src/components/scheduler/schedule-drawer/schedule-drawer.tsx +116 -0
  152. package/src/components/scheduler/schedule-drawer/sortable-integration-row.tsx +130 -0
  153. package/src/components/scheduler/schedule-filter.ts +1 -1
  154. package/src/components/scheduler/schedule-icon.tsx +5 -6
  155. package/src/components/scheduler/schedule-integration-icon.tsx +31 -0
  156. package/src/components/templates/index.ts +1 -0
  157. package/src/components/templates/inputs/index.tsx +1392 -0
  158. package/src/components/templates/template-filter.ts +5 -0
  159. package/src/components/templates/templates-list/index.ts +1 -0
  160. package/src/components/templates/templates-list/templates-list-row.tsx +55 -0
  161. package/src/components/templates/templates-list/templates-list-table.tsx +58 -0
  162. package/src/components/templates/templates-list/templates-list.tsx +253 -0
  163. package/src/components/templates/types.tsx +76 -0
  164. package/src/components/templates/wizard.tsx +737 -0
  165. package/src/hooks/use-breadcrumbs.ts +1 -1
  166. package/src/hooks/use-recurrence.tsx +1 -2
  167. package/src/pages/dashboard/dashboard-link-cards.tsx +8 -11
  168. package/src/pages/dashboard/dashboard-list-sections.tsx +8 -10
  169. package/src/pages/dashboard/dashboard.tsx +1 -2
  170. package/src/pages/execution-details/execution-details.tsx +212 -14
  171. package/src/pages/execution-details/task-execution-details.tsx +160 -0
  172. package/src/pages/execution-details/task-execution-drawer.tsx +54 -0
  173. package/src/pages/executions/executions-list/executions-list-row.tsx +21 -27
  174. package/src/pages/executions/executions-list/executions-list-table.tsx +29 -36
  175. package/src/pages/executions/executions-list/executions-list.tsx +24 -18
  176. package/src/pages/executions/executions.tsx +11 -15
  177. package/src/pages/integration-create/index.ts +1 -0
  178. package/src/pages/integration-create/integration-create.tsx +216 -0
  179. package/src/pages/integration-create/pre-creation-step.tsx +84 -0
  180. package/src/pages/integration-create/select-step.tsx +105 -0
  181. package/src/pages/integration-create/template-list-step.tsx +77 -0
  182. package/src/pages/integration-create/wizard-step.tsx +51 -0
  183. package/src/pages/integration-details/import-process/copy-tasks-list.tsx +265 -0
  184. package/src/pages/integration-details/import-process/copy-tasks-row.tsx +77 -0
  185. package/src/pages/integration-details/import-process/import-confirm.tsx +61 -0
  186. package/src/pages/integration-details/import-process/import-drawer.tsx +48 -0
  187. package/src/pages/integration-details/import-process/import-process-reducer.ts +90 -0
  188. package/src/pages/integration-details/import-process/import-process.tsx +149 -0
  189. package/src/pages/integration-details/index.ts +1 -0
  190. package/src/pages/integration-details/integration-details.tsx +468 -0
  191. package/src/pages/integration-details/task-drawer/add-task.tsx +172 -0
  192. package/src/pages/integration-details/task-drawer/edit-task.tsx +161 -0
  193. package/src/pages/integration-details/task-drawer/task-drawer.tsx +157 -0
  194. package/src/pages/integration-details/task-drawer/task-reducer.ts +103 -0
  195. package/src/pages/integrations/integrations.tsx +11 -14
  196. package/src/pages/scheduler/scheduler.tsx +12 -24
  197. package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +27 -37
  198. package/src/pages/scheduler/schedules-list/schedules-list-table.tsx +28 -43
  199. package/src/pages/scheduler/schedules-list/schedules-list.tsx +48 -21
  200. package/src/utils/date-functions.ts +69 -0
  201. package/src/utils/slugify.ts +3 -0
  202. package/tsconfig.json +12 -4
  203. package/src/hooks/use-timestamp.tsx +0 -25
  204. package/src/pages/integrations/integration-list/integration-list-row.tsx +0 -147
  205. package/src/pages/integrations/integration-list/integration-list-table.tsx +0 -78
  206. package/src/pages/scheduler/schedule-drawer/schedule-details-integrations.tsx +0 -227
  207. package/src/pages/scheduler/schedule-drawer/schedule-details-name.tsx +0 -77
  208. package/src/pages/scheduler/schedule-drawer/schedule-drawer-buttons.tsx +0 -72
  209. package/src/pages/scheduler/schedule-drawer/schedule-drawer-group.tsx +0 -103
  210. package/src/pages/scheduler/schedule-drawer/schedule-drawer.tsx +0 -101
  211. package/src/pages/scheduler/schedule-drawer/sortable-integration-row.tsx +0 -93
  212. /package/src/{pages/integrations/integration-list → components/integration-list/list}/index.ts +0 -0
  213. /package/src/{pages → components}/scheduler/schedule-drawer/edited/edited-types.ts +0 -0
  214. /package/src/{pages → components}/scheduler/schedule-drawer/edited/index.ts +0 -0
  215. /package/src/{pages → components}/scheduler/schedule-drawer/index.ts +0 -0
@@ -1,14 +1,13 @@
1
- import React from "react";
2
-
3
- import { SxProps } from "@mui/material";
4
- import StorageIcon from "@mui/icons-material/Storage";
5
- import ElectricBoltIcon from "@mui/icons-material/ElectricBolt";
6
1
  import CodeIcon from "@mui/icons-material/Code";
7
- import TableChartIcon from "@mui/icons-material/TableChart";
2
+ import ElectricBoltIcon from "@mui/icons-material/ElectricBolt";
8
3
  import EmailIcon from "@mui/icons-material/Email";
9
4
  import IosShareIcon from "@mui/icons-material/IosShare";
10
5
  import QuestionMarkIcon from "@mui/icons-material/QuestionMark";
6
+ import StorageIcon from "@mui/icons-material/Storage";
7
+ import TableChartIcon from "@mui/icons-material/TableChart";
8
+ import type { SxProps } from "@mui/material";
11
9
  import { purple } from "@mui/material/colors";
10
+ import type React from "react";
12
11
 
13
12
  interface Props {
14
13
  processIcon: string;
@@ -17,7 +16,7 @@ interface Props {
17
16
 
18
17
  const IntegrationStatusIcon: React.FC<Props> = (props: Props) => {
19
18
  const color = purple[500];
20
- const statusIconMap = {
19
+ const statusIconMap: { [key: string]: React.ReactNode } = {
21
20
  DB: <StorageIcon color="success" />,
22
21
  Webhook: <ElectricBoltIcon color="error" />,
23
22
  Restful: <CodeIcon color="info" />,
@@ -27,7 +26,7 @@ const IntegrationStatusIcon: React.FC<Props> = (props: Props) => {
27
26
  noIcon: <QuestionMarkIcon color="info" />,
28
27
  };
29
28
 
30
- return statusIconMap[props.processIcon] || statusIconMap["noIcon"];
29
+ return statusIconMap[props.processIcon] || statusIconMap.noIcon;
31
30
  };
32
31
 
33
32
  export default IntegrationStatusIcon;
@@ -1,20 +1,7 @@
1
- import React from "react";
2
- import { styled } from "@mui/material/styles";
3
- import { Box, Typography, SxProps } from "@mui/material";
1
+ import { StatusTag } from "@evenicanpm/admin-integrate/components/core";
2
+ import { Box, type SxProps } from "@mui/material";
4
3
  import { useTranslations } from "next-intl";
5
4
 
6
- const StyledTagBox = styled(Box)(({ theme }) => ({
7
- padding: theme.spacing(0, 1.5),
8
- border: "solid 1px",
9
- borderRadius: 4,
10
- alignContent: "center",
11
- maxWidth: "fit-content",
12
- }));
13
-
14
- const StyledTag = styled(Typography)(({ theme }) => ({
15
- fontWeight: "bold",
16
- }));
17
-
18
5
  interface Props {
19
6
  process: {
20
7
  isScheduled: number;
@@ -29,46 +16,15 @@ const IntegrationTag: React.FC<Props> = ({ process, sx }) => {
29
16
  return (
30
17
  <Box display="flex" gap={1} justifyContent="center">
31
18
  {process.isTriggered === 1 && (
32
- <StyledTagBox
33
- sx={{
34
- backgroundColor: "info.100",
35
- borderColor: "transparent",
36
- ...sx,
37
- }}
38
- >
39
- <StyledTag color="info" variant="caption">
40
- {t("triggered")}
41
- </StyledTag>
42
- </StyledTagBox>
19
+ <StatusTag type="info" text={t("triggered")} sx={sx} />
43
20
  )}
44
21
 
45
22
  {process.isScheduled === 1 && (
46
- <StyledTagBox
47
- sx={{
48
- backgroundColor: "success.100",
49
- borderColor: "transparent",
50
- ...sx,
51
- }}
52
- >
53
- <StyledTag color="success" variant="caption">
54
- {t("scheduled")}
55
- </StyledTag>
56
- </StyledTagBox>
23
+ <StatusTag type="success" text={t("scheduled")} sx={sx} />
57
24
  )}
58
25
 
59
- {process.isScheduled === 0 && process.isTriggered === 0 && (
60
- <StyledTagBox
61
- sx={{
62
- backgroundColor: "warning.100",
63
- borderColor: "transparent",
64
- color: "orange.700",
65
- ...sx,
66
- }}
67
- >
68
- <StyledTag color="inherit" variant="caption">
69
- {t("scheduledPending")}
70
- </StyledTag>
71
- </StyledTagBox>
26
+ {process.isScheduled === 0 && (
27
+ <StatusTag type="warning" text={t("scheduledPending")} sx={sx} />
72
28
  )}
73
29
  </Box>
74
30
  );
@@ -0,0 +1,161 @@
1
+ import { DateTimePopover } from "@evenicanpm/admin-integrate/components/core";
2
+ import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
3
+ import {
4
+ StyledIconButton,
5
+ StyledTableCell,
6
+ StyledTableRow,
7
+ } from "@evenicanpm/admin-integrate/components/data-table/table-row";
8
+ import {
9
+ IntegrationStatusIcon,
10
+ IntegrationTag,
11
+ } from "@evenicanpm/admin-integrate/components/integration-list";
12
+ import { toDistanceDate } from "@evenicanpm/admin-integrate/utils/date-functions";
13
+ import { ContentCopyOutlined, RemoveRedEye } from "@mui/icons-material";
14
+ import {
15
+ Box,
16
+ Stack,
17
+ type SxProps,
18
+ type TableCellProps,
19
+ type Theme,
20
+ Typography,
21
+ useTheme,
22
+ } from "@mui/material";
23
+ import { RedirectType, redirect } from "next/navigation";
24
+ import type React from "react";
25
+ import { useState } from "react";
26
+ import type { IntegrationItem } from "./integration-list";
27
+
28
+ interface Props {
29
+ item: IntegrationItem;
30
+ heading: Head[]; // for alignment
31
+ sx?: SxProps;
32
+ handleRedirect?: (id: string) => void;
33
+ isImportMode?: boolean;
34
+ readOnly?: boolean;
35
+ }
36
+
37
+ const IntegrationListRow: React.FC<Props> = (props: Props) => {
38
+ const theme = useTheme();
39
+ const styles = getStyles(theme);
40
+
41
+ const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
42
+ const open = Boolean(anchorEl);
43
+
44
+ const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
45
+ setAnchorEl(event.currentTarget);
46
+ };
47
+
48
+ const handlePopoverClose = () => {
49
+ setAnchorEl(null);
50
+ };
51
+
52
+ const handleRedirect = () => {
53
+ if (props.handleRedirect) {
54
+ props.handleRedirect(props.item.id);
55
+ } else {
56
+ redirect(`/e4integrate/integrations/${props.item.id}`, RedirectType.push);
57
+ }
58
+ };
59
+
60
+ const headings = {
61
+ name: props.heading.find((h) => h.id === "name"),
62
+ id: props.heading.find((h) => h.id === "id"),
63
+ isScheduled: props.heading.find((h) => h.id === "isScheduled"),
64
+ modified: props.heading.find((h) => h.id === "modified"),
65
+ view: props.heading.find((h) => h.id === "view"),
66
+ };
67
+
68
+ return (
69
+ <StyledTableRow sx={props.sx}>
70
+ {headings.name && (
71
+ <StyledTableCell
72
+ align={headings.name.align as TableCellProps["align"]}
73
+ width={headings.name.width}
74
+ >
75
+ <Stack spacing={1} direction="row">
76
+ <Box display="flex" justifyContent="flex-end" alignItems="center">
77
+ <IntegrationStatusIcon processIcon={props.item.processIcon} />
78
+ </Box>
79
+ <Box display="flex" justifyContent="flex-end" alignItems="center">
80
+ <Typography>{props.item.name}</Typography>
81
+ </Box>
82
+ </Stack>
83
+ </StyledTableCell>
84
+ )}
85
+ {headings.id && (
86
+ <StyledTableCell
87
+ align={headings.id.align as TableCellProps["align"]}
88
+ width={headings.id.width}
89
+ >
90
+ <Typography>{props.item.id}</Typography>
91
+ </StyledTableCell>
92
+ )}
93
+ {headings.isScheduled && (
94
+ <StyledTableCell
95
+ align={headings.isScheduled.align as TableCellProps["align"]}
96
+ width={headings.isScheduled.width}
97
+ >
98
+ <IntegrationTag
99
+ process={{
100
+ isScheduled: props.item.isScheduled,
101
+ isTriggered: props.item.isTriggered,
102
+ }}
103
+ />
104
+ </StyledTableCell>
105
+ )}
106
+ {headings.modified && (
107
+ <StyledTableCell
108
+ align={headings.modified.align as TableCellProps["align"]}
109
+ width={headings.modified.width}
110
+ sx={styles.timeCell}
111
+ >
112
+ <Typography
113
+ onMouseEnter={handlePopoverOpen}
114
+ onMouseLeave={handlePopoverClose}
115
+ >
116
+ {toDistanceDate(props.item.modified)}
117
+ </Typography>
118
+ <DateTimePopover
119
+ dateIsoString={props.item.modified}
120
+ sx={{ pointerEvents: "none" }}
121
+ open={open}
122
+ anchorEl={anchorEl}
123
+ anchorOrigin={{
124
+ vertical: "bottom",
125
+ horizontal: "center",
126
+ }}
127
+ transformOrigin={{
128
+ vertical: "top",
129
+ horizontal: "center",
130
+ }}
131
+ onClose={handlePopoverClose}
132
+ disableRestoreFocus
133
+ />
134
+ </StyledTableCell>
135
+ )}
136
+ {headings.view && (
137
+ <StyledTableCell
138
+ align={headings.view.align as TableCellProps["align"]}
139
+ width={headings.view.width}
140
+ >
141
+ <StyledIconButton onClick={handleRedirect} disabled={props.readOnly}>
142
+ {props.isImportMode ? <ContentCopyOutlined /> : <RemoveRedEye />}
143
+ </StyledIconButton>
144
+ </StyledTableCell>
145
+ )}
146
+ </StyledTableRow>
147
+ );
148
+ };
149
+
150
+ const getStyles = (theme: Theme) => {
151
+ return {
152
+ timeCell: {
153
+ cursor: "default",
154
+ },
155
+ popover: {
156
+ padding: theme.spacing(1),
157
+ },
158
+ };
159
+ };
160
+
161
+ export default IntegrationListRow;
@@ -0,0 +1,62 @@
1
+ import type { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
2
+ import { TableHeader } from "@evenicanpm/admin-integrate/components/data-table";
3
+ import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
4
+ import { type SxProps, Table, TableBody, TableContainer } from "@mui/material";
5
+ import type { IntegrationItem } from "./integration-list";
6
+ import IntegrationListRow from "./integration-list-row";
7
+
8
+ interface Props {
9
+ heading: Head[];
10
+ items: IntegrationItem[];
11
+ input: ProcessExecutionInput;
12
+ setInput: (newInput: ProcessExecutionInput) => void;
13
+ rowSx?: SxProps;
14
+ handleRedirect?: (id: string) => void;
15
+ isImportMode?: boolean;
16
+ readOnly?: boolean;
17
+ }
18
+
19
+ export default function IntegrationListTable(props: Readonly<Props>) {
20
+ const handleRequestSort = (property: string) => {
21
+ const current = props.input.sort;
22
+ if (property === current) {
23
+ props.setInput({
24
+ ...props.input,
25
+ sortDesc: !props.input.sortDesc,
26
+ });
27
+ } else {
28
+ props.setInput({
29
+ ...props.input,
30
+ sort: property,
31
+ sortDesc: false,
32
+ });
33
+ }
34
+ };
35
+
36
+ return (
37
+ <TableContainer>
38
+ <Table>
39
+ <TableHeader
40
+ heading={props.heading}
41
+ orderBy={props.input.sort ?? ""}
42
+ order={props.input.sortDesc ? "desc" : "asc"}
43
+ onRequestSort={handleRequestSort}
44
+ rowSx={props.rowSx}
45
+ />
46
+ <TableBody>
47
+ {props.items.map((item) => (
48
+ <IntegrationListRow
49
+ key={item.id}
50
+ item={item}
51
+ heading={props.heading}
52
+ sx={props.rowSx}
53
+ handleRedirect={props.handleRedirect}
54
+ isImportMode={props.isImportMode}
55
+ readOnly={props.readOnly}
56
+ />
57
+ ))}
58
+ </TableBody>
59
+ </Table>
60
+ </TableContainer>
61
+ );
62
+ }
@@ -1,46 +1,35 @@
1
- import React, { useState, useEffect } from "react";
2
- import { useTranslations } from "next-intl";
3
-
4
- // API
5
- import {
1
+ import type {
6
2
  GetProcessesQuery,
7
3
  ProcessInput,
8
4
  } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
9
- import { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
10
-
11
- // MUI
12
- import { Theme, useTheme } from "@mui/material";
13
- import {
14
- Card,
15
- Box,
16
- Stack,
17
- Typography,
18
- Grid2 as Grid,
19
- Skeleton,
20
- } from "@mui/material";
21
-
22
- // Custom components
23
5
  import { FlexBox } from "@evenicanpm/admin-core/components/flex-box";
24
6
  import {
25
7
  TablePagination,
26
8
  TableSkeleton,
27
9
  } from "@evenicanpm/admin-integrate/components/data-table";
28
- import { ListFilter } from "@evenicanpm/admin-integrate/components/list-filter";
29
-
30
- // Local components
31
- import IntegrationListTable from "./integration-list-table";
32
-
33
- // Types
34
- import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
35
- import { ListFilterOutput } from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
10
+ import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
36
11
  import {
37
- IntegrationListFilters,
12
+ type IntegrationListFilters,
38
13
  integrationListFilters,
39
14
  } from "@evenicanpm/admin-integrate/components/integration-list/integration-filter";
40
- import { log } from "console";
15
+ import { ListFilter } from "@evenicanpm/admin-integrate/components/list-filter";
16
+ import type { ListFilterOutput } from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
17
+ import {
18
+ Box,
19
+ Card,
20
+ Grid2 as Grid,
21
+ Stack,
22
+ type Theme,
23
+ Typography,
24
+ useTheme,
25
+ } from "@mui/material";
26
+ import { useTranslations } from "next-intl";
27
+ import type React from "react";
28
+ import { useEffect, useState } from "react";
29
+ import IntegrationListTable from "./integration-list-table";
41
30
 
42
31
  // Returned from processExecutions query
43
- export interface executionItem {
32
+ export interface IntegrationItem {
44
33
  isScheduled: 0 | 1;
45
34
  isTriggered: 0 | 1;
46
35
  id: string;
@@ -58,6 +47,9 @@ interface Props {
58
47
  loading: boolean;
59
48
  input: ProcessInput;
60
49
  setInput: (newInput: ProcessInput) => void;
50
+ handleRedirect?: (id: string) => void;
51
+ isImportMode?: boolean;
52
+ readOnly?: boolean;
61
53
  }
62
54
 
63
55
  const IntegrationList: React.FC<Props> = (props: Props) => {
@@ -66,22 +58,22 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
66
58
  const theme = useTheme();
67
59
  const styles = getStyles(theme);
68
60
 
69
- const [items, setItems] = useState<Item[]>([]);
70
- const [fetched, setFetched] = useState<boolean>(false); // prevents "empty list" msg from showing for split second
71
- const [page, setPage] = useState(props.input.skip / props.input.top + 1);
72
- const [perPage, setPerPage] = useState(props.input.top);
61
+ const [items, setItems] = useState<IntegrationItem[]>([]);
62
+ const [page, setPage] = useState(
63
+ (props.input.skip ?? 0) / (props.input.top ?? 10) + 1,
64
+ );
65
+ const [perPage, setPerPage] = useState<number>(props.input.top || 10);
73
66
 
74
67
  const handleChangePage = (
75
68
  event: React.ChangeEvent<unknown>,
76
69
  value: number,
77
70
  ) => {
78
- if (page !== value) {
71
+ if (page !== value && event) {
79
72
  setPage(value);
80
73
  props.setInput({
81
74
  ...props.input,
82
- skip: props.input.top * (value - 1),
75
+ skip: (props.input.top || 10) * (value - 1),
83
76
  });
84
- setFetched(false);
85
77
  }
86
78
  };
87
79
 
@@ -89,7 +81,6 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
89
81
  filterUpdate: ListFilterOutput<IntegrationListFilters>,
90
82
  ) => {
91
83
  const { itemsPerPage, search, filters } = filterUpdate;
92
- console.log("filters", filters?.multiSelectFilter);
93
84
 
94
85
  props.setInput({
95
86
  ...props.input,
@@ -98,10 +89,8 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
98
89
  search: search,
99
90
  integrationTags:
100
91
  filters?.multiSelectFilter?.map((f) => `${f.id}`) || null,
101
- sortDesc: true,
102
92
  });
103
- setFetched(false);
104
- setPerPage(itemsPerPage);
93
+ setPerPage(itemsPerPage as number);
105
94
  setPage(1);
106
95
  };
107
96
 
@@ -111,13 +100,11 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
111
100
  skip: 0,
112
101
  integrationTags: null,
113
102
  });
114
- setFetched(false);
115
103
  };
116
104
 
117
105
  useEffect(() => {
118
- if (props.data) {
119
- setItems(props.data.processes.nodes as Item[]);
120
- setFetched(true);
106
+ if (props.data?.processes?.nodes) {
107
+ setItems(props.data.processes.nodes as IntegrationItem[]);
121
108
  }
122
109
  }, [props.data]);
123
110
 
@@ -127,7 +114,11 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
127
114
  <ListFilter<IntegrationListFilters>
128
115
  setFilters={handleSetFilters}
129
116
  clearFilters={handleClearFilters}
130
- filters={integrationListFilters}
117
+ filters={
118
+ props.heading.find((h) => h.id === "isScheduled")
119
+ ? integrationListFilters
120
+ : ({} as IntegrationListFilters)
121
+ }
131
122
  config={{
132
123
  pagination: {
133
124
  pageDefault: 10,
@@ -147,10 +138,11 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
147
138
  </Card>
148
139
  )}
149
140
 
150
- {!props.loading && props.data && fetched && items.length > 0 ? (
141
+ {!props.loading && props.data.processes && items.length > 0 ? (
151
142
  <Box
152
143
  sx={{
153
144
  minHeight:
145
+ props.data.processes.pageInfo?.resultsReturned &&
154
146
  props.data.processes.pageInfo.resultsReturned < perPage &&
155
147
  page === 1
156
148
  ? theme.spacing(
@@ -167,12 +159,15 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
167
159
  input={props.input}
168
160
  setInput={props.setInput}
169
161
  rowSx={styles.rowSx}
162
+ handleRedirect={props.handleRedirect}
163
+ isImportMode={props.isImportMode}
164
+ readOnly={props.readOnly}
170
165
  />
171
166
  </Card>
172
167
  </Box>
173
168
  ) : null}
174
169
 
175
- {!props.loading && fetched && items.length === 0 ? (
170
+ {!props.loading && items.length === 0 ? (
176
171
  <Card>
177
172
  <FlexBox
178
173
  justifyContent="center"
@@ -192,7 +187,7 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
192
187
  </Card>
193
188
  ) : null}
194
189
 
195
- {!props.loading && props.data && fetched && items.length > 0 ? (
190
+ {!props.loading && props.data?.processes && items.length > 0 ? (
196
191
  <Grid container spacing={1} sx={styles.pagination}>
197
192
  <Grid size={{ xs: 10.5 }}>
198
193
  <FlexBox
@@ -204,7 +199,8 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
204
199
  page={page}
205
200
  onChange={handleChangePage}
206
201
  count={Math.ceil(
207
- props.data.processes.recordCount / props.input.top,
202
+ (props.data.processes.recordCount || 10) /
203
+ (props.input.top || 10),
208
204
  )}
209
205
  />
210
206
  </FlexBox>
@@ -216,7 +212,7 @@ const IntegrationList: React.FC<Props> = (props: Props) => {
216
212
  sx={{ height: "100%" }}
217
213
  >
218
214
  <Typography color="grey">
219
- {`${props.data.processes.pageInfo.resultsReturned} ${t("Pagination.of")} ${props.data.processes.recordCount} ${t("Pagination.items")}`}
215
+ {`${props.data.processes.pageInfo?.resultsReturned || 0} ${t("Pagination.of")} ${props.data.processes.recordCount || 0} ${t("Pagination.items")}`}
220
216
  </Typography>
221
217
  </FlexBox>
222
218
  </Grid>
@@ -0,0 +1,31 @@
1
+ import { BaseEdge, type EdgeProps, getSmoothStepPath } from "@xyflow/react";
2
+ import React from "react";
3
+
4
+ export function AnimatedSVGEdge({
5
+ id,
6
+ sourceX,
7
+ sourceY,
8
+ targetX,
9
+ targetY,
10
+ sourcePosition,
11
+ targetPosition,
12
+ markerEnd,
13
+ }: EdgeProps) {
14
+ const [edgePath] = getSmoothStepPath({
15
+ sourceX,
16
+ sourceY,
17
+ sourcePosition,
18
+ targetX,
19
+ targetY,
20
+ targetPosition,
21
+ });
22
+
23
+ return (
24
+ <>
25
+ <BaseEdge id={id} path={edgePath} markerEnd={markerEnd} />
26
+ <circle r="5" fill="#4E97FD">
27
+ <animateMotion dur="2s" repeatCount="indefinite" path={edgePath} />
28
+ </circle>
29
+ </>
30
+ );
31
+ }
@@ -1,4 +1,4 @@
1
- import { BaseEdge, EdgeProps, getSmoothStepPath } from "@xyflow/react";
1
+ import { BaseEdge, type EdgeProps, getSmoothStepPath } from "@xyflow/react";
2
2
 
3
3
  export function DefaultEdge({
4
4
  id,
@@ -16,9 +16,5 @@ export function DefaultEdge({
16
16
  borderRadius: 0,
17
17
  });
18
18
 
19
- return (
20
- <>
21
- <BaseEdge id={id} path={edgePath} markerEnd={markerEnd} />
22
- </>
23
- );
19
+ return <BaseEdge id={id} path={edgePath} markerEnd={markerEnd} />;
24
20
  }
@@ -1,4 +1,4 @@
1
- import { LayoutOptions } from "elkjs";
1
+ import type { LayoutOptions } from "elkjs";
2
2
 
3
3
  export const layoutOptions: LayoutOptions = {
4
4
  "elk.algorithm": "layered",
@@ -8,7 +8,7 @@ export const layoutOptions: LayoutOptions = {
8
8
  "org.eclipse.elk.hierarchyHandling": "INCLUDE_CHILDREN",
9
9
 
10
10
  // Center parent nodes among their children, children immediately below
11
- "org.eclipse.elk.layered.contentAlignment": "H_CENTER,V_TOP",
11
+ //"org.eclipse.elk.layered.contentAlignment": "H_CENTER,V_TOP",
12
12
 
13
13
  // Reduce edge crossings
14
14
  "org.eclipse.elk.layered.crossingMinimization.strategy": "LAYER_SWEEP",
@@ -1,18 +1,47 @@
1
- import { ElkExtendedEdge, ElkNode } from "elkjs";
1
+ import type { ElkExtendedEdge, ElkNode } from "elkjs";
2
+ import type {
3
+ ProcessTask,
4
+ ProcessTaskExecution,
5
+ } from "../../../../admin-core/src/api/e4/graphqlRequestSdk";
2
6
 
3
7
  export interface ElkNodeWithFlow extends ElkNode {
4
8
  type?: string;
5
- data?: {
6
- label: string;
7
- icon?: any;
8
- isLast?: boolean;
9
- };
9
+ data?: any;
10
10
  position?: {
11
11
  x: number;
12
12
  y: number;
13
13
  };
14
14
  children?: ElkNodeWithFlow[];
15
15
  extent?: string;
16
+ parentId?: string;
17
+ sort?: number;
18
+ }
19
+
20
+ export interface GroupNode extends ElkNodeWithFlow {
21
+ data: {
22
+ label: string;
23
+ parallelProcessesingGroup?: number;
24
+ isLast?: boolean;
25
+ disabled?: boolean;
26
+ selected?: boolean;
27
+ };
28
+ }
29
+
30
+ export interface ProcessTaskNode extends ElkNodeWithFlow {
31
+ data: {
32
+ processTask: ProcessTask;
33
+ isLast?: boolean;
34
+ disabled?: boolean;
35
+ selected?: boolean;
36
+ };
37
+ }
38
+
39
+ export interface ProcessTaskExecutionNode extends ElkNodeWithFlow {
40
+ data: {
41
+ processTaskExecution: ProcessTaskExecution;
42
+ isLast?: boolean;
43
+ disabled?: boolean;
44
+ };
16
45
  }
17
46
 
18
47
  export interface ElkExtendedEdgeWithFlow extends ElkExtendedEdge {
@@ -1,16 +1,28 @@
1
+ import { AnimatedSVGEdge } from "./animated-svg";
1
2
  import { DefaultEdge } from "./edges/default-edge";
3
+ import { AddNode } from "./nodes/add-node";
2
4
  import { ConnectionNode } from "./nodes/connection-node";
5
+ import { EmptyNode } from "./nodes/empty-node";
3
6
  import { EntryNode } from "./nodes/entry-node";
7
+ import { ExecutionEntryNode } from "./nodes/execution-entry-node";
8
+ import { ExecutionTaskNode } from "./nodes/execution-task-node";
4
9
  import { GroupNode } from "./nodes/group-node";
10
+ import { RowNode } from "./nodes/row-node";
5
11
  import { TaskNode } from "./nodes/task-node";
6
12
 
7
13
  export const edgeTypes = {
8
14
  "default-edge": DefaultEdge,
15
+ "animated-edge": AnimatedSVGEdge,
9
16
  };
10
17
 
11
18
  export const nodeTypes = {
12
19
  "connection-node": ConnectionNode,
13
20
  "entry-node": EntryNode,
21
+ "execution-entry-node": ExecutionEntryNode,
14
22
  "group-node": GroupNode,
15
23
  "task-node": TaskNode, // Assuming you have a custom connection node
24
+ "execution-task-node": ExecutionTaskNode, // Assuming you have a custom connection node,
25
+ "row-node": RowNode,
26
+ "empty-node": EmptyNode,
27
+ "add-node": AddNode, // Temporary use TaskNode for AddNode
16
28
  };