@evenicanpm/admin-integrate 1.1.0 → 1.2.2

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 (114) hide show
  1. package/documents/Process/fragments.ts +13 -0
  2. package/documents/Process/list.ts +27 -0
  3. package/documents/ProcessSchedule/fragments.ts +24 -0
  4. package/documents/ProcessSchedule/read.ts +12 -0
  5. package/documents/ProcessScheduleGroup/fragments.ts +29 -0
  6. package/documents/ProcessScheduleGroup/read.ts +12 -0
  7. package/documents/ScheduledProcess/fragments.ts +24 -0
  8. package/documents/ScheduledProcess/list.ts +27 -0
  9. package/package.json +21 -17
  10. package/src/api/Integrations/queries/get-process.query.ts +48 -0
  11. package/src/api/Integrations/queries/get-process.server.ts +9 -0
  12. package/src/api/Integrations/queries/index.ts +1 -0
  13. package/src/api/dashboard/queries/get-process-executions.query.ts +33 -36
  14. package/src/api/dashboard/queries/get-process-executions.server.ts +4 -4
  15. package/src/api/scheduler/queries/get-process-schedule-group-details.query.ts +45 -0
  16. package/src/api/scheduler/queries/get-process-schedule-group-details.server.ts +14 -0
  17. package/src/api/scheduler/queries/get-process-schedule.query.ts +45 -0
  18. package/src/api/scheduler/queries/get-process-schedule.server.ts +14 -0
  19. package/src/api/scheduler/queries/get-scheduled-processes.query.ts +45 -0
  20. package/src/api/scheduler/queries/get-scheduled-processes.server.ts +11 -0
  21. package/src/api/scheduler/queries/index.ts +3 -0
  22. package/src/components/breadcrumbs/breadcrumbs.tsx +23 -26
  23. package/src/components/breadcrumbs/index.ts +1 -1
  24. package/src/components/breadcrumbs/types.tsx +4 -0
  25. package/src/components/button/outlined-icon-button.tsx +26 -38
  26. package/src/components/core/date-time-popover.tsx +32 -0
  27. package/src/components/core/edited-typography.tsx +20 -0
  28. package/src/components/core/index.ts +3 -0
  29. package/src/components/core/loading.tsx +6 -6
  30. package/src/components/core/title-edit.tsx +122 -0
  31. package/src/components/dashboard-list/dashboard-list-row.tsx +114 -115
  32. package/src/components/dashboard-list/dashboard-list.tsx +119 -119
  33. package/src/components/data-table/table-header.tsx +85 -81
  34. package/src/components/data-table/table-pagination.tsx +27 -27
  35. package/src/components/data-table/table-row.tsx +14 -14
  36. package/src/components/data-table/table-skeleton.tsx +34 -34
  37. package/src/components/execution/execution-filter.ts +22 -22
  38. package/src/components/execution/execution-status-icon.tsx +16 -17
  39. package/src/components/execution/execution-tag.tsx +81 -80
  40. package/src/components/footer/footer.tsx +34 -34
  41. package/src/components/header/dashboard-list-header.tsx +64 -63
  42. package/src/components/header/execution-details-header.tsx +102 -129
  43. package/src/components/header/header.tsx +27 -27
  44. package/src/components/header/index.ts +1 -0
  45. package/src/components/header/integration-details-header.tsx +99 -0
  46. package/src/components/icons/up-down.tsx +15 -15
  47. package/src/components/integration-list/index.ts +2 -0
  48. package/src/components/integration-list/integration-filter.ts +21 -0
  49. package/src/components/integration-list/integration-status-icon.tsx +33 -0
  50. package/src/components/integration-list/integration-tag.tsx +77 -0
  51. package/src/components/integration-view/edges/default-edge.tsx +18 -17
  52. package/src/components/integration-view/elk-layout-options.ts +26 -26
  53. package/src/components/integration-view/elk-types.ts +16 -12
  54. package/src/components/integration-view/flow-types.tsx +5 -5
  55. package/src/components/integration-view/integration-view.tsx +132 -130
  56. package/src/components/integration-view/nodes/base-node.tsx +50 -0
  57. package/src/components/integration-view/nodes/connection-node.tsx +8 -8
  58. package/src/components/integration-view/nodes/entry-node.tsx +8 -8
  59. package/src/components/integration-view/nodes/group-node.tsx +47 -6
  60. package/src/components/integration-view/nodes/task-node.tsx +58 -13
  61. package/src/components/integration-view/temp-data/initialElements.tsx +224 -0
  62. package/src/components/integration-view/types.ts +6 -6
  63. package/src/components/layouts/main-layout.tsx +13 -13
  64. package/src/components/layouts/root-container.tsx +25 -25
  65. package/src/components/link-cards/link-card.tsx +23 -23
  66. package/src/components/link-cards/styles.ts +15 -15
  67. package/src/components/list-filter/date-filter.tsx +41 -45
  68. package/src/components/list-filter/date-range-filter.tsx +78 -77
  69. package/src/components/list-filter/list-filter-types.ts +38 -38
  70. package/src/components/list-filter/list-filter.tsx +363 -354
  71. package/src/components/list-filter/multi-select-filter.tsx +94 -95
  72. package/src/components/list-filter/select-filter.tsx +67 -64
  73. package/src/components/scheduler/day-selector.tsx +174 -0
  74. package/src/components/scheduler/day-tag.tsx +73 -0
  75. package/src/components/scheduler/index.ts +4 -0
  76. package/src/components/scheduler/schedule-filter.ts +25 -0
  77. package/src/components/scheduler/schedule-icon.tsx +87 -0
  78. package/src/components/scheduler/scheduler-types.ts +40 -0
  79. package/src/hooks/use-breadcrumbs.ts +31 -31
  80. package/src/hooks/use-recurrence.tsx +13 -0
  81. package/src/hooks/use-timestamp.tsx +21 -21
  82. package/src/pages/dashboard/dashboard-link-cards.tsx +99 -99
  83. package/src/pages/dashboard/dashboard-list-sections.tsx +130 -125
  84. package/src/pages/dashboard/dashboard.tsx +6 -6
  85. package/src/pages/execution-details/execution-details.tsx +23 -29
  86. package/src/pages/executions/executions-list/executions-list-row.tsx +101 -104
  87. package/src/pages/executions/executions-list/executions-list-table.tsx +45 -53
  88. package/src/pages/executions/executions-list/executions-list.tsx +219 -212
  89. package/src/pages/executions/executions.tsx +67 -72
  90. package/src/pages/integrations/integration-list/index.ts +1 -0
  91. package/src/pages/integrations/integration-list/integration-list-row.tsx +147 -0
  92. package/src/pages/integrations/integration-list/integration-list-table.tsx +78 -0
  93. package/src/pages/integrations/integration-list/integration-list.tsx +262 -0
  94. package/src/pages/integrations/integrations.tsx +83 -28
  95. package/src/pages/scheduler/schedule-drawer/edited/edited-types.ts +17 -0
  96. package/src/pages/scheduler/schedule-drawer/edited/index.ts +1 -0
  97. package/src/pages/scheduler/schedule-drawer/index.ts +1 -0
  98. package/src/pages/scheduler/schedule-drawer/schedule-details-integrations.tsx +227 -0
  99. package/src/pages/scheduler/schedule-drawer/schedule-details-main.tsx +292 -0
  100. package/src/pages/scheduler/schedule-drawer/schedule-details-name.tsx +77 -0
  101. package/src/pages/scheduler/schedule-drawer/schedule-details-skeleton.tsx +64 -0
  102. package/src/pages/scheduler/schedule-drawer/schedule-details.tsx +42 -0
  103. package/src/pages/scheduler/schedule-drawer/schedule-drawer-buttons.tsx +72 -0
  104. package/src/pages/scheduler/schedule-drawer/schedule-drawer-group.tsx +103 -0
  105. package/src/pages/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +94 -0
  106. package/src/pages/scheduler/schedule-drawer/schedule-drawer.tsx +101 -0
  107. package/src/pages/scheduler/schedule-drawer/sortable-integration-row.tsx +93 -0
  108. package/src/pages/scheduler/scheduler.tsx +106 -30
  109. package/src/pages/scheduler/schedules-list/index.ts +1 -0
  110. package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +235 -0
  111. package/src/pages/scheduler/schedules-list/schedules-list-table.tsx +74 -0
  112. package/src/pages/scheduler/schedules-list/schedules-list.tsx +280 -0
  113. package/tsconfig.json +29 -26
  114. 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
- };
@@ -0,0 +1 @@
1
+ export { default } from "./integration-list";
@@ -0,0 +1,147 @@
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, Popover } from "@mui/material";
7
+ import { RemoveRedEye } from "@mui/icons-material";
8
+ import { SxProps } from "@mui/material";
9
+
10
+ // Custom components
11
+ import {
12
+ StyledTableCell,
13
+ StyledTableRow,
14
+ StyledIconButton,
15
+ } from "@evenicanpm/admin-integrate/components/data-table/table-row";
16
+ import {
17
+ IntegrationTag,
18
+ IntegrationStatusIcon,
19
+ } from "@evenicanpm/admin-integrate/components/integration-list";
20
+
21
+ // Hooks
22
+ import useTimestamp from "@evenicanpm/admin-integrate/hooks/use-timestamp";
23
+
24
+ // Types
25
+ import { executionItem } from "./integration-list";
26
+ import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
27
+ import { TableCellProps } from "@mui/material";
28
+
29
+ interface Props {
30
+ item: executionItem;
31
+ heading: Head[]; // for alignment
32
+ sx?: SxProps;
33
+ }
34
+
35
+ const IntegrationListRow: React.FC<Props> = (props: Props) => {
36
+ const theme = useTheme();
37
+ const styles = getStyles(theme);
38
+
39
+ // e.g. "xx days ago"
40
+ const time = useTimestamp(props.item.modified);
41
+ const localTime = new Date(props.item.modified).toString();
42
+
43
+ const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
44
+ const open = Boolean(anchorEl);
45
+
46
+ const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
47
+ setAnchorEl(event.currentTarget);
48
+ };
49
+
50
+ const handlePopoverClose = () => {
51
+ setAnchorEl(null);
52
+ };
53
+
54
+ const handleRedirect = () => {
55
+ redirect(
56
+ `/e4integrate/integration/${props.item.id}?IntegrationId=${props.item.id}`,
57
+ RedirectType.push,
58
+ );
59
+ };
60
+
61
+ return (
62
+ <StyledTableRow sx={props.sx}>
63
+ <StyledTableCell
64
+ align={props.heading[0].align as TableCellProps["align"]}
65
+ width={props.heading[0].width}
66
+ >
67
+ <Stack spacing={1} direction="row">
68
+ <Box display="flex" justifyContent="flex-end" alignItems="center">
69
+ <IntegrationStatusIcon processIcon={props.item.processIcon} />
70
+ </Box>
71
+ <Box display="flex" justifyContent="flex-end" alignItems="center">
72
+ <Typography>{props.item.name}</Typography>
73
+ </Box>
74
+ </Stack>
75
+ </StyledTableCell>
76
+ <StyledTableCell
77
+ align={props.heading[1].align as TableCellProps["align"]}
78
+ width={props.heading[1].width}
79
+ >
80
+ <Typography>{props.item.id}</Typography>
81
+ </StyledTableCell>
82
+ <StyledTableCell
83
+ align={props.heading[1].align as TableCellProps["align"]}
84
+ width={props.heading[1].width}
85
+ >
86
+ <IntegrationTag
87
+ process={{
88
+ isScheduled: props.item.isScheduled,
89
+ isTriggered: props.item.isTriggered,
90
+ }}
91
+ />
92
+ </StyledTableCell>
93
+ <StyledTableCell
94
+ align={props.heading[2].align as TableCellProps["align"]}
95
+ width={props.heading[2].width}
96
+ sx={styles.timeCell}
97
+ >
98
+ <Typography
99
+ onMouseEnter={handlePopoverOpen}
100
+ onMouseLeave={handlePopoverClose}
101
+ >
102
+ {time}
103
+ </Typography>
104
+ <Popover
105
+ sx={{ pointerEvents: "none" }}
106
+ open={open}
107
+ anchorEl={anchorEl}
108
+ anchorOrigin={{
109
+ vertical: "bottom",
110
+ horizontal: "center",
111
+ }}
112
+ transformOrigin={{
113
+ vertical: "top",
114
+ horizontal: "center",
115
+ }}
116
+ onClose={handlePopoverClose}
117
+ disableRestoreFocus
118
+ >
119
+ <Box sx={styles.popover}>
120
+ <Typography>{localTime}</Typography>
121
+ </Box>
122
+ </Popover>
123
+ </StyledTableCell>
124
+ <StyledTableCell
125
+ align={props.heading[3].align as TableCellProps["align"]}
126
+ width={props.heading[3].width}
127
+ >
128
+ <StyledIconButton onClick={handleRedirect}>
129
+ <RemoveRedEye />
130
+ </StyledIconButton>
131
+ </StyledTableCell>
132
+ </StyledTableRow>
133
+ );
134
+ };
135
+
136
+ const getStyles = (theme: Theme) => {
137
+ return {
138
+ timeCell: {
139
+ cursor: "default",
140
+ },
141
+ popover: {
142
+ padding: theme.spacing(1),
143
+ },
144
+ };
145
+ };
146
+
147
+ export default IntegrationListRow;
@@ -0,0 +1,78 @@
1
+ import React from "react";
2
+
3
+ // Types
4
+ import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
5
+ import { Item } from "./integration-list";
6
+
7
+ // API
8
+ import { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
9
+
10
+ // MUI
11
+ import { Theme, useTheme } from "@mui/material";
12
+ import { TableContainer, Table, TableBody } from "@mui/material";
13
+ import { SxProps } from "@mui/material";
14
+
15
+ // Custom components
16
+ import { TableHeader } from "@evenicanpm/admin-integrate/components/data-table";
17
+
18
+ // Local components
19
+ import IntegrationListRow from "./integration-list-row";
20
+
21
+ interface Props {
22
+ heading: Head[];
23
+ items: Item[];
24
+ input: ProcessExecutionInput;
25
+ setInput: (newInput: ProcessExecutionInput) => void;
26
+ rowSx?: SxProps;
27
+ }
28
+
29
+ export default function IntegrationListTable(props: Props) {
30
+ const theme = useTheme();
31
+ const styles = getStyles(theme);
32
+
33
+ const handleRequestSort = (property: string) => {
34
+ const current = props.input.sort;
35
+ if (property === current) {
36
+ props.setInput({
37
+ ...props.input,
38
+ sortDesc: !props.input.sortDesc,
39
+ });
40
+ } else {
41
+ props.setInput({
42
+ ...props.input,
43
+ sort: property,
44
+ sortDesc: false,
45
+ });
46
+ }
47
+ };
48
+
49
+ return (
50
+ <>
51
+ <TableContainer>
52
+ <Table>
53
+ <TableHeader
54
+ heading={props.heading}
55
+ orderBy={props.input.sort}
56
+ order={props.input.sortDesc ? "desc" : "asc"}
57
+ onRequestSort={handleRequestSort}
58
+ rowSx={props.rowSx}
59
+ />
60
+ <TableBody>
61
+ {props.items.map((item, index) => (
62
+ <IntegrationListRow
63
+ key={index}
64
+ item={item}
65
+ heading={props.heading}
66
+ sx={props.rowSx}
67
+ />
68
+ ))}
69
+ </TableBody>
70
+ </Table>
71
+ </TableContainer>
72
+ </>
73
+ );
74
+ }
75
+
76
+ const getStyles = (theme: Theme) => {
77
+ return {};
78
+ };
@@ -0,0 +1,262 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { useTranslations } from "next-intl";
3
+
4
+ // API
5
+ import {
6
+ GetProcessesQuery,
7
+ ProcessInput,
8
+ } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
9
+ import { ProcessExecutionInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
10
+
11
+ // MUI
12
+ import { Theme, useTheme } from "@mui/material";
13
+ import {
14
+ Card,
15
+ Box,
16
+ Stack,
17
+ Typography,
18
+ Grid2 as Grid,
19
+ Skeleton,
20
+ } from "@mui/material";
21
+
22
+ // Custom components
23
+ import { FlexBox } from "@evenicanpm/admin-core/components/flex-box";
24
+ import {
25
+ TablePagination,
26
+ TableSkeleton,
27
+ } from "@evenicanpm/admin-integrate/components/data-table";
28
+ import { ListFilter } from "@evenicanpm/admin-integrate/components/list-filter";
29
+
30
+ // Local components
31
+ import IntegrationListTable from "./integration-list-table";
32
+
33
+ // Types
34
+ import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
35
+ import { ListFilterOutput } from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
36
+ import {
37
+ IntegrationListFilters,
38
+ integrationListFilters,
39
+ } from "@evenicanpm/admin-integrate/components/integration-list/integration-filter";
40
+ import { log } from "console";
41
+
42
+ // Returned from processExecutions query
43
+ export interface executionItem {
44
+ isScheduled: 0 | 1;
45
+ isTriggered: 0 | 1;
46
+ id: string;
47
+ name: string;
48
+ modified: string;
49
+ processIcon: string;
50
+ }
51
+
52
+ // Row height in terms of multiples of theme.spacing(1) (e.g. theme.spacing(7.5 & rows per page))
53
+ const rowHeight = 7.5;
54
+
55
+ interface Props {
56
+ heading: Head[];
57
+ data: GetProcessesQuery;
58
+ loading: boolean;
59
+ input: ProcessInput;
60
+ setInput: (newInput: ProcessInput) => void;
61
+ }
62
+
63
+ const IntegrationList: React.FC<Props> = (props: Props) => {
64
+ const t = useTranslations("Integrate.IntegrationList");
65
+
66
+ const theme = useTheme();
67
+ const styles = getStyles(theme);
68
+
69
+ const [items, setItems] = useState<Item[]>([]);
70
+ const [fetched, setFetched] = useState<boolean>(false); // prevents "empty list" msg from showing for split second
71
+ const [page, setPage] = useState(props.input.skip / props.input.top + 1);
72
+ const [perPage, setPerPage] = useState(props.input.top);
73
+
74
+ const handleChangePage = (
75
+ event: React.ChangeEvent<unknown>,
76
+ value: number,
77
+ ) => {
78
+ if (page !== value) {
79
+ setPage(value);
80
+ props.setInput({
81
+ ...props.input,
82
+ skip: props.input.top * (value - 1),
83
+ });
84
+ setFetched(false);
85
+ }
86
+ };
87
+
88
+ const handleSetFilters = (
89
+ filterUpdate: ListFilterOutput<IntegrationListFilters>,
90
+ ) => {
91
+ const { itemsPerPage, search, filters } = filterUpdate;
92
+ console.log("filters", filters?.multiSelectFilter);
93
+
94
+ props.setInput({
95
+ ...props.input,
96
+ top: itemsPerPage,
97
+ skip: 0,
98
+ search: search,
99
+ integrationTags:
100
+ filters?.multiSelectFilter?.map((f) => `${f.id}`) || null,
101
+ sortDesc: true,
102
+ });
103
+ setFetched(false);
104
+ setPerPage(itemsPerPage);
105
+ setPage(1);
106
+ };
107
+
108
+ const handleClearFilters = () => {
109
+ props.setInput({
110
+ ...props.input,
111
+ skip: 0,
112
+ integrationTags: null,
113
+ });
114
+ setFetched(false);
115
+ };
116
+
117
+ useEffect(() => {
118
+ if (props.data) {
119
+ setItems(props.data.processes.nodes as Item[]);
120
+ setFetched(true);
121
+ }
122
+ }, [props.data]);
123
+
124
+ return (
125
+ <>
126
+ <Box sx={styles.list}>
127
+ <ListFilter<IntegrationListFilters>
128
+ setFilters={handleSetFilters}
129
+ clearFilters={handleClearFilters}
130
+ filters={integrationListFilters}
131
+ config={{
132
+ pagination: {
133
+ pageDefault: 10,
134
+ pageOptions: [10, 20, 50],
135
+ },
136
+ }}
137
+ />
138
+ </Box>
139
+
140
+ {props.loading && !props.data && (
141
+ <Card>
142
+ <TableSkeleton
143
+ heading={props.heading}
144
+ perPage={perPage}
145
+ rowSx={styles.rowSx}
146
+ />
147
+ </Card>
148
+ )}
149
+
150
+ {!props.loading && props.data && fetched && items.length > 0 ? (
151
+ <Box
152
+ sx={{
153
+ minHeight:
154
+ props.data.processes.pageInfo.resultsReturned < perPage &&
155
+ page === 1
156
+ ? theme.spacing(
157
+ rowHeight *
158
+ (props.data.processes.pageInfo.resultsReturned + 1),
159
+ )
160
+ : theme.spacing(rowHeight * (perPage + 1)),
161
+ }}
162
+ >
163
+ <Card>
164
+ <IntegrationListTable
165
+ heading={props.heading}
166
+ items={items}
167
+ input={props.input}
168
+ setInput={props.setInput}
169
+ rowSx={styles.rowSx}
170
+ />
171
+ </Card>
172
+ </Box>
173
+ ) : null}
174
+
175
+ {!props.loading && fetched && items.length === 0 ? (
176
+ <Card>
177
+ <FlexBox
178
+ justifyContent="center"
179
+ alignItems="center"
180
+ sx={{
181
+ minHeight: "335px",
182
+ marginBottom: theme.spacing(2),
183
+ }}
184
+ >
185
+ <Stack spacing={1} justifyContent="center" alignItems="center">
186
+ <Typography variant="h6" color="info">
187
+ {t("ListEmpty.title")}
188
+ </Typography>
189
+ <Typography variant="body1">{t("ListEmpty.body")}</Typography>
190
+ </Stack>
191
+ </FlexBox>
192
+ </Card>
193
+ ) : null}
194
+
195
+ {!props.loading && props.data && fetched && items.length > 0 ? (
196
+ <Grid container spacing={1} sx={styles.pagination}>
197
+ <Grid size={{ xs: 10.5 }}>
198
+ <FlexBox
199
+ justifyContent="center"
200
+ alignItems="center"
201
+ sx={styles.paginationBox}
202
+ >
203
+ <TablePagination
204
+ page={page}
205
+ onChange={handleChangePage}
206
+ count={Math.ceil(
207
+ props.data.processes.recordCount / props.input.top,
208
+ )}
209
+ />
210
+ </FlexBox>
211
+ </Grid>
212
+ <Grid size={{ xs: 1.5 }}>
213
+ <FlexBox
214
+ justifyContent="flex-end"
215
+ alignItems="center"
216
+ sx={{ height: "100%" }}
217
+ >
218
+ <Typography color="grey">
219
+ {`${props.data.processes.pageInfo.resultsReturned} ${t("Pagination.of")} ${props.data.processes.recordCount} ${t("Pagination.items")}`}
220
+ </Typography>
221
+ </FlexBox>
222
+ </Grid>
223
+ </Grid>
224
+ ) : null}
225
+ </>
226
+ );
227
+ };
228
+
229
+ const getStyles = (theme: Theme) => {
230
+ return {
231
+ title: {
232
+ display: "flex",
233
+ alignItems: "center",
234
+ height: "100%",
235
+ },
236
+ typography: {
237
+ fontWeight: "medium",
238
+ },
239
+ button: {
240
+ borderWidth: 2,
241
+ borderRadius: 1,
242
+ marginRight: theme.spacing(1),
243
+ },
244
+ iconButton: {
245
+ borderRadius: 1,
246
+ },
247
+ pagination: {
248
+ marginTop: theme.spacing(2),
249
+ },
250
+ list: {
251
+ margin: theme.spacing(2, 0),
252
+ },
253
+ paginationBox: {
254
+ paddingLeft: theme.spacing(15),
255
+ },
256
+ rowSx: {
257
+ height: theme.spacing(rowHeight),
258
+ },
259
+ };
260
+ };
261
+
262
+ export default IntegrationList;