@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
@@ -3,16 +3,18 @@ import { useTranslations } from "next-intl";
3
3
 
4
4
  // API
5
5
  import { getProcessExecutions } from "@evenicanpm/admin-integrate/api/dashboard/queries";
6
- import { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
6
+ import {
7
+ ProcessExecutionInput,
8
+ GetProcessExecutionsQuery,
9
+ } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
7
10
 
8
11
  // MUI
9
- import { Theme, useTheme } from "@mui/material";
10
12
  import { Box } from "@mui/material";
11
13
 
12
14
  // Custom components
13
15
  import {
14
- IntegrateBreadcrumbs,
15
- Crumb,
16
+ IntegrateBreadcrumbs,
17
+ Crumb,
16
18
  } from "@evenicanpm/admin-integrate/components/breadcrumbs";
17
19
 
18
20
  // Local components
@@ -22,77 +24,70 @@ import ExecutionsList from "./executions-list";
22
24
  import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
23
25
 
24
26
  export default function Executions() {
25
- const t = useTranslations("Integrate");
26
- const l = useTranslations("Integrate.Executions.ListHeader");
27
-
28
- const theme = useTheme();
29
- const styles = getStyles(theme);
27
+ const t = useTranslations("Integrate");
28
+ const l = useTranslations("Integrate.Executions.ListHeader");
30
29
 
31
- const breadcrumbs: Crumb[] = [
32
- {
33
- name: t("Header.dashboard"),
34
- url: "/e4integrate",
35
- },
36
- {
37
- name: t("Header.executions"),
38
- },
39
- ];
30
+ const breadcrumbs: Crumb[] = [
31
+ {
32
+ name: t("Header.dashboard"),
33
+ url: "/e4integrate",
34
+ },
35
+ {
36
+ name: t("Header.executions"),
37
+ },
38
+ ];
40
39
 
41
- const heading: Head[] = [
42
- {
43
- id: "name",
44
- label: l("executionName"),
45
- align: "left",
46
- width: "30%",
47
- sortable: true,
48
- },
49
- {
50
- id: "executionStatus",
51
- label: l("status"),
52
- align: "center",
53
- width: "50%",
54
- },
55
- {
56
- id: "startDate",
57
- label: l("time"),
58
- align: "center",
59
- width: "15%",
60
- sortable: true,
61
- },
62
- {
63
- id: "view",
64
- label: l("actions"),
65
- align: "center",
66
- width: "5%",
67
- },
68
- ];
40
+ const heading: Head[] = [
41
+ {
42
+ id: "name",
43
+ label: l("executionName"),
44
+ align: "left",
45
+ width: "30%",
46
+ sortable: true,
47
+ },
48
+ {
49
+ id: "executionStatus",
50
+ label: l("status"),
51
+ align: "center",
52
+ width: "50%",
53
+ },
54
+ {
55
+ id: "startDate",
56
+ label: l("time"),
57
+ align: "center",
58
+ width: "15%",
59
+ sortable: true,
60
+ },
61
+ {
62
+ id: "view",
63
+ label: l("actions"),
64
+ align: "right",
65
+ width: "5%",
66
+ },
67
+ ];
69
68
 
70
- // TODO: initialize input based on url query params
71
- const [input, setInput] = useState<ProcessExecutionInput>({
72
- sort: "startDate",
73
- sortDesc: true,
74
- top: 10,
75
- skip: 0,
76
- });
69
+ // TODO: initialize input based on url query params
70
+ const [input, setInput] = useState<ProcessExecutionInput>({
71
+ sort: "startDate",
72
+ sortDesc: true,
73
+ top: 10,
74
+ skip: 0,
75
+ });
77
76
 
78
- const { data, isLoading } = getProcessExecutions.useData({
79
- input: input,
80
- });
77
+ const { data, isLoading } = getProcessExecutions.useData({
78
+ input: input,
79
+ });
81
80
 
82
- return (
83
- <Box>
84
- <IntegrateBreadcrumbs breadcrumbs={breadcrumbs} />
85
- <ExecutionsList
86
- heading={heading}
87
- data={data}
88
- loading={isLoading}
89
- input={input}
90
- setInput={setInput}
91
- />
92
- </Box>
93
- );
81
+ return (
82
+ <Box>
83
+ <IntegrateBreadcrumbs breadcrumbs={breadcrumbs} />
84
+ <ExecutionsList
85
+ heading={heading}
86
+ data={data as GetProcessExecutionsQuery}
87
+ loading={isLoading}
88
+ input={input}
89
+ setInput={setInput}
90
+ />
91
+ </Box>
92
+ );
94
93
  }
95
-
96
- const getStyles = (theme: Theme) => {
97
- return {};
98
- };
@@ -2,38 +2,30 @@ import React from "react";
2
2
  import { useTranslations } from "next-intl";
3
3
 
4
4
  // MUI
5
- import { Theme, useTheme } from "@mui/material";
6
5
  import { Box } from "@mui/material";
7
6
 
8
7
  // Custom components
9
8
  import {
10
- IntegrateBreadcrumbs,
11
- Crumb,
9
+ IntegrateBreadcrumbs,
10
+ Crumb,
12
11
  } from "@evenicanpm/admin-integrate/components/breadcrumbs";
13
12
 
14
13
  export default function Integrations() {
15
- const t = useTranslations("Integrate");
14
+ const t = useTranslations("Integrate");
16
15
 
17
- const theme = useTheme();
18
- const styles = getStyles(theme);
16
+ const breadcrumbs: Crumb[] = [
17
+ {
18
+ name: t("Header.dashboard"),
19
+ url: "/e4integrate",
20
+ },
21
+ {
22
+ name: t("Header.integrations"),
23
+ },
24
+ ];
19
25
 
20
- const breadcrumbs: Crumb[] = [
21
- {
22
- name: t("Header.dashboard"),
23
- url: "/e4integrate",
24
- },
25
- {
26
- name: t("Header.integrations"),
27
- },
28
- ];
29
-
30
- return (
31
- <Box>
32
- <IntegrateBreadcrumbs breadcrumbs={breadcrumbs} />
33
- </Box>
34
- );
26
+ return (
27
+ <Box>
28
+ <IntegrateBreadcrumbs breadcrumbs={breadcrumbs} />
29
+ </Box>
30
+ );
35
31
  }
36
-
37
- const getStyles = (theme: Theme) => {
38
- return {};
39
- };
@@ -0,0 +1,17 @@
1
+ export type Edited = {
2
+ name: boolean;
3
+ enabled: boolean;
4
+ days: boolean;
5
+ startDate: boolean;
6
+ recurrence: boolean;
7
+ integrations: boolean;
8
+ };
9
+
10
+ export const initialEdited: Edited = {
11
+ name: false,
12
+ enabled: false,
13
+ days: false,
14
+ startDate: false,
15
+ recurrence: false,
16
+ integrations: false,
17
+ };
@@ -0,0 +1 @@
1
+ export * from "./edited-types";
@@ -0,0 +1 @@
1
+ export { default } from "./schedule-drawer";
@@ -0,0 +1,227 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { useTranslations } from "next-intl";
3
+
4
+ // Dnd
5
+ import {
6
+ DndContext,
7
+ closestCenter,
8
+ KeyboardSensor,
9
+ PointerSensor,
10
+ useSensor,
11
+ useSensors,
12
+ DragEndEvent,
13
+ } from "@dnd-kit/core";
14
+ import {
15
+ arrayMove,
16
+ SortableContext,
17
+ sortableKeyboardCoordinates,
18
+ verticalListSortingStrategy,
19
+ } from "@dnd-kit/sortable";
20
+ import { restrictToFirstScrollableAncestor } from "@dnd-kit/modifiers";
21
+
22
+ // Api
23
+ import {
24
+ GetProcessScheduleGroupDetailsQuery,
25
+ ProcessScheduleGroupDetailsUpdate,
26
+ GetProcessScheduleByIdQuery,
27
+ } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
28
+
29
+ // MUI
30
+ import { Theme, useTheme } from "@mui/material";
31
+ import {
32
+ Box,
33
+ Typography,
34
+ Stack,
35
+ TableContainer,
36
+ Table,
37
+ TableBody,
38
+ Button,
39
+ } from "@mui/material";
40
+ import { Add } from "@mui/icons-material";
41
+
42
+ // Custom components
43
+ import { TableHeader } from "@evenicanpm/admin-integrate/components/data-table";
44
+ import { EditedTypography } from "@evenicanpm/admin-integrate/components/core";
45
+
46
+ // Local components
47
+ import SortableIntegrationRow from "./sortable-integration-row";
48
+
49
+ // Types
50
+ import { Edited } from "./edited";
51
+ import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
52
+
53
+ export type Process = {
54
+ id: string;
55
+ sort: number;
56
+ name: string;
57
+ processIcon: string;
58
+ };
59
+
60
+ interface Props {
61
+ data: GetProcessScheduleGroupDetailsQuery | GetProcessScheduleByIdQuery;
62
+ details: ProcessScheduleGroupDetailsUpdate;
63
+ setDetails: (newDetails: ProcessScheduleGroupDetailsUpdate) => void;
64
+ edited: Edited;
65
+ setEdited: (newEdited: Edited) => void;
66
+ readOnly?: boolean;
67
+ }
68
+
69
+ export default function ScheduleDetailsIntegrations(props: Props) {
70
+ const t = useTranslations("Integrate.Scheduler");
71
+
72
+ const theme = useTheme();
73
+ const styles = getStyles(theme);
74
+
75
+ const [items, setItems] = useState<Process[]>([]);
76
+
77
+ const sensors = useSensors(
78
+ useSensor(PointerSensor),
79
+ useSensor(KeyboardSensor, {
80
+ coordinateGetter: sortableKeyboardCoordinates,
81
+ }),
82
+ );
83
+
84
+ useEffect(() => {
85
+ if (props.data) {
86
+ if ("processScheduleGroupDetails" in props.data) {
87
+ setItems(
88
+ (props.data.processScheduleGroupDetails?.processSchedule
89
+ ?.processes as Process[]) || [],
90
+ );
91
+ } else if ("processScheduleById" in props.data) {
92
+ setItems([props.data.processScheduleById?.process as Process]);
93
+ }
94
+ }
95
+ }, [props.data]);
96
+
97
+ function handleDragEnd(event: DragEndEvent) {
98
+ const { active, over } = event;
99
+
100
+ if (over && active.id !== over.id) {
101
+ setItems((items) => {
102
+ const oldIndex = items.findIndex((process) => process.id === active.id);
103
+ const newIndex = items.findIndex((process) => process.id === over.id);
104
+
105
+ return arrayMove(items, oldIndex, newIndex);
106
+ });
107
+
108
+ props.setDetails({
109
+ ...props.details,
110
+ processes: items,
111
+ });
112
+ if (!props.edited.integrations) {
113
+ props.setEdited({
114
+ ...props.edited,
115
+ integrations: true,
116
+ });
117
+ }
118
+ }
119
+ }
120
+
121
+ // @ts-ignore
122
+ const handleDeleteIntegration = (item: Process) => {
123
+ // TODO: delete integration
124
+ };
125
+
126
+ let heading: Head[] = [
127
+ {
128
+ id: "drag",
129
+ label: "",
130
+ align: "right",
131
+ width: "1%",
132
+ },
133
+ {
134
+ id: "name",
135
+ label: t("integration"),
136
+ align: "left",
137
+ width: "92%",
138
+ },
139
+ {
140
+ id: "actions",
141
+ label: t("ListHeader.actions"),
142
+ align: "right",
143
+ width: "7%",
144
+ },
145
+ ];
146
+
147
+ return (
148
+ <Box sx={styles.main}>
149
+ {items.length > 0 ? (
150
+ <>
151
+ <Box display="flex" justifyContent="space-between">
152
+ <Stack direction="row" spacing={1} alignItems="center">
153
+ <Typography variant="body1">
154
+ {t("scheduledIntegrations")}
155
+ </Typography>
156
+ <EditedTypography edited={props.edited.integrations} />
157
+ </Stack>
158
+ {!props.readOnly && (
159
+ <Button
160
+ color="info"
161
+ variant="contained"
162
+ sx={{ fontSize: theme.typography.caption.fontSize }}
163
+ startIcon={<Add />}
164
+ >
165
+ Add
166
+ </Button>
167
+ )}
168
+ </Box>
169
+ <Box sx={styles.list}>
170
+ <DndContext
171
+ sensors={sensors}
172
+ collisionDetection={closestCenter}
173
+ onDragEnd={handleDragEnd}
174
+ modifiers={[restrictToFirstScrollableAncestor]}
175
+ >
176
+ <SortableContext
177
+ items={items}
178
+ strategy={verticalListSortingStrategy}
179
+ >
180
+ <TableContainer>
181
+ <Table>
182
+ <TableHeader
183
+ heading={heading}
184
+ orderBy={"sort"}
185
+ order={"asc"}
186
+ />
187
+ <TableBody>
188
+ {items.map((item) => (
189
+ <SortableIntegrationRow
190
+ key={item.id}
191
+ item={item}
192
+ heading={heading}
193
+ handleDeleteIntegration={handleDeleteIntegration}
194
+ readOnly={props.readOnly}
195
+ />
196
+ ))}
197
+ </TableBody>
198
+ </Table>
199
+ </TableContainer>
200
+ </SortableContext>
201
+ </DndContext>
202
+ </Box>
203
+ </>
204
+ ) : (
205
+ <></>
206
+ )}
207
+ </Box>
208
+ );
209
+ }
210
+
211
+ const getStyles = (theme: Theme) => {
212
+ return {
213
+ main: {
214
+ padding: theme.spacing(2, 3),
215
+
216
+ maxHeight: "50vh",
217
+ overflow: "auto",
218
+ },
219
+ list: {
220
+ margin: theme.spacing(1, 0),
221
+ borderColor: theme.palette.grey[200],
222
+ borderWidth: theme.spacing(0.25),
223
+ borderStyle: "solid",
224
+ borderRadius: "1%",
225
+ },
226
+ };
227
+ };