@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,13 +3,13 @@ import FlexRowCenter from "@evenicanpm/admin-core/components/flex-box/flex-row-c
3
3
  import { useTheme } from "@mui/material";
4
4
 
5
5
  const Loading = () => {
6
- const theme = useTheme();
6
+ const theme = useTheme();
7
7
 
8
- return (
9
- <FlexRowCenter sx={{ margin: theme.spacing(1) }}>
10
- <CircularProgress color="info" />
11
- </FlexRowCenter>
12
- );
8
+ return (
9
+ <FlexRowCenter sx={{ margin: theme.spacing(1) }}>
10
+ <CircularProgress color="info" />
11
+ </FlexRowCenter>
12
+ );
13
13
  };
14
14
 
15
15
  export default Loading;
@@ -0,0 +1,122 @@
1
+ import { useState } from "react";
2
+
3
+ import { Theme, useTheme } from "@mui/material";
4
+ import {
5
+ Box,
6
+ Stack,
7
+ Typography,
8
+ TextField,
9
+ IconButton,
10
+ TypographyOwnProps,
11
+ } from "@mui/material";
12
+ import { EditOutlined, Clear, Check } from "@mui/icons-material";
13
+
14
+ import { OutlinedIconButton } from "@evenicanpm/admin-integrate/components/button";
15
+
16
+ interface Props {
17
+ title: string;
18
+ onConfirm: (input: string) => void; // update source of props.title
19
+ readOnly?: boolean;
20
+ fullWidth?: boolean;
21
+ variant?: TypographyOwnProps["variant"];
22
+ }
23
+
24
+ export default function TitleEdit(props: Props) {
25
+ const theme = useTheme();
26
+ const styles = getStyles(theme);
27
+
28
+ const [editMode, setEditMode] = useState(false);
29
+ const [input, setInput] = useState(props.title);
30
+
31
+ const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
32
+ setInput(event.target.value);
33
+ };
34
+
35
+ const handleClickEdit = () => {
36
+ setEditMode(true);
37
+ };
38
+
39
+ const handleClose = () => {
40
+ setInput(props.title);
41
+ setEditMode(false);
42
+ };
43
+
44
+ const handleConfirm = () => {
45
+ props.onConfirm(input);
46
+ setEditMode(false);
47
+ };
48
+
49
+ const handleKeyDown = (event: React.KeyboardEvent) => {
50
+ if (event.key === "Enter" && input !== "") {
51
+ handleConfirm();
52
+ }
53
+ };
54
+
55
+ return (
56
+ <>
57
+ <Box
58
+ sx={{
59
+ width: props.fullWidth ? "100%" : "fit-content",
60
+ overflowX: "auto",
61
+ }}
62
+ display="flex"
63
+ justifyContent="flex-start"
64
+ alignItems="center"
65
+ >
66
+ {!editMode ? (
67
+ <Typography sx={styles.name} variant={props.variant || "h6"}>
68
+ {props.title}
69
+ </Typography>
70
+ ) : (
71
+ <TextField
72
+ sx={styles.input}
73
+ fullWidth={props.fullWidth}
74
+ autoFocus
75
+ color="info"
76
+ value={input}
77
+ onChange={handleChange}
78
+ onKeyDown={handleKeyDown}
79
+ />
80
+ )}
81
+ </Box>
82
+ {!props.readOnly && (
83
+ <Box display="flex" justifyContent="flex-end" alignItems="center">
84
+ {!editMode ? (
85
+ <IconButton onClick={handleClickEdit}>
86
+ <EditOutlined />
87
+ </IconButton>
88
+ ) : (
89
+ <Stack direction="row" spacing={1}>
90
+ <OutlinedIconButton color="error" onClick={handleClose}>
91
+ <Clear />
92
+ </OutlinedIconButton>
93
+ <OutlinedIconButton
94
+ color="success"
95
+ onClick={handleConfirm}
96
+ disabled={input === ""}
97
+ >
98
+ <Check />
99
+ </OutlinedIconButton>
100
+ </Stack>
101
+ )}
102
+ </Box>
103
+ )}
104
+ </>
105
+ );
106
+ }
107
+
108
+ const getStyles = (theme: Theme) => {
109
+ return {
110
+ name: {
111
+ overflowX: "auto",
112
+ whiteSpace: "nowrap",
113
+ fontWeight: "medium",
114
+ },
115
+ input: {
116
+ minWidth: theme.spacing(30),
117
+ "& .MuiInputBase-input": {
118
+ padding: theme.spacing(1, 1),
119
+ },
120
+ },
121
+ };
122
+ };
@@ -8,9 +8,9 @@ import { RemoveRedEye } from "@mui/icons-material";
8
8
 
9
9
  // Custom components
10
10
  import {
11
- StyledTableCell,
12
- StyledTableRow,
13
- StyledIconButton,
11
+ StyledTableCell,
12
+ StyledTableRow,
13
+ StyledIconButton,
14
14
  } from "@evenicanpm/admin-integrate/components/data-table/table-row";
15
15
  import { ExecutionStatusIcon } from "@evenicanpm/admin-integrate/components/execution";
16
16
 
@@ -20,126 +20,125 @@ import useTimestamp from "@evenicanpm/admin-integrate/hooks/use-timestamp";
20
20
  // Types
21
21
  import { Item } from "./dashboard-list";
22
22
  import { Head } from "../data-table/table-header";
23
- import { TableCellProps } from "@mui/material";
23
+ import { TableCellProps, SxProps } from "@mui/material";
24
24
 
25
25
  interface Props {
26
- item: Item;
27
- heading: Head[]; // for alignment
28
- enableBgColor?: boolean;
29
- sx?: SxProps;
26
+ item: Item;
27
+ heading: Head[]; // for alignment
28
+ enableBgColor?: boolean;
29
+ sx?: SxProps;
30
30
  }
31
31
 
32
32
  const DashboardListRow: React.FC<Props> = (props: Props) => {
33
- const theme = useTheme();
34
- const styles = getStyles(theme);
35
-
36
- // e.g. "xx days ago"
37
- const time = useTimestamp(props.item.startDate);
38
- const localTime = new Date(props.item.startDate).toString();
39
-
40
- const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
41
- const open = Boolean(anchorEl);
42
-
43
- const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
44
- setAnchorEl(event.currentTarget);
45
- };
46
-
47
- const handlePopoverClose = () => {
48
- setAnchorEl(null);
49
- };
50
-
51
- const handleRedirect = () => {
52
- //Temporarily commented out until executions detail page is implemented
53
- // redirect(
54
- // `/e4integrate/executions/${props.item.process.id}?ExecutionId=${props.item.id}`,
55
- // RedirectType.push,
56
- // );
57
- };
58
-
59
- // only relevant for execution status 450 & 500 (i.e. Notifications list)
60
- let bgColor = "";
61
- if (props.enableBgColor) {
62
- switch (props.item.executionStatus.id) {
63
- case "450":
64
- bgColor = "warning.100";
65
- break;
66
- case "500":
67
- bgColor = "error.100";
68
- break;
69
- }
70
- }
71
-
72
- const sx = props.sx || {};
73
-
74
- return (
75
- <StyledTableRow sx={{ ...sx, backgroundColor: bgColor }}>
76
- <StyledTableCell
77
- align={props.heading[0].align as TableCellProps["align"]}
78
- width={props.heading[0].width}
79
- >
80
- <Stack spacing={1} direction="row">
81
- <Box display="flex" justifyContent="flex-end" alignItems="center">
82
- <ExecutionStatusIcon
83
- executionStatusId={props.item.executionStatus.id}
84
- />
85
- </Box>
86
- <Box display="flex" justifyContent="flex-end" alignItems="center">
87
- <Typography>{props.item.name}</Typography>
88
- </Box>
89
- </Stack>
90
- </StyledTableCell>
91
- <StyledTableCell
92
- align={props.heading[1].align as TableCellProps["align"]}
93
- width={props.heading[1].width}
94
- sx={styles.timeCell}
95
- >
96
- <Typography
97
- onMouseEnter={handlePopoverOpen}
98
- onMouseLeave={handlePopoverClose}
99
- >
100
- {time}
101
- </Typography>
102
- <Popover
103
- sx={{ pointerEvents: "none" }}
104
- open={open}
105
- anchorEl={anchorEl}
106
- anchorOrigin={{
107
- vertical: "bottom",
108
- horizontal: "center",
109
- }}
110
- transformOrigin={{
111
- vertical: "top",
112
- horizontal: "center",
113
- }}
114
- onClose={handlePopoverClose}
115
- disableRestoreFocus
116
- >
117
- <Box sx={styles.popover}>
118
- <Typography>{localTime}</Typography>
119
- </Box>
120
- </Popover>
121
- </StyledTableCell>
122
- <StyledTableCell
123
- align={props.heading[2].align as TableCellProps["align"]}
124
- width={props.heading[2].width}
125
- >
126
- <StyledIconButton onClick={handleRedirect}>
127
- <RemoveRedEye />
128
- </StyledIconButton>
129
- </StyledTableCell>
130
- </StyledTableRow>
131
- );
33
+ const theme = useTheme();
34
+ const styles = getStyles(theme);
35
+
36
+ // e.g. "xx days ago"
37
+ const time = useTimestamp(props.item.startDate);
38
+ const localTime = new Date(props.item.startDate).toString();
39
+
40
+ const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
41
+ const open = Boolean(anchorEl);
42
+
43
+ const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
44
+ setAnchorEl(event.currentTarget);
45
+ };
46
+
47
+ const handlePopoverClose = () => {
48
+ setAnchorEl(null);
49
+ };
50
+
51
+ const handleRedirect = () => {
52
+ redirect(
53
+ `/e4integrate/executions/${props.item.process.id}?ExecutionId=${props.item.id}`,
54
+ RedirectType.push,
55
+ );
56
+ };
57
+
58
+ // only relevant for execution status 450 & 500 (i.e. Notifications list)
59
+ let bgColor = "";
60
+ if (props.enableBgColor) {
61
+ switch (props.item.executionStatus.id) {
62
+ case "450":
63
+ bgColor = "warning.100";
64
+ break;
65
+ case "500":
66
+ bgColor = "error.100";
67
+ break;
68
+ }
69
+ }
70
+
71
+ const sx = props.sx || {};
72
+
73
+ return (
74
+ <StyledTableRow sx={{ ...sx, backgroundColor: bgColor }}>
75
+ <StyledTableCell
76
+ align={props.heading[0].align as TableCellProps["align"]}
77
+ width={props.heading[0].width}
78
+ >
79
+ <Stack spacing={1} direction="row">
80
+ <Box display="flex" justifyContent="flex-end" alignItems="center">
81
+ <ExecutionStatusIcon
82
+ executionStatusId={props.item.executionStatus.id}
83
+ />
84
+ </Box>
85
+ <Box display="flex" justifyContent="flex-end" alignItems="center">
86
+ <Typography>{props.item.name}</Typography>
87
+ </Box>
88
+ </Stack>
89
+ </StyledTableCell>
90
+ <StyledTableCell
91
+ align={props.heading[1].align as TableCellProps["align"]}
92
+ width={props.heading[1].width}
93
+ sx={styles.timeCell}
94
+ >
95
+ <Typography
96
+ onMouseEnter={handlePopoverOpen}
97
+ onMouseLeave={handlePopoverClose}
98
+ >
99
+ {time}
100
+ </Typography>
101
+ <Popover
102
+ sx={{ pointerEvents: "none" }}
103
+ open={open}
104
+ anchorEl={anchorEl}
105
+ anchorOrigin={{
106
+ vertical: "bottom",
107
+ horizontal: "center",
108
+ }}
109
+ transformOrigin={{
110
+ vertical: "top",
111
+ horizontal: "center",
112
+ }}
113
+ onClose={handlePopoverClose}
114
+ disableRestoreFocus
115
+ >
116
+ <Box sx={styles.popover}>
117
+ <Typography>{localTime}</Typography>
118
+ </Box>
119
+ </Popover>
120
+ </StyledTableCell>
121
+ <StyledTableCell
122
+ align={props.heading[2].align as TableCellProps["align"]}
123
+ width={props.heading[2].width}
124
+ >
125
+ <StyledIconButton onClick={handleRedirect}>
126
+ <RemoveRedEye />
127
+ </StyledIconButton>
128
+ </StyledTableCell>
129
+ </StyledTableRow>
130
+ );
132
131
  };
133
132
 
134
133
  const getStyles = (theme: Theme) => {
135
- return {
136
- timeCell: {
137
- cursor: "default",
138
- },
139
- popover: {
140
- padding: theme.spacing(1),
141
- },
142
- };
134
+ return {
135
+ timeCell: {
136
+ cursor: "default",
137
+ },
138
+ popover: {
139
+ padding: theme.spacing(1),
140
+ },
141
+ };
143
142
  };
144
143
 
145
144
  export default DashboardListRow;
@@ -21,137 +21,137 @@ import { Typography, Stack } from "@mui/material";
21
21
 
22
22
  // Returned from processExecutions query
23
23
  export interface Item {
24
- id: string;
25
- name: string;
26
- startDate: string;
27
- executionStatus: {
28
- id: string;
29
- };
30
- process: {
31
- id: string;
32
- };
24
+ id: string;
25
+ name: string;
26
+ startDate: string;
27
+ executionStatus: {
28
+ id: string;
29
+ };
30
+ process: {
31
+ id: string;
32
+ };
33
33
  }
34
34
 
35
35
  interface Props {
36
- title: string;
37
- heading: Head[];
38
- data: GetProcessExecutionsQuery;
39
- loading: boolean;
40
- url: string;
41
- handleRefresh?: () => void;
42
- enableBgColor?: boolean;
36
+ title: string;
37
+ heading: Head[];
38
+ data: GetProcessExecutionsQuery;
39
+ loading: boolean;
40
+ url: string;
41
+ handleRefresh?: () => void;
42
+ enableBgColor?: boolean;
43
43
  }
44
44
 
45
45
  // Row height in terms of multiples of theme.spacing(1) (e.g. theme.spacing(7.5 & rows per page))
46
46
  const rowHeight = 7.5;
47
47
 
48
48
  const DashboardList: React.FC<Props> = (props: Props) => {
49
- const t = useTranslations("Integrate.Dashboard");
50
-
51
- const theme = useTheme();
52
- const styles = getStyles(theme);
53
-
54
- const [items, setItems] = useState<Item[]>([]);
55
- const [fetched, setFetched] = useState<boolean>(false); // prevents "empty list" msg from showing for split second
56
-
57
- useEffect(() => {
58
- if (props.data) {
59
- setItems(props.data.processExecutions.nodes as Item[]);
60
- setFetched(true);
61
- }
62
- }, [props.data]);
63
-
64
- return (
65
- <Card sx={styles.card}>
66
- <Box mr={2} ml={2}>
67
- <DashboardListHeader
68
- title={props.title}
69
- url={props.url}
70
- handleRefresh={props.handleRefresh}
71
- />
72
- </Box>
73
-
74
- {props.loading && (
75
- <TableSkeleton
76
- heading={props.heading}
77
- perPage={5}
78
- rowSx={styles.rowSx}
79
- sx={styles.tableContainer}
80
- />
81
- )}
82
-
83
- {!props.loading && props.data && fetched && items.length > 0 ? (
84
- <TableContainer sx={styles.tableContainer}>
85
- <Table>
86
- <TableHeader
87
- heading={props.heading}
88
- orderBy={"startDate"}
89
- order={"desc"}
90
- />
91
- <TableBody>
92
- {items.map((item, index) => (
93
- <DashboardListRow
94
- key={index}
95
- item={item}
96
- heading={props.heading}
97
- enableBgColor={props.enableBgColor}
98
- sx={styles.rowSx}
99
- />
100
- ))}
101
- </TableBody>
102
- </Table>
103
- </TableContainer>
104
- ) : null}
105
-
106
- {!props.loading && !(props.data && fetched && items.length > 0) ? (
107
- <FlexBox
108
- justifyContent="center"
109
- alignItems="center"
110
- sx={{
111
- minHeight: "335px",
112
- marginBottom: theme.spacing(2),
113
- }}
114
- >
115
- <Stack spacing={1} justifyContent="center" alignItems="center">
116
- <Typography variant="h6" color="info">
117
- {t("ListEmpty.title")}
118
- </Typography>
119
- <Typography variant="body1">{t("ListEmpty.body")}</Typography>
120
- </Stack>
121
- </FlexBox>
122
- ) : null}
123
- </Card>
124
- );
49
+ const t = useTranslations("Integrate.Dashboard");
50
+
51
+ const theme = useTheme();
52
+ const styles = getStyles(theme);
53
+
54
+ const [items, setItems] = useState<Item[]>([]);
55
+ const [fetched, setFetched] = useState<boolean>(false); // prevents "empty list" msg from showing for split second
56
+
57
+ useEffect(() => {
58
+ if (props.data?.processExecutions?.nodes) {
59
+ setItems(props.data.processExecutions.nodes as Item[]);
60
+ setFetched(true);
61
+ }
62
+ }, [props.data]);
63
+
64
+ return (
65
+ <Card sx={styles.card}>
66
+ <Box mr={2} ml={2}>
67
+ <DashboardListHeader
68
+ title={props.title}
69
+ url={props.url}
70
+ handleRefresh={props.handleRefresh}
71
+ />
72
+ </Box>
73
+
74
+ {props.loading && (
75
+ <TableSkeleton
76
+ heading={props.heading}
77
+ perPage={5}
78
+ rowSx={styles.rowSx}
79
+ sx={styles.tableContainer}
80
+ />
81
+ )}
82
+
83
+ {!props.loading && props.data && fetched && items.length > 0 ? (
84
+ <TableContainer sx={styles.tableContainer}>
85
+ <Table>
86
+ <TableHeader
87
+ heading={props.heading}
88
+ orderBy={"startDate"}
89
+ order={"desc"}
90
+ />
91
+ <TableBody>
92
+ {items.map((item, index) => (
93
+ <DashboardListRow
94
+ key={index}
95
+ item={item}
96
+ heading={props.heading}
97
+ enableBgColor={props.enableBgColor}
98
+ sx={styles.rowSx}
99
+ />
100
+ ))}
101
+ </TableBody>
102
+ </Table>
103
+ </TableContainer>
104
+ ) : null}
105
+
106
+ {!props.loading && !(props.data && fetched && items.length > 0) ? (
107
+ <FlexBox
108
+ justifyContent="center"
109
+ alignItems="center"
110
+ sx={{
111
+ minHeight: "335px",
112
+ marginBottom: theme.spacing(2),
113
+ }}
114
+ >
115
+ <Stack spacing={1} justifyContent="center" alignItems="center">
116
+ <Typography variant="h6" color="info">
117
+ {t("ListEmpty.title")}
118
+ </Typography>
119
+ <Typography variant="body1">{t("ListEmpty.body")}</Typography>
120
+ </Stack>
121
+ </FlexBox>
122
+ ) : null}
123
+ </Card>
124
+ );
125
125
  };
126
126
 
127
127
  const getStyles = (theme: Theme) => {
128
- return {
129
- card: {
130
- paddingTop: theme.spacing(2),
131
- },
132
- title: {
133
- display: "flex",
134
- alignItems: "center",
135
- height: "100%",
136
- },
137
- typography: {
138
- fontWeight: "medium",
139
- },
140
- button: {
141
- borderWidth: 2,
142
- borderRadius: 1,
143
- marginRight: theme.spacing(1),
144
- },
145
- iconButton: {
146
- borderRadius: 1,
147
- },
148
- tableContainer: {
149
- paddingTop: theme.spacing(2),
150
- },
151
- rowSx: {
152
- height: theme.spacing(rowHeight),
153
- },
154
- };
128
+ return {
129
+ card: {
130
+ paddingTop: theme.spacing(2),
131
+ },
132
+ title: {
133
+ display: "flex",
134
+ alignItems: "center",
135
+ height: "100%",
136
+ },
137
+ typography: {
138
+ fontWeight: "medium",
139
+ },
140
+ button: {
141
+ borderWidth: 2,
142
+ borderRadius: 1,
143
+ marginRight: theme.spacing(1),
144
+ },
145
+ iconButton: {
146
+ borderRadius: 1,
147
+ },
148
+ tableContainer: {
149
+ paddingTop: theme.spacing(2),
150
+ },
151
+ rowSx: {
152
+ height: theme.spacing(rowHeight),
153
+ },
154
+ };
155
155
  };
156
156
 
157
157
  export default DashboardList;