@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.
- package/documents/Process/fragments.ts +13 -0
- package/documents/Process/list.ts +27 -0
- 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/Integrations/queries/get-process.query.ts +48 -0
- package/src/api/Integrations/queries/get-process.server.ts +9 -0
- package/src/api/Integrations/queries/index.ts +1 -0
- 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-list/index.ts +2 -0
- package/src/components/integration-list/integration-filter.ts +21 -0
- package/src/components/integration-list/integration-status-icon.tsx +33 -0
- package/src/components/integration-list/integration-tag.tsx +77 -0
- 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/integration-list/index.ts +1 -0
- package/src/pages/integrations/integration-list/integration-list-row.tsx +147 -0
- package/src/pages/integrations/integration-list/integration-list-table.tsx +78 -0
- package/src/pages/integrations/integration-list/integration-list.tsx +262 -0
- package/src/pages/integrations/integrations.tsx +83 -28
- 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,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
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
// Api
|
|
4
|
+
import { getProcessScheduleById } from "@evenicanpm/admin-integrate/api/scheduler/queries";
|
|
5
|
+
import { GetProcessScheduleByIdQuery } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
6
|
+
|
|
7
|
+
// Mui
|
|
8
|
+
import { Divider } from "@mui/material";
|
|
9
|
+
|
|
10
|
+
// Local components
|
|
11
|
+
import ScheduleDrawerButtons from "./schedule-drawer-buttons";
|
|
12
|
+
import ScheduleDetails from "./schedule-details";
|
|
13
|
+
import ScheduleDetailsIntegrations from "./schedule-details-integrations";
|
|
14
|
+
import ScheduleDetailsSkeleton from "./schedule-details-skeleton";
|
|
15
|
+
|
|
16
|
+
// Types
|
|
17
|
+
import { DrawerOpen } from "../scheduler";
|
|
18
|
+
import { Edited } from "./edited";
|
|
19
|
+
import { ProcessScheduleById } from "./schedule-drawer";
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
drawerOpen: DrawerOpen;
|
|
23
|
+
details: ProcessScheduleById | null;
|
|
24
|
+
setDetails: (newDetails: ProcessScheduleById | null) => void;
|
|
25
|
+
edited: Edited;
|
|
26
|
+
setEdited: (newEdited: Edited) => void;
|
|
27
|
+
handleClose: () => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default function ScheduleDrawerLegacy(props: Props) {
|
|
31
|
+
const styles = getStyles();
|
|
32
|
+
|
|
33
|
+
const { data } = getProcessScheduleById.useData({
|
|
34
|
+
id: props.drawerOpen.id,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (data) {
|
|
39
|
+
const typedData = data as GetProcessScheduleByIdQuery;
|
|
40
|
+
if (typedData.processScheduleById) {
|
|
41
|
+
const fetchedDetails = typedData.processScheduleById;
|
|
42
|
+
|
|
43
|
+
props.setDetails(fetchedDetails as ProcessScheduleById);
|
|
44
|
+
} else {
|
|
45
|
+
props.setDetails(null);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, [data]);
|
|
49
|
+
|
|
50
|
+
const handleSave = () => {};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<ScheduleDrawerButtons
|
|
55
|
+
handleClose={props.handleClose}
|
|
56
|
+
handleSave={handleSave}
|
|
57
|
+
edited={props.edited}
|
|
58
|
+
readOnly
|
|
59
|
+
/>
|
|
60
|
+
<Divider sx={styles.divider} />
|
|
61
|
+
{props.details ? (
|
|
62
|
+
<>
|
|
63
|
+
<ScheduleDetails
|
|
64
|
+
id={props.drawerOpen.id}
|
|
65
|
+
details={props.details}
|
|
66
|
+
setDetails={props.setDetails}
|
|
67
|
+
edited={props.edited}
|
|
68
|
+
setEdited={props.setEdited}
|
|
69
|
+
readOnly
|
|
70
|
+
/>
|
|
71
|
+
<Divider sx={styles.divider} />
|
|
72
|
+
<ScheduleDetailsIntegrations
|
|
73
|
+
data={data as GetProcessScheduleByIdQuery}
|
|
74
|
+
details={props.details}
|
|
75
|
+
setDetails={props.setDetails}
|
|
76
|
+
edited={props.edited}
|
|
77
|
+
setEdited={props.setEdited}
|
|
78
|
+
readOnly
|
|
79
|
+
/>
|
|
80
|
+
</>
|
|
81
|
+
) : (
|
|
82
|
+
<ScheduleDetailsSkeleton />
|
|
83
|
+
)}
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const getStyles = () => {
|
|
89
|
+
return {
|
|
90
|
+
divider: {
|
|
91
|
+
borderColor: "grey.400",
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useTranslations } from "next-intl";
|
|
2
|
+
import React, { useState } from "react";
|
|
3
|
+
|
|
4
|
+
// API
|
|
5
|
+
import {
|
|
6
|
+
ProcessScheduleGroupDetailsUpdate,
|
|
7
|
+
GetProcessScheduleByIdQuery,
|
|
8
|
+
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
9
|
+
|
|
10
|
+
// MUI
|
|
11
|
+
import { Theme, useTheme } from "@mui/material";
|
|
12
|
+
import { Drawer, Box } from "@mui/material";
|
|
13
|
+
|
|
14
|
+
// Local components
|
|
15
|
+
import ScheduleDrawerGroup from "./schedule-drawer-group";
|
|
16
|
+
import ScheduleDrawerLegacy from "./schedule-drawer-legacy";
|
|
17
|
+
|
|
18
|
+
// Types
|
|
19
|
+
import { Edited, initialEdited } from "./edited";
|
|
20
|
+
import { DrawerOpen } from "../scheduler";
|
|
21
|
+
|
|
22
|
+
export type ProcessScheduleById =
|
|
23
|
+
GetProcessScheduleByIdQuery["processScheduleById"];
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
drawerOpen: DrawerOpen | null;
|
|
27
|
+
setDrawerOpen: (drawerOpen: DrawerOpen | null) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default function ScheduleDrawer(props: Props) {
|
|
31
|
+
const t = useTranslations("Integrate.Scheduler");
|
|
32
|
+
|
|
33
|
+
const theme = useTheme();
|
|
34
|
+
const styles = getStyles(theme);
|
|
35
|
+
|
|
36
|
+
const [edited, setEdited] = useState<Edited>(initialEdited);
|
|
37
|
+
|
|
38
|
+
const [detailsGroup, setDetailsGroup] =
|
|
39
|
+
useState<ProcessScheduleGroupDetailsUpdate | null>(null);
|
|
40
|
+
const [detailsLegacy, setDetailsLegacy] =
|
|
41
|
+
useState<ProcessScheduleById | null>(null);
|
|
42
|
+
|
|
43
|
+
const handleClose = () => {
|
|
44
|
+
const isEdited = Object.values(edited).some((value) => value);
|
|
45
|
+
if (isEdited) {
|
|
46
|
+
const confirmClose = confirm(t("unsavedChanges"));
|
|
47
|
+
if (!confirmClose) return;
|
|
48
|
+
}
|
|
49
|
+
setDetailsGroup(null);
|
|
50
|
+
setDetailsLegacy(null);
|
|
51
|
+
setEdited(initialEdited);
|
|
52
|
+
props.setDrawerOpen(null);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<Drawer
|
|
57
|
+
open={props.drawerOpen !== null}
|
|
58
|
+
onClose={handleClose}
|
|
59
|
+
anchor="right"
|
|
60
|
+
>
|
|
61
|
+
<Box sx={styles.main}>
|
|
62
|
+
{props.drawerOpen && props.drawerOpen.group && (
|
|
63
|
+
<ScheduleDrawerGroup
|
|
64
|
+
drawerOpen={props.drawerOpen}
|
|
65
|
+
details={detailsGroup}
|
|
66
|
+
setDetails={setDetailsGroup}
|
|
67
|
+
edited={edited}
|
|
68
|
+
setEdited={setEdited}
|
|
69
|
+
handleClose={handleClose}
|
|
70
|
+
/>
|
|
71
|
+
)}
|
|
72
|
+
{props.drawerOpen && !props.drawerOpen.group && (
|
|
73
|
+
<ScheduleDrawerLegacy
|
|
74
|
+
drawerOpen={props.drawerOpen}
|
|
75
|
+
details={detailsLegacy}
|
|
76
|
+
setDetails={setDetailsLegacy}
|
|
77
|
+
edited={edited}
|
|
78
|
+
setEdited={setEdited}
|
|
79
|
+
handleClose={handleClose}
|
|
80
|
+
/>
|
|
81
|
+
)}
|
|
82
|
+
</Box>
|
|
83
|
+
</Drawer>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const getStyles = (theme: Theme) => {
|
|
88
|
+
return {
|
|
89
|
+
main: {
|
|
90
|
+
[theme.breakpoints.down("sm")]: {
|
|
91
|
+
width: theme.spacing(35),
|
|
92
|
+
},
|
|
93
|
+
[theme.breakpoints.up("sm")]: {
|
|
94
|
+
width: theme.spacing(55),
|
|
95
|
+
},
|
|
96
|
+
[theme.breakpoints.up("xl")]: {
|
|
97
|
+
width: theme.spacing(75),
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useSortable } from "@dnd-kit/sortable";
|
|
3
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
4
|
+
|
|
5
|
+
// Mui
|
|
6
|
+
import { Box, Stack, IconButton, Typography } from "@mui/material";
|
|
7
|
+
import { DragIndicator, DeleteOutline } from "@mui/icons-material";
|
|
8
|
+
|
|
9
|
+
// Custom components
|
|
10
|
+
import {
|
|
11
|
+
StyledTableCell,
|
|
12
|
+
StyledTableRow,
|
|
13
|
+
StyledIconButton,
|
|
14
|
+
} from "@evenicanpm/admin-integrate/components/data-table/table-row";
|
|
15
|
+
|
|
16
|
+
// Types
|
|
17
|
+
import { Process } from "./schedule-details-integrations";
|
|
18
|
+
import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
19
|
+
import { TableCellProps } from "@mui/material";
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
item: Process;
|
|
23
|
+
heading: Head[];
|
|
24
|
+
handleDeleteIntegration: (item: Process) => void;
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default function SortableIntegrationRow(props: Props) {
|
|
29
|
+
const styles = getStyles();
|
|
30
|
+
|
|
31
|
+
const { attributes, listeners, setNodeRef, transform, transition } =
|
|
32
|
+
useSortable({ id: props.item.id });
|
|
33
|
+
|
|
34
|
+
const transformStyles = {
|
|
35
|
+
transform: CSS.Transform.toString(transform),
|
|
36
|
+
transition,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const handleClickDelete = () => {
|
|
40
|
+
if (!props.readOnly) {
|
|
41
|
+
props.handleDeleteIntegration(props.item);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const listenersProps = props.readOnly ? {} : listeners;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<StyledTableRow
|
|
49
|
+
ref={setNodeRef}
|
|
50
|
+
sx={{ ...transformStyles, ...styles.row }}
|
|
51
|
+
{...attributes}
|
|
52
|
+
>
|
|
53
|
+
<StyledTableCell
|
|
54
|
+
align={props.heading[0].align as TableCellProps["align"]}
|
|
55
|
+
width={props.heading[0].width}
|
|
56
|
+
sx={{ padding: 0 }}
|
|
57
|
+
>
|
|
58
|
+
<IconButton {...listenersProps} disableRipple>
|
|
59
|
+
<DragIndicator />
|
|
60
|
+
</IconButton>
|
|
61
|
+
</StyledTableCell>
|
|
62
|
+
<StyledTableCell
|
|
63
|
+
align={props.heading[1].align as TableCellProps["align"]}
|
|
64
|
+
width={props.heading[1].width}
|
|
65
|
+
>
|
|
66
|
+
<Stack spacing={1} direction="row">
|
|
67
|
+
<Box display="flex" justifyContent="flex-end" alignItems="center">
|
|
68
|
+
{/* process icon */}
|
|
69
|
+
</Box>
|
|
70
|
+
<Box display="flex" justifyContent="flex-end" alignItems="center">
|
|
71
|
+
<Typography variant="caption">{props.item.name}</Typography>
|
|
72
|
+
</Box>
|
|
73
|
+
</Stack>
|
|
74
|
+
</StyledTableCell>
|
|
75
|
+
<StyledTableCell
|
|
76
|
+
align={props.heading[2].align as TableCellProps["align"]}
|
|
77
|
+
width={props.heading[2].width}
|
|
78
|
+
>
|
|
79
|
+
<StyledIconButton onClick={handleClickDelete} disabled={props.readOnly}>
|
|
80
|
+
<DeleteOutline color={props.readOnly ? "disabled" : "error"} />
|
|
81
|
+
</StyledIconButton>
|
|
82
|
+
</StyledTableCell>
|
|
83
|
+
</StyledTableRow>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const getStyles = () => {
|
|
88
|
+
return {
|
|
89
|
+
row: {
|
|
90
|
+
backgroundColor: "white",
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
};
|