@evenicanpm/admin-integrate 1.1.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 (79) hide show
  1. package/README.md +29 -0
  2. package/documents/ProcessExecution/fragments.ts +16 -0
  3. package/documents/ProcessExecution/list.ts +31 -0
  4. package/package.json +19 -0
  5. package/src/api/dashboard/queries/get-process-executions.query.ts +48 -0
  6. package/src/api/dashboard/queries/get-process-executions.server.ts +11 -0
  7. package/src/api/dashboard/queries/index.ts +1 -0
  8. package/src/auth/.keep +0 -0
  9. package/src/auth/types/.keep +0 -0
  10. package/src/components/breadcrumbs/breadcrumbs.tsx +42 -0
  11. package/src/components/breadcrumbs/index.ts +2 -0
  12. package/src/components/button/index.ts +1 -0
  13. package/src/components/button/outlined-icon-button.tsx +47 -0
  14. package/src/components/core/index.ts +1 -0
  15. package/src/components/core/loading.tsx +15 -0
  16. package/src/components/dashboard-list/dashboard-list-row.tsx +145 -0
  17. package/src/components/dashboard-list/dashboard-list.tsx +157 -0
  18. package/src/components/dashboard-list/index.ts +1 -0
  19. package/src/components/data-table/index.ts +3 -0
  20. package/src/components/data-table/table-header.tsx +109 -0
  21. package/src/components/data-table/table-pagination.tsx +36 -0
  22. package/src/components/data-table/table-row.tsx +27 -0
  23. package/src/components/data-table/table-skeleton.tsx +45 -0
  24. package/src/components/execution/execution-filter.ts +30 -0
  25. package/src/components/execution/execution-status-icon.tsx +30 -0
  26. package/src/components/execution/execution-tag.tsx +100 -0
  27. package/src/components/execution/index.ts +2 -0
  28. package/src/components/footer/footer.tsx +55 -0
  29. package/src/components/footer/index.ts +1 -0
  30. package/src/components/header/dashboard-list-header.tsx +88 -0
  31. package/src/components/header/execution-details-header.tsx +154 -0
  32. package/src/components/header/header.tsx +42 -0
  33. package/src/components/header/index.ts +3 -0
  34. package/src/components/icons/up-down.tsx +21 -0
  35. package/src/components/integration-view/edges/default-edge.tsx +23 -0
  36. package/src/components/integration-view/elk-layout-options.ts +39 -0
  37. package/src/components/integration-view/elk-types.ts +19 -0
  38. package/src/components/integration-view/flow-types.tsx +16 -0
  39. package/src/components/integration-view/index.ts +1 -0
  40. package/src/components/integration-view/integration-view.tsx +159 -0
  41. package/src/components/integration-view/nodes/connection-node.tsx +10 -0
  42. package/src/components/integration-view/nodes/entry-node.tsx +10 -0
  43. package/src/components/integration-view/nodes/group-node.tsx +10 -0
  44. package/src/components/integration-view/nodes/task-node.tsx +17 -0
  45. package/src/components/integration-view/temp-data/initialElements.ts +238 -0
  46. package/src/components/integration-view/types.ts +12 -0
  47. package/src/components/layouts/index.ts +2 -0
  48. package/src/components/layouts/main-layout.tsx +28 -0
  49. package/src/components/layouts/root-container.tsx +43 -0
  50. package/src/components/link-cards/index.ts +1 -0
  51. package/src/components/link-cards/link-card.tsx +36 -0
  52. package/src/components/link-cards/styles.ts +29 -0
  53. package/src/components/list-filter/date-filter.tsx +55 -0
  54. package/src/components/list-filter/date-range-filter.tsx +101 -0
  55. package/src/components/list-filter/index.ts +6 -0
  56. package/src/components/list-filter/list-filter-types.ts +70 -0
  57. package/src/components/list-filter/list-filter.tsx +409 -0
  58. package/src/components/list-filter/multi-select-filter.tsx +117 -0
  59. package/src/components/list-filter/select-filter.tsx +82 -0
  60. package/src/hooks/use-breadcrumbs.ts +45 -0
  61. package/src/hooks/use-timestamp.tsx +25 -0
  62. package/src/lib/.keep +0 -0
  63. package/src/pages/dashboard/dashboard-link-cards.tsx +122 -0
  64. package/src/pages/dashboard/dashboard-list-sections.tsx +149 -0
  65. package/src/pages/dashboard/dashboard.tsx +14 -0
  66. package/src/pages/dashboard/index.ts +1 -0
  67. package/src/pages/execution-details/execution-details.tsx +43 -0
  68. package/src/pages/execution-details/index.ts +1 -0
  69. package/src/pages/executions/executions-list/executions-list-row.tsx +142 -0
  70. package/src/pages/executions/executions-list/executions-list-table.tsx +78 -0
  71. package/src/pages/executions/executions-list/executions-list.tsx +265 -0
  72. package/src/pages/executions/executions-list/index.ts +1 -0
  73. package/src/pages/executions/executions.tsx +98 -0
  74. package/src/pages/executions/index.ts +1 -0
  75. package/src/pages/integrations/index.ts +1 -0
  76. package/src/pages/integrations/integrations.tsx +39 -0
  77. package/src/pages/scheduler/index.ts +1 -0
  78. package/src/pages/scheduler/scheduler.tsx +39 -0
  79. package/tsconfig.json +28 -0
@@ -0,0 +1,265 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { useTranslations } from "next-intl";
3
+
4
+ // API
5
+ import { GetProcessExecutionsQuery } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
6
+ import { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
7
+
8
+ // MUI
9
+ import { Theme, useTheme } from "@mui/material";
10
+ import {
11
+ Card,
12
+ Box,
13
+ Stack,
14
+ Typography,
15
+ Grid2 as Grid,
16
+ Skeleton,
17
+ } from "@mui/material";
18
+
19
+ // Custom components
20
+ import { FlexBox } from "@evenicanpm/admin-core/components/flex-box";
21
+ import {
22
+ TablePagination,
23
+ TableSkeleton,
24
+ } from "@evenicanpm/admin-integrate/components/data-table";
25
+ import { ListFilter } from "@evenicanpm/admin-integrate/components/list-filter";
26
+
27
+ // Local components
28
+ import ExecutionsListTable from "./executions-list-table";
29
+
30
+ // Types
31
+ import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
32
+ import { ListFilterOutput } from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
33
+ import {
34
+ ExecutionsListFilters,
35
+ executionListFilters,
36
+ } from "@evenicanpm/admin-integrate/components/execution/execution-filter";
37
+
38
+ // Returned from processExecutions query
39
+ export interface Item {
40
+ id: string;
41
+ name: string;
42
+ startDate: string;
43
+ executionStatus: {
44
+ id: string;
45
+ };
46
+ process: {
47
+ id: string;
48
+ };
49
+ }
50
+
51
+ // Row height in terms of multiples of theme.spacing(1) (e.g. theme.spacing(7.5 & rows per page))
52
+ const rowHeight = 7.5;
53
+
54
+ interface Props {
55
+ heading: Head[];
56
+ data: GetProcessExecutionsQuery;
57
+ loading: boolean;
58
+ input: ProcessExecutionInput;
59
+ setInput: (newInput: ProcessExecutionInput) => void;
60
+ }
61
+
62
+ const ExecutionsList: React.FC<Props> = (props: Props) => {
63
+ const t = useTranslations("Integrate.Executions");
64
+
65
+ const theme = useTheme();
66
+ const styles = getStyles(theme);
67
+
68
+ const [items, setItems] = useState<Item[]>([]);
69
+ const [fetched, setFetched] = useState<boolean>(false); // prevents "empty list" msg from showing for split second
70
+ const [page, setPage] = useState(props.input.skip / props.input.top + 1);
71
+ const [perPage, setPerPage] = useState(props.input.top);
72
+
73
+ const handleChangePage = (
74
+ event: React.ChangeEvent<unknown>,
75
+ value: number,
76
+ ) => {
77
+ if (page !== value) {
78
+ setPage(value);
79
+ props.setInput({
80
+ ...props.input,
81
+ skip: props.input.top * (value - 1),
82
+ });
83
+ setFetched(false);
84
+ }
85
+ };
86
+
87
+ const handleSetFilters = (
88
+ filterUpdate: ListFilterOutput<ExecutionsListFilters>,
89
+ ) => {
90
+ const { itemsPerPage, search, filters } = filterUpdate;
91
+ props.setInput({
92
+ ...props.input,
93
+ top: itemsPerPage,
94
+ skip: 0,
95
+ search: search,
96
+ dateRange: {
97
+ startDate: filters.dateRange?.start,
98
+ endDate: filters.dateRange?.end,
99
+ },
100
+ executionStatusIds: filters.multiSelectFilter?.map(
101
+ (obj) => obj.id as number,
102
+ ),
103
+ });
104
+ setFetched(false);
105
+ setPerPage(itemsPerPage);
106
+ setPage(1);
107
+ };
108
+
109
+ const handleClearFilters = () => {
110
+ props.setInput({
111
+ ...props.input,
112
+ skip: 0,
113
+ dateRange: null,
114
+ executionStatusIds: null,
115
+ });
116
+ setFetched(false);
117
+ };
118
+
119
+ useEffect(() => {
120
+ if (props.data) {
121
+ setItems(props.data.processExecutions.nodes as Item[]);
122
+ setFetched(true);
123
+ }
124
+ }, [props.data]);
125
+
126
+ return (
127
+ <>
128
+ <Box sx={styles.list}>
129
+ <ListFilter<ExecutionsListFilters>
130
+ setFilters={handleSetFilters}
131
+ clearFilters={handleClearFilters}
132
+ filters={executionListFilters}
133
+ config={{
134
+ pagination: {
135
+ pageDefault: 10,
136
+ pageOptions: [10, 20, 50],
137
+ },
138
+ }}
139
+ />
140
+ </Box>
141
+
142
+ {props.loading && !props.data && (
143
+ <Card>
144
+ <TableSkeleton
145
+ heading={props.heading}
146
+ perPage={perPage}
147
+ rowSx={styles.rowSx}
148
+ />
149
+ </Card>
150
+ )}
151
+
152
+ {!props.loading && props.data && fetched && items.length > 0 ? (
153
+ <Box
154
+ sx={{
155
+ minHeight:
156
+ props.data.processExecutions.pageInfo.resultsReturned < perPage &&
157
+ page === 1
158
+ ? theme.spacing(
159
+ rowHeight *
160
+ (props.data.processExecutions.pageInfo.resultsReturned +
161
+ 1),
162
+ )
163
+ : theme.spacing(rowHeight * (perPage + 1)),
164
+ }}
165
+ >
166
+ <Card>
167
+ <ExecutionsListTable
168
+ heading={props.heading}
169
+ items={items}
170
+ input={props.input}
171
+ setInput={props.setInput}
172
+ rowSx={styles.rowSx}
173
+ />
174
+ </Card>
175
+ </Box>
176
+ ) : null}
177
+
178
+ {!props.loading && fetched && items.length === 0 ? (
179
+ <Card>
180
+ <FlexBox
181
+ justifyContent="center"
182
+ alignItems="center"
183
+ sx={{
184
+ minHeight: "335px",
185
+ marginBottom: theme.spacing(2),
186
+ }}
187
+ >
188
+ <Stack spacing={1} justifyContent="center" alignItems="center">
189
+ <Typography variant="h6" color="info">
190
+ {t("ListEmpty.title")}
191
+ </Typography>
192
+ <Typography variant="body1">{t("ListEmpty.body")}</Typography>
193
+ </Stack>
194
+ </FlexBox>
195
+ </Card>
196
+ ) : null}
197
+
198
+ {!props.loading && props.data && fetched && items.length > 0 ? (
199
+ <Grid container spacing={1} sx={styles.pagination}>
200
+ <Grid size={{ xs: 10.5 }}>
201
+ <FlexBox
202
+ justifyContent="center"
203
+ alignItems="center"
204
+ sx={styles.paginationBox}
205
+ >
206
+ <TablePagination
207
+ page={page}
208
+ onChange={handleChangePage}
209
+ count={Math.ceil(
210
+ props.data.processExecutions.recordCount / props.input.top,
211
+ )}
212
+ />
213
+ </FlexBox>
214
+ </Grid>
215
+ <Grid size={{ xs: 1.5 }}>
216
+ <FlexBox
217
+ justifyContent="flex-end"
218
+ alignItems="center"
219
+ sx={{ height: "100%" }}
220
+ >
221
+ <Typography color="grey">
222
+ {`${props.data.processExecutions.pageInfo.resultsReturned} ${t("Pagination.of")} ${props.data.processExecutions.recordCount} ${t("Pagination.items")}`}
223
+ </Typography>
224
+ </FlexBox>
225
+ </Grid>
226
+ </Grid>
227
+ ) : null}
228
+ </>
229
+ );
230
+ };
231
+
232
+ const getStyles = (theme: Theme) => {
233
+ return {
234
+ title: {
235
+ display: "flex",
236
+ alignItems: "center",
237
+ height: "100%",
238
+ },
239
+ typography: {
240
+ fontWeight: "medium",
241
+ },
242
+ button: {
243
+ borderWidth: 2,
244
+ borderRadius: 1,
245
+ marginRight: theme.spacing(1),
246
+ },
247
+ iconButton: {
248
+ borderRadius: 1,
249
+ },
250
+ pagination: {
251
+ marginTop: theme.spacing(2),
252
+ },
253
+ list: {
254
+ margin: theme.spacing(2, 0),
255
+ },
256
+ paginationBox: {
257
+ paddingLeft: theme.spacing(15),
258
+ },
259
+ rowSx: {
260
+ height: theme.spacing(rowHeight),
261
+ },
262
+ };
263
+ };
264
+
265
+ export default ExecutionsList;
@@ -0,0 +1 @@
1
+ export { default } from "./executions-list";
@@ -0,0 +1,98 @@
1
+ import React, { useState } from "react";
2
+ import { useTranslations } from "next-intl";
3
+
4
+ // API
5
+ import { getProcessExecutions } from "@evenicanpm/admin-integrate/api/dashboard/queries";
6
+ import { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
7
+
8
+ // MUI
9
+ import { Theme, useTheme } from "@mui/material";
10
+ import { Box } from "@mui/material";
11
+
12
+ // Custom components
13
+ import {
14
+ IntegrateBreadcrumbs,
15
+ Crumb,
16
+ } from "@evenicanpm/admin-integrate/components/breadcrumbs";
17
+
18
+ // Local components
19
+ import ExecutionsList from "./executions-list";
20
+
21
+ // Types
22
+ import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
23
+
24
+ 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);
30
+
31
+ const breadcrumbs: Crumb[] = [
32
+ {
33
+ name: t("Header.dashboard"),
34
+ url: "/e4integrate",
35
+ },
36
+ {
37
+ name: t("Header.executions"),
38
+ },
39
+ ];
40
+
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
+ ];
69
+
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
+ });
77
+
78
+ const { data, isLoading } = getProcessExecutions.useData({
79
+ input: input,
80
+ });
81
+
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
+ );
94
+ }
95
+
96
+ const getStyles = (theme: Theme) => {
97
+ return {};
98
+ };
@@ -0,0 +1 @@
1
+ export { default } from "./executions";
@@ -0,0 +1 @@
1
+ export { default } from "./integrations";
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import { useTranslations } from "next-intl";
3
+
4
+ // MUI
5
+ import { Theme, useTheme } from "@mui/material";
6
+ import { Box } from "@mui/material";
7
+
8
+ // Custom components
9
+ import {
10
+ IntegrateBreadcrumbs,
11
+ Crumb,
12
+ } from "@evenicanpm/admin-integrate/components/breadcrumbs";
13
+
14
+ export default function Integrations() {
15
+ const t = useTranslations("Integrate");
16
+
17
+ const theme = useTheme();
18
+ const styles = getStyles(theme);
19
+
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
+ );
35
+ }
36
+
37
+ const getStyles = (theme: Theme) => {
38
+ return {};
39
+ };
@@ -0,0 +1 @@
1
+ export { default } from "./scheduler";
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import { useTranslations } from "next-intl";
3
+
4
+ // MUI
5
+ import { Theme, useTheme } from "@mui/material";
6
+ import { Box } from "@mui/material";
7
+
8
+ // Custom components
9
+ import {
10
+ IntegrateBreadcrumbs,
11
+ Crumb,
12
+ } from "@evenicanpm/admin-integrate/components/breadcrumbs";
13
+
14
+ export default function Scheduler() {
15
+ const t = useTranslations("Integrate");
16
+
17
+ const theme = useTheme();
18
+ const styles = getStyles(theme);
19
+
20
+ const breadcrumbs: Crumb[] = [
21
+ {
22
+ name: t("Header.dashboard"),
23
+ url: "/e4integrate",
24
+ },
25
+ {
26
+ name: t("Header.scheduler"),
27
+ },
28
+ ];
29
+
30
+ return (
31
+ <Box>
32
+ <IntegrateBreadcrumbs breadcrumbs={breadcrumbs} />
33
+ </Box>
34
+ );
35
+ }
36
+
37
+ const getStyles = (theme: Theme) => {
38
+ return {};
39
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES6",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "sourceMap": true,
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "declaration": true,
10
+ "moduleResolution": "node",
11
+ "resolveJsonModule": true,
12
+ "outDir": "./dist",
13
+ "jsx": "preserve",
14
+ "baseUrl": "./",
15
+ "paths": {
16
+ "@/lib/*": ["src/lib/*"],
17
+ "@/auth/*": ["src/auth/*"],
18
+ "@/api/*": ["src/api/*"],
19
+ "@/components/*": ["src/components/*"],
20
+ "@evenicanpm/admin-core/*": [
21
+ "./node_modules/@evenicanpm/admin-core/src/*"
22
+ ],
23
+ "@evenicanpm/admin-integrate/*": [
24
+ "./node_modules/@evenicanpm/admin-integrate/src/*"
25
+ ]
26
+ }
27
+ }
28
+ }