@evenicanpm/admin-integrate 1.2.2 → 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 +22 -0
- package/documents/Process/get-process-details.ts +73 -0
- package/documents/Process/list.ts +24 -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 +12 -12
- package/src/api/Integrations/queries/get-process.server.ts +7 -2
- 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 +2 -1
- package/src/components/integration-list/integration-filter.ts +1 -1
- package/src/components/integration-list/integration-status-icon.tsx +7 -8
- package/src/components/integration-list/integration-tag.tsx +6 -50
- 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/{pages/integrations/integration-list → components/integration-list/list}/integration-list.tsx +47 -51
- 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 +30 -25
- 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 +11 -14
- 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/integrations/integration-list/integration-list-row.tsx +0 -147
- package/src/pages/integrations/integration-list/integration-list-table.tsx +0 -78
- 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/integrations/integration-list → components/integration-list/list}/index.ts +0 -0
- /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,73 @@
|
|
|
1
|
+
export enum TaskActionType {
|
|
2
|
+
CLOSE = "CLOSE",
|
|
3
|
+
OPEN_ADD = "OPEN_ADD",
|
|
4
|
+
OPEN_EDIT = "OPEN_EDIT",
|
|
5
|
+
INCREMENT_STEP = "INCREMENT_STEP",
|
|
6
|
+
DECREMENT_STEP = "DECREMENT_STEP",
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum TaskMode {
|
|
10
|
+
NONE = "NONE",
|
|
11
|
+
ADD = "ADD",
|
|
12
|
+
EDIT = "EDIT",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface TaskAction {
|
|
16
|
+
type: TaskActionType;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface EditAction extends TaskAction {
|
|
20
|
+
processTaskId: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface TaskState {
|
|
24
|
+
open: boolean;
|
|
25
|
+
mode: TaskMode;
|
|
26
|
+
step: number | null;
|
|
27
|
+
processTaskId?: string | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function taskReducer(state: TaskState, action: TaskAction): TaskState {
|
|
31
|
+
switch (action.type) {
|
|
32
|
+
case TaskActionType.CLOSE: {
|
|
33
|
+
return {
|
|
34
|
+
open: false,
|
|
35
|
+
mode: TaskMode.NONE,
|
|
36
|
+
step: null,
|
|
37
|
+
processTaskId: null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
case TaskActionType.OPEN_ADD: {
|
|
41
|
+
return {
|
|
42
|
+
open: true,
|
|
43
|
+
mode: TaskMode.ADD,
|
|
44
|
+
step: 0,
|
|
45
|
+
processTaskId: null,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
case TaskActionType.OPEN_EDIT: {
|
|
49
|
+
return {
|
|
50
|
+
open: true,
|
|
51
|
+
mode: TaskMode.EDIT,
|
|
52
|
+
step: 0,
|
|
53
|
+
processTaskId: (action as EditAction).processTaskId,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
case TaskActionType.INCREMENT_STEP: {
|
|
57
|
+
return {
|
|
58
|
+
...state,
|
|
59
|
+
step: state.step !== null ? state.step + 1 : null,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
case TaskActionType.DECREMENT_STEP: {
|
|
63
|
+
return {
|
|
64
|
+
...state,
|
|
65
|
+
step: state.step !== null ? Math.max(state.step - 1, 0) : null,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
default: {
|
|
69
|
+
console.error(`${action.type} is not a valid action for detailsReducer`);
|
|
70
|
+
return state;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { Box } from "@mui/material";
|
|
6
|
-
|
|
7
|
-
// API
|
|
1
|
+
import type {
|
|
2
|
+
GetProcessesQuery,
|
|
3
|
+
ProcessInput,
|
|
4
|
+
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
8
5
|
import { getProcesses } from "@evenicanpm/admin-integrate/api/Integrations/queries";
|
|
9
|
-
import { ProcessInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
10
|
-
|
|
11
|
-
// Custom components
|
|
12
6
|
import {
|
|
7
|
+
type Crumb,
|
|
13
8
|
IntegrateBreadcrumbs,
|
|
14
|
-
Crumb,
|
|
15
9
|
} from "@evenicanpm/admin-integrate/components/breadcrumbs";
|
|
16
|
-
import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
17
|
-
import IntegrationList from "
|
|
10
|
+
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
11
|
+
import { IntegrationList } from "@evenicanpm/admin-integrate/components/integration-list";
|
|
12
|
+
import { Box } from "@mui/material";
|
|
13
|
+
import { useTranslations } from "next-intl";
|
|
14
|
+
import { useState } from "react";
|
|
18
15
|
|
|
19
16
|
export default function Integrations() {
|
|
20
17
|
const t = useTranslations("Integrate");
|
|
@@ -84,7 +81,7 @@ export default function Integrations() {
|
|
|
84
81
|
<IntegrateBreadcrumbs breadcrumbs={breadcrumbs} />
|
|
85
82
|
<IntegrationList
|
|
86
83
|
heading={heading}
|
|
87
|
-
data={data}
|
|
84
|
+
data={data as GetProcessesQuery}
|
|
88
85
|
loading={isLoading}
|
|
89
86
|
input={input}
|
|
90
87
|
setInput={setInput}
|
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useTranslations } from "next-intl";
|
|
3
|
-
|
|
4
|
-
// API
|
|
5
|
-
import { getScheduledProcesses } from "@evenicanpm/admin-integrate/api/scheduler/queries";
|
|
6
|
-
import {
|
|
7
|
-
ScheduledProcessInput,
|
|
1
|
+
import type {
|
|
8
2
|
GetScheduledProcessesQuery,
|
|
3
|
+
ScheduledProcessInput,
|
|
9
4
|
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import { getScheduledProcesses } from "@evenicanpm/admin-integrate/api/scheduler/queries";
|
|
6
|
+
import {
|
|
7
|
+
type Crumb,
|
|
8
|
+
IntegrateBreadcrumbs,
|
|
9
|
+
} from "@evenicanpm/admin-integrate/components/breadcrumbs";
|
|
10
|
+
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
11
|
+
import ScheduleDrawer from "@evenicanpm/admin-integrate/components/scheduler/schedule-drawer";
|
|
12
|
+
import type { DrawerOpen } from "@evenicanpm/admin-integrate/components/scheduler/schedule-drawer/schedule-drawer";
|
|
12
13
|
import { Box } from "@mui/material";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { IntegrateBreadcrumbs } from "@evenicanpm/admin-integrate/components/breadcrumbs";
|
|
16
|
-
|
|
17
|
-
// Local components
|
|
14
|
+
import { useTranslations } from "next-intl";
|
|
15
|
+
import { useState } from "react";
|
|
18
16
|
import SchedulesList from "./schedules-list";
|
|
19
|
-
import ScheduleDrawer from "./schedule-drawer";
|
|
20
|
-
|
|
21
|
-
// Types
|
|
22
|
-
import { Crumb } from "@evenicanpm/admin-integrate/components/breadcrumbs";
|
|
23
|
-
import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
24
|
-
|
|
25
|
-
export type DrawerOpen = {
|
|
26
|
-
id: string;
|
|
27
|
-
group?: boolean;
|
|
28
|
-
};
|
|
29
17
|
|
|
30
18
|
export default function Scheduler() {
|
|
31
19
|
const t = useTranslations("Integrate");
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
// MUI
|
|
4
|
-
import { Theme, useTheme } from "@mui/material";
|
|
5
|
-
import { Box, Stack, Typography } from "@mui/material";
|
|
6
|
-
import { RemoveRedEye } from "@mui/icons-material";
|
|
7
|
-
import { SxProps } from "@mui/material";
|
|
8
|
-
|
|
9
|
-
// Custom components
|
|
1
|
+
import { DateTimePopover } from "@evenicanpm/admin-integrate/components/core";
|
|
2
|
+
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
10
3
|
import {
|
|
4
|
+
StyledIconButton,
|
|
11
5
|
StyledTableCell,
|
|
12
6
|
StyledTableRow,
|
|
13
|
-
StyledIconButton,
|
|
14
7
|
} from "@evenicanpm/admin-integrate/components/data-table/table-row";
|
|
15
8
|
import {
|
|
9
|
+
type DayString,
|
|
16
10
|
DayTag,
|
|
11
|
+
dayKeys,
|
|
12
|
+
isDayMap,
|
|
17
13
|
ScheduleIcon,
|
|
18
14
|
} from "@evenicanpm/admin-integrate/components/scheduler";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
// Hooks
|
|
22
|
-
import useTimestamp from "@evenicanpm/admin-integrate/hooks/use-timestamp";
|
|
15
|
+
import type { DrawerOpen } from "@evenicanpm/admin-integrate/components/scheduler/schedule-drawer/schedule-drawer";
|
|
23
16
|
import useRecurrence from "@evenicanpm/admin-integrate/hooks/use-recurrence";
|
|
24
|
-
|
|
25
|
-
// Types
|
|
26
|
-
import { Item } from "./schedules-list";
|
|
27
|
-
import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
28
|
-
import { TableCellProps } from "@mui/material";
|
|
29
17
|
import {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} from "@
|
|
34
|
-
import {
|
|
18
|
+
toDistanceDate,
|
|
19
|
+
toShortDate,
|
|
20
|
+
} from "@evenicanpm/admin-integrate/utils/date-functions";
|
|
21
|
+
import { RemoveRedEye } from "@mui/icons-material";
|
|
22
|
+
import {
|
|
23
|
+
Box,
|
|
24
|
+
Stack,
|
|
25
|
+
type SxProps,
|
|
26
|
+
type TableCellProps,
|
|
27
|
+
type Theme,
|
|
28
|
+
Typography,
|
|
29
|
+
useTheme,
|
|
30
|
+
} from "@mui/material";
|
|
31
|
+
import type React from "react";
|
|
32
|
+
import { useState } from "react";
|
|
33
|
+
import type { Item } from "./schedules-list";
|
|
35
34
|
|
|
36
35
|
interface Props {
|
|
37
36
|
item: Item;
|
|
@@ -44,20 +43,11 @@ const SchedulesListRow: React.FC<Props> = (props: Props) => {
|
|
|
44
43
|
const theme = useTheme();
|
|
45
44
|
const styles = getStyles(theme);
|
|
46
45
|
|
|
47
|
-
// e.g. "xx days ago"
|
|
48
|
-
const modified = useTimestamp(props.item.modified);
|
|
49
|
-
const modifiedFull = new Date(props.item.modified).toString();
|
|
50
|
-
|
|
51
46
|
const recurrence = useRecurrence(
|
|
52
47
|
props.item.interval,
|
|
53
48
|
props.item.intervalUnitId,
|
|
54
49
|
);
|
|
55
50
|
|
|
56
|
-
const start = new Date(props.item.startDate);
|
|
57
|
-
const startDateLocale = start.toLocaleString().split(",")[0];
|
|
58
|
-
const startTimeLocale = start.toLocaleTimeString().slice(0, 5);
|
|
59
|
-
const startDateFull = start.toString();
|
|
60
|
-
|
|
61
51
|
const [modifiedAnchorEl, setModifiedAnchorEl] = useState<HTMLElement | null>(
|
|
62
52
|
null,
|
|
63
53
|
);
|
|
@@ -146,7 +136,7 @@ const SchedulesListRow: React.FC<Props> = (props: Props) => {
|
|
|
146
136
|
onMouseEnter={handlePopoverOpen}
|
|
147
137
|
onMouseLeave={handlePopoverClose}
|
|
148
138
|
>
|
|
149
|
-
{
|
|
139
|
+
{toShortDate(props.item.startDate)}
|
|
150
140
|
</Typography>
|
|
151
141
|
</StyledTableCell>
|
|
152
142
|
<StyledTableCell
|
|
@@ -159,7 +149,7 @@ const SchedulesListRow: React.FC<Props> = (props: Props) => {
|
|
|
159
149
|
onMouseEnter={handlePopoverOpen}
|
|
160
150
|
onMouseLeave={handlePopoverClose}
|
|
161
151
|
>
|
|
162
|
-
{modified}
|
|
152
|
+
{toDistanceDate(props.item.modified)}
|
|
163
153
|
</Typography>
|
|
164
154
|
</StyledTableCell>
|
|
165
155
|
<StyledTableCell
|
|
@@ -172,7 +162,7 @@ const SchedulesListRow: React.FC<Props> = (props: Props) => {
|
|
|
172
162
|
</StyledTableCell>
|
|
173
163
|
|
|
174
164
|
<DateTimePopover
|
|
175
|
-
dateIsoString={
|
|
165
|
+
dateIsoString={props.item.modified}
|
|
176
166
|
sx={{ pointerEvents: "none" }}
|
|
177
167
|
open={modifiedOpen}
|
|
178
168
|
anchorEl={modifiedAnchorEl}
|
|
@@ -188,7 +178,7 @@ const SchedulesListRow: React.FC<Props> = (props: Props) => {
|
|
|
188
178
|
disableRestoreFocus
|
|
189
179
|
/>
|
|
190
180
|
<DateTimePopover
|
|
191
|
-
dateIsoString={
|
|
181
|
+
dateIsoString={props.item.startDate}
|
|
192
182
|
sx={{ pointerEvents: "none" }}
|
|
193
183
|
open={startDateOpen}
|
|
194
184
|
anchorEl={startDateAnchorEl}
|
|
@@ -1,25 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
// Types
|
|
4
|
-
import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
5
|
-
import { Item } from "./schedules-list";
|
|
6
|
-
|
|
7
|
-
// API
|
|
8
|
-
import { ScheduledProcessInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
9
|
-
|
|
10
|
-
// MUI
|
|
11
|
-
import { TableContainer, Table, TableBody } from "@mui/material";
|
|
12
|
-
import { SxProps } from "@mui/material";
|
|
13
|
-
|
|
14
|
-
// Custom components
|
|
1
|
+
import type { ScheduledProcessInput } from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
15
2
|
import { TableHeader } from "@evenicanpm/admin-integrate/components/data-table";
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
4
|
+
import type { DrawerOpen } from "@evenicanpm/admin-integrate/components/scheduler/schedule-drawer/schedule-drawer";
|
|
5
|
+
import { type SxProps, Table, TableBody, TableContainer } from "@mui/material";
|
|
6
|
+
import type React from "react";
|
|
7
|
+
import type { Item } from "./schedules-list";
|
|
18
8
|
import SchedulesListRow from "./schedules-list-row";
|
|
19
9
|
|
|
20
|
-
// Types
|
|
21
|
-
import { DrawerOpen } from "../scheduler";
|
|
22
|
-
|
|
23
10
|
interface Props {
|
|
24
11
|
heading: Head[];
|
|
25
12
|
items: Item[];
|
|
@@ -47,28 +34,26 @@ export default function SchedulesListTable(props: Props) {
|
|
|
47
34
|
};
|
|
48
35
|
|
|
49
36
|
return (
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
</TableContainer>
|
|
72
|
-
</>
|
|
37
|
+
<TableContainer>
|
|
38
|
+
<Table>
|
|
39
|
+
<TableHeader
|
|
40
|
+
heading={props.heading}
|
|
41
|
+
orderBy={props.input.sort || ""}
|
|
42
|
+
order={props.input.sortDesc ? "desc" : "asc"}
|
|
43
|
+
onRequestSort={handleRequestSort}
|
|
44
|
+
/>
|
|
45
|
+
<TableBody>
|
|
46
|
+
{props.items.map((item) => (
|
|
47
|
+
<SchedulesListRow
|
|
48
|
+
key={item.id}
|
|
49
|
+
item={item}
|
|
50
|
+
heading={props.heading}
|
|
51
|
+
sx={props.rowSx}
|
|
52
|
+
setDrawerOpen={props.setDrawerOpen}
|
|
53
|
+
/>
|
|
54
|
+
))}
|
|
55
|
+
</TableBody>
|
|
56
|
+
</Table>
|
|
57
|
+
</TableContainer>
|
|
73
58
|
);
|
|
74
59
|
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useTranslations } from "next-intl";
|
|
3
|
-
|
|
4
|
-
// API
|
|
5
|
-
import {
|
|
6
|
-
ScheduledProcessInput,
|
|
1
|
+
import type {
|
|
7
2
|
GetScheduledProcessesQuery,
|
|
3
|
+
ScheduledProcessInput,
|
|
8
4
|
} from "@evenicanpm/admin-core/api/e4/graphqlRequestSdk";
|
|
9
|
-
|
|
10
|
-
// MUI
|
|
11
|
-
import { Theme, useTheme } from "@mui/material";
|
|
12
|
-
import { Card, Box, Stack, Typography, Grid2 as Grid } from "@mui/material";
|
|
13
|
-
|
|
14
|
-
// Custom components
|
|
15
5
|
import { FlexBox } from "@evenicanpm/admin-core/components/flex-box";
|
|
16
6
|
import {
|
|
17
7
|
TablePagination,
|
|
18
8
|
TableSkeleton,
|
|
19
9
|
} from "@evenicanpm/admin-integrate/components/data-table";
|
|
10
|
+
import type { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
20
11
|
import { ListFilter } from "@evenicanpm/admin-integrate/components/list-filter";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import SchedulesListTable from "./schedules-list-table";
|
|
24
|
-
|
|
25
|
-
// Types
|
|
26
|
-
import { Head } from "@evenicanpm/admin-integrate/components/data-table/table-header";
|
|
27
|
-
import { ListFilterOutput } from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
|
|
12
|
+
import type { ListFilterOutput } from "@evenicanpm/admin-integrate/components/list-filter/list-filter-types";
|
|
13
|
+
import type { DrawerOpen } from "@evenicanpm/admin-integrate/components/scheduler/schedule-drawer/schedule-drawer";
|
|
28
14
|
import {
|
|
29
|
-
SchedulesListFilters,
|
|
15
|
+
type SchedulesListFilters,
|
|
30
16
|
schedulesListFilters,
|
|
31
17
|
} from "@evenicanpm/admin-integrate/components/scheduler/schedule-filter";
|
|
32
|
-
import
|
|
18
|
+
import AddIcon from "@mui/icons-material/Add";
|
|
19
|
+
import {
|
|
20
|
+
Box,
|
|
21
|
+
Card,
|
|
22
|
+
Grid2 as Grid,
|
|
23
|
+
Stack,
|
|
24
|
+
type Theme,
|
|
25
|
+
Typography,
|
|
26
|
+
useTheme,
|
|
27
|
+
} from "@mui/material";
|
|
28
|
+
import Button from "@mui/material/Button";
|
|
29
|
+
import { useTranslations } from "next-intl";
|
|
30
|
+
import type React from "react";
|
|
31
|
+
import { useEffect, useState } from "react";
|
|
32
|
+
import SchedulesListTable from "./schedules-list-table";
|
|
33
33
|
|
|
34
34
|
export type Item = {
|
|
35
35
|
id: string;
|
|
@@ -124,6 +124,15 @@ const SchedulesList: React.FC<Props> = (props: Props) => {
|
|
|
124
124
|
}
|
|
125
125
|
}, [props.data]);
|
|
126
126
|
|
|
127
|
+
const handleMenuOpen = () => {
|
|
128
|
+
const newDrawerOpen: DrawerOpen = {
|
|
129
|
+
id: "",
|
|
130
|
+
group: true,
|
|
131
|
+
addMode: true,
|
|
132
|
+
};
|
|
133
|
+
props.setDrawerOpen(newDrawerOpen);
|
|
134
|
+
};
|
|
135
|
+
|
|
127
136
|
return (
|
|
128
137
|
<>
|
|
129
138
|
<Box sx={styles.list}>
|
|
@@ -138,6 +147,20 @@ const SchedulesList: React.FC<Props> = (props: Props) => {
|
|
|
138
147
|
},
|
|
139
148
|
}}
|
|
140
149
|
/>
|
|
150
|
+
<Button
|
|
151
|
+
variant="contained"
|
|
152
|
+
color="info"
|
|
153
|
+
startIcon={<AddIcon />}
|
|
154
|
+
onClick={handleMenuOpen}
|
|
155
|
+
sx={{
|
|
156
|
+
padding: theme.spacing(1, 2),
|
|
157
|
+
fontSize: ".89rem",
|
|
158
|
+
textTransform: "none",
|
|
159
|
+
borderRadius: 1,
|
|
160
|
+
}}
|
|
161
|
+
>
|
|
162
|
+
{t("addNew")}
|
|
163
|
+
</Button>
|
|
141
164
|
</Box>
|
|
142
165
|
|
|
143
166
|
{props.loading && !props.data && (
|
|
@@ -267,6 +290,10 @@ const getStyles = (theme: Theme) => {
|
|
|
267
290
|
},
|
|
268
291
|
list: {
|
|
269
292
|
margin: theme.spacing(2, 0),
|
|
293
|
+
display: "flex",
|
|
294
|
+
alignItems: "center",
|
|
295
|
+
justifyContent: "space-between",
|
|
296
|
+
width: "100%",
|
|
270
297
|
},
|
|
271
298
|
paginationBox: {
|
|
272
299
|
paddingLeft: theme.spacing(15),
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type FormatDistanceOptions,
|
|
3
|
+
type FormatDurationOptions,
|
|
4
|
+
type FormatOptions,
|
|
5
|
+
format,
|
|
6
|
+
formatDistanceStrict,
|
|
7
|
+
formatDuration,
|
|
8
|
+
} from "date-fns";
|
|
9
|
+
|
|
10
|
+
export function toShortDate(
|
|
11
|
+
dateString: string,
|
|
12
|
+
pattern: string = "Ppp",
|
|
13
|
+
options?: FormatOptions,
|
|
14
|
+
) {
|
|
15
|
+
try {
|
|
16
|
+
const date = new Date(dateString);
|
|
17
|
+
const formatted = format(date, pattern, options);
|
|
18
|
+
return formatted;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error(error);
|
|
21
|
+
return "N/A";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function toLongDate(dateString: string) {
|
|
26
|
+
try {
|
|
27
|
+
const date = new Date(dateString);
|
|
28
|
+
const formatted = date.toString();
|
|
29
|
+
return formatted;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(error);
|
|
32
|
+
return "N/A";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function toDistanceDate(
|
|
37
|
+
dateString: string,
|
|
38
|
+
options?: FormatDistanceOptions,
|
|
39
|
+
) {
|
|
40
|
+
try {
|
|
41
|
+
const date = new Date(dateString);
|
|
42
|
+
const now = new Date();
|
|
43
|
+
const formatted = formatDistanceStrict(now, date, options);
|
|
44
|
+
return formatted;
|
|
45
|
+
} catch (error) {
|
|
46
|
+
console.error(error);
|
|
47
|
+
return "N/A";
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function toDurationDate(
|
|
52
|
+
startDate: string,
|
|
53
|
+
endDate: string,
|
|
54
|
+
options?: FormatDurationOptions,
|
|
55
|
+
) {
|
|
56
|
+
try {
|
|
57
|
+
const start = new Date(startDate);
|
|
58
|
+
const end = new Date(endDate);
|
|
59
|
+
const seconds = Math.floor((end.getTime() - start.getTime()) / 1000);
|
|
60
|
+
const formatted = formatDuration(
|
|
61
|
+
{ seconds: seconds },
|
|
62
|
+
{ format: ["seconds"], ...options },
|
|
63
|
+
);
|
|
64
|
+
return formatted;
|
|
65
|
+
} catch (error) {
|
|
66
|
+
console.error(error);
|
|
67
|
+
return "";
|
|
68
|
+
}
|
|
69
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -15,10 +15,18 @@
|
|
|
15
15
|
"typeRoots": ["../../../../admin/node_modules/@types"],
|
|
16
16
|
"paths": {
|
|
17
17
|
"*": ["../../../../admin/node_modules/*"],
|
|
18
|
-
"@/lib/*": [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"@/
|
|
18
|
+
"@/lib/*": [
|
|
19
|
+
"../../../../admin/node_modules/@evenicanpm/admin-integrate/src/lib/*"
|
|
20
|
+
],
|
|
21
|
+
"@/auth/*": [
|
|
22
|
+
"../../../../admin/node_modules/@evenicanpm/admin-integrate/src/auth/*"
|
|
23
|
+
],
|
|
24
|
+
"@/api/*": [
|
|
25
|
+
"../../../../admin/node_modules/@evenicanpm/admin-integrate/src/api/*"
|
|
26
|
+
],
|
|
27
|
+
"@/components/*": [
|
|
28
|
+
"../../../../admin/node_modules/@evenicanpm/admin-integrate/src/components/*"
|
|
29
|
+
],
|
|
22
30
|
"@evenicanpm/admin-core/*": [
|
|
23
31
|
"../../../../admin/node_modules/@evenicanpm/admin-core/src/*"
|
|
24
32
|
],
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export default function useTimestamp(dateTime: string) {
|
|
2
|
-
const then = new Date(dateTime);
|
|
3
|
-
const diffTime = Date.now() - then.getTime();
|
|
4
|
-
const diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
|
5
|
-
|
|
6
|
-
let result: string;
|
|
7
|
-
if (diffDays === 0) {
|
|
8
|
-
const diffMin = Math.floor(diffTime / (1000 * 60));
|
|
9
|
-
if (diffMin === 0) {
|
|
10
|
-
result = "Now";
|
|
11
|
-
} else if (diffMin >= 60) {
|
|
12
|
-
result = Math.floor(diffTime / (1000 * 60 * 60)) + "h ago";
|
|
13
|
-
} else {
|
|
14
|
-
result = diffMin + "m ago";
|
|
15
|
-
}
|
|
16
|
-
} else {
|
|
17
|
-
if (diffDays === 1) {
|
|
18
|
-
result = "Yesterday";
|
|
19
|
-
} else {
|
|
20
|
-
result = diffDays + " days ago";
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return result;
|
|
25
|
-
}
|