@evenicanpm/admin-integrate 1.2.2 → 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 (209) 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 +22 -0
  6. package/documents/Process/get-process-details.ts +73 -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/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 +12 -12
  23. package/src/api/Integrations/queries/get-process.server.ts +7 -2
  24. package/src/api/dashboard/queries/get-process-executions.query.ts +6 -3
  25. package/src/api/dashboard/queries/get-process-executions.server.ts +1 -1
  26. package/src/api/execution-details/queries/get-process-execution-details.query.ts +46 -0
  27. package/src/api/execution-details/queries/get-process-execution-details.server.ts +11 -0
  28. package/src/api/execution-details/queries/get-process-executions-by-process.query.ts +48 -0
  29. package/src/api/execution-details/queries/get-process-executions-by-process.server.ts +11 -0
  30. package/src/api/execution-details/queries/index.ts +2 -0
  31. package/src/api/process/mutations/copy-process.mutation.ts +48 -0
  32. package/src/api/process/mutations/copy-process.server.ts +14 -0
  33. package/src/api/process/mutations/index.ts +2 -0
  34. package/src/api/process/mutations/run-process.mutation.ts +41 -0
  35. package/src/api/process/mutations/run-process.server.ts +14 -0
  36. package/src/api/process/queries/get-process-by-id.query.ts +85 -0
  37. package/src/api/process/queries/get-process-by-id.server.ts +20 -0
  38. package/src/api/process/queries/index.ts +4 -0
  39. package/src/api/process-config/mutation/index.ts +2 -0
  40. package/src/api/process-config/mutation/process-config-import.mutation.ts +33 -0
  41. package/src/api/process-config/mutation/process-config-import.server.ts +14 -0
  42. package/src/api/process-config/mutation/process-config-merge.mutation.ts +33 -0
  43. package/src/api/process-config/mutation/process-config-merge.server.ts +14 -0
  44. package/src/api/process-task/queries/get-process-task-by-id.query.ts +45 -0
  45. package/src/api/process-task/queries/get-process-task-by-id.server.ts +9 -0
  46. package/src/api/process-task/queries/index.ts +1 -0
  47. package/src/api/scheduler/mutation/create-process-schedule-group-details.mutation.ts +47 -0
  48. package/src/api/scheduler/mutation/create-process-schedule-group-details.server.ts +14 -0
  49. package/src/api/scheduler/mutation/index.ts +2 -0
  50. package/src/api/scheduler/mutation/update-process-schedule-group-details.mutation.ts +47 -0
  51. package/src/api/scheduler/mutation/update-process-schedule-group-details.server.ts +14 -0
  52. package/src/api/scheduler/queries/get-non-scheduled-processes.query.ts +48 -0
  53. package/src/api/scheduler/queries/get-non-scheduled-processes.server.ts +11 -0
  54. package/src/api/scheduler/queries/get-process-schedule-group-details.query.ts +6 -3
  55. package/src/api/scheduler/queries/get-process-schedule-group-details.server.ts +3 -3
  56. package/src/api/scheduler/queries/get-process-schedule.query.ts +6 -3
  57. package/src/api/scheduler/queries/get-process-schedule.server.ts +3 -3
  58. package/src/api/scheduler/queries/get-scheduled-processes.query.ts +6 -3
  59. package/src/api/scheduler/queries/get-scheduled-processes.server.ts +1 -1
  60. package/src/api/scheduler/queries/index.ts +3 -2
  61. package/src/api/templates/queries/get-process-template-groups.query.ts +48 -0
  62. package/src/api/templates/queries/get-process-template-groups.server.ts +11 -0
  63. package/src/api/templates/queries/get-process-template-records.query.ts +48 -0
  64. package/src/api/templates/queries/get-process-template-records.server.ts +11 -0
  65. package/src/api/templates/queries/get-process-template.query.ts +48 -0
  66. package/src/api/templates/queries/get-process-template.server.ts +9 -0
  67. package/src/api/templates/queries/get-process-templates.query.ts +45 -0
  68. package/src/api/templates/queries/get-process-templates.server.ts +9 -0
  69. package/src/api/templates/queries/index.ts +5 -0
  70. package/src/api/templates/queries/template-input-search.query.ts +34 -0
  71. package/src/api/templates/queries/template-input-search.server.ts +35 -0
  72. package/src/api/templates/queries/types.ts +28 -0
  73. package/src/components/breadcrumbs/breadcrumbs.tsx +32 -5
  74. package/src/components/button/outlined-icon-button.tsx +2 -2
  75. package/src/components/core/date-time-popover.tsx +11 -4
  76. package/src/components/core/drawer-buttons.tsx +52 -0
  77. package/src/components/core/edited-typography.tsx +1 -1
  78. package/src/components/core/index.ts +4 -2
  79. package/src/components/core/loading.tsx +1 -1
  80. package/src/components/core/status-tag.tsx +97 -0
  81. package/src/components/core/title-edit.tsx +18 -11
  82. package/src/components/dashboard-list/dashboard-list-row.tsx +22 -29
  83. package/src/components/dashboard-list/dashboard-list.tsx +19 -15
  84. package/src/components/data-table/table-header.tsx +5 -7
  85. package/src/components/data-table/table-pagination.tsx +1 -1
  86. package/src/components/data-table/table-row.tsx +1 -1
  87. package/src/components/data-table/table-skeleton.tsx +9 -4
  88. package/src/components/execution/execution-filter.ts +1 -1
  89. package/src/components/execution/execution-status-icon.tsx +7 -7
  90. package/src/components/execution/execution-tag.tsx +12 -77
  91. package/src/components/execution/index.ts +1 -1
  92. package/src/components/execution-history-drawer/execution-history-drawer.tsx +203 -0
  93. package/src/components/execution-history-drawer/executions-card.tsx +85 -0
  94. package/src/components/execution-history-drawer/index.ts +1 -0
  95. package/src/components/footer/footer.tsx +10 -6
  96. package/src/components/header/dashboard-list-header.tsx +12 -7
  97. package/src/components/header/execution-details-header.tsx +35 -26
  98. package/src/components/header/header.tsx +10 -3
  99. package/src/components/header/index.ts +1 -1
  100. package/src/components/header/integration-details-header.tsx +104 -45
  101. package/src/components/integration-list/index.ts +2 -1
  102. package/src/components/integration-list/integration-filter.ts +1 -1
  103. package/src/components/integration-list/integration-status-icon.tsx +7 -8
  104. package/src/components/integration-list/integration-tag.tsx +6 -50
  105. package/src/components/integration-list/list/integration-list-row.tsx +161 -0
  106. package/src/components/integration-list/list/integration-list-table.tsx +62 -0
  107. package/src/{pages/integrations/integration-list → components/integration-list/list}/integration-list.tsx +47 -51
  108. package/src/components/integration-view/animated-svg.tsx +31 -0
  109. package/src/components/integration-view/edges/default-edge.tsx +1 -1
  110. package/src/components/integration-view/elk-layout-options.ts +2 -2
  111. package/src/components/integration-view/elk-types.ts +35 -6
  112. package/src/components/integration-view/flow-types.tsx +10 -0
  113. package/src/components/integration-view/integration-view.tsx +990 -55
  114. package/src/components/integration-view/nodes/empty-node.tsx +65 -0
  115. package/src/components/integration-view/nodes/entry-node.tsx +98 -4
  116. package/src/components/integration-view/nodes/execution-entry-node.tsx +107 -0
  117. package/src/components/integration-view/nodes/execution-task-node.tsx +88 -0
  118. package/src/components/integration-view/nodes/group-node.tsx +19 -13
  119. package/src/components/integration-view/nodes/row-node.tsx +19 -0
  120. package/src/components/integration-view/nodes/task-node.tsx +14 -8
  121. package/src/components/integration-view/task-icon.tsx +193 -0
  122. package/src/components/integration-view/temp-data/initialElements.tsx +36 -32
  123. package/src/components/integration-view/types.ts +2 -2
  124. package/src/components/layouts/main-layout.tsx +2 -3
  125. package/src/components/layouts/root-container.tsx +3 -6
  126. package/src/components/link-cards/link-card.tsx +15 -4
  127. package/src/components/link-cards/styles.ts +1 -1
  128. package/src/components/list-filter/date-filter.tsx +4 -3
  129. package/src/components/list-filter/date-range-filter.tsx +11 -5
  130. package/src/components/list-filter/index.ts +1 -1
  131. package/src/components/list-filter/list-filter.tsx +30 -25
  132. package/src/components/list-filter/multi-select-filter.tsx +11 -10
  133. package/src/components/list-filter/select-filter.tsx +13 -8
  134. package/src/components/scheduler/day-selector.tsx +29 -15
  135. package/src/components/scheduler/day-tag.tsx +14 -51
  136. package/src/components/scheduler/index.ts +2 -1
  137. package/src/components/scheduler/schedule-drawer/details-reducer.ts +217 -0
  138. package/src/components/scheduler/schedule-drawer/schedule-details-integrations.tsx +503 -0
  139. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details-main.tsx +136 -99
  140. package/src/components/scheduler/schedule-drawer/schedule-details-name.tsx +94 -0
  141. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details-skeleton.tsx +1 -2
  142. package/src/{pages → components}/scheduler/schedule-drawer/schedule-details.tsx +9 -13
  143. package/src/components/scheduler/schedule-drawer/schedule-drawer-group.tsx +218 -0
  144. package/src/{pages → components}/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +6 -25
  145. package/src/components/scheduler/schedule-drawer/schedule-drawer.tsx +116 -0
  146. package/src/components/scheduler/schedule-drawer/sortable-integration-row.tsx +130 -0
  147. package/src/components/scheduler/schedule-filter.ts +1 -1
  148. package/src/components/scheduler/schedule-icon.tsx +5 -6
  149. package/src/components/scheduler/schedule-integration-icon.tsx +31 -0
  150. package/src/components/templates/index.ts +1 -0
  151. package/src/components/templates/inputs/index.tsx +1351 -0
  152. package/src/components/templates/template-filter.ts +5 -0
  153. package/src/components/templates/templates-list/index.ts +1 -0
  154. package/src/components/templates/templates-list/templates-list-row.tsx +55 -0
  155. package/src/components/templates/templates-list/templates-list-table.tsx +58 -0
  156. package/src/components/templates/templates-list/templates-list.tsx +253 -0
  157. package/src/components/templates/types.tsx +75 -0
  158. package/src/components/templates/wizard.tsx +689 -0
  159. package/src/hooks/use-breadcrumbs.ts +1 -1
  160. package/src/hooks/use-recurrence.tsx +1 -2
  161. package/src/pages/dashboard/dashboard-link-cards.tsx +8 -11
  162. package/src/pages/dashboard/dashboard-list-sections.tsx +7 -9
  163. package/src/pages/dashboard/dashboard.tsx +1 -2
  164. package/src/pages/execution-details/execution-details.tsx +211 -14
  165. package/src/pages/execution-details/task-execution-details.tsx +160 -0
  166. package/src/pages/execution-details/task-execution-drawer.tsx +54 -0
  167. package/src/pages/executions/executions-list/executions-list-row.tsx +21 -27
  168. package/src/pages/executions/executions-list/executions-list-table.tsx +28 -35
  169. package/src/pages/executions/executions-list/executions-list.tsx +24 -18
  170. package/src/pages/executions/executions.tsx +11 -15
  171. package/src/pages/integration-create/index.ts +1 -0
  172. package/src/pages/integration-create/integration-create.tsx +174 -0
  173. package/src/pages/integration-create/pre-creation-step.tsx +12 -0
  174. package/src/pages/integration-create/select-step.tsx +105 -0
  175. package/src/pages/integration-create/template-list-step.tsx +77 -0
  176. package/src/pages/integration-create/wizard-step.tsx +50 -0
  177. package/src/pages/integration-details/import-process/copy-tasks-list.tsx +265 -0
  178. package/src/pages/integration-details/import-process/copy-tasks-row.tsx +77 -0
  179. package/src/pages/integration-details/import-process/import-confirm.tsx +61 -0
  180. package/src/pages/integration-details/import-process/import-drawer.tsx +48 -0
  181. package/src/pages/integration-details/import-process/import-process-reducer.ts +90 -0
  182. package/src/pages/integration-details/import-process/import-process.tsx +149 -0
  183. package/src/pages/integration-details/index.ts +1 -0
  184. package/src/pages/integration-details/integration-details.tsx +221 -0
  185. package/src/pages/integration-details/task-drawer/add-task.tsx +120 -0
  186. package/src/pages/integration-details/task-drawer/edit-task.tsx +175 -0
  187. package/src/pages/integration-details/task-drawer/task-drawer.tsx +139 -0
  188. package/src/pages/integration-details/task-drawer/task-reducer.ts +73 -0
  189. package/src/pages/integrations/integrations.tsx +11 -14
  190. package/src/pages/scheduler/scheduler.tsx +12 -24
  191. package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +27 -37
  192. package/src/pages/scheduler/schedules-list/schedules-list-table.tsx +27 -42
  193. package/src/pages/scheduler/schedules-list/schedules-list.tsx +48 -21
  194. package/src/utils/date-functions.ts +69 -0
  195. package/src/utils/slugify.ts +3 -0
  196. package/tsconfig.json +12 -4
  197. package/src/hooks/use-timestamp.tsx +0 -25
  198. package/src/pages/integrations/integration-list/integration-list-row.tsx +0 -147
  199. package/src/pages/integrations/integration-list/integration-list-table.tsx +0 -78
  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/integrations/integration-list → components/integration-list/list}/index.ts +0 -0
  207. /package/src/{pages → components}/scheduler/schedule-drawer/edited/edited-types.ts +0 -0
  208. /package/src/{pages → components}/scheduler/schedule-drawer/edited/index.ts +0 -0
  209. /package/src/{pages → components}/scheduler/schedule-drawer/index.ts +0 -0
@@ -1,11 +1,15 @@
1
- import React from "react";
2
- import { useTranslations } from "next-intl";
3
-
1
+ import { Copyright } from "@mui/icons-material";
4
2
  // MUI
5
- import { Theme, useTheme } from "@mui/material";
3
+ import {
4
+ Box,
5
+ Grid2 as Grid,
6
+ type Theme,
7
+ Typography,
8
+ useTheme,
9
+ } from "@mui/material";
6
10
  import styled from "@mui/material/styles/styled";
7
- import { Typography, Box, Grid2 as Grid } from "@mui/material";
8
- import { Copyright } from "@mui/icons-material";
11
+ import { useTranslations } from "next-intl";
12
+ import type React from "react";
9
13
 
10
14
  // Styled components
11
15
  const Footer = styled("footer")(() => ({
@@ -1,11 +1,16 @@
1
- import React from "react";
2
- import { redirect, RedirectType } from "next/navigation";
3
- import { useTranslations } from "next-intl";
4
-
5
- // MUI
6
- import { Theme, useTheme } from "@mui/material";
7
- import { Grid2 as Grid, Box, Typography, Button } from "@mui/material";
8
1
  import { Refresh, VisibilityOutlined } from "@mui/icons-material";
2
+ // MUI
3
+ import {
4
+ Box,
5
+ Button,
6
+ Grid2 as Grid,
7
+ type Theme,
8
+ Typography,
9
+ useTheme,
10
+ } from "@mui/material";
11
+ import { RedirectType, redirect } from "next/navigation";
12
+ import { useTranslations } from "next-intl";
13
+ import type React from "react";
9
14
 
10
15
  // Custom components
11
16
  import { OutlinedIconButton } from "../button";
@@ -1,17 +1,24 @@
1
- import React, { useState } from "react";
2
-
3
- // MUI
4
- import { Theme, useTheme } from "@mui/material";
5
- import { Grid2 as Grid, Typography, Stack } from "@mui/material";
6
-
7
- // Custom components
8
- import { ExecutionTag } from "@evenicanpm/admin-integrate/components/execution";
9
1
  import { DateTimePopover } from "@evenicanpm/admin-integrate/components/core";
2
+ import { ExecutionTag } from "@evenicanpm/admin-integrate/components/execution";
3
+ import {
4
+ toDurationDate,
5
+ toShortDate,
6
+ } from "@evenicanpm/admin-integrate/utils/date-functions";
7
+ import {
8
+ Grid2 as Grid,
9
+ Stack,
10
+ type Theme,
11
+ Typography,
12
+ useTheme,
13
+ } from "@mui/material";
14
+ import { useTranslations } from "next-intl";
15
+ import type React from "react";
16
+ import { useState } from "react";
10
17
 
11
- interface Execution {
18
+ export interface Execution {
12
19
  name: string;
13
20
  startDate: string;
14
- endDate: string;
21
+ endDate?: string;
15
22
  executionStatus: {
16
23
  id: string;
17
24
  };
@@ -23,13 +30,14 @@ interface Props {
23
30
  }
24
31
 
25
32
  const ExecutionDetailsHeader: React.FC<Props> = (props: Props) => {
33
+ const t = useTranslations("Integrate");
34
+
26
35
  const theme = useTheme();
27
36
  const styles = getStyles(theme);
28
37
 
29
- const startDate = new Date(props.execution.startDate);
30
- const endDate = new Date(props.execution.endDate);
31
- const localTime = startDate.toLocaleString();
32
- const duration = (endDate.getTime() - startDate.getTime()) / 1000;
38
+ const duration = props.execution.endDate
39
+ ? toDurationDate(props.execution.startDate, props.execution.endDate)
40
+ : "";
33
41
 
34
42
  const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
35
43
  const open = Boolean(anchorEl);
@@ -41,7 +49,6 @@ const ExecutionDetailsHeader: React.FC<Props> = (props: Props) => {
41
49
  const handlePopoverClose = () => {
42
50
  setAnchorEl(null);
43
51
  };
44
-
45
52
  return (
46
53
  <Grid container columnSpacing={1}>
47
54
  <Grid size={8}>
@@ -66,18 +73,20 @@ const ExecutionDetailsHeader: React.FC<Props> = (props: Props) => {
66
73
  </Stack>
67
74
  </Grid>
68
75
  <Grid size={12}>
69
- <Stack
70
- spacing={1}
71
- direction="row"
72
- onMouseEnter={handlePopoverOpen}
73
- onMouseLeave={handlePopoverClose}
74
- >
75
- <Typography color="grey" variant="caption">
76
- {localTime}
77
- </Typography>
78
- <Typography color="grey" variant="caption">
79
- Duration: {duration}s
76
+ <Stack spacing={1} direction="row">
77
+ <Typography
78
+ color="grey"
79
+ variant="caption"
80
+ onMouseEnter={handlePopoverOpen}
81
+ onMouseLeave={handlePopoverClose}
82
+ >
83
+ {toShortDate(props.execution.startDate)}
80
84
  </Typography>
85
+ {duration && (
86
+ <Typography color="grey" variant="caption">
87
+ {t("Executions.duration")}: {duration}
88
+ </Typography>
89
+ )}
81
90
  </Stack>
82
91
  </Grid>
83
92
  <DateTimePopover
@@ -1,6 +1,13 @@
1
- import React from "react";
2
- import { Box, Typography, AppBar, Toolbar, Stack } from "@mui/material";
3
- import { Theme, useTheme } from "@mui/material";
1
+ import {
2
+ AppBar,
3
+ Box,
4
+ Stack,
5
+ type Theme,
6
+ Toolbar,
7
+ Typography,
8
+ useTheme,
9
+ } from "@mui/material";
10
+ import type React from "react";
4
11
 
5
12
  interface Props {
6
13
  title: string; // e.g. Executions
@@ -1,4 +1,4 @@
1
- export { default as IntegrateHeader } from "./header";
2
1
  export { default as DashboardListHeader } from "./dashboard-list-header";
3
2
  export { default as ExecutionDetailsHeader } from "./execution-details-header";
3
+ export { default as IntegrateHeader } from "./header";
4
4
  export { default as IntegrationDetailsHeader } from "./integration-details-header";
@@ -1,29 +1,36 @@
1
- import React from "react";
2
- import { useTranslations } from "next-intl";
3
-
4
- // MUI
5
- import { Theme, useTheme } from "@mui/material";
6
- import { Grid2 as Grid, Stack, Divider, Button, Box } from "@mui/material";
7
1
  import {
8
- InfoOutlined,
2
+ StatusTag,
3
+ TitleEdit,
4
+ } from "@evenicanpm/admin-integrate/components/core";
5
+ import { IntegrationStatusIcon } from "@evenicanpm/admin-integrate/components/integration-list";
6
+ import {
7
+ AccessTime,
9
8
  Code,
10
9
  FileUploadOutlined,
11
10
  PlayArrowOutlined,
12
11
  } from "@mui/icons-material";
13
-
14
- // Custom components
15
- import { TitleEdit } from "@evenicanpm/admin-integrate/components/core";
16
-
17
- // TODO: when applying on page, change to use type of API query result
18
- type DetailsTemp = {
19
- name: string;
20
- processIcon: string;
21
- };
12
+ import {
13
+ Box,
14
+ Button,
15
+ Divider,
16
+ Grid2 as Grid,
17
+ Stack,
18
+ type SxProps,
19
+ type Theme,
20
+ useTheme,
21
+ } from "@mui/material";
22
+ import { useTranslations } from "next-intl";
22
23
 
23
24
  interface Props {
24
- details: DetailsTemp;
25
- setDetails: (newDetails: DetailsTemp) => void;
25
+ name: string;
26
+ setName: React.Dispatch<React.SetStateAction<string>>;
27
+ onImportClick?: React.MouseEventHandler<HTMLButtonElement>;
28
+ onScheduleClick?: React.MouseEventHandler<HTMLButtonElement>;
29
+ icon?: string;
26
30
  children?: React.ReactNode; // buttons to go in header, e.g. save, cancel etc.
31
+ toolbar?: "enabled" | "disabled" | "hidden";
32
+ draft?: boolean;
33
+ untitled?: boolean;
27
34
  }
28
35
 
29
36
  const IntegrationDetailsHeader: React.FC<Props> = (props: Props) => {
@@ -33,24 +40,39 @@ const IntegrationDetailsHeader: React.FC<Props> = (props: Props) => {
33
40
  const styles = getStyles(theme);
34
41
 
35
42
  const onConfirm = (input: string) => {
36
- props.setDetails({ ...props.details, name: input });
43
+ props.setName(input);
37
44
  };
38
45
 
46
+ const toolbarStyles: SxProps =
47
+ props.toolbar === "disabled"
48
+ ? {
49
+ ...styles.controlsButton,
50
+ color: theme.palette.grey[100],
51
+ borderColor: theme.palette.grey[300],
52
+ }
53
+ : styles.controlsButton;
54
+
39
55
  return (
40
- <Grid container rowSpacing={1} columnSpacing={0}>
41
- <Grid size={{ xs: 12, sm: 8 }}>
56
+ <Grid container rowSpacing={1} columnSpacing={0} sx={styles.root}>
57
+ <Grid
58
+ size={{ xs: 12, sm: 8 }}
59
+ pl={2}
60
+ pt={1}
61
+ display="flex"
62
+ alignItems="center"
63
+ >
42
64
  <Stack spacing={1} direction="row" alignItems="center">
43
- {/* TODO: Apply Process icon component once that is merged. Using temp icon for now */}
44
- <InfoOutlined color="info" />
65
+ <IntegrationStatusIcon processIcon={props.icon || "noIcon"} />
45
66
 
46
- <TitleEdit
47
- title={props.details.name}
48
- onConfirm={onConfirm}
49
- variant="h5"
50
- />
67
+ <TitleEdit title={props.name} onConfirm={onConfirm} variant="h5" />
68
+
69
+ {props.untitled && <StatusTag type="warning" text={t("untitled")} />}
70
+ {props.draft && !props.untitled && (
71
+ <StatusTag type="info" text={t("draft")} />
72
+ )}
51
73
  </Stack>
52
74
  </Grid>
53
- <Grid size={{ xs: 12, sm: 4 }}>
75
+ <Grid size={{ xs: 12, sm: 4 }} pt={1} pr={2}>
54
76
  <Stack
55
77
  spacing={1}
56
78
  direction="row"
@@ -61,28 +83,65 @@ const IntegrationDetailsHeader: React.FC<Props> = (props: Props) => {
61
83
  {props.children}
62
84
  </Stack>
63
85
  </Grid>
64
- <Grid size={12}>
65
- <Divider sx={styles.divider} />
66
- </Grid>
67
- <Grid size={12}>
68
- <Stack direction="row">
69
- <Box sx={styles.controlsButton}>
70
- <Button startIcon={<Code />}>{t("codeView")}</Button>
71
- </Box>
72
- <Box sx={styles.controlsButton}>
73
- <Button startIcon={<FileUploadOutlined />}>{t("import")}</Button>
74
- </Box>
75
- <Box sx={{ ...styles.controlsButton, border: "none" }}>
76
- <Button startIcon={<PlayArrowOutlined />}>{t("executions")}</Button>
77
- </Box>
78
- </Stack>
79
- </Grid>
86
+
87
+ {(!props.toolbar || props.toolbar !== "hidden") && (
88
+ <>
89
+ <Grid size={12}>
90
+ <Divider sx={styles.divider} />
91
+ </Grid>
92
+ <Grid size={12} pb={1} pl={1} pr={1}>
93
+ <Stack direction="row">
94
+ <Box sx={toolbarStyles}>
95
+ <Button
96
+ startIcon={<Code />}
97
+ disabled={props.toolbar === "disabled"}
98
+ >
99
+ {t("codeView")}
100
+ </Button>
101
+ </Box>
102
+ <Box sx={toolbarStyles}>
103
+ <Button
104
+ startIcon={<FileUploadOutlined />}
105
+ disabled={props.toolbar === "disabled"}
106
+ onClick={(e) => {
107
+ if (props.onImportClick) props.onImportClick(e);
108
+ }}
109
+ >
110
+ {t("import")}
111
+ </Button>
112
+ </Box>
113
+ <Box sx={{ ...toolbarStyles }}>
114
+ <Button
115
+ startIcon={<AccessTime />}
116
+ disabled={props.toolbar === "disabled"}
117
+ onClick={(e) => {
118
+ if (props.onScheduleClick) props.onScheduleClick(e);
119
+ }}
120
+ >
121
+ {t("schedule")}
122
+ </Button>
123
+ </Box>
124
+ <Box sx={{ ...toolbarStyles, border: "none" }}>
125
+ <Button
126
+ startIcon={<PlayArrowOutlined />}
127
+ disabled={props.toolbar === "disabled"}
128
+ >
129
+ {t("executions")}
130
+ </Button>
131
+ </Box>
132
+ </Stack>
133
+ </Grid>
134
+ </>
135
+ )}
80
136
  </Grid>
81
137
  );
82
138
  };
83
139
 
84
140
  const getStyles = (theme: Theme) => {
85
141
  return {
142
+ root: {
143
+ backgroundColor: theme.palette.background.paper,
144
+ },
86
145
  divider: {
87
146
  border: `1px solid ${theme.palette.grey[500]}`,
88
147
  },
@@ -1,2 +1,3 @@
1
- export { default as IntegrationTag } from "./integration-tag";
2
1
  export { default as IntegrationStatusIcon } from "./integration-status-icon";
2
+ export { default as IntegrationTag } from "./integration-tag";
3
+ export { default as IntegrationList } from "./list";
@@ -1,4 +1,4 @@
1
- import {
1
+ import type {
2
2
  Filters,
3
3
  MultiSelectFilter,
4
4
  } from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
@@ -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;