@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
@@ -8,48 +8,48 @@ import { Typography, Box, Grid2 as Grid } from "@mui/material";
8
8
  import { Copyright } from "@mui/icons-material";
9
9
 
10
10
  // Styled components
11
- const Footer = styled("footer")(({ theme }) => ({
12
- flexShrink: 0,
13
- marginTop: "auto",
11
+ const Footer = styled("footer")(() => ({
12
+ flexShrink: 0,
13
+ marginTop: "auto",
14
14
  }));
15
15
 
16
16
  const IntegrateFooter: React.FC = () => {
17
- const t = useTranslations("Integrate.Footer");
17
+ const t = useTranslations("Integrate.Footer");
18
18
 
19
- const theme = useTheme();
20
- const styles = getStyles(theme);
19
+ const theme = useTheme();
20
+ const styles = getStyles(theme);
21
21
 
22
- return (
23
- <Footer>
24
- <Grid container spacing={0.5} sx={styles.container}>
25
- <Grid>
26
- <Box sx={{ ...styles.centered, color: "grey.500" }}>
27
- <Copyright color="inherit" fontSize="small" />
28
- </Box>
29
- </Grid>
30
- <Grid>
31
- <Box sx={styles.centered}>
32
- <Typography variant="caption" color="grey">
33
- {t("copyright")}
34
- </Typography>
35
- </Box>
36
- </Grid>
37
- </Grid>
38
- </Footer>
39
- );
22
+ return (
23
+ <Footer>
24
+ <Grid container spacing={0.5} sx={styles.container}>
25
+ <Grid>
26
+ <Box sx={{ ...styles.centered, color: "grey.500" }}>
27
+ <Copyright color="inherit" fontSize="small" />
28
+ </Box>
29
+ </Grid>
30
+ <Grid>
31
+ <Box sx={styles.centered}>
32
+ <Typography variant="caption" color="grey">
33
+ {t("copyright")}
34
+ </Typography>
35
+ </Box>
36
+ </Grid>
37
+ </Grid>
38
+ </Footer>
39
+ );
40
40
  };
41
41
 
42
42
  const getStyles = (theme: Theme) => {
43
- return {
44
- container: {
45
- justifyContent: "center",
46
- padding: theme.spacing(5, 0, 0),
47
- },
48
- centered: {
49
- display: "grid",
50
- alignItems: "center",
51
- },
52
- };
43
+ return {
44
+ container: {
45
+ justifyContent: "center",
46
+ padding: theme.spacing(5, 0, 0),
47
+ },
48
+ centered: {
49
+ display: "grid",
50
+ alignItems: "center",
51
+ },
52
+ };
53
53
  };
54
54
 
55
55
  export default IntegrateFooter;
@@ -11,78 +11,79 @@ import { Refresh, VisibilityOutlined } from "@mui/icons-material";
11
11
  import { OutlinedIconButton } from "../button";
12
12
 
13
13
  interface Props {
14
- title: string;
15
- url?: string;
16
- handleRefresh?: () => void;
14
+ title: string;
15
+ url?: string;
16
+ handleRefresh?: () => void;
17
17
  }
18
18
 
19
19
  const DashboardListHeader: React.FC<Props> = (props: Props) => {
20
- const t = useTranslations("Integrate.Dashboard");
20
+ const t = useTranslations("Integrate.Dashboard");
21
21
 
22
- const theme = useTheme();
23
- const styles = getStyles(theme);
22
+ const theme = useTheme();
23
+ const styles = getStyles(theme);
24
24
 
25
- const handleViewAll = () => {
26
- //Temporarily commented out until executions detail page is implemented
27
- //redirect(props.url, RedirectType.push);
28
- };
25
+ const handleViewAll = () => {
26
+ if (props.url) {
27
+ redirect(props.url, RedirectType.push);
28
+ }
29
+ };
29
30
 
30
- return (
31
- <Grid container spacing={0}>
32
- <Grid size={8}>
33
- <Box sx={styles.title}>
34
- <Typography variant="h6" sx={styles.typography}>
35
- {props.title}
36
- </Typography>
37
- </Box>
38
- </Grid>
39
- <Grid size={4}>
40
- <Box display="flex" justifyContent="flex-end">
41
- {props.url && (
42
- <Button
43
- sx={styles.button}
44
- variant="outlined"
45
- color="info"
46
- startIcon={<VisibilityOutlined />}
47
- onClick={handleViewAll}
48
- >
49
- {t("ListHeader.viewAll")}
50
- </Button>
51
- )}
52
- {props.handleRefresh && (
53
- <OutlinedIconButton
54
- sx={styles.iconButton}
55
- color="info"
56
- onClick={props.handleRefresh}
57
- >
58
- <Refresh />
59
- </OutlinedIconButton>
60
- )}
61
- </Box>
62
- </Grid>
63
- </Grid>
64
- );
31
+ return (
32
+ <Grid container spacing={0}>
33
+ <Grid size={8}>
34
+ <Box sx={styles.title}>
35
+ <Typography variant="h6" sx={styles.typography}>
36
+ {props.title}
37
+ </Typography>
38
+ </Box>
39
+ </Grid>
40
+ <Grid size={4}>
41
+ <Box display="flex" justifyContent="flex-end">
42
+ {props.url && (
43
+ <Button
44
+ sx={styles.button}
45
+ variant="outlined"
46
+ color="info"
47
+ startIcon={<VisibilityOutlined />}
48
+ onClick={handleViewAll}
49
+ >
50
+ {t("ListHeader.viewAll")}
51
+ </Button>
52
+ )}
53
+ {props.handleRefresh && (
54
+ <OutlinedIconButton
55
+ sx={styles.iconButton}
56
+ color="info"
57
+ onClick={props.handleRefresh}
58
+ >
59
+ <Refresh />
60
+ </OutlinedIconButton>
61
+ )}
62
+ </Box>
63
+ </Grid>
64
+ </Grid>
65
+ );
65
66
  };
66
67
 
67
68
  const getStyles = (theme: Theme) => {
68
- return {
69
- title: {
70
- display: "flex",
71
- alignItems: "center",
72
- height: "100%",
73
- },
74
- typography: {
75
- fontWeight: "medium",
76
- },
77
- button: {
78
- borderWidth: 2,
79
- borderRadius: 1,
80
- marginRight: theme.spacing(1),
81
- },
82
- iconButton: {
83
- borderRadius: 1,
84
- },
85
- };
69
+ return {
70
+ title: {
71
+ display: "flex",
72
+ alignItems: "center",
73
+ height: "100%",
74
+ },
75
+ typography: {
76
+ fontWeight: "medium",
77
+ },
78
+ button: {
79
+ borderWidth: 2,
80
+ borderRadius: 1,
81
+ marginRight: theme.spacing(1),
82
+ },
83
+ iconButton: {
84
+ borderRadius: 1,
85
+ },
86
+ };
86
87
  };
87
88
 
88
89
  export default DashboardListHeader;
@@ -2,153 +2,126 @@ import React, { useState } from "react";
2
2
 
3
3
  // MUI
4
4
  import { Theme, useTheme } from "@mui/material";
5
- import {
6
- Grid2 as Grid,
7
- Box,
8
- Typography,
9
- Button,
10
- Stack,
11
- Popover,
12
- } from "@mui/material";
13
- import { PlayArrowOutlined } from "@mui/icons-material";
5
+ import { Grid2 as Grid, Typography, Stack } from "@mui/material";
14
6
 
15
7
  // Custom components
16
- import ExecutionTag from "../execution/execution-tag";
8
+ import { ExecutionTag } from "@evenicanpm/admin-integrate/components/execution";
9
+ import { DateTimePopover } from "@evenicanpm/admin-integrate/components/core";
17
10
 
18
11
  interface Execution {
19
- name: string;
20
- startDate: string;
21
- endDate: string;
22
- executionStatus: {
23
- id: string;
24
- };
12
+ name: string;
13
+ startDate: string;
14
+ endDate: string;
15
+ executionStatus: {
16
+ id: string;
17
+ };
25
18
  }
26
19
 
27
20
  interface Props {
28
- execution: Execution;
29
- handleRun?: () => void;
21
+ execution: Execution;
22
+ children?: React.ReactNode; // buttons to go in header, e.g. save, cancel etc.
30
23
  }
31
24
 
32
25
  const ExecutionDetailsHeader: React.FC<Props> = (props: Props) => {
33
- const theme = useTheme();
34
- const styles = getStyles(theme);
26
+ const theme = useTheme();
27
+ const styles = getStyles(theme);
35
28
 
36
- const startDate = new Date(props.execution.startDate);
37
- const endDate = new Date(props.execution.endDate);
38
- const localTime = startDate.toLocaleString();
39
- const duration = (endDate.getTime() - startDate.getTime()) / 1000;
29
+ const startDate = new Date(props.execution.startDate);
30
+ const endDate = new Date(props.execution.endDate);
31
+ const localTime = startDate.toLocaleString();
32
+ const duration = (endDate.getTime() - startDate.getTime()) / 1000;
40
33
 
41
- const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
42
- const open = Boolean(anchorEl);
34
+ const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
35
+ const open = Boolean(anchorEl);
43
36
 
44
- const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
45
- setAnchorEl(event.currentTarget);
46
- };
37
+ const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
38
+ setAnchorEl(event.currentTarget);
39
+ };
47
40
 
48
- const handlePopoverClose = () => {
49
- setAnchorEl(null);
50
- };
41
+ const handlePopoverClose = () => {
42
+ setAnchorEl(null);
43
+ };
51
44
 
52
- return (
53
- <Grid container spacing={0}>
54
- <Grid size={8}>
55
- <Stack spacing={5} direction="row">
56
- <Typography variant="h5" sx={styles.typography}>
57
- {props.execution.name}
58
- </Typography>
59
- <ExecutionTag
60
- executionStatusId={props.execution.executionStatus.id}
61
- />
62
- </Stack>
63
- </Grid>
64
- <Grid size={4}>
65
- <Box display="flex" justifyContent="flex-end">
66
- {props.handleRun && (
67
- <Button
68
- sx={styles.button}
69
- variant="contained"
70
- color="info"
71
- startIcon={<PlayArrowOutlined />}
72
- onClick={props.handleRun}
73
- >
74
- Run
75
- </Button>
76
- )}
77
- </Box>
78
- </Grid>
79
- <Grid size={12}>
80
- <Stack
81
- spacing={1}
82
- direction="row"
83
- onMouseEnter={handlePopoverOpen}
84
- onMouseLeave={handlePopoverClose}
85
- >
86
- <Typography color="grey" variant="caption">
87
- {localTime}
88
- </Typography>
89
- <Typography color="grey" variant="caption">
90
- Duration: {duration}s
91
- </Typography>
92
- </Stack>
93
- </Grid>
94
- <Popover
95
- sx={{ pointerEvents: "none" }}
96
- open={open}
97
- anchorEl={anchorEl}
98
- anchorOrigin={{
99
- vertical: "bottom",
100
- horizontal: "left",
101
- }}
102
- transformOrigin={{
103
- vertical: "top",
104
- horizontal: "left",
105
- }}
106
- onClose={handlePopoverClose}
107
- disableRestoreFocus
108
- >
109
- <Box sx={styles.popover}>
110
- <Typography variant="body2">
111
- Uses your browser's local timezone.
112
- </Typography>
113
- <Box
114
- display={
115
- Intl.DateTimeFormat().resolvedOptions().timeZone
116
- ? "block"
117
- : "none"
118
- }
119
- >
120
- <Typography variant="body2" align="center" sx={styles.timezone}>
121
- {Intl.DateTimeFormat().resolvedOptions().timeZone}
122
- </Typography>
123
- </Box>
124
- </Box>
125
- </Popover>
126
- </Grid>
127
- );
45
+ return (
46
+ <Grid container columnSpacing={1}>
47
+ <Grid size={8}>
48
+ <Stack spacing={5} direction="row" alignItems="center">
49
+ <Typography variant="h5" sx={styles.typography}>
50
+ {props.execution.name}
51
+ </Typography>
52
+ <ExecutionTag
53
+ executionStatusId={props.execution.executionStatus.id}
54
+ />
55
+ </Stack>
56
+ </Grid>
57
+ <Grid size={4}>
58
+ <Stack
59
+ spacing={1}
60
+ direction="row"
61
+ alignItems="center"
62
+ justifyContent={{ xs: "flex-start", sm: "flex-end" }}
63
+ >
64
+ {/* E.g. run, etc. */}
65
+ {props.children}
66
+ </Stack>
67
+ </Grid>
68
+ <Grid size={12}>
69
+ <Stack
70
+ spacing={1}
71
+ direction="row"
72
+ onMouseEnter={handlePopoverOpen}
73
+ onMouseLeave={handlePopoverClose}
74
+ >
75
+ <Typography color="grey" variant="caption">
76
+ {localTime}
77
+ </Typography>
78
+ <Typography color="grey" variant="caption">
79
+ Duration: {duration}s
80
+ </Typography>
81
+ </Stack>
82
+ </Grid>
83
+ <DateTimePopover
84
+ dateIsoString={props.execution.startDate}
85
+ sx={{ pointerEvents: "none" }}
86
+ open={open}
87
+ anchorEl={anchorEl}
88
+ anchorOrigin={{
89
+ vertical: "bottom",
90
+ horizontal: "left",
91
+ }}
92
+ transformOrigin={{
93
+ vertical: "top",
94
+ horizontal: "left",
95
+ }}
96
+ onClose={handlePopoverClose}
97
+ disableRestoreFocus
98
+ />
99
+ </Grid>
100
+ );
128
101
  };
129
102
 
130
103
  const getStyles = (theme: Theme) => {
131
- return {
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
- popover: {
146
- padding: theme.spacing(1),
147
- },
148
- timezone: {
149
- color: "info.main",
150
- },
151
- };
104
+ return {
105
+ title: {
106
+ display: "flex",
107
+ alignItems: "center",
108
+ height: "100%",
109
+ },
110
+ typography: {
111
+ fontWeight: "medium",
112
+ },
113
+ button: {
114
+ borderWidth: 2,
115
+ borderRadius: 1,
116
+ marginRight: theme.spacing(1),
117
+ },
118
+ popover: {
119
+ padding: theme.spacing(1),
120
+ },
121
+ timezone: {
122
+ color: "info.main",
123
+ },
124
+ };
152
125
  };
153
126
 
154
127
  export default ExecutionDetailsHeader;
@@ -3,40 +3,40 @@ import { Box, Typography, AppBar, Toolbar, Stack } from "@mui/material";
3
3
  import { Theme, useTheme } from "@mui/material";
4
4
 
5
5
  interface Props {
6
- title: string; // e.g. Executions
7
- section: string; // e.g. e4Integrate
6
+ title: string; // e.g. Executions
7
+ section: string; // e.g. e4Integrate
8
8
  }
9
9
 
10
10
  const IntegrateHeader: React.FC<Props> = (props: Props) => {
11
- const theme = useTheme();
12
- const styles = getStyles(theme);
11
+ const theme = useTheme();
12
+ const styles = getStyles(theme);
13
13
 
14
- return (
15
- <Box sx={{ flexGrow: 1 }}>
16
- <AppBar position="static" sx={styles.appbar} elevation={2}>
17
- <Toolbar sx={styles.toolbar}>
18
- <Stack>
19
- <Typography variant="body1" color="info.main">
20
- {props.section}
21
- </Typography>
22
- <Typography variant="h4">{props.title}</Typography>
23
- </Stack>
24
- </Toolbar>
25
- </AppBar>
26
- </Box>
27
- );
14
+ return (
15
+ <Box sx={{ flexGrow: 1 }}>
16
+ <AppBar position="static" sx={styles.appbar} elevation={2}>
17
+ <Toolbar sx={styles.toolbar}>
18
+ <Stack>
19
+ <Typography variant="body1" color="info.main">
20
+ {props.section}
21
+ </Typography>
22
+ <Typography variant="h4">{props.title}</Typography>
23
+ </Stack>
24
+ </Toolbar>
25
+ </AppBar>
26
+ </Box>
27
+ );
28
28
  };
29
29
 
30
30
  const getStyles = (theme: Theme) => {
31
- return {
32
- appbar: {
33
- color: "text.primary",
34
- },
35
- toolbar: {
36
- backgroundColor: "white",
37
- padding: theme.spacing(2, 0),
38
- },
39
- };
31
+ return {
32
+ appbar: {
33
+ color: "text.primary",
34
+ },
35
+ toolbar: {
36
+ backgroundColor: "white",
37
+ padding: theme.spacing(2, 0),
38
+ },
39
+ };
40
40
  };
41
41
 
42
42
  export default IntegrateHeader;
@@ -1,3 +1,4 @@
1
1
  export { default as IntegrateHeader } from "./header";
2
2
  export { default as DashboardListHeader } from "./dashboard-list-header";
3
3
  export { default as ExecutionDetailsHeader } from "./execution-details-header";
4
+ export { default as IntegrationDetailsHeader } from "./integration-details-header";
@@ -0,0 +1,99 @@
1
+ import React from "react";
2
+ import { useTranslations } from "next-intl";
3
+
4
+ // MUI
5
+ import { Theme, useTheme } from "@mui/material";
6
+ import { Grid2 as Grid, Stack, Divider, Button, Box } from "@mui/material";
7
+ import {
8
+ InfoOutlined,
9
+ Code,
10
+ FileUploadOutlined,
11
+ PlayArrowOutlined,
12
+ } from "@mui/icons-material";
13
+
14
+ // Custom components
15
+ import { TitleEdit } from "@evenicanpm/admin-integrate/components/core";
16
+
17
+ // TODO: when applying on page, change to use type of API query result
18
+ type DetailsTemp = {
19
+ name: string;
20
+ processIcon: string;
21
+ };
22
+
23
+ interface Props {
24
+ details: DetailsTemp;
25
+ setDetails: (newDetails: DetailsTemp) => void;
26
+ children?: React.ReactNode; // buttons to go in header, e.g. save, cancel etc.
27
+ }
28
+
29
+ const IntegrationDetailsHeader: React.FC<Props> = (props: Props) => {
30
+ const t = useTranslations("Integrate.Integrations.Details");
31
+
32
+ const theme = useTheme();
33
+ const styles = getStyles(theme);
34
+
35
+ const onConfirm = (input: string) => {
36
+ props.setDetails({ ...props.details, name: input });
37
+ };
38
+
39
+ return (
40
+ <Grid container rowSpacing={1} columnSpacing={0}>
41
+ <Grid size={{ xs: 12, sm: 8 }}>
42
+ <Stack spacing={1} direction="row" alignItems="center">
43
+ {/* TODO: Apply Process icon component once that is merged. Using temp icon for now */}
44
+ <InfoOutlined color="info" />
45
+
46
+ <TitleEdit
47
+ title={props.details.name}
48
+ onConfirm={onConfirm}
49
+ variant="h5"
50
+ />
51
+ </Stack>
52
+ </Grid>
53
+ <Grid size={{ xs: 12, sm: 4 }}>
54
+ <Stack
55
+ spacing={1}
56
+ direction="row"
57
+ alignItems="center"
58
+ justifyContent={{ xs: "flex-start", sm: "flex-end" }}
59
+ >
60
+ {/* E.g. create, save, cancel buttons, etc. */}
61
+ {props.children}
62
+ </Stack>
63
+ </Grid>
64
+ <Grid size={12}>
65
+ <Divider sx={styles.divider} />
66
+ </Grid>
67
+ <Grid size={12}>
68
+ <Stack direction="row">
69
+ <Box sx={styles.controlsButton}>
70
+ <Button startIcon={<Code />}>{t("codeView")}</Button>
71
+ </Box>
72
+ <Box sx={styles.controlsButton}>
73
+ <Button startIcon={<FileUploadOutlined />}>{t("import")}</Button>
74
+ </Box>
75
+ <Box sx={{ ...styles.controlsButton, border: "none" }}>
76
+ <Button startIcon={<PlayArrowOutlined />}>{t("executions")}</Button>
77
+ </Box>
78
+ </Stack>
79
+ </Grid>
80
+ </Grid>
81
+ );
82
+ };
83
+
84
+ const getStyles = (theme: Theme) => {
85
+ return {
86
+ divider: {
87
+ border: `1px solid ${theme.palette.grey[500]}`,
88
+ },
89
+ controlsButton: {
90
+ padding: theme.spacing(0, 1),
91
+ fontSize: theme.typography.body1.fontSize,
92
+ color: theme.palette.grey[600],
93
+ borderRadius: 0,
94
+ borderRight: `${theme.spacing(0.2)} solid ${theme.palette.grey[500]}`,
95
+ },
96
+ };
97
+ };
98
+
99
+ export default IntegrationDetailsHeader;