@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,18 +1,15 @@
1
- import React from "react";
2
- import { useTranslations } from "next-intl";
3
-
4
- // MUI
5
- import { Theme, useTheme } from "@mui/material";
6
- import { Box, Grid2 as Grid } from "@mui/material";
1
+ // Custom components
2
+ import LinkCard from "@evenicanpm/admin-integrate/components/link-cards";
7
3
  import {
8
- RocketLaunchOutlined,
4
+ AccessTimeOutlined,
9
5
  IntegrationInstructionsOutlined,
10
6
  PlaylistPlayOutlined,
11
- AccessTimeOutlined,
7
+ RocketLaunchOutlined,
12
8
  } from "@mui/icons-material";
13
-
14
- // Custom components
15
- import LinkCard from "@evenicanpm/admin-integrate/components/link-cards";
9
+ // MUI
10
+ import { Box, Grid2 as Grid, type Theme, useTheme } from "@mui/material";
11
+ import { useTranslations } from "next-intl";
12
+ import React from "react";
16
13
 
17
14
  const breakpoints = {
18
15
  xs: 6,
@@ -1,19 +1,17 @@
1
- import React, { useEffect, useState } from "react";
2
- import { useTranslations } from "next-intl";
3
-
4
- // API
5
- import { getProcessExecutions } from "@evenicanpm/admin-integrate/api/dashboard/queries";
6
- import {
7
- ProcessExecutionInput,
1
+ import type {
8
2
  GetProcessExecutionsQuery,
3
+ ProcessExecutionInput,
9
4
  } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
10
-
11
5
  // Custom components
12
6
  import SnackbarAlert, {
13
- iSnackbarAlert,
7
+ type iSnackbarAlert,
14
8
  } from "@evenicanpm/admin-core/components/snackbar-alert";
15
9
 
10
+ // API
11
+ import { getProcessExecutions } from "@evenicanpm/admin-integrate/api/dashboard/queries";
16
12
  import DashboardList from "@evenicanpm/admin-integrate/components/dashboard-list";
13
+ import { useTranslations } from "next-intl";
14
+ import React, { useEffect, useState } from "react";
17
15
 
18
16
  const defaultInput: ProcessExecutionInput = {
19
17
  sort: "startDate",
@@ -1,8 +1,7 @@
1
- import React from "react";
2
-
3
1
  // Local page components
4
2
  import DashboardLinkCards from "@evenicanpm/admin-integrate/pages/dashboard/dashboard-link-cards";
5
3
  import DashboardListSections from "@evenicanpm/admin-integrate/pages/dashboard/dashboard-list-sections";
4
+ import React from "react";
6
5
 
7
6
  export default function IntegrateDashboard() {
8
7
  return (
@@ -1,20 +1,44 @@
1
- import React from "react";
2
- import { useTranslations } from "next-intl";
3
-
4
- // MUI
5
- import { Box } from "@mui/material";
6
-
7
- // Custom components
1
+ "use client";
2
+ import type {
3
+ GetProcessExecutionDetailsQuery,
4
+ GetProcessExecutionsByProcessQuery,
5
+ ProcessExecutionDetails,
6
+ ProcessExecutionInput,
7
+ ProcessTaskExecution,
8
+ } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
9
+ import SnackbarAlert, {
10
+ type iSnackbarAlert,
11
+ } from "@evenicanpm/admin-core/components/snackbar-alert";
12
+ import {
13
+ getProcessExecutionDetails,
14
+ getProcessExecutionsByProcess,
15
+ } from "@evenicanpm/admin-integrate/api/execution-details/queries";
16
+ import { runProcessWebhook } from "@evenicanpm/admin-integrate/api/process/mutations";
8
17
  import {
18
+ type Crumb,
9
19
  IntegrateBreadcrumbs,
10
- Crumb,
11
20
  } from "@evenicanpm/admin-integrate/components/breadcrumbs";
21
+ import { Loading } from "@evenicanpm/admin-integrate/components/core";
22
+ import { ExecutionHistoryDrawer } from "@evenicanpm/admin-integrate/components/execution-history-drawer";
23
+ import { ExecutionDetailsHeader } from "@evenicanpm/admin-integrate/components/header";
24
+ import type { Execution } from "@evenicanpm/admin-integrate/components/header/execution-details-header";
12
25
  import IntegrationView from "@evenicanpm/admin-integrate/components/integration-view/integration-view";
26
+ import PlayArrowIcon from "@mui/icons-material/PlayArrow";
27
+ import { Box, Button, useTheme } from "@mui/material";
28
+ import { useParams, useSearchParams } from "next/navigation";
29
+ import { useTranslations } from "next-intl";
30
+ import { useEffect, useState } from "react";
31
+ import TaskExecutionDrawer from "./task-execution-drawer";
13
32
 
14
33
  export default function ExecutionDetails() {
15
34
  const t = useTranslations("Integrate");
35
+ const theme = useTheme();
36
+ const params = useParams<{ processId: string }>();
37
+ const processId = params?.processId as string;
38
+ const searchParams = useSearchParams();
39
+ const selectedExecutionId = searchParams.get("ExecutionId");
16
40
 
17
- const breadcrumbs: Crumb[] = [
41
+ const [breadcrumbs, setBreadcrumbs] = useState<Crumb[]>([
18
42
  {
19
43
  name: t("Header.dashboard"),
20
44
  url: "/e4integrate",
@@ -23,15 +47,188 @@ export default function ExecutionDetails() {
23
47
  name: t("Header.executions"),
24
48
  url: "/e4integrate/executions",
25
49
  },
26
- {
27
- name: "TODO: dynamic title",
28
- },
29
- ];
50
+ ]);
51
+
52
+ // very first render jumps to page of selected. disable processExecutionId argument for list query after first render.
53
+ const [disableExecutionId, setDisableExecutionId] = useState<boolean>(false);
54
+
55
+ const [selected, setSelected] = useState<Execution | null>(null);
56
+
57
+ const [drawerOpen, setDrawerOpen] = useState<boolean>(true);
58
+
59
+ const [input, setInput] = useState<ProcessExecutionInput>({
60
+ skip: 0,
61
+ sort: "startDate",
62
+ sortDesc: true,
63
+ top: 10,
64
+ });
65
+
66
+ const [selectedTaskExecution, setSelectedTaskExecution] =
67
+ useState<ProcessTaskExecution | null>(null);
68
+ const handleCloseDrawer = () => {
69
+ setSelectedTaskExecution(null);
70
+ setDrawerOpen(true);
71
+ };
72
+
73
+ const { data: executions, isLoading: executionsLoading } =
74
+ getProcessExecutionsByProcess.useData({
75
+ processId,
76
+ processExecutionId: disableExecutionId ? undefined : selectedExecutionId,
77
+ input,
78
+ });
79
+
80
+ const { data: details } = getProcessExecutionDetails.useData({
81
+ id: selectedExecutionId ?? "", // returns null if id = ""
82
+ });
83
+
84
+ const isLoading = executionsLoading;
85
+
86
+ const handleSelectedTaskExecution = (
87
+ processTaskExecution: ProcessTaskExecution,
88
+ ) => {
89
+ setDrawerOpen(false);
90
+ setSelectedTaskExecution(processTaskExecution);
91
+ };
92
+
93
+ useEffect(() => {
94
+ const typedData = details as GetProcessExecutionDetailsQuery;
95
+ if (typedData?.processExecutionDetails) {
96
+ setSelected(typedData.processExecutionDetails as Execution);
97
+
98
+ if (breadcrumbs.length === 2) {
99
+ const newCrumbs: Crumb[] = JSON.parse(JSON.stringify(breadcrumbs));
100
+
101
+ newCrumbs.push({
102
+ name: typedData.processExecutionDetails.name as string,
103
+ });
104
+
105
+ setBreadcrumbs(newCrumbs);
106
+ }
107
+ }
108
+ }, [details]);
109
+
110
+ useEffect(() => {
111
+ const typedData = executions as GetProcessExecutionsByProcessQuery;
112
+ if (typedData?.processExecutionsByProcess) {
113
+ setDisableExecutionId(true);
114
+ setInput((prev) => ({
115
+ ...prev,
116
+ skip: typedData.processExecutionsByProcess?.pageInfo.skip,
117
+ }));
118
+ }
119
+ }, [executions]);
120
+
121
+ const runProcess = runProcessWebhook();
122
+ const [message, setMessage] = useState<iSnackbarAlert>({ open: false });
123
+
124
+ const handleRun = () => {
125
+ runProcess.mutate(
126
+ {
127
+ input: { id: processId },
128
+ },
129
+ {
130
+ onSuccess: async (data) => {
131
+ const name = (details as GetProcessExecutionDetailsQuery)
132
+ ?.processExecutionDetails?.name;
133
+
134
+ setMessage({
135
+ open: true,
136
+ severity:
137
+ data.runProcessWebhook?.status === "Success"
138
+ ? "success"
139
+ : "error",
140
+ message:
141
+ data.runProcessWebhook?.status === "Success"
142
+ ? `${name ?? "Integration"} successfully queued for execution.`
143
+ : `Failed to queue ${name ?? "integration"} for exeuction.`,
144
+ });
145
+ },
146
+ onError: (error) => {
147
+ const name = (details as GetProcessExecutionDetailsQuery)
148
+ ?.processExecutionDetails?.name;
149
+
150
+ setMessage({
151
+ open: true,
152
+ severity: "error",
153
+ message: `Failed to queue ${name ?? "integration"} for exeuction.`,
154
+ });
155
+ console.error("RunProcess failed:", error);
156
+ },
157
+ },
158
+ );
159
+ };
160
+
161
+ if (isLoading) {
162
+ return (
163
+ <Box sx={{ padding: theme.spacing(40, 3, 0) }}>
164
+ <Loading />
165
+ </Box>
166
+ );
167
+ }
168
+
169
+ if (!isLoading && !executions) {
170
+ return "error";
171
+ }
30
172
 
31
173
  return (
32
174
  <Box>
33
175
  <IntegrateBreadcrumbs breadcrumbs={breadcrumbs} />
34
- <IntegrationView />
176
+ {selected && (
177
+ <ExecutionDetailsHeader execution={selected as Execution}>
178
+ <Button
179
+ variant="contained"
180
+ color="info"
181
+ startIcon={<PlayArrowIcon />}
182
+ sx={{ padding: theme.spacing(1.3, 2) }}
183
+ onClick={handleRun}
184
+ >
185
+ {t("Executions.run")}
186
+ </Button>
187
+ </ExecutionDetailsHeader>
188
+ )}
189
+ <Box
190
+ sx={{
191
+ display: "flex",
192
+ height: "80vh",
193
+ width: "100%",
194
+ overflow: "hidden",
195
+ backgroundColor: theme.palette.background.default,
196
+ border: `1px solid ${theme.palette.grey[400]}`,
197
+ marginTop: theme.spacing(1),
198
+ }}
199
+ >
200
+ <ExecutionHistoryDrawer
201
+ data={executions as GetProcessExecutionsByProcessQuery}
202
+ loading={isLoading}
203
+ input={input}
204
+ setInput={setInput}
205
+ drawerOpen={drawerOpen}
206
+ setDrawerOpen={setDrawerOpen}
207
+ />
208
+ <IntegrationView
209
+ data={
210
+ (details as GetProcessExecutionDetailsQuery)
211
+ ?.processExecutionDetails as ProcessExecutionDetails
212
+ }
213
+ variant="process-execution"
214
+ onTaskClick={handleSelectedTaskExecution}
215
+ drawerOpen={!!selectedTaskExecution}
216
+ processTaskId={selectedTaskExecution?.id}
217
+ />
218
+ <TaskExecutionDrawer
219
+ open={selectedTaskExecution !== null}
220
+ onClose={handleCloseDrawer}
221
+ anchor="right"
222
+ processTaskExecution={selectedTaskExecution}
223
+ handleClose={handleCloseDrawer}
224
+ />
225
+ </Box>
226
+ <SnackbarAlert
227
+ open={message.open}
228
+ severity={message.severity}
229
+ message={message.message}
230
+ handleClose={() => setMessage({ open: false })}
231
+ />
35
232
  </Box>
36
233
  );
37
234
  }
@@ -0,0 +1,160 @@
1
+ import type { ProcessTaskExecution } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
2
+ import { DateTimePopover } from "@evenicanpm/admin-integrate/components/core";
3
+ import { ExecutionTag } from "@evenicanpm/admin-integrate/components/execution";
4
+ import {
5
+ toDurationDate,
6
+ toShortDate,
7
+ } from "@evenicanpm/admin-integrate/utils/date-functions";
8
+ import { ChevronRightOutlined } from "@mui/icons-material";
9
+ import {
10
+ Box,
11
+ IconButton,
12
+ Stack,
13
+ type Theme,
14
+ Typography,
15
+ useTheme,
16
+ } from "@mui/material";
17
+ import { useTranslations } from "next-intl";
18
+ import { useState } from "react";
19
+
20
+ interface Props {
21
+ details: ProcessTaskExecution;
22
+ }
23
+
24
+ export default function TaskExecutionDetails({ details }: Props) {
25
+ const t = useTranslations("Integrate.Executions");
26
+ const theme = useTheme();
27
+ const styles = getStyles(theme);
28
+
29
+ const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
30
+ const open = Boolean(anchorEl);
31
+
32
+ const [expandedParams, setExpandedParams] = useState<boolean>(false);
33
+
34
+ const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
35
+ setAnchorEl(event.currentTarget);
36
+ };
37
+
38
+ const handlePopoverClose = () => {
39
+ setAnchorEl(null);
40
+ };
41
+
42
+ const toggleExpanded = () => {
43
+ setExpandedParams(!expandedParams);
44
+ };
45
+
46
+ return (
47
+ <>
48
+ <Box
49
+ display="flex"
50
+ justifyContent="space-between"
51
+ alignItems="center"
52
+ sx={{ marginBottom: theme.spacing(1) }}
53
+ >
54
+ <Typography variant="h5" fontWeight="medium" overflow="auto">
55
+ {details.name}
56
+ </Typography>
57
+ <ExecutionTag
58
+ executionStatusId={details.executionStatus?.id ?? "999"}
59
+ />
60
+ </Box>
61
+
62
+ {details.startDate && (
63
+ <Stack direction="row" spacing={1}>
64
+ <Typography
65
+ variant="caption"
66
+ color="grey"
67
+ onMouseEnter={handlePopoverOpen}
68
+ onMouseLeave={handlePopoverClose}
69
+ >
70
+ {toShortDate(details.startDate as string)}
71
+ </Typography>
72
+ {details.endDate && (
73
+ <Typography variant="caption" color="grey">
74
+ {t("duration")}:{" "}
75
+ {toDurationDate(details.startDate, details.endDate)}
76
+ </Typography>
77
+ )}
78
+ <DateTimePopover
79
+ dateIsoString={details.startDate}
80
+ sx={{ pointerEvents: "none" }}
81
+ open={open}
82
+ anchorEl={anchorEl}
83
+ anchorOrigin={{
84
+ vertical: "bottom",
85
+ horizontal: "left",
86
+ }}
87
+ transformOrigin={{
88
+ vertical: "top",
89
+ horizontal: "left",
90
+ }}
91
+ onClose={handlePopoverClose}
92
+ disableRestoreFocus
93
+ />
94
+ </Stack>
95
+ )}
96
+
97
+ {details.endpoint?.name && (
98
+ <Box sx={styles.detailContainer}>
99
+ <Typography variant="body1">{t("TaskExecution.endpoint")}</Typography>
100
+ <Typography variant="body2" color="grey">
101
+ {details.endpoint.name}
102
+ </Typography>
103
+ </Box>
104
+ )}
105
+
106
+ {details.processTaskType?.name && (
107
+ <Box sx={styles.detailContainer}>
108
+ <Typography variant="body1">{t("TaskExecution.taskType")}</Typography>
109
+ <Typography variant="body2" color="grey">
110
+ {details.processTaskType.name}
111
+ </Typography>
112
+ </Box>
113
+ )}
114
+
115
+ {details.params && (
116
+ <Box sx={styles.detailContainer}>
117
+ <Typography variant="body1">{t("TaskExecution.params")}</Typography>
118
+ <Box display="flex" justifyContent="space-between">
119
+ <Typography
120
+ variant="body2"
121
+ color="grey"
122
+ component="pre"
123
+ noWrap={!expandedParams}
124
+ alignSelf="center"
125
+ >
126
+ {JSON.stringify(JSON.parse(details.params), null, 2)}
127
+ </Typography>
128
+ <IconButton
129
+ onClick={toggleExpanded}
130
+ sx={{
131
+ height: "fit-content",
132
+ transform: expandedParams ? "rotate(90deg)" : undefined,
133
+ transition: "transform 0.1s",
134
+ }}
135
+ >
136
+ <ChevronRightOutlined />
137
+ </IconButton>
138
+ </Box>
139
+ </Box>
140
+ )}
141
+
142
+ {details.executionStatusMessage && (
143
+ <Box sx={styles.detailContainer}>
144
+ <Typography variant="body1">{t("TaskExecution.message")}</Typography>
145
+ <Typography variant="body2" color="grey">
146
+ {details.executionStatusMessage}
147
+ </Typography>
148
+ </Box>
149
+ )}
150
+ </>
151
+ );
152
+ }
153
+
154
+ const getStyles = (theme: Theme) => {
155
+ return {
156
+ detailContainer: {
157
+ marginTop: theme.spacing(2),
158
+ },
159
+ };
160
+ };
@@ -0,0 +1,54 @@
1
+ import type { ProcessTaskExecution } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
2
+ import { DrawerButtons } from "@evenicanpm/admin-integrate/components/core";
3
+ import {
4
+ Box,
5
+ type DrawerProps,
6
+ Drawer as MuiDrawer,
7
+ useTheme,
8
+ } from "@mui/material";
9
+ import { styled } from "@mui/material/styles";
10
+
11
+ import TaskExecutionDetails from "./task-execution-details";
12
+
13
+ interface Props extends DrawerProps {
14
+ processTaskExecution: ProcessTaskExecution | null;
15
+ handleClose: () => void;
16
+ }
17
+
18
+ const Drawer = styled(MuiDrawer)({
19
+ position: "relative", //imp
20
+ //width: 625, //drawer width
21
+ "& .MuiDrawer-paper": {
22
+ width: 525, //drawer width
23
+ position: "absolute", //imp
24
+ transition: "none !important",
25
+ },
26
+ });
27
+
28
+ export default function TaskExecutionDrawer({
29
+ processTaskExecution,
30
+ handleClose,
31
+ ...props
32
+ }: Props) {
33
+ const theme = useTheme();
34
+
35
+ return (
36
+ <Drawer
37
+ {...props}
38
+ variant="persistent"
39
+ sx={{ padding: theme.spacing(2), width: processTaskExecution ? 525 : 0 }}
40
+ >
41
+ <DrawerButtons handleClose={handleClose} />
42
+ <Box
43
+ sx={{
44
+ width: `min(${theme.spacing(70)}, 100vw)`,
45
+ padding: theme.spacing(2, 3),
46
+ }}
47
+ >
48
+ {processTaskExecution && (
49
+ <TaskExecutionDetails details={processTaskExecution} />
50
+ )}
51
+ </Box>
52
+ </Drawer>
53
+ );
54
+ }
@@ -1,31 +1,29 @@
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 } from "@mui/material";
7
- import { RemoveRedEye } from "@mui/icons-material";
8
- import { SxProps } from "@mui/material";
9
-
10
- // Custom components
1
+ import { DateTimePopover } from "@evenicanpm/admin-integrate/components/core";
2
+ import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
11
3
  import {
4
+ StyledIconButton,
12
5
  StyledTableCell,
13
6
  StyledTableRow,
14
- StyledIconButton,
15
7
  } from "@evenicanpm/admin-integrate/components/data-table/table-row";
16
8
  import {
17
- ExecutionTag,
18
9
  ExecutionStatusIcon,
10
+ ExecutionTag,
19
11
  } from "@evenicanpm/admin-integrate/components/execution";
20
- import { DateTimePopover } from "@evenicanpm/admin-integrate/components/core";
21
-
22
- // Hooks
23
- import useTimestamp from "@evenicanpm/admin-integrate/hooks/use-timestamp";
24
-
25
- // Types
26
- import { Item } from "./executions-list";
27
- import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
28
- import { TableCellProps } from "@mui/material";
12
+ import { toDistanceDate } from "@evenicanpm/admin-integrate/utils/date-functions";
13
+ import { 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 { Item } from "./executions-list";
29
27
 
30
28
  interface Props {
31
29
  item: Item;
@@ -37,10 +35,6 @@ const ExecutionsListRow: React.FC<Props> = (props: Props) => {
37
35
  const theme = useTheme();
38
36
  const styles = getStyles(theme);
39
37
 
40
- // e.g. "xx days ago"
41
- const time = useTimestamp(props.item.startDate);
42
- const localTime = new Date(props.item.startDate).toString();
43
-
44
38
  const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
45
39
  const open = Boolean(anchorEl);
46
40
 
@@ -94,10 +88,10 @@ const ExecutionsListRow: React.FC<Props> = (props: Props) => {
94
88
  onMouseEnter={handlePopoverOpen}
95
89
  onMouseLeave={handlePopoverClose}
96
90
  >
97
- {time}
91
+ {toDistanceDate(props.item.startDate)}
98
92
  </Typography>
99
93
  <DateTimePopover
100
- dateIsoString={localTime}
94
+ dateIsoString={props.item.startDate}
101
95
  sx={{ pointerEvents: "none" }}
102
96
  open={open}
103
97
  anchorEl={anchorEl}
@@ -1,18 +1,13 @@
1
- import React from "react";
2
-
3
- // Types
4
- import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
5
- import { Item } from "./executions-list";
6
-
7
1
  // API
8
- import { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
9
-
10
- // MUI
11
- import { TableContainer, Table, TableBody } from "@mui/material";
12
- import { SxProps } from "@mui/material";
13
-
2
+ import type { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
14
3
  // Custom components
15
4
  import { TableHeader } from "@evenicanpm/admin-integrate/components/data-table";
5
+ // Types
6
+ import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
7
+ // MUI
8
+ import { type SxProps, Table, TableBody, TableContainer } from "@mui/material";
9
+ import React from "react";
10
+ import type { Item } from "./executions-list";
16
11
 
17
12
  // Local components
18
13
  import ExecutionsListRow from "./executions-list-row";
@@ -43,28 +38,26 @@ export default function ExecutionsListTable(props: Props) {
43
38
  };
44
39
 
45
40
  return (
46
- <>
47
- <TableContainer>
48
- <Table>
49
- <TableHeader
50
- heading={props.heading}
51
- orderBy={props.input.sort || ""}
52
- order={props.input.sortDesc ? "desc" : "asc"}
53
- onRequestSort={handleRequestSort}
54
- rowSx={props.rowSx}
55
- />
56
- <TableBody>
57
- {props.items.map((item, index) => (
58
- <ExecutionsListRow
59
- key={index}
60
- item={item}
61
- heading={props.heading}
62
- sx={props.rowSx}
63
- />
64
- ))}
65
- </TableBody>
66
- </Table>
67
- </TableContainer>
68
- </>
41
+ <TableContainer>
42
+ <Table>
43
+ <TableHeader
44
+ heading={props.heading}
45
+ orderBy={props.input.sort || ""}
46
+ order={props.input.sortDesc ? "desc" : "asc"}
47
+ onRequestSort={handleRequestSort}
48
+ rowSx={props.rowSx}
49
+ />
50
+ <TableBody>
51
+ {props.items.map((item) => (
52
+ <ExecutionsListRow
53
+ key={item.id}
54
+ item={item}
55
+ heading={props.heading}
56
+ sx={props.rowSx}
57
+ />
58
+ ))}
59
+ </TableBody>
60
+ </Table>
61
+ </TableContainer>
69
62
  );
70
63
  }