@evenicanpm/admin-integrate 1.1.0 → 1.2.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 (101) hide show
  1. package/documents/ProcessSchedule/fragments.ts +24 -0
  2. package/documents/ProcessSchedule/read.ts +12 -0
  3. package/documents/ProcessScheduleGroup/fragments.ts +29 -0
  4. package/documents/ProcessScheduleGroup/read.ts +12 -0
  5. package/documents/ScheduledProcess/fragments.ts +24 -0
  6. package/documents/ScheduledProcess/list.ts +27 -0
  7. package/package.json +21 -17
  8. package/src/api/dashboard/queries/get-process-executions.query.ts +33 -36
  9. package/src/api/dashboard/queries/get-process-executions.server.ts +4 -4
  10. package/src/api/scheduler/queries/get-process-schedule-group-details.query.ts +45 -0
  11. package/src/api/scheduler/queries/get-process-schedule-group-details.server.ts +14 -0
  12. package/src/api/scheduler/queries/get-process-schedule.query.ts +45 -0
  13. package/src/api/scheduler/queries/get-process-schedule.server.ts +14 -0
  14. package/src/api/scheduler/queries/get-scheduled-processes.query.ts +45 -0
  15. package/src/api/scheduler/queries/get-scheduled-processes.server.ts +11 -0
  16. package/src/api/scheduler/queries/index.ts +3 -0
  17. package/src/components/breadcrumbs/breadcrumbs.tsx +23 -26
  18. package/src/components/breadcrumbs/index.ts +1 -1
  19. package/src/components/breadcrumbs/types.tsx +4 -0
  20. package/src/components/button/outlined-icon-button.tsx +26 -38
  21. package/src/components/core/date-time-popover.tsx +32 -0
  22. package/src/components/core/edited-typography.tsx +20 -0
  23. package/src/components/core/index.ts +3 -0
  24. package/src/components/core/loading.tsx +6 -6
  25. package/src/components/core/title-edit.tsx +122 -0
  26. package/src/components/dashboard-list/dashboard-list-row.tsx +114 -115
  27. package/src/components/dashboard-list/dashboard-list.tsx +119 -119
  28. package/src/components/data-table/table-header.tsx +85 -81
  29. package/src/components/data-table/table-pagination.tsx +27 -27
  30. package/src/components/data-table/table-row.tsx +14 -14
  31. package/src/components/data-table/table-skeleton.tsx +34 -34
  32. package/src/components/execution/execution-filter.ts +22 -22
  33. package/src/components/execution/execution-status-icon.tsx +16 -17
  34. package/src/components/execution/execution-tag.tsx +81 -80
  35. package/src/components/footer/footer.tsx +34 -34
  36. package/src/components/header/dashboard-list-header.tsx +64 -63
  37. package/src/components/header/execution-details-header.tsx +102 -129
  38. package/src/components/header/header.tsx +27 -27
  39. package/src/components/header/index.ts +1 -0
  40. package/src/components/header/integration-details-header.tsx +99 -0
  41. package/src/components/icons/up-down.tsx +15 -15
  42. package/src/components/integration-view/edges/default-edge.tsx +18 -17
  43. package/src/components/integration-view/elk-layout-options.ts +26 -26
  44. package/src/components/integration-view/elk-types.ts +16 -12
  45. package/src/components/integration-view/flow-types.tsx +5 -5
  46. package/src/components/integration-view/integration-view.tsx +132 -130
  47. package/src/components/integration-view/nodes/base-node.tsx +50 -0
  48. package/src/components/integration-view/nodes/connection-node.tsx +8 -8
  49. package/src/components/integration-view/nodes/entry-node.tsx +8 -8
  50. package/src/components/integration-view/nodes/group-node.tsx +47 -6
  51. package/src/components/integration-view/nodes/task-node.tsx +58 -13
  52. package/src/components/integration-view/temp-data/initialElements.tsx +224 -0
  53. package/src/components/integration-view/types.ts +6 -6
  54. package/src/components/layouts/main-layout.tsx +13 -13
  55. package/src/components/layouts/root-container.tsx +25 -25
  56. package/src/components/link-cards/link-card.tsx +23 -23
  57. package/src/components/link-cards/styles.ts +15 -15
  58. package/src/components/list-filter/date-filter.tsx +41 -45
  59. package/src/components/list-filter/date-range-filter.tsx +78 -77
  60. package/src/components/list-filter/list-filter-types.ts +38 -38
  61. package/src/components/list-filter/list-filter.tsx +363 -354
  62. package/src/components/list-filter/multi-select-filter.tsx +94 -95
  63. package/src/components/list-filter/select-filter.tsx +67 -64
  64. package/src/components/scheduler/day-selector.tsx +174 -0
  65. package/src/components/scheduler/day-tag.tsx +73 -0
  66. package/src/components/scheduler/index.ts +4 -0
  67. package/src/components/scheduler/schedule-filter.ts +25 -0
  68. package/src/components/scheduler/schedule-icon.tsx +87 -0
  69. package/src/components/scheduler/scheduler-types.ts +40 -0
  70. package/src/hooks/use-breadcrumbs.ts +31 -31
  71. package/src/hooks/use-recurrence.tsx +13 -0
  72. package/src/hooks/use-timestamp.tsx +21 -21
  73. package/src/pages/dashboard/dashboard-link-cards.tsx +99 -99
  74. package/src/pages/dashboard/dashboard-list-sections.tsx +130 -125
  75. package/src/pages/dashboard/dashboard.tsx +6 -6
  76. package/src/pages/execution-details/execution-details.tsx +23 -29
  77. package/src/pages/executions/executions-list/executions-list-row.tsx +101 -104
  78. package/src/pages/executions/executions-list/executions-list-table.tsx +45 -53
  79. package/src/pages/executions/executions-list/executions-list.tsx +219 -212
  80. package/src/pages/executions/executions.tsx +67 -72
  81. package/src/pages/integrations/integrations.tsx +17 -25
  82. package/src/pages/scheduler/schedule-drawer/edited/edited-types.ts +17 -0
  83. package/src/pages/scheduler/schedule-drawer/edited/index.ts +1 -0
  84. package/src/pages/scheduler/schedule-drawer/index.ts +1 -0
  85. package/src/pages/scheduler/schedule-drawer/schedule-details-integrations.tsx +227 -0
  86. package/src/pages/scheduler/schedule-drawer/schedule-details-main.tsx +292 -0
  87. package/src/pages/scheduler/schedule-drawer/schedule-details-name.tsx +77 -0
  88. package/src/pages/scheduler/schedule-drawer/schedule-details-skeleton.tsx +64 -0
  89. package/src/pages/scheduler/schedule-drawer/schedule-details.tsx +42 -0
  90. package/src/pages/scheduler/schedule-drawer/schedule-drawer-buttons.tsx +72 -0
  91. package/src/pages/scheduler/schedule-drawer/schedule-drawer-group.tsx +103 -0
  92. package/src/pages/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +94 -0
  93. package/src/pages/scheduler/schedule-drawer/schedule-drawer.tsx +101 -0
  94. package/src/pages/scheduler/schedule-drawer/sortable-integration-row.tsx +93 -0
  95. package/src/pages/scheduler/scheduler.tsx +106 -30
  96. package/src/pages/scheduler/schedules-list/index.ts +1 -0
  97. package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +235 -0
  98. package/src/pages/scheduler/schedules-list/schedules-list-table.tsx +74 -0
  99. package/src/pages/scheduler/schedules-list/schedules-list.tsx +280 -0
  100. package/tsconfig.json +29 -26
  101. package/src/components/integration-view/temp-data/initialElements.ts +0 -238
@@ -0,0 +1,87 @@
1
+ import React, { useState } from "react";
2
+ import { useTranslations } from "next-intl";
3
+
4
+ import { Theme, useTheme } from "@mui/material";
5
+ import { Box, Popover, Typography } from "@mui/material";
6
+ import { CalendarToday, Block, ReportGmailerrorred } from "@mui/icons-material";
7
+
8
+ interface Props {
9
+ isLegacy?: boolean;
10
+ isDisabled?: boolean;
11
+ enablePopover?: boolean;
12
+ }
13
+
14
+ const ScheduleIcon: React.FC<Props> = (props: Props) => {
15
+ const t = useTranslations("Integrate.Scheduler");
16
+
17
+ const theme = useTheme();
18
+ const styles = getStyles(theme);
19
+
20
+ const iconMap: { [key: string]: any } = {
21
+ enabled: <CalendarToday color="success" />,
22
+ disabled: <Block sx={{ color: "grey.600" }} />,
23
+ legacy: <ReportGmailerrorred color="error" />,
24
+ };
25
+
26
+ let type = "enabled";
27
+ if (props.isLegacy) type = "legacy";
28
+ else if (props.isDisabled) type = "disabled";
29
+
30
+ const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
31
+ const open = Boolean(anchorEl);
32
+
33
+ const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
34
+ if (props.enablePopover) {
35
+ setAnchorEl(event.currentTarget);
36
+ }
37
+ };
38
+
39
+ const handlePopoverClose = () => {
40
+ if (props.enablePopover) {
41
+ setAnchorEl(null);
42
+ }
43
+ };
44
+
45
+ return (
46
+ <>
47
+ <Box
48
+ display="flex"
49
+ alignItems="center"
50
+ justifyContent="center"
51
+ onMouseEnter={handlePopoverOpen}
52
+ onMouseLeave={handlePopoverClose}
53
+ >
54
+ {iconMap[type]}
55
+ </Box>
56
+ <Popover
57
+ sx={{ pointerEvents: "none" }}
58
+ open={open}
59
+ anchorEl={anchorEl}
60
+ anchorOrigin={{
61
+ vertical: "bottom",
62
+ horizontal: "center",
63
+ }}
64
+ transformOrigin={{
65
+ vertical: "top",
66
+ horizontal: "center",
67
+ }}
68
+ onClose={handlePopoverClose}
69
+ disableRestoreFocus
70
+ >
71
+ <Box sx={styles.popover}>
72
+ <Typography>{t(type)}</Typography>
73
+ </Box>
74
+ </Popover>
75
+ </>
76
+ );
77
+ };
78
+
79
+ export default ScheduleIcon;
80
+
81
+ const getStyles = (theme: Theme) => {
82
+ return {
83
+ popover: {
84
+ padding: theme.spacing(1),
85
+ },
86
+ };
87
+ };
@@ -0,0 +1,40 @@
1
+ export type DayString =
2
+ | "monday"
3
+ | "tuesday"
4
+ | "wednesday"
5
+ | "thursday"
6
+ | "friday"
7
+ | "saturday"
8
+ | "sunday"
9
+ | "everyday"
10
+ | "disabled";
11
+
12
+ export type IsDay = {
13
+ isMonday: boolean;
14
+ isTuesday: boolean;
15
+ isWednesday: boolean;
16
+ isThursday: boolean;
17
+ isFriday: boolean;
18
+ isSaturday: boolean;
19
+ isSunday: boolean;
20
+ };
21
+
22
+ export const dayKeys: DayString[] = [
23
+ "monday",
24
+ "tuesday",
25
+ "wednesday",
26
+ "thursday",
27
+ "friday",
28
+ "saturday",
29
+ "sunday",
30
+ ];
31
+
32
+ export const isDayMap = {
33
+ monday: "isMonday",
34
+ tuesday: "isTuesday",
35
+ wednesday: "isWednesday",
36
+ thursday: "isThursday",
37
+ friday: "isFriday",
38
+ saturday: "isSaturday",
39
+ sunday: "isSunday",
40
+ } as const;
@@ -1,45 +1,45 @@
1
- import { Crumb } from "../components/breadcrumbs/breadcrumbs";
1
+ import { Crumb } from "../components/breadcrumbs";
2
2
 
3
3
  const baseUrl = "/e4integrate";
4
4
 
5
5
  const lookup: { [key: string]: Crumb } = {
6
- dashboard: {
7
- name: "Dashboard",
8
- url: `${baseUrl}/dashboard`,
9
- },
10
- executions: {
11
- name: "Executions",
12
- url: `${baseUrl}/executions`,
13
- },
14
- integrations: {
15
- name: "Integrations",
16
- url: `${baseUrl}/integrations`,
17
- },
18
- scheduler: {
19
- name: "Schedules",
20
- url: `${baseUrl}/scheduler`,
21
- },
6
+ dashboard: {
7
+ name: "Dashboard",
8
+ url: `${baseUrl}/dashboard`,
9
+ },
10
+ executions: {
11
+ name: "Executions",
12
+ url: `${baseUrl}/executions`,
13
+ },
14
+ integrations: {
15
+ name: "Integrations",
16
+ url: `${baseUrl}/integrations`,
17
+ },
18
+ scheduler: {
19
+ name: "Schedules",
20
+ url: `${baseUrl}/scheduler`,
21
+ },
22
22
  };
23
23
 
24
24
  // hook that generates breadcrumbs based on url & name of integration if applicable
25
25
  const useBreadcrumbs = (url: string, integrationName?: string) => {
26
- // Dashboard crumb is always the root (breadcrumbs not shown on Dashboard page itself)
27
- const breadcrumbs: Crumb[] = [lookup.dashboard];
26
+ // Dashboard crumb is always the root (breadcrumbs not shown on Dashboard page itself)
27
+ const breadcrumbs: Crumb[] = [lookup.dashboard];
28
28
 
29
- const splitUrl = url.split("/").splice(4);
30
- const path = splitUrl[0];
31
- if (!lookup[path])
32
- throw new Error(`Breadcrumb entry does not exist for path ${path}`);
33
- if (path !== "dashboard") {
34
- breadcrumbs.push(lookup[path]);
35
- }
29
+ const splitUrl = url.split("/").splice(4);
30
+ const path = splitUrl[0];
31
+ if (!lookup[path])
32
+ throw new Error(`Breadcrumb entry does not exist for path ${path}`);
33
+ if (path !== "dashboard") {
34
+ breadcrumbs.push(lookup[path]);
35
+ }
36
36
 
37
- if (integrationName) {
38
- breadcrumbs.push({ name: integrationName, url: "" });
39
- }
40
- delete breadcrumbs.at(-1).url;
37
+ if (integrationName) {
38
+ breadcrumbs.push({ name: integrationName, url: "" });
39
+ }
40
+ delete breadcrumbs.at(-1).url;
41
41
 
42
- return breadcrumbs;
42
+ return breadcrumbs;
43
43
  };
44
44
 
45
45
  export default useBreadcrumbs;
@@ -0,0 +1,13 @@
1
+ export default function useRecurrence(
2
+ interval: number,
3
+ intervalUnitId: string,
4
+ ) {
5
+ if (interval <= 0 || (intervalUnitId !== "1" && intervalUnitId !== "2")) {
6
+ return "N/A";
7
+ }
8
+
9
+ const unitString = intervalUnitId === "1" ? "Minute" : "Hour";
10
+ let result: string =
11
+ "Every " + interval + " " + unitString + (interval === 1 ? "" : "s");
12
+ return result;
13
+ }
@@ -1,25 +1,25 @@
1
1
  export default function useTimestamp(dateTime: string) {
2
- const then = new Date(dateTime);
3
- const diffTime = Date.now() - then.getTime();
4
- const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
2
+ const then = new Date(dateTime);
3
+ const diffTime = Date.now() - then.getTime();
4
+ const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
5
5
 
6
- let result: string;
7
- if (diffDays === 0) {
8
- const diffMin = Math.floor(diffTime / (1000 * 60));
9
- if (diffMin === 0) {
10
- result = "Now";
11
- } else if (diffMin >= 60) {
12
- result = Math.floor(diffTime / (1000 * 60 * 60)) + "h ago";
13
- } else {
14
- result = diffMin + "m ago";
15
- }
16
- } else {
17
- if (diffDays === 1) {
18
- result = "Yesterday";
19
- } else {
20
- result = diffDays + " days ago";
21
- }
22
- }
6
+ let result: string;
7
+ if (diffDays === 0) {
8
+ const diffMin = Math.floor(diffTime / (1000 * 60));
9
+ if (diffMin === 0) {
10
+ result = "Now";
11
+ } else if (diffMin >= 60) {
12
+ result = Math.floor(diffTime / (1000 * 60 * 60)) + "h ago";
13
+ } else {
14
+ result = diffMin + "m ago";
15
+ }
16
+ } else {
17
+ if (diffDays === 1) {
18
+ result = "Yesterday";
19
+ } else {
20
+ result = diffDays + " days ago";
21
+ }
22
+ }
23
23
 
24
- return result;
24
+ return result;
25
25
  }
@@ -5,118 +5,118 @@ import { useTranslations } from "next-intl";
5
5
  import { Theme, useTheme } from "@mui/material";
6
6
  import { Box, Grid2 as Grid } from "@mui/material";
7
7
  import {
8
- RocketLaunchOutlined,
9
- IntegrationInstructionsOutlined,
10
- PlaylistPlayOutlined,
11
- AccessTimeOutlined,
8
+ RocketLaunchOutlined,
9
+ IntegrationInstructionsOutlined,
10
+ PlaylistPlayOutlined,
11
+ AccessTimeOutlined,
12
12
  } from "@mui/icons-material";
13
13
 
14
14
  // Custom components
15
15
  import LinkCard from "@evenicanpm/admin-integrate/components/link-cards";
16
16
 
17
17
  const breakpoints = {
18
- xs: 6,
19
- md: 3,
18
+ xs: 6,
19
+ md: 3,
20
20
  };
21
21
 
22
22
  export default function DashboardLinkCards() {
23
- const t = useTranslations("Integrate.Dashboard.LinkCard");
23
+ const t = useTranslations("Integrate.Dashboard.LinkCard");
24
24
 
25
- const theme = useTheme();
26
- const styles = getStyles(theme);
25
+ const theme = useTheme();
26
+ const styles = getStyles(theme);
27
27
 
28
- const linkcardProps = {
29
- quickstart: {
30
- title: t("quickstart"),
31
- description: t("quickstartDescription"),
32
- url: "/e4integrate",
33
- children: (
34
- <Box
35
- sx={{
36
- ...styles.iconSquare,
37
- backgroundColor: "paste.600",
38
- }}
39
- >
40
- <RocketLaunchOutlined sx={styles.icon} />
41
- </Box>
42
- ),
43
- },
44
- integrations: {
45
- title: t("integrations"),
46
- description: t("integrationsDescription"),
47
- url: "/e4integrate/integrations",
48
- children: (
49
- <Box
50
- sx={{
51
- ...styles.iconSquare,
52
- backgroundColor: "orange.400",
53
- }}
54
- >
55
- <IntegrationInstructionsOutlined sx={styles.icon} />
56
- </Box>
57
- ),
58
- },
59
- scheduler: {
60
- title: t("scheduler"),
61
- description: t("schedulerDescription"),
62
- url: "/e4integrate/scheduler",
63
- children: (
64
- <Box
65
- sx={{
66
- ...styles.iconSquare,
67
- backgroundColor: "marron.600",
68
- }}
69
- >
70
- <AccessTimeOutlined sx={styles.icon} />
71
- </Box>
72
- ),
73
- },
74
- executions: {
75
- title: t("executions"),
76
- description: t("executionsDescription"),
77
- url: "/e4integrate/executions",
78
- children: (
79
- <Box
80
- sx={{
81
- ...styles.iconSquare,
82
- backgroundColor: "info.500",
83
- }}
84
- >
85
- <PlaylistPlayOutlined sx={styles.icon} />
86
- </Box>
87
- ),
88
- },
89
- };
28
+ const linkcardProps = {
29
+ quickstart: {
30
+ title: t("quickstart"),
31
+ description: t("quickstartDescription"),
32
+ url: "/e4integrate",
33
+ children: (
34
+ <Box
35
+ sx={{
36
+ ...styles.iconSquare,
37
+ backgroundColor: "paste.600",
38
+ }}
39
+ >
40
+ <RocketLaunchOutlined sx={styles.icon} />
41
+ </Box>
42
+ ),
43
+ },
44
+ integrations: {
45
+ title: t("integrations"),
46
+ description: t("integrationsDescription"),
47
+ url: "/e4integrate/integrations",
48
+ children: (
49
+ <Box
50
+ sx={{
51
+ ...styles.iconSquare,
52
+ backgroundColor: "orange.400",
53
+ }}
54
+ >
55
+ <IntegrationInstructionsOutlined sx={styles.icon} />
56
+ </Box>
57
+ ),
58
+ },
59
+ scheduler: {
60
+ title: t("scheduler"),
61
+ description: t("schedulerDescription"),
62
+ url: "/e4integrate/scheduler",
63
+ children: (
64
+ <Box
65
+ sx={{
66
+ ...styles.iconSquare,
67
+ backgroundColor: "marron.600",
68
+ }}
69
+ >
70
+ <AccessTimeOutlined sx={styles.icon} />
71
+ </Box>
72
+ ),
73
+ },
74
+ executions: {
75
+ title: t("executions"),
76
+ description: t("executionsDescription"),
77
+ url: "/e4integrate/executions",
78
+ children: (
79
+ <Box
80
+ sx={{
81
+ ...styles.iconSquare,
82
+ backgroundColor: "info.500",
83
+ }}
84
+ >
85
+ <PlaylistPlayOutlined sx={styles.icon} />
86
+ </Box>
87
+ ),
88
+ },
89
+ };
90
90
 
91
- return (
92
- <Grid container spacing={4}>
93
- <Grid size={breakpoints}>
94
- <LinkCard {...linkcardProps.quickstart} />
95
- </Grid>
96
- <Grid size={breakpoints}>
97
- <LinkCard {...linkcardProps.integrations} />
98
- </Grid>
99
- <Grid size={breakpoints}>
100
- <LinkCard {...linkcardProps.executions} />
101
- </Grid>
102
- <Grid size={breakpoints}>
103
- <LinkCard {...linkcardProps.scheduler} />
104
- </Grid>
105
- </Grid>
106
- );
91
+ return (
92
+ <Grid container spacing={4}>
93
+ <Grid size={breakpoints}>
94
+ <LinkCard {...linkcardProps.quickstart} />
95
+ </Grid>
96
+ <Grid size={breakpoints}>
97
+ <LinkCard {...linkcardProps.integrations} />
98
+ </Grid>
99
+ <Grid size={breakpoints}>
100
+ <LinkCard {...linkcardProps.executions} />
101
+ </Grid>
102
+ <Grid size={breakpoints}>
103
+ <LinkCard {...linkcardProps.scheduler} />
104
+ </Grid>
105
+ </Grid>
106
+ );
107
107
  }
108
108
 
109
109
  const getStyles = (theme: Theme) => {
110
- return {
111
- iconSquare: {
112
- padding: theme.spacing(1),
113
- paddingBottom: theme.spacing(0.5),
114
- marginBottom: theme.spacing(1),
115
- color: "grey.200",
116
- borderRadius: 1,
117
- },
118
- icon: {
119
- fontSize: "h4.fontSize",
120
- },
121
- };
110
+ return {
111
+ iconSquare: {
112
+ padding: theme.spacing(1),
113
+ paddingBottom: theme.spacing(0.5),
114
+ marginBottom: theme.spacing(1),
115
+ color: "grey.200",
116
+ borderRadius: 1,
117
+ },
118
+ icon: {
119
+ fontSize: "h4.fontSize",
120
+ },
121
+ };
122
122
  };