@evenicanpm/admin-integrate 1.2.0 → 1.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 (208) 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 +22 -0
  5. package/documents/Process/fragments.ts +35 -0
  6. package/documents/Process/get-process-details.ts +73 -0
  7. package/documents/Process/list.ts +51 -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/ProcessScheduleGroup/read.ts +43 -0
  15. package/documents/ProcessTask/fragments.ts +285 -0
  16. package/documents/ProcessTask/read.ts +12 -0
  17. package/documents/ProcessTemplate/fragments.ts +69 -0
  18. package/documents/ProcessTemplate/list.ts +67 -0
  19. package/documents/ProcessTemplate/read.ts +12 -0
  20. package/documents/RunProcess/run.ts +11 -0
  21. package/package.json +4 -3
  22. package/src/api/Integrations/queries/get-process.query.ts +48 -0
  23. package/src/api/Integrations/queries/get-process.server.ts +14 -0
  24. package/src/api/Integrations/queries/index.ts +1 -0
  25. package/src/api/dashboard/queries/get-process-executions.query.ts +6 -3
  26. package/src/api/dashboard/queries/get-process-executions.server.ts +1 -1
  27. package/src/api/execution-details/queries/get-process-execution-details.query.ts +46 -0
  28. package/src/api/execution-details/queries/get-process-execution-details.server.ts +11 -0
  29. package/src/api/execution-details/queries/get-process-executions-by-process.query.ts +48 -0
  30. package/src/api/execution-details/queries/get-process-executions-by-process.server.ts +11 -0
  31. package/src/api/execution-details/queries/index.ts +2 -0
  32. package/src/api/process/mutations/copy-process.mutation.ts +48 -0
  33. package/src/api/process/mutations/copy-process.server.ts +14 -0
  34. package/src/api/process/mutations/index.ts +2 -0
  35. package/src/api/process/mutations/run-process.mutation.ts +41 -0
  36. package/src/api/process/mutations/run-process.server.ts +14 -0
  37. package/src/api/process/queries/get-process-by-id.query.ts +85 -0
  38. package/src/api/process/queries/get-process-by-id.server.ts +20 -0
  39. package/src/api/process/queries/index.ts +4 -0
  40. package/src/api/process-config/mutation/index.ts +2 -0
  41. package/src/api/process-config/mutation/process-config-import.mutation.ts +33 -0
  42. package/src/api/process-config/mutation/process-config-import.server.ts +14 -0
  43. package/src/api/process-config/mutation/process-config-merge.mutation.ts +33 -0
  44. package/src/api/process-config/mutation/process-config-merge.server.ts +14 -0
  45. package/src/api/process-task/queries/get-process-task-by-id.query.ts +45 -0
  46. package/src/api/process-task/queries/get-process-task-by-id.server.ts +9 -0
  47. package/src/api/process-task/queries/index.ts +1 -0
  48. package/src/api/scheduler/mutation/create-process-schedule-group-details.mutation.ts +47 -0
  49. package/src/api/scheduler/mutation/create-process-schedule-group-details.server.ts +14 -0
  50. package/src/api/scheduler/mutation/index.ts +2 -0
  51. package/src/api/scheduler/mutation/update-process-schedule-group-details.mutation.ts +47 -0
  52. package/src/api/scheduler/mutation/update-process-schedule-group-details.server.ts +14 -0
  53. package/src/api/scheduler/queries/get-non-scheduled-processes.query.ts +48 -0
  54. package/src/api/scheduler/queries/get-non-scheduled-processes.server.ts +11 -0
  55. package/src/api/scheduler/queries/get-process-schedule-group-details.query.ts +6 -3
  56. package/src/api/scheduler/queries/get-process-schedule-group-details.server.ts +3 -3
  57. package/src/api/scheduler/queries/get-process-schedule.query.ts +6 -3
  58. package/src/api/scheduler/queries/get-process-schedule.server.ts +3 -3
  59. package/src/api/scheduler/queries/get-scheduled-processes.query.ts +6 -3
  60. package/src/api/scheduler/queries/get-scheduled-processes.server.ts +1 -1
  61. package/src/api/scheduler/queries/index.ts +3 -2
  62. package/src/api/templates/queries/get-process-template-groups.query.ts +48 -0
  63. package/src/api/templates/queries/get-process-template-groups.server.ts +11 -0
  64. package/src/api/templates/queries/get-process-template-records.query.ts +48 -0
  65. package/src/api/templates/queries/get-process-template-records.server.ts +11 -0
  66. package/src/api/templates/queries/get-process-template.query.ts +48 -0
  67. package/src/api/templates/queries/get-process-template.server.ts +9 -0
  68. package/src/api/templates/queries/get-process-templates.query.ts +45 -0
  69. package/src/api/templates/queries/get-process-templates.server.ts +9 -0
  70. package/src/api/templates/queries/index.ts +5 -0
  71. package/src/api/templates/queries/template-input-search.query.ts +34 -0
  72. package/src/api/templates/queries/template-input-search.server.ts +35 -0
  73. package/src/api/templates/queries/types.ts +28 -0
  74. package/src/components/breadcrumbs/breadcrumbs.tsx +32 -5
  75. package/src/components/button/outlined-icon-button.tsx +2 -2
  76. package/src/components/core/date-time-popover.tsx +11 -4
  77. package/src/components/core/drawer-buttons.tsx +52 -0
  78. package/src/components/core/edited-typography.tsx +1 -1
  79. package/src/components/core/index.ts +4 -2
  80. package/src/components/core/loading.tsx +1 -1
  81. package/src/components/core/status-tag.tsx +97 -0
  82. package/src/components/core/title-edit.tsx +18 -11
  83. package/src/components/dashboard-list/dashboard-list-row.tsx +22 -29
  84. package/src/components/dashboard-list/dashboard-list.tsx +19 -15
  85. package/src/components/data-table/table-header.tsx +5 -7
  86. package/src/components/data-table/table-pagination.tsx +1 -1
  87. package/src/components/data-table/table-row.tsx +1 -1
  88. package/src/components/data-table/table-skeleton.tsx +9 -4
  89. package/src/components/execution/execution-filter.ts +1 -1
  90. package/src/components/execution/execution-status-icon.tsx +7 -7
  91. package/src/components/execution/execution-tag.tsx +12 -77
  92. package/src/components/execution/index.ts +1 -1
  93. package/src/components/execution-history-drawer/execution-history-drawer.tsx +203 -0
  94. package/src/components/execution-history-drawer/executions-card.tsx +85 -0
  95. package/src/components/execution-history-drawer/index.ts +1 -0
  96. package/src/components/footer/footer.tsx +10 -6
  97. package/src/components/header/dashboard-list-header.tsx +12 -7
  98. package/src/components/header/execution-details-header.tsx +35 -26
  99. package/src/components/header/header.tsx +10 -3
  100. package/src/components/header/index.ts +1 -1
  101. package/src/components/header/integration-details-header.tsx +104 -45
  102. package/src/components/integration-list/index.ts +3 -0
  103. package/src/components/integration-list/integration-filter.ts +21 -0
  104. package/src/components/integration-list/integration-status-icon.tsx +32 -0
  105. package/src/components/integration-list/integration-tag.tsx +33 -0
  106. package/src/components/integration-list/list/index.ts +1 -0
  107. package/src/components/integration-list/list/integration-list-row.tsx +161 -0
  108. package/src/components/integration-list/list/integration-list-table.tsx +62 -0
  109. package/src/components/integration-list/list/integration-list.tsx +258 -0
  110. package/src/components/integration-view/animated-svg.tsx +31 -0
  111. package/src/components/integration-view/edges/default-edge.tsx +1 -1
  112. package/src/components/integration-view/elk-layout-options.ts +2 -2
  113. package/src/components/integration-view/elk-types.ts +35 -6
  114. package/src/components/integration-view/flow-types.tsx +10 -0
  115. package/src/components/integration-view/integration-view.tsx +990 -55
  116. package/src/components/integration-view/nodes/empty-node.tsx +65 -0
  117. package/src/components/integration-view/nodes/entry-node.tsx +98 -4
  118. package/src/components/integration-view/nodes/execution-entry-node.tsx +107 -0
  119. package/src/components/integration-view/nodes/execution-task-node.tsx +88 -0
  120. package/src/components/integration-view/nodes/group-node.tsx +19 -13
  121. package/src/components/integration-view/nodes/row-node.tsx +19 -0
  122. package/src/components/integration-view/nodes/task-node.tsx +14 -8
  123. package/src/components/integration-view/task-icon.tsx +193 -0
  124. package/src/components/integration-view/temp-data/initialElements.tsx +36 -32
  125. package/src/components/integration-view/types.ts +2 -2
  126. package/src/components/layouts/main-layout.tsx +2 -3
  127. package/src/components/layouts/root-container.tsx +3 -6
  128. package/src/components/link-cards/link-card.tsx +15 -4
  129. package/src/components/link-cards/styles.ts +1 -1
  130. package/src/components/list-filter/date-filter.tsx +4 -3
  131. package/src/components/list-filter/date-range-filter.tsx +11 -5
  132. package/src/components/list-filter/index.ts +1 -1
  133. package/src/components/list-filter/list-filter.tsx +31 -26
  134. package/src/components/list-filter/multi-select-filter.tsx +11 -10
  135. package/src/components/list-filter/select-filter.tsx +13 -8
  136. package/src/components/scheduler/day-selector.tsx +29 -15
  137. package/src/components/scheduler/day-tag.tsx +14 -51
  138. package/src/components/scheduler/index.ts +2 -1
  139. package/src/components/scheduler/schedule-drawer/details-reducer.ts +217 -0
  140. package/src/components/scheduler/schedule-drawer/schedule-details-integrations.tsx +503 -0
  141. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details-main.tsx +136 -99
  142. package/src/components/scheduler/schedule-drawer/schedule-details-name.tsx +94 -0
  143. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details-skeleton.tsx +1 -2
  144. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details.tsx +9 -13
  145. package/src/components/scheduler/schedule-drawer/schedule-drawer-group.tsx +218 -0
  146. package/src/{pages → components}/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +6 -25
  147. package/src/components/scheduler/schedule-drawer/schedule-drawer.tsx +116 -0
  148. package/src/components/scheduler/schedule-drawer/sortable-integration-row.tsx +130 -0
  149. package/src/components/scheduler/schedule-filter.ts +1 -1
  150. package/src/components/scheduler/schedule-icon.tsx +5 -6
  151. package/src/components/scheduler/schedule-integration-icon.tsx +31 -0
  152. package/src/components/templates/index.ts +1 -0
  153. package/src/components/templates/inputs/index.tsx +1351 -0
  154. package/src/components/templates/template-filter.ts +5 -0
  155. package/src/components/templates/templates-list/index.ts +1 -0
  156. package/src/components/templates/templates-list/templates-list-row.tsx +55 -0
  157. package/src/components/templates/templates-list/templates-list-table.tsx +58 -0
  158. package/src/components/templates/templates-list/templates-list.tsx +253 -0
  159. package/src/components/templates/types.tsx +75 -0
  160. package/src/components/templates/wizard.tsx +689 -0
  161. package/src/hooks/use-breadcrumbs.ts +1 -1
  162. package/src/hooks/use-recurrence.tsx +1 -2
  163. package/src/pages/dashboard/dashboard-link-cards.tsx +8 -11
  164. package/src/pages/dashboard/dashboard-list-sections.tsx +7 -9
  165. package/src/pages/dashboard/dashboard.tsx +1 -2
  166. package/src/pages/execution-details/execution-details.tsx +211 -14
  167. package/src/pages/execution-details/task-execution-details.tsx +160 -0
  168. package/src/pages/execution-details/task-execution-drawer.tsx +54 -0
  169. package/src/pages/executions/executions-list/executions-list-row.tsx +21 -27
  170. package/src/pages/executions/executions-list/executions-list-table.tsx +28 -35
  171. package/src/pages/executions/executions-list/executions-list.tsx +24 -18
  172. package/src/pages/executions/executions.tsx +11 -15
  173. package/src/pages/integration-create/index.ts +1 -0
  174. package/src/pages/integration-create/integration-create.tsx +174 -0
  175. package/src/pages/integration-create/pre-creation-step.tsx +12 -0
  176. package/src/pages/integration-create/select-step.tsx +105 -0
  177. package/src/pages/integration-create/template-list-step.tsx +77 -0
  178. package/src/pages/integration-create/wizard-step.tsx +50 -0
  179. package/src/pages/integration-details/import-process/copy-tasks-list.tsx +265 -0
  180. package/src/pages/integration-details/import-process/copy-tasks-row.tsx +77 -0
  181. package/src/pages/integration-details/import-process/import-confirm.tsx +61 -0
  182. package/src/pages/integration-details/import-process/import-drawer.tsx +48 -0
  183. package/src/pages/integration-details/import-process/import-process-reducer.ts +90 -0
  184. package/src/pages/integration-details/import-process/import-process.tsx +149 -0
  185. package/src/pages/integration-details/index.ts +1 -0
  186. package/src/pages/integration-details/integration-details.tsx +221 -0
  187. package/src/pages/integration-details/task-drawer/add-task.tsx +120 -0
  188. package/src/pages/integration-details/task-drawer/edit-task.tsx +175 -0
  189. package/src/pages/integration-details/task-drawer/task-drawer.tsx +139 -0
  190. package/src/pages/integration-details/task-drawer/task-reducer.ts +73 -0
  191. package/src/pages/integrations/integrations.tsx +68 -8
  192. package/src/pages/scheduler/scheduler.tsx +12 -24
  193. package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +27 -37
  194. package/src/pages/scheduler/schedules-list/schedules-list-table.tsx +27 -42
  195. package/src/pages/scheduler/schedules-list/schedules-list.tsx +48 -21
  196. package/src/utils/date-functions.ts +69 -0
  197. package/src/utils/slugify.ts +3 -0
  198. package/tsconfig.json +12 -4
  199. package/src/hooks/use-timestamp.tsx +0 -25
  200. package/src/pages/scheduler/schedule-drawer/schedule-details-integrations.tsx +0 -227
  201. package/src/pages/scheduler/schedule-drawer/schedule-details-name.tsx +0 -77
  202. package/src/pages/scheduler/schedule-drawer/schedule-drawer-buttons.tsx +0 -72
  203. package/src/pages/scheduler/schedule-drawer/schedule-drawer-group.tsx +0 -103
  204. package/src/pages/scheduler/schedule-drawer/schedule-drawer.tsx +0 -101
  205. package/src/pages/scheduler/schedule-drawer/sortable-integration-row.tsx +0 -93
  206. /package/src/{pages → components}/scheduler/schedule-drawer/edited/edited-types.ts +0 -0
  207. /package/src/{pages → components}/scheduler/schedule-drawer/edited/index.ts +0 -0
  208. /package/src/{pages → components}/scheduler/schedule-drawer/index.ts +0 -0
@@ -1,17 +1,16 @@
1
- import { useState } from "react";
2
-
3
- import { Theme, useTheme } from "@mui/material";
1
+ import { OutlinedIconButton } from "@evenicanpm/admin-integrate/components/button";
2
+ import { Check, Clear, EditOutlined } from "@mui/icons-material";
4
3
  import {
5
4
  Box,
5
+ IconButton,
6
6
  Stack,
7
- Typography,
8
7
  TextField,
9
- IconButton,
10
- TypographyOwnProps,
8
+ type Theme,
9
+ Typography,
10
+ type TypographyOwnProps,
11
+ useTheme,
11
12
  } from "@mui/material";
12
- import { EditOutlined, Clear, Check } from "@mui/icons-material";
13
-
14
- import { OutlinedIconButton } from "@evenicanpm/admin-integrate/components/button";
13
+ import { useEffect, useState } from "react";
15
14
 
16
15
  interface Props {
17
16
  title: string;
@@ -42,7 +41,9 @@ export default function TitleEdit(props: Props) {
42
41
  };
43
42
 
44
43
  const handleConfirm = () => {
45
- props.onConfirm(input);
44
+ const trimmed = input.trim().replace(/\s+/g, " ");
45
+ props.onConfirm(trimmed);
46
+ setInput(trimmed);
46
47
  setEditMode(false);
47
48
  };
48
49
 
@@ -52,6 +53,12 @@ export default function TitleEdit(props: Props) {
52
53
  }
53
54
  };
54
55
 
56
+ useEffect(() => {
57
+ if (props.readOnly) {
58
+ handleClose();
59
+ }
60
+ }, [props.readOnly]);
61
+
55
62
  return (
56
63
  <>
57
64
  <Box
@@ -93,7 +100,7 @@ export default function TitleEdit(props: Props) {
93
100
  <OutlinedIconButton
94
101
  color="success"
95
102
  onClick={handleConfirm}
96
- disabled={input === ""}
103
+ disabled={!/(.|\s)*\S(.|\s)*/.test(input)}
97
104
  >
98
105
  <Check />
99
106
  </OutlinedIconButton>
@@ -1,26 +1,26 @@
1
- import React, { useState } from "react";
2
- import { redirect, RedirectType } from "next/navigation";
3
-
4
- // MUI
5
- import { Theme, useTheme } from "@mui/material";
6
- import { Box, Stack, Typography, Popover } from "@mui/material";
7
- import { RemoveRedEye } from "@mui/icons-material";
8
-
9
- // Custom components
1
+ import { DateTimePopover } from "@evenicanpm/admin-integrate/components/core";
10
2
  import {
3
+ StyledIconButton,
11
4
  StyledTableCell,
12
5
  StyledTableRow,
13
- StyledIconButton,
14
6
  } from "@evenicanpm/admin-integrate/components/data-table/table-row";
15
7
  import { ExecutionStatusIcon } from "@evenicanpm/admin-integrate/components/execution";
16
-
17
- // Hooks
18
- import useTimestamp from "@evenicanpm/admin-integrate/hooks/use-timestamp";
19
-
20
- // Types
21
- import { Item } from "./dashboard-list";
22
- import { Head } from "../data-table/table-header";
23
- import { TableCellProps, SxProps } from "@mui/material";
8
+ import { toDistanceDate } from "@evenicanpm/admin-integrate/utils/date-functions";
9
+ import { RemoveRedEye } from "@mui/icons-material";
10
+ import {
11
+ Box,
12
+ Stack,
13
+ type SxProps,
14
+ type TableCellProps,
15
+ type Theme,
16
+ Typography,
17
+ useTheme,
18
+ } from "@mui/material";
19
+ import { RedirectType, redirect } from "next/navigation";
20
+ import type React from "react";
21
+ import { useState } from "react";
22
+ import type { Head } from "../data-table/table-header";
23
+ import type { Item } from "./dashboard-list";
24
24
 
25
25
  interface Props {
26
26
  item: Item;
@@ -33,10 +33,6 @@ const DashboardListRow: React.FC<Props> = (props: Props) => {
33
33
  const theme = useTheme();
34
34
  const styles = getStyles(theme);
35
35
 
36
- // e.g. "xx days ago"
37
- const time = useTimestamp(props.item.startDate);
38
- const localTime = new Date(props.item.startDate).toString();
39
-
40
36
  const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
41
37
  const open = Boolean(anchorEl);
42
38
 
@@ -96,9 +92,10 @@ const DashboardListRow: React.FC<Props> = (props: Props) => {
96
92
  onMouseEnter={handlePopoverOpen}
97
93
  onMouseLeave={handlePopoverClose}
98
94
  >
99
- {time}
95
+ {toDistanceDate(props.item.startDate)}
100
96
  </Typography>
101
- <Popover
97
+ <DateTimePopover
98
+ dateIsoString={props.item.startDate}
102
99
  sx={{ pointerEvents: "none" }}
103
100
  open={open}
104
101
  anchorEl={anchorEl}
@@ -112,11 +109,7 @@ const DashboardListRow: React.FC<Props> = (props: Props) => {
112
109
  }}
113
110
  onClose={handlePopoverClose}
114
111
  disableRestoreFocus
115
- >
116
- <Box sx={styles.popover}>
117
- <Typography>{localTime}</Typography>
118
- </Box>
119
- </Popover>
112
+ />
120
113
  </StyledTableCell>
121
114
  <StyledTableCell
122
115
  align={props.heading[2].align as TableCellProps["align"]}
@@ -1,23 +1,27 @@
1
- import React, { useState, useEffect } from "react";
2
- import { useTranslations } from "next-intl";
3
-
4
1
  // API
5
- import { GetProcessExecutionsQuery } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
6
-
7
- // MUI
8
- import { Card, Table, TableContainer, TableBody, Box } from "@mui/material";
9
- import { Theme, useTheme } from "@mui/material";
10
-
2
+ import type { GetProcessExecutionsQuery } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
11
3
  // Custom components
12
4
  import { FlexBox } from "@evenicanpm/admin-core/components/flex-box";
13
-
5
+ // MUI
6
+ import {
7
+ Box,
8
+ Card,
9
+ Stack,
10
+ Table,
11
+ TableBody,
12
+ TableContainer,
13
+ type Theme,
14
+ Typography,
15
+ useTheme,
16
+ } from "@mui/material";
17
+ import { useTranslations } from "next-intl";
18
+ import type React from "react";
19
+ import { useEffect, useState } from "react";
14
20
  import { TableHeader, TableSkeleton } from "../data-table";
15
- import DashboardListRow from "./dashboard-list-row";
16
- import { DashboardListHeader } from "../header/";
17
-
18
21
  // Types
19
- import { Head } from "../data-table/table-header";
20
- import { Typography, Stack } from "@mui/material";
22
+ import type { Head } from "../data-table/table-header";
23
+ import { DashboardListHeader } from "../header/";
24
+ import DashboardListRow from "./dashboard-list-row";
21
25
 
22
26
  // Returned from processExecutions query
23
27
  export interface Item {
@@ -1,12 +1,10 @@
1
- import TableRow from "@mui/material/TableRow";
1
+ import { ExpandLess, ExpandMore } from "@mui/icons-material";
2
+ import { type SxProps, type Theme, useTheme } from "@mui/material";
3
+ import styled from "@mui/material/styles/styled";
4
+ import TableCell, { type TableCellProps } from "@mui/material/TableCell";
2
5
  import TableHead from "@mui/material/TableHead";
6
+ import TableRow from "@mui/material/TableRow";
3
7
  import TableSortLabel from "@mui/material/TableSortLabel";
4
- import TableCell, { TableCellProps } from "@mui/material/TableCell";
5
- import styled from "@mui/material/styles/styled";
6
-
7
- import { SxProps } from "@mui/material";
8
- import { Theme, useTheme } from "@mui/material";
9
- import { ExpandLess, ExpandMore } from "@mui/icons-material";
10
8
 
11
9
  // STYLED COMPONENTS
12
10
  const StyledTableCell = styled(TableCell)(({ theme }) => ({
@@ -1,4 +1,4 @@
1
- import Pagination, { PaginationProps } from "@mui/material/Pagination";
1
+ import Pagination, { type PaginationProps } from "@mui/material/Pagination";
2
2
  import styled from "@mui/material/styles/styled";
3
3
 
4
4
  // STYLED COMPONENT
@@ -1,5 +1,5 @@
1
+ import { IconButton, TableCell, TableRow } from "@mui/material";
1
2
  import styled from "@mui/material/styles/styled";
2
- import { TableRow, TableCell, IconButton } from "@mui/material";
3
3
 
4
4
  const StyledTableCell = styled(TableCell)(({ theme }) => ({
5
5
  fontSize: 14,
@@ -1,8 +1,13 @@
1
- import { TableContainer, Table, TableBody, Skeleton } from "@mui/material";
2
- import { SxProps } from "@mui/material";
1
+ import {
2
+ Skeleton,
3
+ type SxProps,
4
+ Table,
5
+ TableBody,
6
+ TableContainer,
7
+ } from "@mui/material";
3
8
 
4
- import TableHeader, { Head } from "./table-header";
5
- import { StyledTableRow, StyledTableCell } from "./table-row";
9
+ import TableHeader, { type Head } from "./table-header";
10
+ import { StyledTableCell, StyledTableRow } from "./table-row";
6
11
 
7
12
  interface Props {
8
13
  heading: Head[];
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  DateRangeFilter,
3
3
  Filters,
4
4
  MultiSelectFilter,
@@ -1,21 +1,21 @@
1
- import React from "react";
2
-
3
- import { SxProps } from "@mui/material";
4
1
  import {
5
- Loop,
6
2
  CheckCircleOutline,
7
- WarningAmber,
8
- ErrorOutline,
9
3
  Clear,
4
+ ErrorOutline,
5
+ Loop,
6
+ WarningAmber,
10
7
  } from "@mui/icons-material";
11
8
 
9
+ import type { SxProps } from "@mui/material";
10
+ import type React from "react";
11
+
12
12
  interface Props {
13
13
  executionStatusId: string;
14
14
  sx?: SxProps;
15
15
  }
16
16
 
17
17
  const ExecutionStatusIcon: React.FC<Props> = (props: Props) => {
18
- const statusIconMap: { [key: string]: any } = {
18
+ const statusIconMap: { [key: string]: React.ReactNode } = {
19
19
  "300": <Loop color="info" />,
20
20
  "400": <CheckCircleOutline color="success" />,
21
21
  "450": <WarningAmber color="warning" />,
@@ -1,22 +1,7 @@
1
- import React from "react";
1
+ import { StatusTag } from "@evenicanpm/admin-integrate/components/core";
2
+ import type { SxProps } from "@mui/material";
2
3
  import { useTranslations } from "next-intl";
3
4
 
4
- import { styled } from "@mui/material/styles";
5
- import { Box, Typography, SxProps } from "@mui/material";
6
-
7
- // Styled components
8
- const StyledTagBox = styled(Box)(({ theme }) => ({
9
- padding: theme.spacing(0, 1.5),
10
- border: "solid 1px",
11
- borderRadius: 4,
12
- alignContent: "center",
13
- maxWidth: "fit-content",
14
- maxHeight: "fit-content",
15
- }));
16
- const StyledTag = styled(Typography)(() => ({
17
- fontWeight: "bold",
18
- }));
19
-
20
5
  interface Props {
21
6
  executionStatusId: string;
22
7
  sx?: SxProps;
@@ -25,73 +10,23 @@ interface Props {
25
10
  const ExecutionTag: React.FC<Props> = (props: Props) => {
26
11
  const t = useTranslations("Integrate");
27
12
 
28
- const statusTagMap: { [key: string]: any } = {
13
+ const statusTagMap: { [key: string]: React.ReactNode } = {
29
14
  300: (
30
- <StyledTagBox
31
- sx={{
32
- backgroundColor: "info.100",
33
- borderColor: "info.main",
34
- ...props.sx,
35
- }}
36
- >
37
- <StyledTag color="info" variant="caption">
38
- {t("Executions.inProgress")}
39
- </StyledTag>
40
- </StyledTagBox>
15
+ <StatusTag type="info" text={t("Executions.inProgress")} sx={props.sx} />
41
16
  ),
42
17
  400: (
43
- <StyledTagBox
44
- sx={{
45
- backgroundColor: "success.100",
46
- borderColor: "success.main",
47
- ...props.sx,
48
- }}
49
- >
50
- <StyledTag color="success" variant="caption">
51
- {t("Executions.complete")}
52
- </StyledTag>
53
- </StyledTagBox>
18
+ <StatusTag type="success" text={t("Executions.complete")} sx={props.sx} />
54
19
  ),
55
20
  450: (
56
- <StyledTagBox
57
- sx={{
58
- backgroundColor: "warning.100",
59
- borderColor: "orange.700",
60
- color: "orange.700",
61
- ...props.sx,
62
- }}
63
- >
64
- <StyledTag color="inherit" variant="caption">
65
- {t("Executions.warning")}
66
- </StyledTag>
67
- </StyledTagBox>
68
- ),
69
- 500: (
70
- <StyledTagBox
71
- sx={{
72
- backgroundColor: "error.100",
73
- borderColor: "error.main",
74
- ...props.sx,
75
- }}
76
- >
77
- <StyledTag color="error" variant="caption">
78
- {t("Executions.failed")}
79
- </StyledTag>
80
- </StyledTagBox>
21
+ <StatusTag type="warning" text={t("Executions.warning")} sx={props.sx} />
81
22
  ),
23
+ 500: <StatusTag type="error" text={t("Executions.failed")} sx={props.sx} />,
82
24
  999: (
83
- <StyledTagBox
84
- sx={{
85
- backgroundColor: "grey.300",
86
- borderColor: "grey.600",
87
- color: "grey.600",
88
- ...props.sx,
89
- }}
90
- >
91
- <StyledTag color="inherit" variant="caption">
92
- {t("Executions.unavailable")}
93
- </StyledTag>
94
- </StyledTagBox>
25
+ <StatusTag
26
+ type="unavailable"
27
+ text={t("Executions.unavailable")}
28
+ sx={props.sx}
29
+ />
95
30
  ),
96
31
  };
97
32
 
@@ -1,2 +1,2 @@
1
- export { default as ExecutionTag } from "./execution-tag";
2
1
  export { default as ExecutionStatusIcon } from "./execution-status-icon";
2
+ export { default as ExecutionTag } from "./execution-tag";
@@ -0,0 +1,203 @@
1
+ "use client";
2
+ import type {
3
+ GetProcessExecutionsByProcessQuery,
4
+ ProcessExecutionInput,
5
+ } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
6
+ import { FlexBox } from "@evenicanpm/admin-core/components/flex-box";
7
+ import { TablePagination } from "@evenicanpm/admin-integrate/components/data-table";
8
+ import KeyboardDoubleArrowRightIcon from "@mui/icons-material/KeyboardDoubleArrowRight";
9
+ import {
10
+ Box,
11
+ Card,
12
+ Grid2 as Grid,
13
+ Stack,
14
+ type Theme,
15
+ Typography,
16
+ useTheme,
17
+ } from "@mui/material";
18
+ import IconButton from "@mui/material/IconButton";
19
+ import { useTranslations } from "next-intl";
20
+ import type React from "react";
21
+ import { useEffect, useState } from "react";
22
+ import ExecutionsCard from "./executions-card";
23
+
24
+ // Returned from processExecutionsByProcess query
25
+ export interface Item {
26
+ id: string;
27
+ name: string;
28
+ startDate: string;
29
+ executionStatus: {
30
+ id: string;
31
+ };
32
+ }
33
+
34
+ interface Props {
35
+ data: GetProcessExecutionsByProcessQuery;
36
+ loading: boolean;
37
+ input: ProcessExecutionInput;
38
+ setInput: (newInput: ProcessExecutionInput) => void;
39
+ drawerOpen?: boolean;
40
+ setDrawerOpen?: (open: boolean) => void;
41
+ }
42
+
43
+ const ExecutionHistoryDrawer: React.FC<Props> = (props: Props) => {
44
+ const t = useTranslations("Integrate.Executions");
45
+
46
+ const theme = useTheme();
47
+ const styles = getStyles(theme);
48
+
49
+ const [items, setItems] = useState<Item[]>([]);
50
+ const [fetched, setFetched] = useState<boolean>(false); // prevents "empty list" msg from showing for split second
51
+
52
+ useEffect(() => {
53
+ if (props.data?.processExecutionsByProcess?.nodes) {
54
+ setItems(props.data.processExecutionsByProcess.nodes as Item[]);
55
+ setFetched(true);
56
+ }
57
+ }, [props.data]);
58
+
59
+ const handleChangePage = (
60
+ event: React.ChangeEvent<unknown>,
61
+ value: number,
62
+ ) => {
63
+ const page = (props.input.skip || 0) / (props.input.top || 10) + 1;
64
+ if (page !== value && event) {
65
+ props.setInput({
66
+ ...props.input,
67
+ skip: (props.input.top || 10) * (value - 1),
68
+ });
69
+ setFetched(false);
70
+ }
71
+ };
72
+ // Toggle drawer open/close
73
+ const toggleDrawer = () => {
74
+ if (props.setDrawerOpen) props.setDrawerOpen(!props.drawerOpen);
75
+ };
76
+
77
+ return (
78
+ <Box
79
+ sx={{
80
+ width: props.drawerOpen ? 345 : 43,
81
+ //transition: "width 0.3s ease",
82
+ backgroundColor: theme.palette.background.default,
83
+ borderRight: `1px solid ${theme.palette.grey[400]}`,
84
+ display: "flex",
85
+ flexDirection: "column",
86
+ alignItems: "flex-start",
87
+ position: "relative",
88
+ overflow: "auto",
89
+ }}
90
+ >
91
+ <Box
92
+ sx={{
93
+ display: "flex",
94
+ alignItems: "center",
95
+ justifyContent: "center",
96
+ width: "100%",
97
+ p: 1,
98
+ borderBottom: `1px solid ${theme.palette.divider}`,
99
+ }}
100
+ >
101
+ {props.drawerOpen && (
102
+ <Typography
103
+ variant="subtitle1"
104
+ align="center"
105
+ sx={{
106
+ fontWeight: 600,
107
+ flex: 1,
108
+ padding: theme.spacing(0, 0, 0, 2),
109
+ }}
110
+ >
111
+ {t("ExecutionsDetail.history")}
112
+ </Typography>
113
+ )}
114
+ <IconButton
115
+ onClick={toggleDrawer}
116
+ size="small"
117
+ sx={{
118
+ transition: "transform 0.3s ease",
119
+ transform: props.drawerOpen ? "rotate(180deg)" : "rotate(0deg)",
120
+ }}
121
+ >
122
+ <KeyboardDoubleArrowRightIcon />
123
+ </IconButton>
124
+ </Box>
125
+ {props.drawerOpen &&
126
+ props?.data?.processExecutionsByProcess?.nodes &&
127
+ props.data.processExecutionsByProcess.nodes.map((item) => (
128
+ <ExecutionsCard key={item?.id as string} item={item as Item} />
129
+ ))}
130
+
131
+ {!props.loading && props.drawerOpen && fetched && items.length === 0 ? (
132
+ <Card
133
+ sx={{
134
+ background: "transparent",
135
+ textAlign: "center",
136
+ padding: theme.spacing(0, 2),
137
+ boxShadow: "none",
138
+ }}
139
+ >
140
+ <FlexBox
141
+ justifyContent="center"
142
+ alignItems="center"
143
+ sx={{
144
+ minHeight: "335px",
145
+ marginBottom: theme.spacing(2),
146
+ background: "transparent",
147
+ }}
148
+ >
149
+ <Stack spacing={1} justifyContent="center" alignItems="center">
150
+ <Typography variant="h6" color="info">
151
+ {t("ListEmpty.title")}
152
+ </Typography>
153
+ <Typography variant="body1">{t("ListEmpty.body")}</Typography>
154
+ </Stack>
155
+ </FlexBox>
156
+ </Card>
157
+ ) : null}
158
+
159
+ {!props.loading &&
160
+ props.data?.processExecutionsByProcess &&
161
+ fetched &&
162
+ props.drawerOpen &&
163
+ items.length > 0 ? (
164
+ <Grid container spacing={1} sx={styles.pagination}>
165
+ <Grid size={{ xs: 10.5 }}>
166
+ <FlexBox
167
+ justifyContent="center"
168
+ alignItems="center"
169
+ sx={styles.paginationBox}
170
+ >
171
+ <TablePagination
172
+ page={(props.input.skip || 0) / (props.input.top || 10) + 1}
173
+ onChange={handleChangePage}
174
+ count={Math.ceil(
175
+ (props.data.processExecutionsByProcess.recordCount || 10) /
176
+ (props.input.top || 10),
177
+ )}
178
+ />
179
+ </FlexBox>
180
+ </Grid>
181
+ </Grid>
182
+ ) : null}
183
+ </Box>
184
+ );
185
+ };
186
+
187
+ const getStyles = (theme: Theme) => {
188
+ return {
189
+ iconButton: {
190
+ borderRadius: 1,
191
+ },
192
+ pagination: {
193
+ marginTop: "auto",
194
+ width: "100%",
195
+ },
196
+ paginationBox: {
197
+ paddingLeft: theme.spacing(0),
198
+ width: "100%",
199
+ },
200
+ };
201
+ };
202
+
203
+ export default ExecutionHistoryDrawer;
@@ -0,0 +1,85 @@
1
+ import {
2
+ ExecutionStatusIcon,
3
+ ExecutionTag,
4
+ } from "@evenicanpm/admin-integrate/components/execution";
5
+ import { toShortDate } from "@evenicanpm/admin-integrate/utils/date-functions";
6
+ import { Box, Card, Typography, useTheme } from "@mui/material";
7
+ import { useParams, useRouter, useSearchParams } from "next/navigation";
8
+ import type React from "react";
9
+ import type { Item } from "./execution-history-drawer";
10
+
11
+ interface Props {
12
+ item: Item;
13
+ }
14
+
15
+ const ExecutionsCard: React.FC<Props> = (props: Props) => {
16
+ const { item } = props;
17
+ const theme = useTheme();
18
+ const router = useRouter();
19
+ const params = useParams();
20
+ const searchParams = useSearchParams();
21
+
22
+ const processId = params?.processId as string;
23
+ const selectedExecutionId = searchParams.get("ExecutionId");
24
+
25
+ const isSelected = item.id.toString() === selectedExecutionId;
26
+
27
+ const handleChangeExecutionId = (newId: string) => {
28
+ router.push(`/e4integrate/executions/${processId}?ExecutionId=${newId}`);
29
+ };
30
+
31
+ return (
32
+ <Box
33
+ sx={{
34
+ padding: theme.spacing(0.5, 2),
35
+ width: "100%",
36
+ }}
37
+ >
38
+ <Card
39
+ onClick={() => handleChangeExecutionId(item.id.toString())}
40
+ sx={{
41
+ backgroundColor: isSelected ? "#DBF0FE" /* primary[100] */ : "white",
42
+ border: `1px solid ${isSelected ? "#4E97FD" /*primary[500]*/ : theme.palette.grey[400]}`,
43
+ boxShadow: "none",
44
+ borderRadius: 2.5,
45
+ width: "100%",
46
+ p: 1,
47
+ cursor: "pointer",
48
+ transition: "all 0.2s ease-in-out",
49
+ "&:hover": { boxShadow: 4 },
50
+ }}
51
+ >
52
+ {/* Top Row: Icon, Name, and Status */}
53
+ <Box display="flex" alignItems="center" justifyContent="space-between">
54
+ <Box display="flex" alignItems="center" gap={1}>
55
+ <ExecutionStatusIcon executionStatusId={item.executionStatus.id} />
56
+ <Typography
57
+ variant="subtitle1"
58
+ title={item.name}
59
+ fontWeight={600}
60
+ sx={{
61
+ whiteSpace: "nowrap",
62
+ overflow: "hidden",
63
+ textOverflow: "ellipsis",
64
+ maxWidth: 100,
65
+ }}
66
+ >
67
+ {item.name}
68
+ </Typography>
69
+ </Box>
70
+
71
+ <ExecutionTag executionStatusId={item.executionStatus.id} />
72
+ </Box>
73
+
74
+ <Typography
75
+ variant="body2"
76
+ sx={{ color: theme.palette.grey[500], mt: 1, ml: 0 }}
77
+ >
78
+ {toShortDate(item.startDate)}
79
+ </Typography>
80
+ </Card>
81
+ </Box>
82
+ );
83
+ };
84
+
85
+ export default ExecutionsCard;
@@ -0,0 +1 @@
1
+ export { default as ExecutionHistoryDrawer } from "./execution-history-drawer";