@vef-framework-react/cron 2.13.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/LICENSE +201 -0
- package/dist/cjs/_internal/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/api/index.cjs +1 -0
- package/dist/cjs/api/query.cjs +1 -0
- package/dist/cjs/api/run-api.cjs +1 -0
- package/dist/cjs/api/schedule-api.cjs +1 -0
- package/dist/cjs/components/duration.cjs +1 -0
- package/dist/cjs/components/format.cjs +1 -0
- package/dist/cjs/components/index.cjs +1 -0
- package/dist/cjs/components/status/colors.cjs +1 -0
- package/dist/cjs/components/status/index.cjs +1 -0
- package/dist/cjs/components/status/labels.cjs +1 -0
- package/dist/cjs/components/trigger-editor/helpers.cjs +1 -0
- package/dist/cjs/components/trigger-editor/index.cjs +1 -0
- package/dist/cjs/index.cjs +1 -0
- package/dist/cjs/pages/index.cjs +1 -0
- package/dist/cjs/pages/run-page/columns.cjs +1 -0
- package/dist/cjs/pages/run-page/detail.cjs +1 -0
- package/dist/cjs/pages/run-page/index.cjs +1 -0
- package/dist/cjs/pages/run-page/search.cjs +1 -0
- package/dist/cjs/pages/schedule-page/columns.cjs +1 -0
- package/dist/cjs/pages/schedule-page/form.cjs +1 -0
- package/dist/cjs/pages/schedule-page/helpers.cjs +1 -0
- package/dist/cjs/pages/schedule-page/index.cjs +1 -0
- package/dist/cjs/pages/schedule-page/model.cjs +1 -0
- package/dist/cjs/pages/schedule-page/search.cjs +1 -0
- package/dist/cjs/permissions.cjs +1 -0
- package/dist/cjs/types/enums.cjs +1 -0
- package/dist/cjs/types/index.cjs +1 -0
- package/dist/es/api/index.js +5 -0
- package/dist/es/api/query.js +13 -0
- package/dist/es/api/run-api.js +18 -0
- package/dist/es/api/schedule-api.js +32 -0
- package/dist/es/components/duration.js +68 -0
- package/dist/es/components/format.js +11 -0
- package/dist/es/components/index.js +9 -0
- package/dist/es/components/status/colors.js +13 -0
- package/dist/es/components/status/index.js +20 -0
- package/dist/es/components/status/labels.js +36 -0
- package/dist/es/components/trigger-editor/helpers.js +64 -0
- package/dist/es/components/trigger-editor/index.js +150 -0
- package/dist/es/index.js +19 -0
- package/dist/es/pages/index.js +7 -0
- package/dist/es/pages/run-page/columns.js +68 -0
- package/dist/es/pages/run-page/detail.js +117 -0
- package/dist/es/pages/run-page/index.js +36 -0
- package/dist/es/pages/run-page/search.js +96 -0
- package/dist/es/pages/schedule-page/columns.js +65 -0
- package/dist/es/pages/schedule-page/form.js +192 -0
- package/dist/es/pages/schedule-page/helpers.js +31 -0
- package/dist/es/pages/schedule-page/index.js +136 -0
- package/dist/es/pages/schedule-page/model.js +89 -0
- package/dist/es/pages/schedule-page/search.js +79 -0
- package/dist/es/permissions.js +11 -0
- package/dist/es/types/enums.js +17 -0
- package/dist/es/types/index.js +3 -0
- package/dist/types/api/index.d.ts +3 -0
- package/dist/types/api/query.d.ts +16 -0
- package/dist/types/api/run-api.d.ts +15 -0
- package/dist/types/api/schedule-api.d.ts +24 -0
- package/dist/types/components/duration.d.ts +33 -0
- package/dist/types/components/format.d.ts +10 -0
- package/dist/types/components/index.d.ts +7 -0
- package/dist/types/components/status/colors.d.ts +6 -0
- package/dist/types/components/status/index.d.ts +13 -0
- package/dist/types/components/status/labels.d.ts +24 -0
- package/dist/types/components/trigger-editor/helpers.d.ts +41 -0
- package/dist/types/components/trigger-editor/index.d.ts +18 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/pages/index.d.ts +7 -0
- package/dist/types/pages/run-page/columns.d.ts +3 -0
- package/dist/types/pages/run-page/detail.d.ts +9 -0
- package/dist/types/pages/run-page/index.d.ts +6 -0
- package/dist/types/pages/run-page/props.d.ts +11 -0
- package/dist/types/pages/run-page/search.d.ts +9 -0
- package/dist/types/pages/schedule-page/columns.d.ts +3 -0
- package/dist/types/pages/schedule-page/form.d.ts +4 -0
- package/dist/types/pages/schedule-page/helpers.d.ts +29 -0
- package/dist/types/pages/schedule-page/index.d.ts +7 -0
- package/dist/types/pages/schedule-page/model.d.ts +62 -0
- package/dist/types/pages/schedule-page/props.d.ts +16 -0
- package/dist/types/pages/schedule-page/search.d.ts +8 -0
- package/dist/types/permissions.d.ts +22 -0
- package/dist/types/types/base.d.ts +14 -0
- package/dist/types/types/enums.d.ts +29 -0
- package/dist/types/types/index.d.ts +5 -0
- package/dist/types/types/json.d.ts +8 -0
- package/dist/types/types/run.d.ts +38 -0
- package/dist/types/types/schedule.d.ts +98 -0
- package/package.json +66 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
import { formatTimestamp as e } from "../../components/format.js";
|
|
3
|
+
import { TRIGGER_KIND_LABELS as t } from "../../components/status/labels.js";
|
|
4
|
+
import { EnabledTag as n } from "../../components/status/index.js";
|
|
5
|
+
import { formatTriggerSummary as r } from "../../components/trigger-editor/helpers.js";
|
|
6
|
+
import { Tag as i, Text as a } from "@vef-framework-react/components";
|
|
7
|
+
import { jsx as o } from "@emotion/react/jsx-runtime";
|
|
8
|
+
//#region src/pages/schedule-page/columns.tsx
|
|
9
|
+
var s = {
|
|
10
|
+
cron: "blue",
|
|
11
|
+
interval: "geekblue",
|
|
12
|
+
once: "purple"
|
|
13
|
+
}, c = [
|
|
14
|
+
{
|
|
15
|
+
title: "名称",
|
|
16
|
+
dataIndex: "name",
|
|
17
|
+
width: 180,
|
|
18
|
+
render: (e) => /* @__PURE__ */ o(a, {
|
|
19
|
+
strong: !0,
|
|
20
|
+
children: e
|
|
21
|
+
})
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
title: "任务处理器",
|
|
25
|
+
dataIndex: "jobName",
|
|
26
|
+
width: 160
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
title: "触发方式",
|
|
30
|
+
dataIndex: "kind",
|
|
31
|
+
width: 110,
|
|
32
|
+
align: "center",
|
|
33
|
+
render: (e) => /* @__PURE__ */ o(i, {
|
|
34
|
+
color: s[e],
|
|
35
|
+
children: t[e]
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "trigger",
|
|
40
|
+
title: "触发规则",
|
|
41
|
+
minWidth: 220,
|
|
42
|
+
render: (e, t) => /* @__PURE__ */ o(a, { children: r(t) })
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: "状态",
|
|
46
|
+
dataIndex: "isEnabled",
|
|
47
|
+
width: 90,
|
|
48
|
+
align: "center",
|
|
49
|
+
render: (e) => /* @__PURE__ */ o(n, { enabled: e })
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "nextFireAt",
|
|
53
|
+
title: "下次触发",
|
|
54
|
+
width: 160,
|
|
55
|
+
render: (t, n) => n.isEnabled ? e(n.nextFireAt) : "-"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: "上次触发",
|
|
59
|
+
dataIndex: "lastFireAt",
|
|
60
|
+
width: 160,
|
|
61
|
+
render: e
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
//#endregion
|
|
65
|
+
export { c as scheduleColumns };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
import { CONCURRENCY_POLICY_OPTIONS as e, MISFIRE_POLICY_OPTIONS as t } from "../../components/status/labels.js";
|
|
3
|
+
import { isTriggerComplete as n } from "../../components/trigger-editor/helpers.js";
|
|
4
|
+
import { TriggerEditor as r } from "../../components/trigger-editor/index.js";
|
|
5
|
+
import { TIMEOUT_UNIT_OPTIONS as i, jsonParamsError as a } from "./model.js";
|
|
6
|
+
import { useJobNames as o } from "./helpers.js";
|
|
7
|
+
import { Flex as s, Grid as c, Labeled as l, Stack as u, Text as d, globalCssVars as f, useFormContext as p } from "@vef-framework-react/components";
|
|
8
|
+
import { jsx as m, jsxs as h } from "@emotion/react/jsx-runtime";
|
|
9
|
+
import { z as g } from "@vef-framework-react/shared";
|
|
10
|
+
//#region src/pages/schedule-page/form.tsx
|
|
11
|
+
var _ = "YYYY-MM-DD HH:mm:ss", v = g.string("请输入调度名称").min(1, "请输入调度名称").max(128, "最多 128 个字符"), y = g.string("请选择任务处理器").min(1, "请选择任务处理器"), b = {
|
|
12
|
+
fire_now: "错过后立即补跑一次",
|
|
13
|
+
skip: "跳过错过的触发"
|
|
14
|
+
}, x = {
|
|
15
|
+
forbid: "上次未结束则跳过",
|
|
16
|
+
allow: "允许并行"
|
|
17
|
+
};
|
|
18
|
+
function S() {
|
|
19
|
+
let g = p(), S = o();
|
|
20
|
+
return /* @__PURE__ */ m(u, {
|
|
21
|
+
gap: "middle",
|
|
22
|
+
children: /* @__PURE__ */ h(c, {
|
|
23
|
+
columnGap: "small",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ m(c.Item, {
|
|
26
|
+
span: 12,
|
|
27
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
28
|
+
name: "name",
|
|
29
|
+
validators: { onBlur: v },
|
|
30
|
+
children: (e) => /* @__PURE__ */ m(e.Input, {
|
|
31
|
+
required: !0,
|
|
32
|
+
extra: "唯一标识;编辑时修改即为重命名",
|
|
33
|
+
label: "名称",
|
|
34
|
+
placeholder: "如 nightly-sync"
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ m(c.Item, {
|
|
39
|
+
span: 12,
|
|
40
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
41
|
+
name: "jobName",
|
|
42
|
+
validators: { onChange: y },
|
|
43
|
+
children: (e) => /* @__PURE__ */ m(e.Select, {
|
|
44
|
+
required: !0,
|
|
45
|
+
showSearch: !0,
|
|
46
|
+
label: "任务处理器",
|
|
47
|
+
loading: S.loading,
|
|
48
|
+
options: S.options,
|
|
49
|
+
placeholder: "选择已注册的任务处理器"
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
}),
|
|
53
|
+
/* @__PURE__ */ m(c.Item, {
|
|
54
|
+
span: 24,
|
|
55
|
+
children: /* @__PURE__ */ m(g.Subscribe, {
|
|
56
|
+
selector: (e) => ({
|
|
57
|
+
startsAt: e.values.startsAt,
|
|
58
|
+
endsAt: e.values.endsAt
|
|
59
|
+
}),
|
|
60
|
+
children: ({ startsAt: e, endsAt: t }) => /* @__PURE__ */ m(g.AppField, {
|
|
61
|
+
name: "trigger",
|
|
62
|
+
validators: { onChange: ({ value: e }) => n(e) ? void 0 : "请完善触发配置" },
|
|
63
|
+
children: (i) => /* @__PURE__ */ h(l, {
|
|
64
|
+
required: !0,
|
|
65
|
+
label: "触发规则",
|
|
66
|
+
children: [/* @__PURE__ */ m(r, {
|
|
67
|
+
endsAt: t,
|
|
68
|
+
startsAt: e,
|
|
69
|
+
value: i.state.value,
|
|
70
|
+
onChange: i.handleChange
|
|
71
|
+
}), i.state.meta.isTouched && !n(i.state.value) ? /* @__PURE__ */ m(d, {
|
|
72
|
+
style: { fontSize: f.fontSizeSm },
|
|
73
|
+
type: "danger",
|
|
74
|
+
children: "请完善触发配置后再保存"
|
|
75
|
+
}) : null]
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
}),
|
|
80
|
+
/* @__PURE__ */ m(c.Item, {
|
|
81
|
+
span: 12,
|
|
82
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
83
|
+
name: "startsAt",
|
|
84
|
+
children: (e) => /* @__PURE__ */ m(e.DatePicker, {
|
|
85
|
+
showTime: !0,
|
|
86
|
+
format: _,
|
|
87
|
+
label: "生效开始",
|
|
88
|
+
placeholder: "留空则立即生效"
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ m(c.Item, {
|
|
93
|
+
span: 12,
|
|
94
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
95
|
+
name: "endsAt",
|
|
96
|
+
children: (e) => /* @__PURE__ */ m(e.DatePicker, {
|
|
97
|
+
showTime: !0,
|
|
98
|
+
format: _,
|
|
99
|
+
label: "生效结束",
|
|
100
|
+
placeholder: "留空则长期有效"
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ m(c.Item, {
|
|
105
|
+
span: 12,
|
|
106
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
107
|
+
name: "misfirePolicy",
|
|
108
|
+
children: (e) => /* @__PURE__ */ m(e.Select, {
|
|
109
|
+
extra: b[e.state.value],
|
|
110
|
+
label: "错过策略",
|
|
111
|
+
options: t
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
/* @__PURE__ */ m(c.Item, {
|
|
116
|
+
span: 12,
|
|
117
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
118
|
+
name: "concurrencyPolicy",
|
|
119
|
+
children: (t) => /* @__PURE__ */ m(t.Select, {
|
|
120
|
+
extra: x[t.state.value],
|
|
121
|
+
label: "并发策略",
|
|
122
|
+
options: e
|
|
123
|
+
})
|
|
124
|
+
})
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ m(c.Item, {
|
|
127
|
+
span: 12,
|
|
128
|
+
children: /* @__PURE__ */ m(l, {
|
|
129
|
+
hint: "0 表示使用全局默认",
|
|
130
|
+
label: "执行超时",
|
|
131
|
+
children: /* @__PURE__ */ h(s, {
|
|
132
|
+
gap: "small",
|
|
133
|
+
children: [/* @__PURE__ */ m(g.AppField, {
|
|
134
|
+
name: "timeoutValue",
|
|
135
|
+
children: (e) => /* @__PURE__ */ m(e.InputNumber, {
|
|
136
|
+
noWrapper: !0,
|
|
137
|
+
min: 0,
|
|
138
|
+
style: { flex: 1 }
|
|
139
|
+
})
|
|
140
|
+
}), /* @__PURE__ */ m(g.AppField, {
|
|
141
|
+
name: "timeoutUnit",
|
|
142
|
+
children: (e) => /* @__PURE__ */ m(e.Select, {
|
|
143
|
+
noWrapper: !0,
|
|
144
|
+
options: i,
|
|
145
|
+
style: { width: 100 }
|
|
146
|
+
})
|
|
147
|
+
})]
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
}),
|
|
151
|
+
/* @__PURE__ */ m(c.Item, {
|
|
152
|
+
span: 12,
|
|
153
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
154
|
+
name: "recover",
|
|
155
|
+
children: (e) => /* @__PURE__ */ m(e.Bool, {
|
|
156
|
+
extra: "节点崩溃后重新触发,处理器需保证幂等",
|
|
157
|
+
label: "崩溃恢复",
|
|
158
|
+
variant: "switch"
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
}),
|
|
162
|
+
/* @__PURE__ */ m(c.Item, {
|
|
163
|
+
span: 24,
|
|
164
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
165
|
+
name: "paramsText",
|
|
166
|
+
validators: { onChange: ({ value: e }) => a(e) },
|
|
167
|
+
children: (e) => /* @__PURE__ */ m(e.CodeEditor, {
|
|
168
|
+
showLineNumbers: !0,
|
|
169
|
+
extra: "JSON 对象,留空表示无参数",
|
|
170
|
+
height: 140,
|
|
171
|
+
label: "任务参数",
|
|
172
|
+
language: "json",
|
|
173
|
+
placeholder: "如 { \"batchSize\": 100 }"
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
}),
|
|
177
|
+
/* @__PURE__ */ m(c.Item, {
|
|
178
|
+
span: 24,
|
|
179
|
+
children: /* @__PURE__ */ m(g.AppField, {
|
|
180
|
+
name: "enabled",
|
|
181
|
+
children: (e) => /* @__PURE__ */ m(e.Bool, {
|
|
182
|
+
label: "启用",
|
|
183
|
+
variant: "switch"
|
|
184
|
+
})
|
|
185
|
+
})
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
})
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
//#endregion
|
|
192
|
+
export { S as ScheduleForm };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
import { API_PATH as e } from "../../api/query.js";
|
|
3
|
+
import { useScheduleApi as t } from "../../api/schedule-api.js";
|
|
4
|
+
import { scheduleToParams as n } from "./model.js";
|
|
5
|
+
import { createCrudKit as r } from "@vef-framework-react/components";
|
|
6
|
+
import { createApiRequest as i, useApiClient as a, useQuery as o } from "@vef-framework-react/core";
|
|
7
|
+
import { useMemo as s } from "react";
|
|
8
|
+
//#region src/pages/schedule-page/helpers.ts
|
|
9
|
+
var c = "sys/cron/schedule", l = r(), u = l.OperationButtonGroup, d = l.ActionButtonGroup;
|
|
10
|
+
function f() {
|
|
11
|
+
let t = a();
|
|
12
|
+
return s(() => ({
|
|
13
|
+
create: t.createMutationFn("cron_schedule_form_create", ({ post: t }) => (r) => t(e, { data: i(c, "create", n(r)) })),
|
|
14
|
+
update: t.createMutationFn("cron_schedule_form_update", ({ post: t }) => (r) => t(e, { data: i(c, "update", n(r)) }))
|
|
15
|
+
}), [t]);
|
|
16
|
+
}
|
|
17
|
+
function p() {
|
|
18
|
+
let e = t(), { data: n, isLoading: r } = o({
|
|
19
|
+
queryFn: e.listJobs,
|
|
20
|
+
queryKey: [e.listJobs.key]
|
|
21
|
+
});
|
|
22
|
+
return s(() => ({
|
|
23
|
+
options: (n ?? []).map((e) => ({
|
|
24
|
+
label: e,
|
|
25
|
+
value: e
|
|
26
|
+
})),
|
|
27
|
+
loading: r
|
|
28
|
+
}), [n, r]);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { d as ScheduleActionButtonGroup, u as ScheduleOperationButtonGroup, p as useJobNames, f as useScheduleFormMutations };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
import { useScheduleApi as e } from "../../api/schedule-api.js";
|
|
3
|
+
import { CRON_PERMISSIONS as t } from "../../permissions.js";
|
|
4
|
+
import { scheduleColumns as n } from "./columns.js";
|
|
5
|
+
import { SCHEDULE_FORM_DEFAULTS as r, scheduleToFormValues as i } from "./model.js";
|
|
6
|
+
import { ScheduleActionButtonGroup as a, ScheduleOperationButtonGroup as o, useScheduleFormMutations as s } from "./helpers.js";
|
|
7
|
+
import { ScheduleForm as c } from "./form.js";
|
|
8
|
+
import { ScheduleAdvancedSearchFields as l, ScheduleSearchFields as u } from "./search.js";
|
|
9
|
+
import { ActionButton as d, CrudPage as f, Icon as p, OperationButton as m, PermissionGate as h, showSuccessMessage as g } from "@vef-framework-react/components";
|
|
10
|
+
import { useMutation as _ } from "@vef-framework-react/core";
|
|
11
|
+
import { Fragment as v, jsx as y, jsxs as b } from "@emotion/react/jsx-runtime";
|
|
12
|
+
import { EditIcon as x, PauseIcon as S, PlayIcon as C, PlusIcon as w, TrashIcon as T, ZapIcon as E } from "lucide-react";
|
|
13
|
+
//#region src/pages/schedule-page/index.tsx
|
|
14
|
+
var D = {
|
|
15
|
+
xxs: "100vw",
|
|
16
|
+
md: "80vw",
|
|
17
|
+
lg: 680
|
|
18
|
+
};
|
|
19
|
+
function O({ row: t, perms: n }) {
|
|
20
|
+
let r = e(), a = _({ mutationFn: r.pause }), s = _({ mutationFn: r.resume }), c = _({ mutationFn: r.triggerNow });
|
|
21
|
+
return /* @__PURE__ */ y(o, {
|
|
22
|
+
selector: (e) => [
|
|
23
|
+
e.openForm,
|
|
24
|
+
e.delete,
|
|
25
|
+
e.refetchQuery
|
|
26
|
+
],
|
|
27
|
+
children: ([e, r, o]) => /* @__PURE__ */ b(v, { children: [
|
|
28
|
+
/* @__PURE__ */ y(m, {
|
|
29
|
+
color: "primary",
|
|
30
|
+
icon: /* @__PURE__ */ y(p, { component: x }),
|
|
31
|
+
requiredPermissions: n.manage,
|
|
32
|
+
onClick: () => e({
|
|
33
|
+
scene: "update",
|
|
34
|
+
values: i(t),
|
|
35
|
+
title: "编辑调度",
|
|
36
|
+
mode: "drawer",
|
|
37
|
+
width: D
|
|
38
|
+
}),
|
|
39
|
+
children: "编辑"
|
|
40
|
+
}),
|
|
41
|
+
t.isEnabled ? /* @__PURE__ */ y(m, {
|
|
42
|
+
color: "orange",
|
|
43
|
+
icon: /* @__PURE__ */ y(p, { component: S }),
|
|
44
|
+
requiredPermissions: n.manage,
|
|
45
|
+
onClick: async () => {
|
|
46
|
+
try {
|
|
47
|
+
await a.mutateAsync({ name: t.name }), g("已暂停"), o();
|
|
48
|
+
} catch {}
|
|
49
|
+
},
|
|
50
|
+
children: "暂停"
|
|
51
|
+
}) : /* @__PURE__ */ y(m, {
|
|
52
|
+
color: "primary",
|
|
53
|
+
icon: /* @__PURE__ */ y(p, { component: C }),
|
|
54
|
+
requiredPermissions: n.manage,
|
|
55
|
+
onClick: async () => {
|
|
56
|
+
try {
|
|
57
|
+
await s.mutateAsync({ name: t.name }), g("已恢复"), o();
|
|
58
|
+
} catch {}
|
|
59
|
+
},
|
|
60
|
+
children: "恢复"
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ y(m, {
|
|
63
|
+
confirmable: !0,
|
|
64
|
+
color: "purple",
|
|
65
|
+
confirmDescription: "将通过正常的领取流程立即触发一次执行。",
|
|
66
|
+
icon: /* @__PURE__ */ y(p, { component: E }),
|
|
67
|
+
requiredPermissions: n.manage,
|
|
68
|
+
onClick: async () => {
|
|
69
|
+
try {
|
|
70
|
+
await c.mutateAsync({ name: t.name }), g("已触发一次执行"), o();
|
|
71
|
+
} catch {}
|
|
72
|
+
},
|
|
73
|
+
children: "立即执行"
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ y(m, {
|
|
76
|
+
confirmable: !0,
|
|
77
|
+
color: "danger",
|
|
78
|
+
confirmDescription: "删除后该调度不再触发;历史运行记录仍会保留。",
|
|
79
|
+
icon: /* @__PURE__ */ y(p, { component: T }),
|
|
80
|
+
requiredPermissions: n.manage,
|
|
81
|
+
onClick: async () => {
|
|
82
|
+
try {
|
|
83
|
+
await r(t), o();
|
|
84
|
+
} catch {}
|
|
85
|
+
},
|
|
86
|
+
children: "删除"
|
|
87
|
+
})
|
|
88
|
+
] })
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function k({ permissions: i, columnStorageKey: o = "cron.schedule", title: m }) {
|
|
92
|
+
let g = e(), _ = s(), v = {
|
|
93
|
+
...t.schedule,
|
|
94
|
+
...i
|
|
95
|
+
};
|
|
96
|
+
return /* @__PURE__ */ y(f, {
|
|
97
|
+
advancedSearch: /* @__PURE__ */ y(l, {}),
|
|
98
|
+
basicSearch: /* @__PURE__ */ y(u, {}),
|
|
99
|
+
columnSettings: { storageKey: o },
|
|
100
|
+
deleteMutationFn: g.remove,
|
|
101
|
+
formLayout: { layout: "vertical" },
|
|
102
|
+
formMutationFns: _,
|
|
103
|
+
operationColumn: {
|
|
104
|
+
width: 280,
|
|
105
|
+
render: (e) => /* @__PURE__ */ y(O, {
|
|
106
|
+
perms: v,
|
|
107
|
+
row: e
|
|
108
|
+
})
|
|
109
|
+
},
|
|
110
|
+
queryFn: g.findPage,
|
|
111
|
+
renderForm: () => /* @__PURE__ */ y(c, {}),
|
|
112
|
+
rowKey: "id",
|
|
113
|
+
sceneDefaultFormValues: { create: r },
|
|
114
|
+
tableColumns: n,
|
|
115
|
+
title: m,
|
|
116
|
+
toolbarActions: /* @__PURE__ */ y(a, {
|
|
117
|
+
selector: (e) => [e.openForm],
|
|
118
|
+
children: ([e]) => /* @__PURE__ */ y(h, {
|
|
119
|
+
requiredPermissions: v.manage,
|
|
120
|
+
children: /* @__PURE__ */ y(d, {
|
|
121
|
+
icon: /* @__PURE__ */ y(p, { component: w }),
|
|
122
|
+
type: "primary",
|
|
123
|
+
onClick: () => e({
|
|
124
|
+
scene: "create",
|
|
125
|
+
title: "新增调度",
|
|
126
|
+
mode: "drawer",
|
|
127
|
+
width: D
|
|
128
|
+
}),
|
|
129
|
+
children: "新增调度"
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { k as CronSchedulePage };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
import { TIMEOUT_UNITS as e, combineDurationMs as t, splitDurationMs as n } from "../../components/duration.js";
|
|
3
|
+
import { DEFAULT_TRIGGER as r, triggerFormToParams as i, triggerToFormValues as a } from "../../components/trigger-editor/helpers.js";
|
|
4
|
+
//#region src/pages/schedule-page/model.ts
|
|
5
|
+
function o(e) {
|
|
6
|
+
let t = e.trim();
|
|
7
|
+
if (!t) return {
|
|
8
|
+
ok: !0,
|
|
9
|
+
value: void 0
|
|
10
|
+
};
|
|
11
|
+
let n;
|
|
12
|
+
try {
|
|
13
|
+
n = JSON.parse(t);
|
|
14
|
+
} catch {
|
|
15
|
+
return {
|
|
16
|
+
ok: !1,
|
|
17
|
+
error: "任务参数不是合法的 JSON"
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return typeof n != "object" || !n || Array.isArray(n) ? {
|
|
21
|
+
ok: !1,
|
|
22
|
+
error: "任务参数必须是 JSON 对象"
|
|
23
|
+
} : {
|
|
24
|
+
ok: !0,
|
|
25
|
+
value: n
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function s(e) {
|
|
29
|
+
let t = o(e);
|
|
30
|
+
return t.ok ? void 0 : t.error;
|
|
31
|
+
}
|
|
32
|
+
function c(t) {
|
|
33
|
+
let r = t.timeoutMs > 0 ? n(t.timeoutMs, e) : {
|
|
34
|
+
value: 0,
|
|
35
|
+
unit: "second"
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
id: t.id,
|
|
39
|
+
originalName: t.name,
|
|
40
|
+
name: t.name,
|
|
41
|
+
jobName: t.jobName,
|
|
42
|
+
trigger: a(t),
|
|
43
|
+
startsAt: t.startsAt ?? "",
|
|
44
|
+
endsAt: t.endsAt ?? "",
|
|
45
|
+
misfirePolicy: t.misfirePolicy,
|
|
46
|
+
concurrencyPolicy: t.concurrencyPolicy,
|
|
47
|
+
recover: t.recover,
|
|
48
|
+
timeoutValue: r.value,
|
|
49
|
+
timeoutUnit: r.unit,
|
|
50
|
+
paramsText: t.params ? JSON.stringify(t.params, null, 2) : "",
|
|
51
|
+
enabled: t.isEnabled
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function l(n) {
|
|
55
|
+
let r = !!n.originalName && n.originalName !== n.name, a = o(n.paramsText);
|
|
56
|
+
return {
|
|
57
|
+
name: n.originalName ?? n.name,
|
|
58
|
+
newName: r ? n.name : void 0,
|
|
59
|
+
jobName: n.jobName,
|
|
60
|
+
trigger: i(n.trigger),
|
|
61
|
+
params: a.ok ? a.value : void 0,
|
|
62
|
+
startsAt: n.startsAt || void 0,
|
|
63
|
+
endsAt: n.endsAt || void 0,
|
|
64
|
+
misfirePolicy: n.misfirePolicy,
|
|
65
|
+
concurrencyPolicy: n.concurrencyPolicy,
|
|
66
|
+
recover: n.recover,
|
|
67
|
+
timeoutMs: t(n.timeoutValue, n.timeoutUnit, e),
|
|
68
|
+
enabled: n.enabled
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
var u = {
|
|
72
|
+
name: "",
|
|
73
|
+
jobName: "",
|
|
74
|
+
trigger: { ...r },
|
|
75
|
+
startsAt: "",
|
|
76
|
+
endsAt: "",
|
|
77
|
+
misfirePolicy: "fire_now",
|
|
78
|
+
concurrencyPolicy: "forbid",
|
|
79
|
+
recover: !1,
|
|
80
|
+
timeoutValue: 0,
|
|
81
|
+
timeoutUnit: "second",
|
|
82
|
+
paramsText: "",
|
|
83
|
+
enabled: !0
|
|
84
|
+
}, d = e.map((e) => ({
|
|
85
|
+
label: e.label,
|
|
86
|
+
value: e.value
|
|
87
|
+
}));
|
|
88
|
+
//#endregion
|
|
89
|
+
export { u as SCHEDULE_FORM_DEFAULTS, d as TIMEOUT_UNIT_OPTIONS, s as jsonParamsError, o as parseJsonParams, c as scheduleToFormValues, l as scheduleToParams };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
import { TRIGGER_KIND_OPTIONS as e } from "../../components/status/labels.js";
|
|
3
|
+
import { useJobNames as t } from "./helpers.js";
|
|
4
|
+
import { Col as n, Row as r, useFormContext as i } from "@vef-framework-react/components";
|
|
5
|
+
import { jsx as a, jsxs as o } from "@emotion/react/jsx-runtime";
|
|
6
|
+
//#region src/pages/schedule-page/search.tsx
|
|
7
|
+
var s = [{
|
|
8
|
+
label: "启用",
|
|
9
|
+
value: "true"
|
|
10
|
+
}, {
|
|
11
|
+
label: "停用",
|
|
12
|
+
value: "false"
|
|
13
|
+
}];
|
|
14
|
+
function c() {
|
|
15
|
+
let { AppField: e } = i();
|
|
16
|
+
return /* @__PURE__ */ a(e, {
|
|
17
|
+
name: "name",
|
|
18
|
+
children: (e) => /* @__PURE__ */ a(e.Input, {
|
|
19
|
+
allowClear: !0,
|
|
20
|
+
noWrapper: !0,
|
|
21
|
+
placeholder: "名称",
|
|
22
|
+
style: { width: 160 }
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function l() {
|
|
27
|
+
let { AppField: c } = i(), l = t();
|
|
28
|
+
return /* @__PURE__ */ o(r, {
|
|
29
|
+
gutter: ["var(--vef-spacing-md)", "var(--vef-spacing-md)"],
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ a(n, {
|
|
32
|
+
lg: 8,
|
|
33
|
+
md: 12,
|
|
34
|
+
xs: 24,
|
|
35
|
+
children: /* @__PURE__ */ a(c, {
|
|
36
|
+
name: "jobName",
|
|
37
|
+
children: (e) => /* @__PURE__ */ a(e.Select, {
|
|
38
|
+
allowClear: !0,
|
|
39
|
+
showSearch: !0,
|
|
40
|
+
label: "任务处理器",
|
|
41
|
+
loading: l.loading,
|
|
42
|
+
options: l.options,
|
|
43
|
+
placeholder: "任务处理器"
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ a(n, {
|
|
48
|
+
lg: 8,
|
|
49
|
+
md: 12,
|
|
50
|
+
xs: 24,
|
|
51
|
+
children: /* @__PURE__ */ a(c, {
|
|
52
|
+
name: "kind",
|
|
53
|
+
children: (t) => /* @__PURE__ */ a(t.Select, {
|
|
54
|
+
allowClear: !0,
|
|
55
|
+
label: "触发方式",
|
|
56
|
+
options: e,
|
|
57
|
+
placeholder: "触发方式"
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
}),
|
|
61
|
+
/* @__PURE__ */ a(n, {
|
|
62
|
+
lg: 8,
|
|
63
|
+
md: 12,
|
|
64
|
+
xs: 24,
|
|
65
|
+
children: /* @__PURE__ */ a(c, {
|
|
66
|
+
name: "isEnabled",
|
|
67
|
+
children: (e) => /* @__PURE__ */ a(e.Select, {
|
|
68
|
+
allowClear: !0,
|
|
69
|
+
label: "状态",
|
|
70
|
+
options: s,
|
|
71
|
+
placeholder: "状态"
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { l as ScheduleAdvancedSearchFields, c as ScheduleSearchFields };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
//#region src/permissions.ts
|
|
3
|
+
var e = {
|
|
4
|
+
schedule: {
|
|
5
|
+
query: "cron.schedule.query",
|
|
6
|
+
manage: "cron.schedule.manage"
|
|
7
|
+
},
|
|
8
|
+
run: { query: "cron.run.query" }
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as CRON_PERMISSIONS };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
//#region src/types/enums.ts
|
|
3
|
+
var e = [
|
|
4
|
+
"cron",
|
|
5
|
+
"interval",
|
|
6
|
+
"once"
|
|
7
|
+
], t = ["fire_now", "skip"], n = ["forbid", "allow"], r = [
|
|
8
|
+
"running",
|
|
9
|
+
"succeeded",
|
|
10
|
+
"failed",
|
|
11
|
+
"missed",
|
|
12
|
+
"skipped",
|
|
13
|
+
"abandoned",
|
|
14
|
+
"canceled"
|
|
15
|
+
];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { n as CONCURRENCY_POLICIES, t as MISFIRE_POLICIES, r as RUN_STATUSES, e as TRIGGER_KINDS };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! @vef-framework-react/cron v2.13.0 made by Venus | 2026-07-21T07:15:48.744Z */
|
|
2
|
+
import { CONCURRENCY_POLICIES as e, MISFIRE_POLICIES as t, RUN_STATUSES as n, TRIGGER_KINDS as r } from "./enums.js";
|
|
3
|
+
export { e as CONCURRENCY_POLICIES, t as MISFIRE_POLICIES, n as RUN_STATUSES, r as TRIGGER_KINDS };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PaginatedQueryParams, SYMBOL_PAGINATION } from '@vef-framework-react/components';
|
|
2
|
+
import { PaginationParams } from '@vef-framework-react/core';
|
|
3
|
+
import { AnyObject } from '@vef-framework-react/shared';
|
|
4
|
+
/**
|
|
5
|
+
* The framework RPC endpoint every management call posts to.
|
|
6
|
+
*/
|
|
7
|
+
export declare const API_PATH = "/api";
|
|
8
|
+
/**
|
|
9
|
+
* Split ProTable's symbol-keyed query params into the plain search params and
|
|
10
|
+
* the pagination metadata. The sort symbol is left on `params`; JSON
|
|
11
|
+
* serialization drops it, so it never reaches the wire.
|
|
12
|
+
*/
|
|
13
|
+
export declare function splitQueryParams<TSearch extends AnyObject>(queryParams: PaginatedQueryParams<TSearch>): {
|
|
14
|
+
params: Omit<PaginatedQueryParams<TSearch>, typeof SYMBOL_PAGINATION>;
|
|
15
|
+
pagination: PaginationParams | undefined;
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PaginatedQueryParams } from '@vef-framework-react/components';
|
|
2
|
+
import { PaginationResult, QueryFunction } from '@vef-framework-react/core';
|
|
3
|
+
import { Run, RunIdParams, RunSearch } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* The read-only query functions for the run journal resource.
|
|
6
|
+
*/
|
|
7
|
+
export interface RunApi {
|
|
8
|
+
findPage: QueryFunction<PaginationResult<Run>, PaginatedQueryParams<RunSearch>>;
|
|
9
|
+
findOne: QueryFunction<Run, RunIdParams>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Query API for the run journal. The detail view refetches the full row
|
|
13
|
+
* through `find_one` so it always shows the complete, untruncated error text.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useRunApi(): RunApi;
|