@jsb188/mday-web 1.1.8 → 1.1.11
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/package.json +34 -18
- package/src/libs/route-metadata.server.ts +67 -0
- package/src/modules/AgentDocs.tsx +800 -0
- package/src/modules/DocAccessSettings.tsx +963 -0
- package/src/modules/Grids.tsx +842 -0
- package/src/modules/RouteShell.tsx +76 -0
- package/src/types/css.d.ts +1 -0
- package/src/utils/account-web.ts +64 -0
- package/src/utils/list-web.ts +17 -0
- package/src/utils/log-web.ts +550 -0
- package/src/utils/org-web.ts +67 -0
- package/src/utils/route-helpers.ts +938 -525
- package/src/utils/workflow-web.ts +96 -0
- package/tsconfig.json +11 -11
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import i18n from '@jsb188/app/i18n/index.ts';
|
|
2
|
+
import { getCronDescription } from '@jsb188/app/utils/cron.ts';
|
|
3
|
+
import { getFullDate } from '@jsb188/app/utils/datetime.ts';
|
|
4
|
+
import type { WorkflowGQL } from '@jsb188/mday/types/workflow.d.ts';
|
|
5
|
+
import {
|
|
6
|
+
getWorkflowShortLabel,
|
|
7
|
+
isRecurringReminder,
|
|
8
|
+
isWorkflowActive,
|
|
9
|
+
} from '@jsb188/mday/utils/workflow.ts';
|
|
10
|
+
import { COMMON_ICON_NAMES } from '@jsb188/react-web/svgs/Icon';
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Return the icon name used to represent one workflow trigger.
|
|
14
|
+
*/
|
|
15
|
+
export function getWorkflowIconName(workflow: WorkflowGQL) {
|
|
16
|
+
const firstLogType = workflow.logTypes?.[0];
|
|
17
|
+
|
|
18
|
+
return firstLogType
|
|
19
|
+
? COMMON_ICON_NAMES[firstLogType] || COMMON_ICON_NAMES.general_workflow
|
|
20
|
+
: COMMON_ICON_NAMES.general_workflow;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Return the formatted next run date for one workflow, or a table-friendly empty value.
|
|
25
|
+
*/
|
|
26
|
+
export function getWorkflowNextRunText(
|
|
27
|
+
workflow: WorkflowGQL,
|
|
28
|
+
timeZone: string | null,
|
|
29
|
+
) {
|
|
30
|
+
return workflow.nextAt
|
|
31
|
+
? getFullDate(workflow.nextAt, 'NUMERIC_TIME', timeZone)
|
|
32
|
+
: '-';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Return the schedule description for one reminder (cron text or one-time date).
|
|
37
|
+
*/
|
|
38
|
+
export function getReminderScheduleText(
|
|
39
|
+
reminder: Pick<WorkflowGQL, 'triggerType' | 'schedule' | 'nextAt'>,
|
|
40
|
+
timeZone: string | null,
|
|
41
|
+
) {
|
|
42
|
+
if (isRecurringReminder(reminder) && reminder.schedule) {
|
|
43
|
+
return getCronDescription(reminder.schedule, true);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return reminder.nextAt
|
|
47
|
+
? getFullDate(reminder.nextAt, 'NUMERIC_TIME', timeZone)
|
|
48
|
+
: '-';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* Return the short recipients summary for one reminder (names/addresses).
|
|
53
|
+
*/
|
|
54
|
+
export function getReminderRecipientsSummaryText(
|
|
55
|
+
reminder: Pick<WorkflowGQL, 'recipients'>,
|
|
56
|
+
) {
|
|
57
|
+
const labels = (reminder.recipients || [])
|
|
58
|
+
.map(
|
|
59
|
+
(recipient) => recipient.name || recipient.phone || recipient.email || '',
|
|
60
|
+
)
|
|
61
|
+
.filter(Boolean);
|
|
62
|
+
|
|
63
|
+
if (!labels.length) {
|
|
64
|
+
return '-';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (labels.length <= 2) {
|
|
68
|
+
return labels.join(', ');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return `${labels.slice(0, 2).join(', ')} +${labels.length - 2}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/*
|
|
75
|
+
* Return the modal header description for one workflow's current scheduling state.
|
|
76
|
+
*/
|
|
77
|
+
export function getWorkflowHeaderDescription(
|
|
78
|
+
workflow: WorkflowGQL,
|
|
79
|
+
timeZone: string | null,
|
|
80
|
+
) {
|
|
81
|
+
if (!isWorkflowActive(workflow)) {
|
|
82
|
+
return i18n.t('workflow.not_active_msg');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (workflow.nextAt) {
|
|
86
|
+
return `${i18n.t('form.next_run')}: ${getWorkflowNextRunText(workflow, timeZone)}`;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const logTypeShortLabel = workflow.logTypes?.length
|
|
90
|
+
? getWorkflowShortLabel(workflow)
|
|
91
|
+
: null;
|
|
92
|
+
|
|
93
|
+
return i18n.t('workflow.active_msg', {
|
|
94
|
+
logType: logTypeShortLabel?.toLowerCase(),
|
|
95
|
+
});
|
|
96
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"allowImportingTsExtensions": true,
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"esModuleInterop": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*"]
|
|
13
13
|
}
|