@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.
- package/documents/ProcessSchedule/fragments.ts +24 -0
- package/documents/ProcessSchedule/read.ts +12 -0
- package/documents/ProcessScheduleGroup/fragments.ts +29 -0
- package/documents/ProcessScheduleGroup/read.ts +12 -0
- package/documents/ScheduledProcess/fragments.ts +24 -0
- package/documents/ScheduledProcess/list.ts +27 -0
- package/package.json +21 -17
- package/src/api/dashboard/queries/get-process-executions.query.ts +33 -36
- package/src/api/dashboard/queries/get-process-executions.server.ts +4 -4
- package/src/api/scheduler/queries/get-process-schedule-group-details.query.ts +45 -0
- package/src/api/scheduler/queries/get-process-schedule-group-details.server.ts +14 -0
- package/src/api/scheduler/queries/get-process-schedule.query.ts +45 -0
- package/src/api/scheduler/queries/get-process-schedule.server.ts +14 -0
- package/src/api/scheduler/queries/get-scheduled-processes.query.ts +45 -0
- package/src/api/scheduler/queries/get-scheduled-processes.server.ts +11 -0
- package/src/api/scheduler/queries/index.ts +3 -0
- package/src/components/breadcrumbs/breadcrumbs.tsx +23 -26
- package/src/components/breadcrumbs/index.ts +1 -1
- package/src/components/breadcrumbs/types.tsx +4 -0
- package/src/components/button/outlined-icon-button.tsx +26 -38
- package/src/components/core/date-time-popover.tsx +32 -0
- package/src/components/core/edited-typography.tsx +20 -0
- package/src/components/core/index.ts +3 -0
- package/src/components/core/loading.tsx +6 -6
- package/src/components/core/title-edit.tsx +122 -0
- package/src/components/dashboard-list/dashboard-list-row.tsx +114 -115
- package/src/components/dashboard-list/dashboard-list.tsx +119 -119
- package/src/components/data-table/table-header.tsx +85 -81
- package/src/components/data-table/table-pagination.tsx +27 -27
- package/src/components/data-table/table-row.tsx +14 -14
- package/src/components/data-table/table-skeleton.tsx +34 -34
- package/src/components/execution/execution-filter.ts +22 -22
- package/src/components/execution/execution-status-icon.tsx +16 -17
- package/src/components/execution/execution-tag.tsx +81 -80
- package/src/components/footer/footer.tsx +34 -34
- package/src/components/header/dashboard-list-header.tsx +64 -63
- package/src/components/header/execution-details-header.tsx +102 -129
- package/src/components/header/header.tsx +27 -27
- package/src/components/header/index.ts +1 -0
- package/src/components/header/integration-details-header.tsx +99 -0
- package/src/components/icons/up-down.tsx +15 -15
- package/src/components/integration-view/edges/default-edge.tsx +18 -17
- package/src/components/integration-view/elk-layout-options.ts +26 -26
- package/src/components/integration-view/elk-types.ts +16 -12
- package/src/components/integration-view/flow-types.tsx +5 -5
- package/src/components/integration-view/integration-view.tsx +132 -130
- package/src/components/integration-view/nodes/base-node.tsx +50 -0
- package/src/components/integration-view/nodes/connection-node.tsx +8 -8
- package/src/components/integration-view/nodes/entry-node.tsx +8 -8
- package/src/components/integration-view/nodes/group-node.tsx +47 -6
- package/src/components/integration-view/nodes/task-node.tsx +58 -13
- package/src/components/integration-view/temp-data/initialElements.tsx +224 -0
- package/src/components/integration-view/types.ts +6 -6
- package/src/components/layouts/main-layout.tsx +13 -13
- package/src/components/layouts/root-container.tsx +25 -25
- package/src/components/link-cards/link-card.tsx +23 -23
- package/src/components/link-cards/styles.ts +15 -15
- package/src/components/list-filter/date-filter.tsx +41 -45
- package/src/components/list-filter/date-range-filter.tsx +78 -77
- package/src/components/list-filter/list-filter-types.ts +38 -38
- package/src/components/list-filter/list-filter.tsx +363 -354
- package/src/components/list-filter/multi-select-filter.tsx +94 -95
- package/src/components/list-filter/select-filter.tsx +67 -64
- package/src/components/scheduler/day-selector.tsx +174 -0
- package/src/components/scheduler/day-tag.tsx +73 -0
- package/src/components/scheduler/index.ts +4 -0
- package/src/components/scheduler/schedule-filter.ts +25 -0
- package/src/components/scheduler/schedule-icon.tsx +87 -0
- package/src/components/scheduler/scheduler-types.ts +40 -0
- package/src/hooks/use-breadcrumbs.ts +31 -31
- package/src/hooks/use-recurrence.tsx +13 -0
- package/src/hooks/use-timestamp.tsx +21 -21
- package/src/pages/dashboard/dashboard-link-cards.tsx +99 -99
- package/src/pages/dashboard/dashboard-list-sections.tsx +130 -125
- package/src/pages/dashboard/dashboard.tsx +6 -6
- package/src/pages/execution-details/execution-details.tsx +23 -29
- package/src/pages/executions/executions-list/executions-list-row.tsx +101 -104
- package/src/pages/executions/executions-list/executions-list-table.tsx +45 -53
- package/src/pages/executions/executions-list/executions-list.tsx +219 -212
- package/src/pages/executions/executions.tsx +67 -72
- package/src/pages/integrations/integrations.tsx +17 -25
- package/src/pages/scheduler/schedule-drawer/edited/edited-types.ts +17 -0
- package/src/pages/scheduler/schedule-drawer/edited/index.ts +1 -0
- package/src/pages/scheduler/schedule-drawer/index.ts +1 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details-integrations.tsx +227 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details-main.tsx +292 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details-name.tsx +77 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details-skeleton.tsx +64 -0
- package/src/pages/scheduler/schedule-drawer/schedule-details.tsx +42 -0
- package/src/pages/scheduler/schedule-drawer/schedule-drawer-buttons.tsx +72 -0
- package/src/pages/scheduler/schedule-drawer/schedule-drawer-group.tsx +103 -0
- package/src/pages/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +94 -0
- package/src/pages/scheduler/schedule-drawer/schedule-drawer.tsx +101 -0
- package/src/pages/scheduler/schedule-drawer/sortable-integration-row.tsx +93 -0
- package/src/pages/scheduler/scheduler.tsx +106 -30
- package/src/pages/scheduler/schedules-list/index.ts +1 -0
- package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +235 -0
- package/src/pages/scheduler/schedules-list/schedules-list-table.tsx +74 -0
- package/src/pages/scheduler/schedules-list/schedules-list.tsx +280 -0
- package/tsconfig.json +29 -26
- package/src/components/integration-view/temp-data/initialElements.ts +0 -238
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { useTranslations } from "next-intl";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
|
|
4
|
+
// Api
|
|
5
|
+
import { ProcessScheduleGroupDetailsUpdate } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
6
|
+
|
|
7
|
+
// MUI
|
|
8
|
+
import { Theme, useTheme } from "@mui/material";
|
|
9
|
+
import {
|
|
10
|
+
Box,
|
|
11
|
+
Stack,
|
|
12
|
+
Typography,
|
|
13
|
+
Switch,
|
|
14
|
+
TextField,
|
|
15
|
+
Select,
|
|
16
|
+
MenuItem,
|
|
17
|
+
SelectChangeEvent,
|
|
18
|
+
} from "@mui/material";
|
|
19
|
+
import { DateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
|
|
20
|
+
import { InfoOutlined } from "@mui/icons-material";
|
|
21
|
+
|
|
22
|
+
// Custom components
|
|
23
|
+
import { DaySelector } from "@evenicanpm/admin-integrate/components/scheduler";
|
|
24
|
+
import {
|
|
25
|
+
DateTimePopover,
|
|
26
|
+
EditedTypography,
|
|
27
|
+
} from "@evenicanpm/admin-integrate/components/core";
|
|
28
|
+
|
|
29
|
+
// Types
|
|
30
|
+
import { Edited } from "./edited";
|
|
31
|
+
import { IsDay } from "@evenicanpm/admin-integrate/components/scheduler";
|
|
32
|
+
|
|
33
|
+
interface Props {
|
|
34
|
+
details: ProcessScheduleGroupDetailsUpdate;
|
|
35
|
+
setDetails: (newDetails: ProcessScheduleGroupDetailsUpdate) => void;
|
|
36
|
+
edited: Edited;
|
|
37
|
+
setEdited: (newEdited: Edited) => void;
|
|
38
|
+
readOnly?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default function ScheduleDetailsMain(props: Props) {
|
|
42
|
+
const t = useTranslations("Integrate.Scheduler");
|
|
43
|
+
|
|
44
|
+
const theme = useTheme();
|
|
45
|
+
const styles = getStyles(theme);
|
|
46
|
+
|
|
47
|
+
const [dateError, setDateError] = useState<string | null>(null);
|
|
48
|
+
|
|
49
|
+
const [interval, setInterval] = useState<string>(
|
|
50
|
+
props.details.interval?.toString() || "1",
|
|
51
|
+
);
|
|
52
|
+
const [intervalError, setIntervalError] = useState<string | null>(null);
|
|
53
|
+
|
|
54
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
|
55
|
+
const open = Boolean(anchorEl);
|
|
56
|
+
|
|
57
|
+
const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
|
|
58
|
+
setAnchorEl(event.currentTarget);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const handlePopoverClose = () => {
|
|
62
|
+
setAnchorEl(null);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const handleEnabledChange = () => {
|
|
66
|
+
props.setDetails({
|
|
67
|
+
...props.details,
|
|
68
|
+
isDisabled: !props.details.isDisabled,
|
|
69
|
+
});
|
|
70
|
+
if (!props.edited.enabled) {
|
|
71
|
+
props.setEdited({
|
|
72
|
+
...props.edited,
|
|
73
|
+
enabled: true,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const handleDayChange = (newDays: IsDay) => {
|
|
79
|
+
props.setDetails({
|
|
80
|
+
...props.details,
|
|
81
|
+
...newDays,
|
|
82
|
+
});
|
|
83
|
+
if (!props.edited.days) {
|
|
84
|
+
props.setEdited({
|
|
85
|
+
...props.edited,
|
|
86
|
+
days: true,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const handleStartDateChange = (newStartDate: string | null) => {
|
|
92
|
+
if (newStartDate) {
|
|
93
|
+
try {
|
|
94
|
+
const date = new Date(newStartDate);
|
|
95
|
+
props.setDetails({
|
|
96
|
+
...props.details,
|
|
97
|
+
startDate: date.toISOString(),
|
|
98
|
+
});
|
|
99
|
+
setDateError(null);
|
|
100
|
+
if (!props.edited.startDate) {
|
|
101
|
+
props.setEdited({
|
|
102
|
+
...props.edited,
|
|
103
|
+
startDate: true,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
} catch {
|
|
107
|
+
setDateError(t("invalidDate"));
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
setDateError(t("invalidDate"));
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const handleStartDateError = (newError: string | null) => {
|
|
115
|
+
setDateError(newError ? t("invalidDate") : null);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const handleIntervalChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
119
|
+
setInterval(event.target.value);
|
|
120
|
+
const newInterval = Number(event.target.value);
|
|
121
|
+
|
|
122
|
+
if (!isNaN(newInterval)) {
|
|
123
|
+
props.setDetails({
|
|
124
|
+
...props.details,
|
|
125
|
+
interval: newInterval,
|
|
126
|
+
});
|
|
127
|
+
if (!props.edited.recurrence) {
|
|
128
|
+
props.setEdited({
|
|
129
|
+
...props.edited,
|
|
130
|
+
recurrence: true,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
setIntervalError(null);
|
|
134
|
+
} else {
|
|
135
|
+
setIntervalError(t("invalidInterval"));
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const handleIntervalUnitChange = (event: SelectChangeEvent) => {
|
|
140
|
+
props.setDetails({
|
|
141
|
+
...props.details,
|
|
142
|
+
intervalUnitId: event.target.value,
|
|
143
|
+
});
|
|
144
|
+
if (!props.edited.recurrence) {
|
|
145
|
+
props.setEdited({
|
|
146
|
+
...props.edited,
|
|
147
|
+
recurrence: true,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<Box sx={styles.main}>
|
|
154
|
+
<Stack spacing={2}>
|
|
155
|
+
{/* Enabled/disabled switch */}
|
|
156
|
+
<Box>
|
|
157
|
+
<Stack direction="row" spacing={1} alignItems="flex-end">
|
|
158
|
+
<Typography variant="body1">
|
|
159
|
+
{props.details.isDisabled ? t("disabled") : t("enabled")}
|
|
160
|
+
</Typography>
|
|
161
|
+
<EditedTypography edited={props.edited.enabled} />
|
|
162
|
+
</Stack>
|
|
163
|
+
<Switch
|
|
164
|
+
color="info"
|
|
165
|
+
checked={!props.details.isDisabled}
|
|
166
|
+
onChange={handleEnabledChange}
|
|
167
|
+
disabled={props.readOnly}
|
|
168
|
+
/>
|
|
169
|
+
</Box>
|
|
170
|
+
|
|
171
|
+
{/* Day of the week selector */}
|
|
172
|
+
<Box>
|
|
173
|
+
<Stack direction="row" spacing={1} alignItems="flex-end">
|
|
174
|
+
<Typography variant="body1">{t("daysOfTheWeek")}</Typography>
|
|
175
|
+
<EditedTypography edited={props.edited.days} />
|
|
176
|
+
</Stack>
|
|
177
|
+
<DaySelector
|
|
178
|
+
days={props.details as IsDay}
|
|
179
|
+
setDays={handleDayChange}
|
|
180
|
+
disabled={props.readOnly}
|
|
181
|
+
/>
|
|
182
|
+
</Box>
|
|
183
|
+
|
|
184
|
+
{/* Start date */}
|
|
185
|
+
<Box>
|
|
186
|
+
<Stack direction="row" spacing={1} alignItems="flex-end">
|
|
187
|
+
<Typography variant="body1">{t("startDate")}</Typography>
|
|
188
|
+
<Box
|
|
189
|
+
onMouseEnter={handlePopoverOpen}
|
|
190
|
+
onMouseLeave={handlePopoverClose}
|
|
191
|
+
display="flex"
|
|
192
|
+
alignItems="flex-end"
|
|
193
|
+
sx={{
|
|
194
|
+
fontSize: theme.typography.h5.fontSize,
|
|
195
|
+
paddingBottom: theme.spacing(0.25),
|
|
196
|
+
}}
|
|
197
|
+
>
|
|
198
|
+
<InfoOutlined color="disabled" fontSize="inherit" />
|
|
199
|
+
</Box>
|
|
200
|
+
<EditedTypography edited={props.edited.startDate} />
|
|
201
|
+
</Stack>
|
|
202
|
+
<DateTimePicker
|
|
203
|
+
sx={styles.startDatePicker}
|
|
204
|
+
value={props.details.startDate}
|
|
205
|
+
onChange={handleStartDateChange}
|
|
206
|
+
onError={handleStartDateError}
|
|
207
|
+
views={["year", "month", "day", "hours", "minutes", "seconds"]}
|
|
208
|
+
slotProps={{
|
|
209
|
+
textField: {
|
|
210
|
+
helperText: dateError || "",
|
|
211
|
+
},
|
|
212
|
+
}}
|
|
213
|
+
disabled={props.readOnly}
|
|
214
|
+
/>
|
|
215
|
+
<DateTimePopover
|
|
216
|
+
dateIsoString={props.details.startDate}
|
|
217
|
+
sx={{ pointerEvents: "none" }}
|
|
218
|
+
open={open}
|
|
219
|
+
anchorEl={anchorEl}
|
|
220
|
+
anchorOrigin={{
|
|
221
|
+
vertical: "center",
|
|
222
|
+
horizontal: "right",
|
|
223
|
+
}}
|
|
224
|
+
transformOrigin={{
|
|
225
|
+
vertical: "center",
|
|
226
|
+
horizontal: "left",
|
|
227
|
+
}}
|
|
228
|
+
onClose={handlePopoverClose}
|
|
229
|
+
disableRestoreFocus
|
|
230
|
+
/>
|
|
231
|
+
</Box>
|
|
232
|
+
|
|
233
|
+
{/* Recurrence */}
|
|
234
|
+
<Box>
|
|
235
|
+
<Stack direction="row" spacing={1} alignItems="flex-end">
|
|
236
|
+
<Typography variant="body1">{t("recurrence")}</Typography>
|
|
237
|
+
<EditedTypography edited={props.edited.recurrence} />
|
|
238
|
+
</Stack>
|
|
239
|
+
<Stack direction="row" spacing={1} alignItems="flex-start">
|
|
240
|
+
<TextField
|
|
241
|
+
value={interval}
|
|
242
|
+
onChange={handleIntervalChange}
|
|
243
|
+
error={intervalError !== null}
|
|
244
|
+
helperText={intervalError || ""}
|
|
245
|
+
slotProps={{
|
|
246
|
+
htmlInput: {
|
|
247
|
+
sx: {
|
|
248
|
+
textAlign: "right",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
}}
|
|
252
|
+
sx={styles.recurrenceInterval}
|
|
253
|
+
disabled={props.readOnly}
|
|
254
|
+
/>
|
|
255
|
+
<Select
|
|
256
|
+
value={props.details.intervalUnitId || "1"}
|
|
257
|
+
onChange={handleIntervalUnitChange}
|
|
258
|
+
sx={styles.recurrenceUnit}
|
|
259
|
+
disabled={props.readOnly}
|
|
260
|
+
>
|
|
261
|
+
<MenuItem value={"1"}>{t("minutes")}</MenuItem>
|
|
262
|
+
<MenuItem value={"2"}>{t("hours")}</MenuItem>
|
|
263
|
+
</Select>
|
|
264
|
+
</Stack>
|
|
265
|
+
</Box>
|
|
266
|
+
</Stack>
|
|
267
|
+
</Box>
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const getStyles = (theme: Theme) => {
|
|
272
|
+
return {
|
|
273
|
+
main: {
|
|
274
|
+
margin: theme.spacing(1, 0),
|
|
275
|
+
},
|
|
276
|
+
startDatePicker: {
|
|
277
|
+
width: "fit-content",
|
|
278
|
+
},
|
|
279
|
+
recurrenceInterval: {
|
|
280
|
+
maxWidth: theme.spacing(15),
|
|
281
|
+
"& .MuiInputBase-input": {
|
|
282
|
+
padding: theme.spacing(1),
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
recurrenceUnit: {
|
|
286
|
+
minWidth: theme.spacing(12),
|
|
287
|
+
"& .MuiSelect-select": {
|
|
288
|
+
padding: theme.spacing(1),
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
// Api
|
|
4
|
+
import { ProcessScheduleGroupDetailsUpdate } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
5
|
+
|
|
6
|
+
// MUI
|
|
7
|
+
import { Theme, useTheme } from "@mui/material";
|
|
8
|
+
import { Box, Stack } from "@mui/material";
|
|
9
|
+
|
|
10
|
+
// Custom components
|
|
11
|
+
import { ScheduleIcon } from "@evenicanpm/admin-integrate/components/scheduler";
|
|
12
|
+
import {
|
|
13
|
+
TitleEdit,
|
|
14
|
+
EditedTypography,
|
|
15
|
+
} from "@evenicanpm/admin-integrate/components/core";
|
|
16
|
+
|
|
17
|
+
// Types
|
|
18
|
+
import { Edited } from "./edited";
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
details: ProcessScheduleGroupDetailsUpdate;
|
|
22
|
+
setDetails: (newDetails: ProcessScheduleGroupDetailsUpdate) => void;
|
|
23
|
+
edited: Edited;
|
|
24
|
+
setEdited: (newEdited: Edited) => void;
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function ScheduleDetailsName(props: Props) {
|
|
29
|
+
const theme = useTheme();
|
|
30
|
+
const styles = getStyles(theme);
|
|
31
|
+
|
|
32
|
+
const onConfirm = (input: string) => {
|
|
33
|
+
if (input !== props.details.name) {
|
|
34
|
+
props.setDetails({
|
|
35
|
+
...props.details,
|
|
36
|
+
name: input,
|
|
37
|
+
code: input.replaceAll(" ", "_").toLowerCase(),
|
|
38
|
+
});
|
|
39
|
+
props.setEdited({
|
|
40
|
+
...props.edited,
|
|
41
|
+
name: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Box sx={styles.main}>
|
|
48
|
+
<Stack direction="row" spacing={1} sx={styles.stack}>
|
|
49
|
+
<Box display="flex" justifyContent="center" alignItems="center">
|
|
50
|
+
<ScheduleIcon
|
|
51
|
+
isDisabled={props.details.isDisabled || false}
|
|
52
|
+
isLegacy={props.readOnly || false}
|
|
53
|
+
enablePopover
|
|
54
|
+
/>
|
|
55
|
+
</Box>
|
|
56
|
+
<TitleEdit
|
|
57
|
+
title={props.details.name || ""}
|
|
58
|
+
onConfirm={onConfirm}
|
|
59
|
+
readOnly={props.readOnly}
|
|
60
|
+
fullWidth
|
|
61
|
+
/>
|
|
62
|
+
</Stack>
|
|
63
|
+
<EditedTypography edited={props.edited.name} />
|
|
64
|
+
</Box>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const getStyles = (theme: Theme) => {
|
|
69
|
+
return {
|
|
70
|
+
main: {
|
|
71
|
+
marginBottom: theme.spacing(2),
|
|
72
|
+
},
|
|
73
|
+
stack: {
|
|
74
|
+
minHeight: theme.spacing(7),
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// MUI
|
|
2
|
+
import { Theme, useTheme } from "@mui/material";
|
|
3
|
+
import { Skeleton, Stack, Box } from "@mui/material";
|
|
4
|
+
|
|
5
|
+
export default function ScheduleDetailsSkeleton() {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const styles = getStyles(theme);
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<Stack sx={styles.main} spacing={1}>
|
|
11
|
+
<Box
|
|
12
|
+
sx={{
|
|
13
|
+
paddingBottom: theme.spacing(3),
|
|
14
|
+
}}
|
|
15
|
+
>
|
|
16
|
+
<Skeleton variant="rectangular" height={theme.spacing(6)} />
|
|
17
|
+
</Box>
|
|
18
|
+
|
|
19
|
+
<Skeleton />
|
|
20
|
+
<Skeleton />
|
|
21
|
+
|
|
22
|
+
<Skeleton />
|
|
23
|
+
<Skeleton />
|
|
24
|
+
|
|
25
|
+
<Skeleton />
|
|
26
|
+
<Skeleton />
|
|
27
|
+
|
|
28
|
+
<Skeleton />
|
|
29
|
+
<Skeleton />
|
|
30
|
+
|
|
31
|
+
<Skeleton />
|
|
32
|
+
<Skeleton />
|
|
33
|
+
|
|
34
|
+
<Skeleton />
|
|
35
|
+
<Skeleton />
|
|
36
|
+
|
|
37
|
+
<Skeleton />
|
|
38
|
+
<Skeleton />
|
|
39
|
+
|
|
40
|
+
<Skeleton />
|
|
41
|
+
<Skeleton />
|
|
42
|
+
|
|
43
|
+
<Skeleton />
|
|
44
|
+
<Skeleton />
|
|
45
|
+
|
|
46
|
+
<Skeleton />
|
|
47
|
+
<Skeleton />
|
|
48
|
+
|
|
49
|
+
<Skeleton />
|
|
50
|
+
<Skeleton />
|
|
51
|
+
|
|
52
|
+
<Skeleton />
|
|
53
|
+
<Skeleton />
|
|
54
|
+
</Stack>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const getStyles = (theme: Theme) => {
|
|
59
|
+
return {
|
|
60
|
+
main: {
|
|
61
|
+
margin: theme.spacing(2, 3),
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Api
|
|
2
|
+
import { ProcessScheduleGroupDetailsUpdate } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
3
|
+
|
|
4
|
+
// MUI
|
|
5
|
+
import { Theme, useTheme } from "@mui/material";
|
|
6
|
+
import { Box } from "@mui/material";
|
|
7
|
+
|
|
8
|
+
// Local components
|
|
9
|
+
import ScheduleDetailsName from "./schedule-details-name";
|
|
10
|
+
import ScheduleDetailsMain from "./schedule-details-main";
|
|
11
|
+
|
|
12
|
+
// Types
|
|
13
|
+
import { Edited } from "./edited";
|
|
14
|
+
|
|
15
|
+
interface Props {
|
|
16
|
+
id: string;
|
|
17
|
+
details: ProcessScheduleGroupDetailsUpdate;
|
|
18
|
+
setDetails: (newDetails: ProcessScheduleGroupDetailsUpdate) => void;
|
|
19
|
+
edited: Edited;
|
|
20
|
+
setEdited: (newEdited: Edited) => void;
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default function ScheduleDetails(props: Props) {
|
|
25
|
+
const theme = useTheme();
|
|
26
|
+
const styles = getStyles(theme);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Box sx={styles.main}>
|
|
30
|
+
<ScheduleDetailsName {...props} />
|
|
31
|
+
<ScheduleDetailsMain {...props} />
|
|
32
|
+
</Box>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const getStyles = (theme: Theme) => {
|
|
37
|
+
return {
|
|
38
|
+
main: {
|
|
39
|
+
padding: theme.spacing(1, 3, 2),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useTranslations } from "next-intl";
|
|
2
|
+
|
|
3
|
+
// MUI
|
|
4
|
+
import { Theme, useTheme } from "@mui/material";
|
|
5
|
+
import { Box, IconButton, Button, Stack } from "@mui/material";
|
|
6
|
+
import {
|
|
7
|
+
KeyboardDoubleArrowRightOutlined,
|
|
8
|
+
Clear,
|
|
9
|
+
Save,
|
|
10
|
+
} from "@mui/icons-material";
|
|
11
|
+
|
|
12
|
+
// Custom components
|
|
13
|
+
import { OutlinedIconButton } from "@evenicanpm/admin-integrate/components/button";
|
|
14
|
+
|
|
15
|
+
// Types
|
|
16
|
+
import { Edited } from "./edited";
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
handleClose: () => void;
|
|
20
|
+
handleSave: () => void;
|
|
21
|
+
edited: Edited;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function ScheduleDrawerButtons(props: Props) {
|
|
26
|
+
const t = useTranslations("Integrate.Scheduler");
|
|
27
|
+
|
|
28
|
+
const theme = useTheme();
|
|
29
|
+
const styles = getStyles(theme);
|
|
30
|
+
|
|
31
|
+
const isEdited = Object.values(props.edited).some((value) => value);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Box sx={styles.buttons} display="flex" justifyContent="space-between">
|
|
35
|
+
<IconButton onClick={props.handleClose}>
|
|
36
|
+
<KeyboardDoubleArrowRightOutlined />
|
|
37
|
+
</IconButton>
|
|
38
|
+
<Stack spacing={1} direction="row">
|
|
39
|
+
{!props.readOnly && (
|
|
40
|
+
<Button
|
|
41
|
+
variant="contained"
|
|
42
|
+
color="info"
|
|
43
|
+
startIcon={<Save />}
|
|
44
|
+
onClick={props.handleSave}
|
|
45
|
+
disabled={!isEdited}
|
|
46
|
+
>
|
|
47
|
+
{t("save")}
|
|
48
|
+
</Button>
|
|
49
|
+
)}
|
|
50
|
+
<OutlinedIconButton onClick={props.handleClose} sx={styles.closeButton}>
|
|
51
|
+
<Clear />
|
|
52
|
+
</OutlinedIconButton>
|
|
53
|
+
</Stack>
|
|
54
|
+
</Box>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const getStyles = (theme: Theme) => {
|
|
59
|
+
return {
|
|
60
|
+
buttons: {
|
|
61
|
+
padding: theme.spacing(2),
|
|
62
|
+
backgroundColor: "grey.100",
|
|
63
|
+
},
|
|
64
|
+
closeButton: {
|
|
65
|
+
backgroundColor: "error.main",
|
|
66
|
+
"&:hover": {
|
|
67
|
+
backgroundColor: "error.500",
|
|
68
|
+
},
|
|
69
|
+
color: "white",
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
// Api
|
|
4
|
+
import {
|
|
5
|
+
GetProcessScheduleGroupDetailsQuery,
|
|
6
|
+
ProcessScheduleGroupDetailsUpdate,
|
|
7
|
+
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
8
|
+
import { getProcessScheduleGroupDetails } from "@evenicanpm/admin-integrate/api/scheduler/queries";
|
|
9
|
+
|
|
10
|
+
// Mui
|
|
11
|
+
import { Divider } from "@mui/material";
|
|
12
|
+
|
|
13
|
+
// Local components
|
|
14
|
+
import ScheduleDrawerButtons from "./schedule-drawer-buttons";
|
|
15
|
+
import ScheduleDetails from "./schedule-details";
|
|
16
|
+
import ScheduleDetailsIntegrations from "./schedule-details-integrations";
|
|
17
|
+
import ScheduleDetailsSkeleton from "./schedule-details-skeleton";
|
|
18
|
+
|
|
19
|
+
// Types
|
|
20
|
+
import { DrawerOpen } from "../scheduler";
|
|
21
|
+
import { Edited } from "./edited";
|
|
22
|
+
|
|
23
|
+
interface Props {
|
|
24
|
+
drawerOpen: DrawerOpen;
|
|
25
|
+
details: ProcessScheduleGroupDetailsUpdate | null;
|
|
26
|
+
setDetails: (newDetails: ProcessScheduleGroupDetailsUpdate | null) => void;
|
|
27
|
+
edited: Edited;
|
|
28
|
+
setEdited: (newEdited: Edited) => void;
|
|
29
|
+
handleClose: () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default function ScheduleDrawerGroup(props: Props) {
|
|
33
|
+
const styles = getStyles();
|
|
34
|
+
|
|
35
|
+
const { data } = getProcessScheduleGroupDetails.useData({
|
|
36
|
+
id: props.drawerOpen.id,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
if (data) {
|
|
41
|
+
const typedData = data as GetProcessScheduleGroupDetailsQuery;
|
|
42
|
+
if (typedData.processScheduleGroupDetails) {
|
|
43
|
+
const fetchedDetails = typedData.processScheduleGroupDetails;
|
|
44
|
+
const processes = fetchedDetails.processSchedule?.processes || [];
|
|
45
|
+
const newDetails = {
|
|
46
|
+
...fetchedDetails,
|
|
47
|
+
processes:
|
|
48
|
+
processes.map((pr) => ({
|
|
49
|
+
id: pr?.id || "",
|
|
50
|
+
sort: pr?.sort || 0,
|
|
51
|
+
})) || [],
|
|
52
|
+
};
|
|
53
|
+
delete newDetails.processSchedule;
|
|
54
|
+
|
|
55
|
+
props.setDetails(newDetails as ProcessScheduleGroupDetailsUpdate);
|
|
56
|
+
} else {
|
|
57
|
+
props.setDetails(null);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, [data]);
|
|
61
|
+
|
|
62
|
+
const handleSave = () => {};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
<ScheduleDrawerButtons
|
|
67
|
+
handleClose={props.handleClose}
|
|
68
|
+
handleSave={handleSave}
|
|
69
|
+
edited={props.edited}
|
|
70
|
+
/>
|
|
71
|
+
<Divider sx={styles.divider} />
|
|
72
|
+
{props.details ? (
|
|
73
|
+
<>
|
|
74
|
+
<ScheduleDetails
|
|
75
|
+
id={props.drawerOpen.id}
|
|
76
|
+
details={props.details}
|
|
77
|
+
setDetails={props.setDetails}
|
|
78
|
+
edited={props.edited}
|
|
79
|
+
setEdited={props.setEdited}
|
|
80
|
+
/>
|
|
81
|
+
<Divider sx={styles.divider} />
|
|
82
|
+
<ScheduleDetailsIntegrations
|
|
83
|
+
data={data as GetProcessScheduleGroupDetailsQuery}
|
|
84
|
+
details={props.details}
|
|
85
|
+
setDetails={props.setDetails}
|
|
86
|
+
edited={props.edited}
|
|
87
|
+
setEdited={props.setEdited}
|
|
88
|
+
/>
|
|
89
|
+
</>
|
|
90
|
+
) : (
|
|
91
|
+
<ScheduleDetailsSkeleton />
|
|
92
|
+
)}
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const getStyles = () => {
|
|
98
|
+
return {
|
|
99
|
+
divider: {
|
|
100
|
+
borderColor: "grey.400",
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
};
|