@evenicanpm/admin-integrate 1.2.0 → 1.3.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/ConfigImport/configuration-import.ts +54 -0
- package/documents/CopyProcess/copy.ts +25 -0
- package/documents/Endpoint/fragments.ts +9 -0
- package/documents/Endpoint/list.ts +22 -0
- package/documents/Process/fragments.ts +35 -0
- package/documents/Process/get-process-details.ts +73 -0
- package/documents/Process/list.ts +51 -0
- package/documents/ProcessConfig/fragments.ts +116 -0
- package/documents/ProcessConfig/read.ts +35 -0
- package/documents/ProcessExecution/fragments.ts +12 -0
- package/documents/ProcessExecution/list.ts +30 -1
- package/documents/ProcessExecutionDetails/fragments.ts +96 -0
- package/documents/ProcessExecutionDetails/read.ts +12 -0
- package/documents/ProcessScheduleGroup/read.ts +43 -0
- package/documents/ProcessTask/fragments.ts +285 -0
- package/documents/ProcessTask/read.ts +12 -0
- package/documents/ProcessTemplate/fragments.ts +69 -0
- package/documents/ProcessTemplate/list.ts +67 -0
- package/documents/ProcessTemplate/read.ts +12 -0
- package/documents/RunProcess/run.ts +11 -0
- package/package.json +4 -3
- package/src/api/Integrations/queries/get-process.query.ts +48 -0
- package/src/api/Integrations/queries/get-process.server.ts +14 -0
- package/src/api/Integrations/queries/index.ts +1 -0
- package/src/api/dashboard/queries/get-process-executions.query.ts +6 -3
- package/src/api/dashboard/queries/get-process-executions.server.ts +1 -1
- package/src/api/execution-details/queries/get-process-execution-details.query.ts +46 -0
- package/src/api/execution-details/queries/get-process-execution-details.server.ts +11 -0
- package/src/api/execution-details/queries/get-process-executions-by-process.query.ts +48 -0
- package/src/api/execution-details/queries/get-process-executions-by-process.server.ts +11 -0
- package/src/api/execution-details/queries/index.ts +2 -0
- package/src/api/process/mutations/copy-process.mutation.ts +48 -0
- package/src/api/process/mutations/copy-process.server.ts +14 -0
- package/src/api/process/mutations/index.ts +2 -0
- package/src/api/process/mutations/run-process.mutation.ts +41 -0
- package/src/api/process/mutations/run-process.server.ts +14 -0
- package/src/api/process/queries/get-process-by-id.query.ts +85 -0
- package/src/api/process/queries/get-process-by-id.server.ts +20 -0
- package/src/api/process/queries/index.ts +4 -0
- package/src/api/process-config/mutation/index.ts +2 -0
- package/src/api/process-config/mutation/process-config-import.mutation.ts +33 -0
- package/src/api/process-config/mutation/process-config-import.server.ts +14 -0
- package/src/api/process-config/mutation/process-config-merge.mutation.ts +33 -0
- package/src/api/process-config/mutation/process-config-merge.server.ts +14 -0
- package/src/api/process-task/queries/get-process-task-by-id.query.ts +45 -0
- package/src/api/process-task/queries/get-process-task-by-id.server.ts +9 -0
- package/src/api/process-task/queries/index.ts +1 -0
- package/src/api/scheduler/mutation/create-process-schedule-group-details.mutation.ts +47 -0
- package/src/api/scheduler/mutation/create-process-schedule-group-details.server.ts +14 -0
- package/src/api/scheduler/mutation/index.ts +2 -0
- package/src/api/scheduler/mutation/update-process-schedule-group-details.mutation.ts +47 -0
- package/src/api/scheduler/mutation/update-process-schedule-group-details.server.ts +14 -0
- package/src/api/scheduler/queries/get-non-scheduled-processes.query.ts +48 -0
- package/src/api/scheduler/queries/get-non-scheduled-processes.server.ts +11 -0
- package/src/api/scheduler/queries/get-process-schedule-group-details.query.ts +6 -3
- package/src/api/scheduler/queries/get-process-schedule-group-details.server.ts +3 -3
- package/src/api/scheduler/queries/get-process-schedule.query.ts +6 -3
- package/src/api/scheduler/queries/get-process-schedule.server.ts +3 -3
- package/src/api/scheduler/queries/get-scheduled-processes.query.ts +6 -3
- package/src/api/scheduler/queries/get-scheduled-processes.server.ts +1 -1
- package/src/api/scheduler/queries/index.ts +3 -2
- package/src/api/templates/queries/get-process-template-groups.query.ts +48 -0
- package/src/api/templates/queries/get-process-template-groups.server.ts +11 -0
- package/src/api/templates/queries/get-process-template-records.query.ts +48 -0
- package/src/api/templates/queries/get-process-template-records.server.ts +11 -0
- package/src/api/templates/queries/get-process-template.query.ts +48 -0
- package/src/api/templates/queries/get-process-template.server.ts +9 -0
- package/src/api/templates/queries/get-process-templates.query.ts +45 -0
- package/src/api/templates/queries/get-process-templates.server.ts +9 -0
- package/src/api/templates/queries/index.ts +5 -0
- package/src/api/templates/queries/template-input-search.query.ts +34 -0
- package/src/api/templates/queries/template-input-search.server.ts +35 -0
- package/src/api/templates/queries/types.ts +28 -0
- package/src/components/breadcrumbs/breadcrumbs.tsx +32 -5
- package/src/components/button/outlined-icon-button.tsx +2 -2
- package/src/components/core/date-time-popover.tsx +11 -4
- package/src/components/core/drawer-buttons.tsx +52 -0
- package/src/components/core/edited-typography.tsx +1 -1
- package/src/components/core/index.ts +4 -2
- package/src/components/core/loading.tsx +1 -1
- package/src/components/core/status-tag.tsx +97 -0
- package/src/components/core/title-edit.tsx +18 -11
- package/src/components/dashboard-list/dashboard-list-row.tsx +22 -29
- package/src/components/dashboard-list/dashboard-list.tsx +19 -15
- package/src/components/data-table/table-header.tsx +5 -7
- package/src/components/data-table/table-pagination.tsx +1 -1
- package/src/components/data-table/table-row.tsx +1 -1
- package/src/components/data-table/table-skeleton.tsx +9 -4
- package/src/components/execution/execution-filter.ts +1 -1
- package/src/components/execution/execution-status-icon.tsx +7 -7
- package/src/components/execution/execution-tag.tsx +12 -77
- package/src/components/execution/index.ts +1 -1
- package/src/components/execution-history-drawer/execution-history-drawer.tsx +203 -0
- package/src/components/execution-history-drawer/executions-card.tsx +85 -0
- package/src/components/execution-history-drawer/index.ts +1 -0
- package/src/components/footer/footer.tsx +10 -6
- package/src/components/header/dashboard-list-header.tsx +12 -7
- package/src/components/header/execution-details-header.tsx +35 -26
- package/src/components/header/header.tsx +10 -3
- package/src/components/header/index.ts +1 -1
- package/src/components/header/integration-details-header.tsx +104 -45
- package/src/components/integration-list/index.ts +3 -0
- package/src/components/integration-list/integration-filter.ts +21 -0
- package/src/components/integration-list/integration-status-icon.tsx +32 -0
- package/src/components/integration-list/integration-tag.tsx +33 -0
- package/src/components/integration-list/list/index.ts +1 -0
- package/src/components/integration-list/list/integration-list-row.tsx +161 -0
- package/src/components/integration-list/list/integration-list-table.tsx +62 -0
- package/src/components/integration-list/list/integration-list.tsx +258 -0
- package/src/components/integration-view/animated-svg.tsx +31 -0
- package/src/components/integration-view/edges/default-edge.tsx +1 -1
- package/src/components/integration-view/elk-layout-options.ts +2 -2
- package/src/components/integration-view/elk-types.ts +35 -6
- package/src/components/integration-view/flow-types.tsx +10 -0
- package/src/components/integration-view/integration-view.tsx +990 -55
- package/src/components/integration-view/nodes/empty-node.tsx +65 -0
- package/src/components/integration-view/nodes/entry-node.tsx +98 -4
- package/src/components/integration-view/nodes/execution-entry-node.tsx +107 -0
- package/src/components/integration-view/nodes/execution-task-node.tsx +88 -0
- package/src/components/integration-view/nodes/group-node.tsx +19 -13
- package/src/components/integration-view/nodes/row-node.tsx +19 -0
- package/src/components/integration-view/nodes/task-node.tsx +14 -8
- package/src/components/integration-view/task-icon.tsx +193 -0
- package/src/components/integration-view/temp-data/initialElements.tsx +36 -32
- package/src/components/integration-view/types.ts +2 -2
- package/src/components/layouts/main-layout.tsx +2 -3
- package/src/components/layouts/root-container.tsx +3 -6
- package/src/components/link-cards/link-card.tsx +15 -4
- package/src/components/link-cards/styles.ts +1 -1
- package/src/components/list-filter/date-filter.tsx +4 -3
- package/src/components/list-filter/date-range-filter.tsx +11 -5
- package/src/components/list-filter/index.ts +1 -1
- package/src/components/list-filter/list-filter.tsx +31 -26
- package/src/components/list-filter/multi-select-filter.tsx +11 -10
- package/src/components/list-filter/select-filter.tsx +13 -8
- package/src/components/scheduler/day-selector.tsx +29 -15
- package/src/components/scheduler/day-tag.tsx +14 -51
- package/src/components/scheduler/index.ts +2 -1
- package/src/components/scheduler/schedule-drawer/details-reducer.ts +217 -0
- package/src/components/scheduler/schedule-drawer/schedule-details-integrations.tsx +503 -0
- package/src/{pages → components}/scheduler/schedule-drawer/schedule-details-main.tsx +136 -99
- package/src/components/scheduler/schedule-drawer/schedule-details-name.tsx +94 -0
- package/src/{pages → components}/scheduler/schedule-drawer/schedule-details-skeleton.tsx +1 -2
- package/src/{pages → components}/scheduler/schedule-drawer/schedule-details.tsx +9 -13
- package/src/components/scheduler/schedule-drawer/schedule-drawer-group.tsx +218 -0
- package/src/{pages → components}/scheduler/schedule-drawer/schedule-drawer-legacy.tsx +6 -25
- package/src/components/scheduler/schedule-drawer/schedule-drawer.tsx +116 -0
- package/src/components/scheduler/schedule-drawer/sortable-integration-row.tsx +130 -0
- package/src/components/scheduler/schedule-filter.ts +1 -1
- package/src/components/scheduler/schedule-icon.tsx +5 -6
- package/src/components/scheduler/schedule-integration-icon.tsx +31 -0
- package/src/components/templates/index.ts +1 -0
- package/src/components/templates/inputs/index.tsx +1351 -0
- package/src/components/templates/template-filter.ts +5 -0
- package/src/components/templates/templates-list/index.ts +1 -0
- package/src/components/templates/templates-list/templates-list-row.tsx +55 -0
- package/src/components/templates/templates-list/templates-list-table.tsx +58 -0
- package/src/components/templates/templates-list/templates-list.tsx +253 -0
- package/src/components/templates/types.tsx +75 -0
- package/src/components/templates/wizard.tsx +689 -0
- package/src/hooks/use-breadcrumbs.ts +1 -1
- package/src/hooks/use-recurrence.tsx +1 -2
- package/src/pages/dashboard/dashboard-link-cards.tsx +8 -11
- package/src/pages/dashboard/dashboard-list-sections.tsx +7 -9
- package/src/pages/dashboard/dashboard.tsx +1 -2
- package/src/pages/execution-details/execution-details.tsx +211 -14
- package/src/pages/execution-details/task-execution-details.tsx +160 -0
- package/src/pages/execution-details/task-execution-drawer.tsx +54 -0
- package/src/pages/executions/executions-list/executions-list-row.tsx +21 -27
- package/src/pages/executions/executions-list/executions-list-table.tsx +28 -35
- package/src/pages/executions/executions-list/executions-list.tsx +24 -18
- package/src/pages/executions/executions.tsx +11 -15
- package/src/pages/integration-create/index.ts +1 -0
- package/src/pages/integration-create/integration-create.tsx +174 -0
- package/src/pages/integration-create/pre-creation-step.tsx +12 -0
- package/src/pages/integration-create/select-step.tsx +105 -0
- package/src/pages/integration-create/template-list-step.tsx +77 -0
- package/src/pages/integration-create/wizard-step.tsx +50 -0
- package/src/pages/integration-details/import-process/copy-tasks-list.tsx +265 -0
- package/src/pages/integration-details/import-process/copy-tasks-row.tsx +77 -0
- package/src/pages/integration-details/import-process/import-confirm.tsx +61 -0
- package/src/pages/integration-details/import-process/import-drawer.tsx +48 -0
- package/src/pages/integration-details/import-process/import-process-reducer.ts +90 -0
- package/src/pages/integration-details/import-process/import-process.tsx +149 -0
- package/src/pages/integration-details/index.ts +1 -0
- package/src/pages/integration-details/integration-details.tsx +221 -0
- package/src/pages/integration-details/task-drawer/add-task.tsx +120 -0
- package/src/pages/integration-details/task-drawer/edit-task.tsx +175 -0
- package/src/pages/integration-details/task-drawer/task-drawer.tsx +139 -0
- package/src/pages/integration-details/task-drawer/task-reducer.ts +73 -0
- package/src/pages/integrations/integrations.tsx +68 -8
- package/src/pages/scheduler/scheduler.tsx +12 -24
- package/src/pages/scheduler/schedules-list/schedules-list-row.tsx +27 -37
- package/src/pages/scheduler/schedules-list/schedules-list-table.tsx +27 -42
- package/src/pages/scheduler/schedules-list/schedules-list.tsx +48 -21
- package/src/utils/date-functions.ts +69 -0
- package/src/utils/slugify.ts +3 -0
- package/tsconfig.json +12 -4
- package/src/hooks/use-timestamp.tsx +0 -25
- package/src/pages/scheduler/schedule-drawer/schedule-details-integrations.tsx +0 -227
- package/src/pages/scheduler/schedule-drawer/schedule-details-name.tsx +0 -77
- package/src/pages/scheduler/schedule-drawer/schedule-drawer-buttons.tsx +0 -72
- package/src/pages/scheduler/schedule-drawer/schedule-drawer-group.tsx +0 -103
- package/src/pages/scheduler/schedule-drawer/schedule-drawer.tsx +0 -101
- package/src/pages/scheduler/schedule-drawer/sortable-integration-row.tsx +0 -93
- /package/src/{pages → components}/scheduler/schedule-drawer/edited/edited-types.ts +0 -0
- /package/src/{pages → components}/scheduler/schedule-drawer/edited/index.ts +0 -0
- /package/src/{pages → components}/scheduler/schedule-drawer/index.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./templates-list";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
2
|
+
// Custom components
|
|
3
|
+
import {
|
|
4
|
+
StyledIconButton,
|
|
5
|
+
StyledTableCell,
|
|
6
|
+
StyledTableRow,
|
|
7
|
+
} from "@evenicanpm/admin-integrate/components/data-table/table-row";
|
|
8
|
+
import { ChevronRightOutlined } from "@mui/icons-material";
|
|
9
|
+
// MUI
|
|
10
|
+
import {
|
|
11
|
+
Box,
|
|
12
|
+
Stack,
|
|
13
|
+
type SxProps,
|
|
14
|
+
type TableCellProps,
|
|
15
|
+
Typography,
|
|
16
|
+
} from "@mui/material";
|
|
17
|
+
// Types
|
|
18
|
+
import type { Item } from "./templates-list";
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
item: Item;
|
|
22
|
+
heading: Head[]; // for alignment
|
|
23
|
+
handleRedirect: (id: string) => void;
|
|
24
|
+
sx?: SxProps;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const TemplatesListRow: React.FC<Props> = (props: Props) => {
|
|
28
|
+
return (
|
|
29
|
+
<StyledTableRow sx={props.sx}>
|
|
30
|
+
<StyledTableCell
|
|
31
|
+
align={props.heading[0].align as TableCellProps["align"]}
|
|
32
|
+
width={props.heading[0].width}
|
|
33
|
+
>
|
|
34
|
+
<Stack spacing={1} direction="row">
|
|
35
|
+
<Box display="flex" justifyContent="flex-end" alignItems="center">
|
|
36
|
+
{/* icon */}
|
|
37
|
+
</Box>
|
|
38
|
+
<Box display="flex" justifyContent="flex-end" alignItems="center">
|
|
39
|
+
<Typography>{props.item.name}</Typography>
|
|
40
|
+
</Box>
|
|
41
|
+
</Stack>
|
|
42
|
+
</StyledTableCell>
|
|
43
|
+
<StyledTableCell
|
|
44
|
+
align={props.heading[1].align as TableCellProps["align"]}
|
|
45
|
+
width={props.heading[1].width}
|
|
46
|
+
>
|
|
47
|
+
<StyledIconButton onClick={() => props.handleRedirect(props.item.id)}>
|
|
48
|
+
<ChevronRightOutlined fontSize="large" />
|
|
49
|
+
</StyledIconButton>
|
|
50
|
+
</StyledTableCell>
|
|
51
|
+
</StyledTableRow>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default TemplatesListRow;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { FilterQueryInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
2
|
+
import { TableHeader } from "@evenicanpm/admin-integrate/components/data-table";
|
|
3
|
+
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
4
|
+
import { type SxProps, Table, TableBody, TableContainer } from "@mui/material";
|
|
5
|
+
import type { Item } from "./templates-list";
|
|
6
|
+
import TemplatesListRow from "./templates-list-row";
|
|
7
|
+
|
|
8
|
+
interface Props {
|
|
9
|
+
heading: Head[];
|
|
10
|
+
items: Item[];
|
|
11
|
+
input: FilterQueryInput;
|
|
12
|
+
setInput: (newInput: FilterQueryInput) => void;
|
|
13
|
+
handleRedirect: (id: string) => void;
|
|
14
|
+
rowSx?: SxProps;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default function TemplatesListTable(props: Props) {
|
|
18
|
+
const handleRequestSort = (property: string) => {
|
|
19
|
+
const current = props.input.sort;
|
|
20
|
+
if (property === current) {
|
|
21
|
+
props.setInput({
|
|
22
|
+
...props.input,
|
|
23
|
+
sortDesc: !props.input.sortDesc,
|
|
24
|
+
});
|
|
25
|
+
} else {
|
|
26
|
+
props.setInput({
|
|
27
|
+
...props.input,
|
|
28
|
+
sort: property,
|
|
29
|
+
sortDesc: false,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<TableContainer>
|
|
36
|
+
<Table>
|
|
37
|
+
<TableHeader
|
|
38
|
+
heading={props.heading}
|
|
39
|
+
orderBy={props.input.sort || ""}
|
|
40
|
+
order={props.input.sortDesc ? "desc" : "asc"}
|
|
41
|
+
onRequestSort={handleRequestSort}
|
|
42
|
+
rowSx={props.rowSx}
|
|
43
|
+
/>
|
|
44
|
+
<TableBody>
|
|
45
|
+
{props.items.map((item, index) => (
|
|
46
|
+
<TemplatesListRow
|
|
47
|
+
key={index}
|
|
48
|
+
item={item}
|
|
49
|
+
heading={props.heading}
|
|
50
|
+
sx={props.rowSx}
|
|
51
|
+
handleRedirect={props.handleRedirect}
|
|
52
|
+
/>
|
|
53
|
+
))}
|
|
54
|
+
</TableBody>
|
|
55
|
+
</Table>
|
|
56
|
+
</TableContainer>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FilterQueryInput,
|
|
3
|
+
GetProcessTemplateGroupsQuery,
|
|
4
|
+
GetProcessTemplatesQuery,
|
|
5
|
+
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
6
|
+
import { FlexBox } from "@evenicanpm/admin-core/components/flex-box";
|
|
7
|
+
import {
|
|
8
|
+
TablePagination,
|
|
9
|
+
TableSkeleton,
|
|
10
|
+
} from "@evenicanpm/admin-integrate/components/data-table";
|
|
11
|
+
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
12
|
+
import { ListFilter } from "@evenicanpm/admin-integrate/components/list-filter";
|
|
13
|
+
import type { ListFilterOutput } from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
|
|
14
|
+
import {
|
|
15
|
+
type TemplateListFilters,
|
|
16
|
+
templateListFilters,
|
|
17
|
+
} from "@evenicanpm/admin-integrate/components/templates/template-filter";
|
|
18
|
+
import {
|
|
19
|
+
Box,
|
|
20
|
+
Card,
|
|
21
|
+
Grid2 as Grid,
|
|
22
|
+
Stack,
|
|
23
|
+
type Theme,
|
|
24
|
+
Typography,
|
|
25
|
+
useTheme,
|
|
26
|
+
} from "@mui/material";
|
|
27
|
+
import { useTranslations } from "next-intl";
|
|
28
|
+
import { useEffect, useState } from "react";
|
|
29
|
+
import TemplatesListTable from "./templates-list-table";
|
|
30
|
+
|
|
31
|
+
export interface Item {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
isActive: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Row height in terms of multiples of theme.spacing(1) (e.g. theme.spacing(7.5 & rows per page))
|
|
38
|
+
const rowHeight = 7.5;
|
|
39
|
+
|
|
40
|
+
interface Props {
|
|
41
|
+
heading: Head[];
|
|
42
|
+
data: GetProcessTemplateGroupsQuery | GetProcessTemplatesQuery;
|
|
43
|
+
loading: boolean;
|
|
44
|
+
input: FilterQueryInput;
|
|
45
|
+
setInput: (newInput: FilterQueryInput) => void;
|
|
46
|
+
handleRedirect: (id: string) => void;
|
|
47
|
+
isTemplateGroupsList?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default function TemplatesList(props: Props) {
|
|
51
|
+
const t = useTranslations("Integrate.Templates");
|
|
52
|
+
|
|
53
|
+
const theme = useTheme();
|
|
54
|
+
const styles = getStyles(theme);
|
|
55
|
+
|
|
56
|
+
const [items, setItems] = useState<Item[]>([]);
|
|
57
|
+
const [page, setPage] = useState(
|
|
58
|
+
(props.input.skip || 0) / (props.input.top || 10) + 1,
|
|
59
|
+
);
|
|
60
|
+
const [perPage, setPerPage] = useState<number>(props.input.top || 10);
|
|
61
|
+
|
|
62
|
+
const handleChangePage = (
|
|
63
|
+
event: React.ChangeEvent<unknown>,
|
|
64
|
+
value: number,
|
|
65
|
+
) => {
|
|
66
|
+
if (page !== value && event) {
|
|
67
|
+
setPage(value);
|
|
68
|
+
props.setInput({
|
|
69
|
+
...props.input,
|
|
70
|
+
skip: (props.input.top || 10) * (value - 1),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const handleSetFilters = (
|
|
76
|
+
filterUpdate: ListFilterOutput<TemplateListFilters>,
|
|
77
|
+
) => {
|
|
78
|
+
const { itemsPerPage, search } = filterUpdate;
|
|
79
|
+
props.setInput({
|
|
80
|
+
...props.input,
|
|
81
|
+
top: itemsPerPage,
|
|
82
|
+
skip: 0,
|
|
83
|
+
search: search,
|
|
84
|
+
});
|
|
85
|
+
setPerPage(itemsPerPage as number);
|
|
86
|
+
setPage(1);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleClearFilters = () => {
|
|
90
|
+
props.setInput({
|
|
91
|
+
...props.input,
|
|
92
|
+
skip: 0,
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (props.isTemplateGroupsList) {
|
|
98
|
+
const typedData = props.data as GetProcessTemplateGroupsQuery;
|
|
99
|
+
if (typedData?.processTemplateGroups?.nodes) {
|
|
100
|
+
setItems(typedData.processTemplateGroups.nodes as Item[]);
|
|
101
|
+
}
|
|
102
|
+
} else {
|
|
103
|
+
const typedData = props.data as GetProcessTemplatesQuery;
|
|
104
|
+
if (typedData?.processTemplates?.nodes) {
|
|
105
|
+
setItems(typedData.processTemplates.nodes as Item[]);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, [props.data]);
|
|
109
|
+
|
|
110
|
+
const resultsReturned = props.isTemplateGroupsList
|
|
111
|
+
? (props.data as GetProcessTemplateGroupsQuery)?.processTemplateGroups
|
|
112
|
+
?.pageInfo.resultsReturned
|
|
113
|
+
: (props.data as GetProcessTemplatesQuery)?.processTemplates?.pageInfo
|
|
114
|
+
.resultsReturned;
|
|
115
|
+
|
|
116
|
+
const recordCount = props.isTemplateGroupsList
|
|
117
|
+
? (props.data as GetProcessTemplateGroupsQuery)?.processTemplateGroups
|
|
118
|
+
?.recordCount
|
|
119
|
+
: (props.data as GetProcessTemplatesQuery)?.processTemplates?.recordCount;
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
<Box sx={styles.list}>
|
|
124
|
+
<ListFilter<TemplateListFilters>
|
|
125
|
+
setFilters={handleSetFilters}
|
|
126
|
+
clearFilters={handleClearFilters}
|
|
127
|
+
filters={templateListFilters}
|
|
128
|
+
config={{
|
|
129
|
+
pagination: {
|
|
130
|
+
pageDefault: 10,
|
|
131
|
+
pageOptions: [10, 20, 50],
|
|
132
|
+
},
|
|
133
|
+
}}
|
|
134
|
+
/>
|
|
135
|
+
</Box>
|
|
136
|
+
|
|
137
|
+
{props.loading && !props.data && (
|
|
138
|
+
<Card>
|
|
139
|
+
<TableSkeleton
|
|
140
|
+
heading={props.heading}
|
|
141
|
+
perPage={perPage}
|
|
142
|
+
rowSx={styles.rowSx}
|
|
143
|
+
/>
|
|
144
|
+
</Card>
|
|
145
|
+
)}
|
|
146
|
+
|
|
147
|
+
{!props.loading &&
|
|
148
|
+
((props.data as GetProcessTemplateGroupsQuery)?.processTemplateGroups ||
|
|
149
|
+
(props.data as GetProcessTemplatesQuery)?.processTemplates) &&
|
|
150
|
+
items.length > 0 ? (
|
|
151
|
+
<Box
|
|
152
|
+
sx={{
|
|
153
|
+
minHeight:
|
|
154
|
+
resultsReturned && resultsReturned < perPage && page === 1
|
|
155
|
+
? theme.spacing(rowHeight * resultsReturned + 1)
|
|
156
|
+
: theme.spacing(rowHeight * (perPage + 1)),
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
<Card>
|
|
160
|
+
<TemplatesListTable
|
|
161
|
+
heading={props.heading}
|
|
162
|
+
items={items}
|
|
163
|
+
input={props.input}
|
|
164
|
+
setInput={props.setInput}
|
|
165
|
+
handleRedirect={props.handleRedirect}
|
|
166
|
+
/>
|
|
167
|
+
</Card>
|
|
168
|
+
</Box>
|
|
169
|
+
) : null}
|
|
170
|
+
|
|
171
|
+
{!props.loading && items.length === 0 ? (
|
|
172
|
+
<Card>
|
|
173
|
+
<FlexBox
|
|
174
|
+
justifyContent="center"
|
|
175
|
+
alignItems="center"
|
|
176
|
+
sx={{
|
|
177
|
+
minHeight: "335px",
|
|
178
|
+
marginBottom: theme.spacing(2),
|
|
179
|
+
}}
|
|
180
|
+
>
|
|
181
|
+
<Stack spacing={1} justifyContent="center" alignItems="center">
|
|
182
|
+
<Typography variant="h6" color="info">
|
|
183
|
+
{t("ListEmpty.title")}
|
|
184
|
+
</Typography>
|
|
185
|
+
</Stack>
|
|
186
|
+
</FlexBox>
|
|
187
|
+
</Card>
|
|
188
|
+
) : null}
|
|
189
|
+
|
|
190
|
+
{!props.loading && recordCount && resultsReturned && items.length > 0 ? (
|
|
191
|
+
<Grid container spacing={1} sx={styles.pagination}>
|
|
192
|
+
<Grid size={{ xs: 10.5 }}>
|
|
193
|
+
<FlexBox
|
|
194
|
+
justifyContent="center"
|
|
195
|
+
alignItems="center"
|
|
196
|
+
sx={styles.paginationBox}
|
|
197
|
+
>
|
|
198
|
+
<TablePagination
|
|
199
|
+
page={page}
|
|
200
|
+
onChange={handleChangePage}
|
|
201
|
+
count={Math.ceil(recordCount / (props.input.top as number))}
|
|
202
|
+
/>
|
|
203
|
+
</FlexBox>
|
|
204
|
+
</Grid>
|
|
205
|
+
<Grid size={{ xs: 1.5 }}>
|
|
206
|
+
<FlexBox
|
|
207
|
+
justifyContent="flex-end"
|
|
208
|
+
alignItems="center"
|
|
209
|
+
sx={{ height: "100%" }}
|
|
210
|
+
>
|
|
211
|
+
<Typography color="grey">
|
|
212
|
+
{`${resultsReturned} ${t("Pagination.of")} ${recordCount} ${t("Pagination.items")}`}
|
|
213
|
+
</Typography>
|
|
214
|
+
</FlexBox>
|
|
215
|
+
</Grid>
|
|
216
|
+
</Grid>
|
|
217
|
+
) : null}
|
|
218
|
+
</>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const getStyles = (theme: Theme) => {
|
|
223
|
+
return {
|
|
224
|
+
title: {
|
|
225
|
+
display: "flex",
|
|
226
|
+
alignItems: "center",
|
|
227
|
+
height: "100%",
|
|
228
|
+
},
|
|
229
|
+
typography: {
|
|
230
|
+
fontWeight: "medium",
|
|
231
|
+
},
|
|
232
|
+
button: {
|
|
233
|
+
borderWidth: 2,
|
|
234
|
+
borderRadius: 1,
|
|
235
|
+
marginRight: theme.spacing(1),
|
|
236
|
+
},
|
|
237
|
+
iconButton: {
|
|
238
|
+
borderRadius: 1,
|
|
239
|
+
},
|
|
240
|
+
pagination: {
|
|
241
|
+
marginTop: theme.spacing(2),
|
|
242
|
+
},
|
|
243
|
+
list: {
|
|
244
|
+
margin: theme.spacing(2, 0),
|
|
245
|
+
},
|
|
246
|
+
paginationBox: {
|
|
247
|
+
paddingLeft: theme.spacing(15),
|
|
248
|
+
},
|
|
249
|
+
rowSx: {
|
|
250
|
+
height: theme.spacing(rowHeight),
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { GetProcessTemplateQuery } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
2
|
+
|
|
3
|
+
export type ProcessTemplateInputSchema = NonNullable<
|
|
4
|
+
NonNullable<NonNullable<ProcessTemplateInput>["schemas"]>[number]
|
|
5
|
+
>;
|
|
6
|
+
|
|
7
|
+
export type ProcessTemplateInput = NonNullable<
|
|
8
|
+
NonNullable<NonNullable<ProcessTemplatePage>["inputs"]>[number]
|
|
9
|
+
>;
|
|
10
|
+
|
|
11
|
+
export type ProcessTemplatePage = NonNullable<
|
|
12
|
+
NonNullable<NonNullable<ProcessTemplate>["pages"]>[number]
|
|
13
|
+
>;
|
|
14
|
+
|
|
15
|
+
export type ProcessTemplate = NonNullable<
|
|
16
|
+
NonNullable<GetProcessTemplateQuery["processTemplate"]>[number]
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export type Data = { processTemplate: ProcessTemplate[] };
|
|
20
|
+
|
|
21
|
+
export type ProcessTemplateFilter = {
|
|
22
|
+
processTemplateGroupId?: string | null;
|
|
23
|
+
processTemplateId?: string | null;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type FieldValue =
|
|
27
|
+
| string
|
|
28
|
+
| number
|
|
29
|
+
| boolean
|
|
30
|
+
| string[]
|
|
31
|
+
| Array<Record<string, string>>
|
|
32
|
+
| Record<string, string>
|
|
33
|
+
| null;
|
|
34
|
+
|
|
35
|
+
export type FormState = Record<string, FieldValue>;
|
|
36
|
+
export type ErrorState = Record<string, string | null>;
|
|
37
|
+
|
|
38
|
+
//This needs to be shared, maybe a way to also have this componentized so theres a proper schema for it?
|
|
39
|
+
export type ProcessConfigMerge = {
|
|
40
|
+
input: {
|
|
41
|
+
config: Array<Record<string, FieldValue>>; //TODO: Actually map this out properly
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type SearchOption = { name: string; templateConfig: string };
|
|
46
|
+
|
|
47
|
+
export type Metadata = {
|
|
48
|
+
name: string;
|
|
49
|
+
code: string;
|
|
50
|
+
parallelProcessingGroup: number;
|
|
51
|
+
sort: number;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type FlatPage = ProcessTemplatePage & {
|
|
55
|
+
_templateIndex: number;
|
|
56
|
+
_templateId: string;
|
|
57
|
+
_templateName: string;
|
|
58
|
+
_pageIndexWithinTemplate: number;
|
|
59
|
+
_flatIndex: number;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const templateFieldKey = (templateId: string, fieldName: string) =>
|
|
63
|
+
`${templateId}::${fieldName}`;
|
|
64
|
+
|
|
65
|
+
export const toRegex = (pattern: string | null) => {
|
|
66
|
+
if (!pattern) return null;
|
|
67
|
+
try {
|
|
68
|
+
return new RegExp(pattern);
|
|
69
|
+
} catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const sortBy = <T extends { sort?: number | null }>(arr: T[]) =>
|
|
75
|
+
[...arr].sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0));
|