@evolver-fi/evolver-basics-admin-components 0.0.19-beta.1 → 0.0.20
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/dist/EnumSelectFilter-DiJhYa2m.js +40 -0
- package/dist/EnumSelectFilter-DiJhYa2m.js.map +1 -0
- package/dist/{ExpandMore-CFLBmfHS.js → ExpandMore-D6gf2UVG.js} +2 -2
- package/dist/{ExpandMore-CFLBmfHS.js.map → ExpandMore-D6gf2UVG.js.map} +1 -1
- package/dist/FilterLink-CHw7-m82.js +43 -0
- package/dist/FilterLink-CHw7-m82.js.map +1 -0
- package/dist/{JwtTokensRoute-CavNQu9F.js → JwtTokensRoute-B3SgLM0q.js} +8 -7
- package/dist/{JwtTokensRoute-CavNQu9F.js.map → JwtTokensRoute-B3SgLM0q.js.map} +1 -1
- package/dist/ScheduledTasksRoute-CNhOAAKd.js +1152 -0
- package/dist/ScheduledTasksRoute-CNhOAAKd.js.map +1 -0
- package/dist/SingleLogMessageRoute-C9CL51r-.js +274 -0
- package/dist/SingleLogMessageRoute-C9CL51r-.js.map +1 -0
- package/dist/SingleMessageRoute-DaaWvgfS.js +293 -0
- package/dist/SingleMessageRoute-DaaWvgfS.js.map +1 -0
- package/dist/Table-DgRqEB1x.js +154 -0
- package/dist/Table-DgRqEB1x.js.map +1 -0
- package/dist/TableMetadataDisplay-C7RP2ZrM.js +122 -0
- package/dist/TableMetadataDisplay-C7RP2ZrM.js.map +1 -0
- package/dist/TextFilter-BKUfkFQe.js +70 -0
- package/dist/TextFilter-BKUfkFQe.js.map +1 -0
- package/dist/{TriggerablesRoute-BY72XS5U.js → TriggerablesRoute-opCAjNCv.js} +1075 -1055
- package/dist/TriggerablesRoute-opCAjNCv.js.map +1 -0
- package/dist/createSvgIcon-Cf1cru4R.js +3945 -0
- package/dist/createSvgIcon-Cf1cru4R.js.map +1 -0
- package/dist/evolverClient-B_TZXnpV.js +1602 -0
- package/dist/evolverClient-B_TZXnpV.js.map +1 -0
- package/dist/filter/index.js +11 -0
- package/dist/filter/index.js.map +1 -0
- package/dist/jwt-tokens/index.js +1 -1
- package/dist/main/index.js +48 -31
- package/dist/main/index.js.map +1 -1
- package/dist/message-log/index.js +1 -1
- package/dist/message-sending/index.js +1 -1
- package/dist/{parser-CI353PAC.js → parser-Bj3mcA83.js} +2 -2
- package/dist/{parser-CI353PAC.js.map → parser-Bj3mcA83.js.map} +1 -1
- package/dist/scheduled-tasks/index.js +9 -5
- package/dist/table/index.js +6 -0
- package/dist/table/index.js.map +1 -0
- package/dist/triggerables/index.js +5 -3
- package/dist/types/admin-components/src/components/filter/index.d.ts +5 -0
- package/dist/types/admin-components/src/components/table/index.d.ts +3 -0
- package/dist/types/admin-components/src/index.d.ts +3 -1
- package/dist/types/admin-components/src/routes/jwt-tokens/JwtTokensRoute.d.ts +1 -1
- package/dist/types/admin-components/src/routes/scheduled-tasks/action.d.ts +20 -0
- package/dist/types/admin-components/src/routes/scheduled-tasks/index.d.ts +3 -2
- package/dist/types/admin-components/src/routes/triggerables/action.d.ts +10 -0
- package/dist/types/admin-components/src/routes/triggerables/index.d.ts +2 -1
- package/dist/types/filter.d.ts +2 -0
- package/dist/types/table.d.ts +2 -0
- package/dist/{validation-BRENvwZ0.js → validation-DStiilqx.js} +2 -2
- package/dist/{validation-BRENvwZ0.js.map → validation-DStiilqx.js.map} +1 -1
- package/package.json +9 -1
- package/dist/ScheduledTaskFormRoute-CnVsqh-c.js +0 -1039
- package/dist/ScheduledTaskFormRoute-CnVsqh-c.js.map +0 -1
- package/dist/SingleLogMessageRoute-B6hkr7rG.js +0 -305
- package/dist/SingleLogMessageRoute-B6hkr7rG.js.map +0 -1
- package/dist/SingleMessageRoute-Bxix2rv7.js +0 -320
- package/dist/SingleMessageRoute-Bxix2rv7.js.map +0 -1
- package/dist/TableMetadataDisplay-DTDUH1KY.js +0 -330
- package/dist/TableMetadataDisplay-DTDUH1KY.js.map +0 -1
- package/dist/TriggerablesRoute-BY72XS5U.js.map +0 -1
- package/dist/createSvgIcon-DCKQGUI3.js +0 -5543
- package/dist/createSvgIcon-DCKQGUI3.js.map +0 -1
|
@@ -0,0 +1,1152 @@
|
|
|
1
|
+
import { getBackendClient as ee } from "@evolver-fi/evolver-basics";
|
|
2
|
+
import { j as d } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
+
import { useState as I, useEffect as me } from "react";
|
|
4
|
+
import { g as X, c as q, a as ge } from "./evolverClient-B_TZXnpV.js";
|
|
5
|
+
import { TableHead as ve, TableRow as te, TableCell as U, Tooltip as A, IconButton as N, CircularProgress as ye, Alert as ne, TableContainer as Te, Table as xe, TableBody as Se, TablePagination as ke, TextField as M, Box as L, Button as J, Typography as Oe, Select as z, MenuItem as F, Collapse as be } from "@mui/material";
|
|
6
|
+
import { D as $ } from "./parser-Bj3mcA83.js";
|
|
7
|
+
import { useLoaderData as re, useParams as we, useNavigate as je, useSubmit as ae, useActionData as _e, useNavigation as Xe, useSearchParams as Ee } from "react-router";
|
|
8
|
+
import { c as R } from "./validation-DStiilqx.js";
|
|
9
|
+
import { C as Me } from "./ConfirmButton-jayUa8_J.js";
|
|
10
|
+
import { r as P, i as W, g as Ie, c as De } from "./createSvgIcon-Cf1cru4R.js";
|
|
11
|
+
import "axios";
|
|
12
|
+
const Ce = (n) => {
|
|
13
|
+
const o = new URLSearchParams();
|
|
14
|
+
return n && Object.keys(n).forEach((i) => {
|
|
15
|
+
const m = n[i];
|
|
16
|
+
m && o.append(i, m.toString());
|
|
17
|
+
}), o;
|
|
18
|
+
}, ie = (n, o) => {
|
|
19
|
+
const i = o || X(), m = Ce(n), v = `schedule${[...m.keys()].length > 0 ? "?" : ""}${m.toString()}`;
|
|
20
|
+
return i.get(v);
|
|
21
|
+
}, Ae = (n, o) => (o || X()).get(`schedule/${n}`), Ne = async (n, o) => ({
|
|
22
|
+
status: (await (o || X()).post("schedule", n)).status
|
|
23
|
+
}), Le = async (n, o) => ({
|
|
24
|
+
status: (await (o || X()).post(`schedule/${n}/delete`)).status
|
|
25
|
+
}), Fe = (n) => X().post(`schedule/${n}/run`), Re = (n, o) => X().post(`schedule/${n}/state/${o}`), Ue = [
|
|
26
|
+
"PAUSED",
|
|
27
|
+
"RUNNING",
|
|
28
|
+
"WAITING"
|
|
29
|
+
], se = ["SKIP_ALL", "RUN_ONCE", "RUN_ALL"], Pe = () => ({
|
|
30
|
+
id: 0,
|
|
31
|
+
name: "",
|
|
32
|
+
state: "WAITING",
|
|
33
|
+
cronExpression: "",
|
|
34
|
+
timeZone: "",
|
|
35
|
+
triggerable: "",
|
|
36
|
+
priority: 0,
|
|
37
|
+
timeoutMs: 0,
|
|
38
|
+
missPolicy: "SKIP_ALL",
|
|
39
|
+
args: {}
|
|
40
|
+
}), H = q("scheduledTasks/fetchScheduledTasks", async (n, o) => {
|
|
41
|
+
const i = await ie(n);
|
|
42
|
+
return i.status !== 200 ? o.rejectWithValue({
|
|
43
|
+
message: "Failed to fetch scheduled tasks"
|
|
44
|
+
}) : {
|
|
45
|
+
totalElementsCount: i.data.totalElements,
|
|
46
|
+
scheduledTasks: i.data.content
|
|
47
|
+
};
|
|
48
|
+
}), K = q("scheduledTasks/trigger", async (n, o) => (await Fe(n)).status > 399 ? o.rejectWithValue({
|
|
49
|
+
message: `Failed to trigger scheduled task with id ${n}`
|
|
50
|
+
}) : `Successfully triggered scheduled task with id ${n}`), Q = q("scheduledTasks/updateState", async ({ id: n, state: o }, i) => (await Re(n, o)).status > 399 ? i.rejectWithValue({
|
|
51
|
+
message: `Failed to update scheduled task ${n} to ${o}`
|
|
52
|
+
}) : `Successfully updated scheduled task ${n} to ${o}`), We = {
|
|
53
|
+
scheduledTasks: [],
|
|
54
|
+
scheduledTasksTotalCount: 0,
|
|
55
|
+
status: "loading",
|
|
56
|
+
filters: {
|
|
57
|
+
page: 0,
|
|
58
|
+
size: 100
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
ge({
|
|
62
|
+
name: "scheduledTask",
|
|
63
|
+
initialState: We,
|
|
64
|
+
reducers: {
|
|
65
|
+
updateFilters(n, { payload: o }) {
|
|
66
|
+
n.filters = { ...n.filters, ...o };
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
extraReducers: (n) => {
|
|
70
|
+
n.addCase(H.pending, (o) => {
|
|
71
|
+
o.status = "loading", o.error = "undefined";
|
|
72
|
+
}), n.addCase(H.fulfilled, (o, { payload: i }) => {
|
|
73
|
+
o.scheduledTasks = i.scheduledTasks, o.scheduledTasksTotalCount = i.totalElementsCount, o.status = "succeeded";
|
|
74
|
+
}), n.addCase(H.rejected, (o, { payload: i }) => {
|
|
75
|
+
i && (o.error = i.message), o.status = "failed", o.scheduledTaskNotification = "Failed fetching scheduled actions";
|
|
76
|
+
}), n.addCase(Q.fulfilled, (o, { payload: i }) => {
|
|
77
|
+
o.scheduledTaskNotification = i;
|
|
78
|
+
}), n.addCase(Q.rejected, (o, { payload: i }) => {
|
|
79
|
+
o.scheduledTaskNotification = i ? i.message : "Failed updating scheduled task state";
|
|
80
|
+
}), n.addCase(K.fulfilled, (o, { payload: i }) => {
|
|
81
|
+
o.scheduledTaskNotification = i;
|
|
82
|
+
}), n.addCase(K.rejected, (o, { payload: i }) => {
|
|
83
|
+
o.scheduledTaskNotification = i ? i.message : "Failed triggering scheduled task";
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const oe = [
|
|
88
|
+
{ id: "name", label: "Name", minWidth: 250 },
|
|
89
|
+
{ id: "state", label: "State", minWidth: 100 },
|
|
90
|
+
{ id: "cronExpression", label: "Cron expression", minWidth: 200 },
|
|
91
|
+
{ id: "timeZone", label: "Time zone" },
|
|
92
|
+
{
|
|
93
|
+
id: "lastFiredTime",
|
|
94
|
+
label: "Last fired time",
|
|
95
|
+
minWidth: 250,
|
|
96
|
+
cellRenderer: (n) => $.fromMillis(n || 0, { zone: "utc" }).toISO({ suppressMilliseconds: !0 }) || n
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "lastFinishedTime",
|
|
100
|
+
label: "Last finished time",
|
|
101
|
+
minWidth: 250,
|
|
102
|
+
cellRenderer: (n) => $.fromMillis(n || 0, { zone: "utc" }).toISO({ suppressMilliseconds: !0 }) || n
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: "nextFireTime",
|
|
106
|
+
label: "Next fire time",
|
|
107
|
+
minWidth: 250,
|
|
108
|
+
cellRenderer: (n) => $.fromMillis(n || 0, { zone: "utc" }).toISO({ suppressMilliseconds: !0 }) || n
|
|
109
|
+
},
|
|
110
|
+
{ id: "triggerable", label: "Triggerable", minWidth: 150 },
|
|
111
|
+
{ id: "priority", label: "Priority", minWidth: 150 },
|
|
112
|
+
{ id: "timeoutMs", label: "Timeout (ms)", minWidth: 150 },
|
|
113
|
+
{ id: "missPolicy", label: "Miss policy", minWidth: 150 }
|
|
114
|
+
], ze = () => d.jsx(ve, { children: d.jsxs(te, { children: [oe.map((n) => d.jsx(U, { sx: {
|
|
115
|
+
backgroundColor: "primary.main",
|
|
116
|
+
color: "common.white",
|
|
117
|
+
fontSize: 18
|
|
118
|
+
}, style: { width: n.minWidth }, children: n.label }, n.id)), d.jsx(U, { sx: {
|
|
119
|
+
backgroundColor: "primary.main",
|
|
120
|
+
color: "common.white",
|
|
121
|
+
fontSize: 18
|
|
122
|
+
}, style: { width: 100 } }, "submit-cell")] }) });
|
|
123
|
+
var V = {}, $e = W;
|
|
124
|
+
Object.defineProperty(V, "__esModule", {
|
|
125
|
+
value: !0
|
|
126
|
+
});
|
|
127
|
+
var ce = V.default = void 0, He = $e(P()), Be = d;
|
|
128
|
+
ce = V.default = (0, He.default)(/* @__PURE__ */ (0, Be.jsx)("path", {
|
|
129
|
+
d: "M7 2v11h3v9l7-12h-4l4-8z"
|
|
130
|
+
}), "FlashOn");
|
|
131
|
+
var Z = {}, qe = W;
|
|
132
|
+
Object.defineProperty(Z, "__esModule", {
|
|
133
|
+
value: !0
|
|
134
|
+
});
|
|
135
|
+
var ue = Z.default = void 0, Ve = qe(P()), Ze = d;
|
|
136
|
+
ue = Z.default = (0, Ve.default)(/* @__PURE__ */ (0, Ze.jsx)("path", {
|
|
137
|
+
d: "M6 19h4V5H6zm8-14v14h4V5z"
|
|
138
|
+
}), "Pause");
|
|
139
|
+
var Y = {}, Ye = W;
|
|
140
|
+
Object.defineProperty(Y, "__esModule", {
|
|
141
|
+
value: !0
|
|
142
|
+
});
|
|
143
|
+
var le = Y.default = void 0, Ge = Ye(P()), Je = d;
|
|
144
|
+
le = Y.default = (0, Ge.default)(/* @__PURE__ */ (0, Je.jsx)("path", {
|
|
145
|
+
d: "M8 5v14l11-7z"
|
|
146
|
+
}), "PlayArrow");
|
|
147
|
+
var G = {}, Ke = W;
|
|
148
|
+
Object.defineProperty(G, "__esModule", {
|
|
149
|
+
value: !0
|
|
150
|
+
});
|
|
151
|
+
var de = G.default = void 0, Qe = Ke(P()), et = d;
|
|
152
|
+
de = G.default = (0, Qe.default)(/* @__PURE__ */ (0, et.jsx)("path", {
|
|
153
|
+
d: "M6 6h12v12H6z"
|
|
154
|
+
}), "Stop");
|
|
155
|
+
var he = { exports: {} };
|
|
156
|
+
(function(n, o) {
|
|
157
|
+
(function(m, T) {
|
|
158
|
+
n.exports = T();
|
|
159
|
+
})(globalThis, () => (
|
|
160
|
+
/******/
|
|
161
|
+
(() => {
|
|
162
|
+
var i = {
|
|
163
|
+
/***/
|
|
164
|
+
949: (
|
|
165
|
+
/***/
|
|
166
|
+
(y, p, x) => {
|
|
167
|
+
Object.defineProperty(p, "__esModule", { value: !0 }), p.CronParser = void 0;
|
|
168
|
+
var r = x(515), k = function() {
|
|
169
|
+
function g(t, e, a) {
|
|
170
|
+
e === void 0 && (e = !0), a === void 0 && (a = !1), this.expression = t, this.dayOfWeekStartIndexZero = e, this.monthStartIndexZero = a;
|
|
171
|
+
}
|
|
172
|
+
return g.prototype.parse = function() {
|
|
173
|
+
var t, e, a = (t = this.expression) !== null && t !== void 0 ? t : "";
|
|
174
|
+
if (a.startsWith("@")) {
|
|
175
|
+
var s = this.parseSpecial(this.expression);
|
|
176
|
+
e = this.extractParts(s);
|
|
177
|
+
} else
|
|
178
|
+
e = this.extractParts(this.expression);
|
|
179
|
+
return this.normalize(e), this.validate(e), e;
|
|
180
|
+
}, g.prototype.parseSpecial = function(t) {
|
|
181
|
+
var e = {
|
|
182
|
+
"@yearly": "0 0 1 1 *",
|
|
183
|
+
"@annually": "0 0 1 1 *",
|
|
184
|
+
"@monthly": "0 0 1 * *",
|
|
185
|
+
"@weekly": "0 0 * * 0",
|
|
186
|
+
"@daily": "0 0 * * *",
|
|
187
|
+
"@midnight": "0 0 * * *",
|
|
188
|
+
"@hourly": "0 * * * *"
|
|
189
|
+
}, a = e[t];
|
|
190
|
+
if (!a)
|
|
191
|
+
throw new Error("Unknown special expression.");
|
|
192
|
+
return a;
|
|
193
|
+
}, g.prototype.extractParts = function(t) {
|
|
194
|
+
if (!this.expression)
|
|
195
|
+
throw new Error("cron expression is empty");
|
|
196
|
+
for (var e = t.trim().split(/[ ]+/), a = 0; a < e.length; a++)
|
|
197
|
+
if (e[a].includes(",")) {
|
|
198
|
+
var s = e[a].split(",").map(function(u) {
|
|
199
|
+
return u.trim();
|
|
200
|
+
}).filter(function(u) {
|
|
201
|
+
return u !== "";
|
|
202
|
+
}).map(function(u) {
|
|
203
|
+
return isNaN(Number(u)) ? u : Number(u);
|
|
204
|
+
}).filter(function(u) {
|
|
205
|
+
return u !== null && u !== "";
|
|
206
|
+
});
|
|
207
|
+
s.length === 0 && s.push("*"), s.sort(function(u, l) {
|
|
208
|
+
return u !== null && l !== null ? u - l : 0;
|
|
209
|
+
}), e[a] = s.map(function(u) {
|
|
210
|
+
return u !== null ? u.toString() : "";
|
|
211
|
+
}).join(",");
|
|
212
|
+
}
|
|
213
|
+
if (e.length < 5)
|
|
214
|
+
throw new Error("Expression has only ".concat(e.length, " part").concat(e.length == 1 ? "" : "s", ". At least 5 parts are required."));
|
|
215
|
+
if (e.length == 5)
|
|
216
|
+
e.unshift(""), e.push("");
|
|
217
|
+
else if (e.length == 6) {
|
|
218
|
+
var c = /\d{4}$/.test(e[5]) || e[4] == "?" || e[2] == "?";
|
|
219
|
+
c ? e.unshift("") : e.push("");
|
|
220
|
+
} else if (e.length > 7)
|
|
221
|
+
throw new Error("Expression has ".concat(e.length, " parts; too many!"));
|
|
222
|
+
return e;
|
|
223
|
+
}, g.prototype.normalize = function(t) {
|
|
224
|
+
var e = this;
|
|
225
|
+
if (t[3] = t[3].replace("?", "*"), t[5] = t[5].replace("?", "*"), t[2] = t[2].replace("?", "*"), t[0].indexOf("0/") == 0 && (t[0] = t[0].replace("0/", "*/")), t[1].indexOf("0/") == 0 && (t[1] = t[1].replace("0/", "*/")), t[2].indexOf("0/") == 0 && (t[2] = t[2].replace("0/", "*/")), t[3].indexOf("1/") == 0 && (t[3] = t[3].replace("1/", "*/")), t[4].indexOf("1/") == 0 && (t[4] = t[4].replace("1/", "*/")), t[6].indexOf("1/") == 0 && (t[6] = t[6].replace("1/", "*/")), t[5] = t[5].replace(/(^\d)|([^#/\s]\d)/g, function(S) {
|
|
226
|
+
var b = S.replace(/\D/, ""), h = b;
|
|
227
|
+
return e.dayOfWeekStartIndexZero ? b == "7" && (h = "0") : h = (parseInt(b) - 1).toString(), S.replace(b, h);
|
|
228
|
+
}), t[5] == "L" && (t[5] = "6"), t[3] == "?" && (t[3] = "*"), t[3].indexOf("W") > -1 && (t[3].indexOf(",") > -1 || t[3].indexOf("-") > -1))
|
|
229
|
+
throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");
|
|
230
|
+
var a = {
|
|
231
|
+
SUN: 0,
|
|
232
|
+
MON: 1,
|
|
233
|
+
TUE: 2,
|
|
234
|
+
WED: 3,
|
|
235
|
+
THU: 4,
|
|
236
|
+
FRI: 5,
|
|
237
|
+
SAT: 6
|
|
238
|
+
};
|
|
239
|
+
for (var s in a)
|
|
240
|
+
t[5] = t[5].replace(new RegExp(s, "gi"), a[s].toString());
|
|
241
|
+
t[4] = t[4].replace(/(^\d{1,2})|([^#/\s]\d{1,2})/g, function(S) {
|
|
242
|
+
var b = S.replace(/\D/, ""), h = b;
|
|
243
|
+
return e.monthStartIndexZero && (h = (parseInt(b) + 1).toString()), S.replace(b, h);
|
|
244
|
+
});
|
|
245
|
+
var c = {
|
|
246
|
+
JAN: 1,
|
|
247
|
+
FEB: 2,
|
|
248
|
+
MAR: 3,
|
|
249
|
+
APR: 4,
|
|
250
|
+
MAY: 5,
|
|
251
|
+
JUN: 6,
|
|
252
|
+
JUL: 7,
|
|
253
|
+
AUG: 8,
|
|
254
|
+
SEP: 9,
|
|
255
|
+
OCT: 10,
|
|
256
|
+
NOV: 11,
|
|
257
|
+
DEC: 12
|
|
258
|
+
};
|
|
259
|
+
for (var u in c)
|
|
260
|
+
t[4] = t[4].replace(new RegExp(u, "gi"), c[u].toString());
|
|
261
|
+
t[0] == "0" && (t[0] = ""), !/\*|\-|\,|\//.test(t[2]) && (/\*|\//.test(t[1]) || /\*|\//.test(t[0])) && (t[2] += "-".concat(t[2]));
|
|
262
|
+
for (var l = 0; l < t.length; l++)
|
|
263
|
+
if (t[l].indexOf(",") != -1 && (t[l] = t[l].split(",").filter(function(S) {
|
|
264
|
+
return S !== "";
|
|
265
|
+
}).join(",") || "*"), t[l] == "*/1" && (t[l] = "*"), t[l].indexOf("/") > -1 && !/^\*|\-|\,/.test(t[l])) {
|
|
266
|
+
var f = null;
|
|
267
|
+
switch (l) {
|
|
268
|
+
case 4:
|
|
269
|
+
f = "12";
|
|
270
|
+
break;
|
|
271
|
+
case 5:
|
|
272
|
+
f = "6";
|
|
273
|
+
break;
|
|
274
|
+
case 6:
|
|
275
|
+
f = "9999";
|
|
276
|
+
break;
|
|
277
|
+
default:
|
|
278
|
+
f = null;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
if (f !== null) {
|
|
282
|
+
var O = t[l].split("/");
|
|
283
|
+
t[l] = "".concat(O[0], "-").concat(f, "/").concat(O[1]);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}, g.prototype.validate = function(t) {
|
|
287
|
+
this.assertNoInvalidCharacters("DOW", t[5]), this.assertNoInvalidCharacters("DOM", t[3]), this.validateRange(t);
|
|
288
|
+
}, g.prototype.validateRange = function(t) {
|
|
289
|
+
r.default.secondRange(t[0]), r.default.minuteRange(t[1]), r.default.hourRange(t[2]), r.default.dayOfMonthRange(t[3]), r.default.monthRange(t[4], this.monthStartIndexZero), r.default.dayOfWeekRange(t[5], this.dayOfWeekStartIndexZero);
|
|
290
|
+
}, g.prototype.assertNoInvalidCharacters = function(t, e) {
|
|
291
|
+
var a = e.match(/[A-KM-VX-Z]+/gi);
|
|
292
|
+
if (a && a.length)
|
|
293
|
+
throw new Error("".concat(t, " part contains invalid values: '").concat(a.toString(), "'"));
|
|
294
|
+
}, g;
|
|
295
|
+
}();
|
|
296
|
+
p.CronParser = k;
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/***/
|
|
300
|
+
333: (
|
|
301
|
+
/***/
|
|
302
|
+
(y, p, x) => {
|
|
303
|
+
Object.defineProperty(p, "__esModule", { value: !0 }), p.ExpressionDescriptor = void 0;
|
|
304
|
+
var r = x(823), k = x(949), g = function() {
|
|
305
|
+
function t(e, a) {
|
|
306
|
+
if (this.expression = e, this.options = a, this.expressionParts = new Array(5), !this.options.locale && t.defaultLocale && (this.options.locale = t.defaultLocale), !t.locales[this.options.locale]) {
|
|
307
|
+
var s = Object.keys(t.locales)[0];
|
|
308
|
+
console.warn("Locale '".concat(this.options.locale, "' could not be found; falling back to '").concat(s, "'.")), this.options.locale = s;
|
|
309
|
+
}
|
|
310
|
+
this.i18n = t.locales[this.options.locale], a.use24HourTimeFormat === void 0 && (a.use24HourTimeFormat = this.i18n.use24HourTimeFormatByDefault());
|
|
311
|
+
}
|
|
312
|
+
return t.toString = function(e, a) {
|
|
313
|
+
var s = a === void 0 ? {} : a, c = s.throwExceptionOnParseError, u = c === void 0 ? !0 : c, l = s.verbose, f = l === void 0 ? !1 : l, O = s.dayOfWeekStartIndexZero, S = O === void 0 ? !0 : O, b = s.monthStartIndexZero, h = b === void 0 ? !1 : b, j = s.use24HourTimeFormat, w = s.locale, D = w === void 0 ? null : w, _ = s.tzOffset, C = _ === void 0 ? 0 : _, E = {
|
|
314
|
+
throwExceptionOnParseError: u,
|
|
315
|
+
verbose: f,
|
|
316
|
+
dayOfWeekStartIndexZero: S,
|
|
317
|
+
monthStartIndexZero: h,
|
|
318
|
+
use24HourTimeFormat: j,
|
|
319
|
+
locale: D,
|
|
320
|
+
tzOffset: C
|
|
321
|
+
}, pe = new t(e, E);
|
|
322
|
+
return pe.getFullDescription();
|
|
323
|
+
}, t.initialize = function(e, a) {
|
|
324
|
+
a === void 0 && (a = "en"), t.specialCharacters = ["/", "-", ",", "*"], t.defaultLocale = a, e.load(t.locales);
|
|
325
|
+
}, t.prototype.getFullDescription = function() {
|
|
326
|
+
var e = "";
|
|
327
|
+
try {
|
|
328
|
+
var a = new k.CronParser(this.expression, this.options.dayOfWeekStartIndexZero, this.options.monthStartIndexZero);
|
|
329
|
+
this.expressionParts = a.parse();
|
|
330
|
+
var s = this.getTimeOfDayDescription(), c = this.getDayOfMonthDescription(), u = this.getMonthDescription(), l = this.getDayOfWeekDescription(), f = this.getYearDescription();
|
|
331
|
+
e += s + c + l + u + f, e = this.transformVerbosity(e, !!this.options.verbose), e = e.charAt(0).toLocaleUpperCase() + e.substr(1);
|
|
332
|
+
} catch (O) {
|
|
333
|
+
if (!this.options.throwExceptionOnParseError)
|
|
334
|
+
e = this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();
|
|
335
|
+
else
|
|
336
|
+
throw "".concat(O);
|
|
337
|
+
}
|
|
338
|
+
return e;
|
|
339
|
+
}, t.prototype.getTimeOfDayDescription = function() {
|
|
340
|
+
var e = this.expressionParts[0], a = this.expressionParts[1], s = this.expressionParts[2], c = "";
|
|
341
|
+
if (!r.StringUtilities.containsAny(a, t.specialCharacters) && !r.StringUtilities.containsAny(s, t.specialCharacters) && !r.StringUtilities.containsAny(e, t.specialCharacters))
|
|
342
|
+
c += this.i18n.atSpace() + this.formatTime(s, a, e);
|
|
343
|
+
else if (!e && a.indexOf("-") > -1 && !(a.indexOf(",") > -1) && !(a.indexOf("/") > -1) && !r.StringUtilities.containsAny(s, t.specialCharacters)) {
|
|
344
|
+
var u = a.split("-");
|
|
345
|
+
c += r.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(), this.formatTime(s, u[0], ""), this.formatTime(s, u[1], ""));
|
|
346
|
+
} else if (!e && s.indexOf(",") > -1 && s.indexOf("-") == -1 && s.indexOf("/") == -1 && !r.StringUtilities.containsAny(a, t.specialCharacters)) {
|
|
347
|
+
var l = s.split(",");
|
|
348
|
+
c += this.i18n.at();
|
|
349
|
+
for (var f = 0; f < l.length; f++)
|
|
350
|
+
c += " ", c += this.formatTime(l[f], a, ""), f < l.length - 2 && (c += ","), f == l.length - 2 && (c += this.i18n.spaceAnd());
|
|
351
|
+
} else {
|
|
352
|
+
var O = this.getSecondsDescription(), S = this.getMinutesDescription(), b = this.getHoursDescription();
|
|
353
|
+
if (c += O, c && S && (c += ", "), c += S, S === b)
|
|
354
|
+
return c;
|
|
355
|
+
c && b && (c += ", "), c += b;
|
|
356
|
+
}
|
|
357
|
+
return c;
|
|
358
|
+
}, t.prototype.getSecondsDescription = function() {
|
|
359
|
+
var e = this, a = this.getSegmentDescription(this.expressionParts[0], this.i18n.everySecond(), function(s) {
|
|
360
|
+
return s;
|
|
361
|
+
}, function(s) {
|
|
362
|
+
return r.StringUtilities.format(e.i18n.everyX0Seconds(s), s);
|
|
363
|
+
}, function(s) {
|
|
364
|
+
return e.i18n.secondsX0ThroughX1PastTheMinute();
|
|
365
|
+
}, function(s) {
|
|
366
|
+
return s == "0" ? "" : parseInt(s) < 20 ? e.i18n.atX0SecondsPastTheMinute(s) : e.i18n.atX0SecondsPastTheMinuteGt20() || e.i18n.atX0SecondsPastTheMinute(s);
|
|
367
|
+
});
|
|
368
|
+
return a;
|
|
369
|
+
}, t.prototype.getMinutesDescription = function() {
|
|
370
|
+
var e = this, a = this.expressionParts[0], s = this.expressionParts[2], c = this.getSegmentDescription(this.expressionParts[1], this.i18n.everyMinute(), function(u) {
|
|
371
|
+
return u;
|
|
372
|
+
}, function(u) {
|
|
373
|
+
return r.StringUtilities.format(e.i18n.everyX0Minutes(u), u);
|
|
374
|
+
}, function(u) {
|
|
375
|
+
return e.i18n.minutesX0ThroughX1PastTheHour();
|
|
376
|
+
}, function(u) {
|
|
377
|
+
try {
|
|
378
|
+
return u == "0" && s.indexOf("/") == -1 && a == "" ? e.i18n.everyHour() : parseInt(u) < 20 ? e.i18n.atX0MinutesPastTheHour(u) : e.i18n.atX0MinutesPastTheHourGt20() || e.i18n.atX0MinutesPastTheHour(u);
|
|
379
|
+
} catch {
|
|
380
|
+
return e.i18n.atX0MinutesPastTheHour(u);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
return c;
|
|
384
|
+
}, t.prototype.getHoursDescription = function() {
|
|
385
|
+
var e = this, a = this.expressionParts[2], s = this.getSegmentDescription(a, this.i18n.everyHour(), function(l) {
|
|
386
|
+
return e.formatTime(l, "0", "");
|
|
387
|
+
}, function(l) {
|
|
388
|
+
return r.StringUtilities.format(e.i18n.everyX0Hours(l), l);
|
|
389
|
+
}, function(l) {
|
|
390
|
+
return e.i18n.betweenX0AndX1();
|
|
391
|
+
}, function(l) {
|
|
392
|
+
return e.i18n.atX0();
|
|
393
|
+
});
|
|
394
|
+
if (s && a.includes("-") && this.expressionParts[1] != "0") {
|
|
395
|
+
var c = Array.from(s.matchAll(/:00/g));
|
|
396
|
+
if (c.length > 1) {
|
|
397
|
+
var u = c[c.length - 1].index;
|
|
398
|
+
s = s.substring(0, u) + ":59" + s.substring(u + 3);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
return s;
|
|
402
|
+
}, t.prototype.getDayOfWeekDescription = function() {
|
|
403
|
+
var e = this, a = this.i18n.daysOfTheWeek(), s = null;
|
|
404
|
+
return this.expressionParts[5] == "*" ? s = "" : s = this.getSegmentDescription(this.expressionParts[5], this.i18n.commaEveryDay(), function(c, u) {
|
|
405
|
+
var l = c;
|
|
406
|
+
c.indexOf("#") > -1 ? l = c.substring(0, c.indexOf("#")) : c.indexOf("L") > -1 && (l = l.replace("L", ""));
|
|
407
|
+
var f = parseInt(l);
|
|
408
|
+
if (e.options.tzOffset) {
|
|
409
|
+
var O = e.expressionParts[2], S = parseInt(O) + (e.options.tzOffset ? e.options.tzOffset : 0);
|
|
410
|
+
S >= 24 ? f++ : S < 0 && f--, f > 6 ? f = 0 : f < 0 && (f = 6);
|
|
411
|
+
}
|
|
412
|
+
var b = e.i18n.daysOfTheWeekInCase ? e.i18n.daysOfTheWeekInCase(u)[f] : a[f];
|
|
413
|
+
if (c.indexOf("#") > -1) {
|
|
414
|
+
var h = null, j = c.substring(c.indexOf("#") + 1), w = c.substring(0, c.indexOf("#"));
|
|
415
|
+
switch (j) {
|
|
416
|
+
case "1":
|
|
417
|
+
h = e.i18n.first(w);
|
|
418
|
+
break;
|
|
419
|
+
case "2":
|
|
420
|
+
h = e.i18n.second(w);
|
|
421
|
+
break;
|
|
422
|
+
case "3":
|
|
423
|
+
h = e.i18n.third(w);
|
|
424
|
+
break;
|
|
425
|
+
case "4":
|
|
426
|
+
h = e.i18n.fourth(w);
|
|
427
|
+
break;
|
|
428
|
+
case "5":
|
|
429
|
+
h = e.i18n.fifth(w);
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
b = h + " " + b;
|
|
433
|
+
}
|
|
434
|
+
return b;
|
|
435
|
+
}, function(c) {
|
|
436
|
+
return parseInt(c) == 1 ? "" : r.StringUtilities.format(e.i18n.commaEveryX0DaysOfTheWeek(c), c);
|
|
437
|
+
}, function(c) {
|
|
438
|
+
var u = c.substring(0, c.indexOf("-")), l = e.expressionParts[3] != "*";
|
|
439
|
+
return l ? e.i18n.commaAndX0ThroughX1(u) : e.i18n.commaX0ThroughX1(u);
|
|
440
|
+
}, function(c) {
|
|
441
|
+
var u = null;
|
|
442
|
+
if (c.indexOf("#") > -1) {
|
|
443
|
+
var l = c.substring(c.indexOf("#") + 1), f = c.substring(0, c.indexOf("#"));
|
|
444
|
+
u = e.i18n.commaOnThe(l, f).trim() + e.i18n.spaceX0OfTheMonth();
|
|
445
|
+
} else if (c.indexOf("L") > -1)
|
|
446
|
+
u = e.i18n.commaOnTheLastX0OfTheMonth(c.replace("L", ""));
|
|
447
|
+
else {
|
|
448
|
+
var O = e.expressionParts[3] != "*";
|
|
449
|
+
u = O ? e.i18n.commaAndOnX0() : e.i18n.commaOnlyOnX0(c);
|
|
450
|
+
}
|
|
451
|
+
return u;
|
|
452
|
+
}), s;
|
|
453
|
+
}, t.prototype.getMonthDescription = function() {
|
|
454
|
+
var e = this, a = this.i18n.monthsOfTheYear(), s = this.getSegmentDescription(this.expressionParts[4], "", function(c, u) {
|
|
455
|
+
return u && e.i18n.monthsOfTheYearInCase ? e.i18n.monthsOfTheYearInCase(u)[parseInt(c) - 1] : a[parseInt(c) - 1];
|
|
456
|
+
}, function(c) {
|
|
457
|
+
return parseInt(c) == 1 ? "" : r.StringUtilities.format(e.i18n.commaEveryX0Months(c), c);
|
|
458
|
+
}, function(c) {
|
|
459
|
+
return e.i18n.commaMonthX0ThroughMonthX1() || e.i18n.commaX0ThroughX1();
|
|
460
|
+
}, function(c) {
|
|
461
|
+
return e.i18n.commaOnlyInMonthX0 ? e.i18n.commaOnlyInMonthX0() : e.i18n.commaOnlyInX0();
|
|
462
|
+
});
|
|
463
|
+
return s;
|
|
464
|
+
}, t.prototype.getDayOfMonthDescription = function() {
|
|
465
|
+
var e = this, a = null, s = this.expressionParts[3];
|
|
466
|
+
switch (s) {
|
|
467
|
+
case "L":
|
|
468
|
+
a = this.i18n.commaOnTheLastDayOfTheMonth();
|
|
469
|
+
break;
|
|
470
|
+
case "WL":
|
|
471
|
+
case "LW":
|
|
472
|
+
a = this.i18n.commaOnTheLastWeekdayOfTheMonth();
|
|
473
|
+
break;
|
|
474
|
+
default:
|
|
475
|
+
var c = s.match(/(\d{1,2}W)|(W\d{1,2})/);
|
|
476
|
+
if (c) {
|
|
477
|
+
var u = parseInt(c[0].replace("W", "")), l = u == 1 ? this.i18n.firstWeekday() : r.StringUtilities.format(this.i18n.weekdayNearestDayX0(), u.toString());
|
|
478
|
+
a = r.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(), l);
|
|
479
|
+
break;
|
|
480
|
+
} else {
|
|
481
|
+
var f = s.match(/L-(\d{1,2})/);
|
|
482
|
+
if (f) {
|
|
483
|
+
var O = f[1];
|
|
484
|
+
a = r.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(O), O);
|
|
485
|
+
break;
|
|
486
|
+
} else {
|
|
487
|
+
if (s == "*" && this.expressionParts[5] != "*")
|
|
488
|
+
return "";
|
|
489
|
+
a = this.getSegmentDescription(s, this.i18n.commaEveryDay(), function(S) {
|
|
490
|
+
return S == "L" ? e.i18n.lastDay() : e.i18n.dayX0 ? r.StringUtilities.format(e.i18n.dayX0(), S) : S;
|
|
491
|
+
}, function(S) {
|
|
492
|
+
return S == "1" ? e.i18n.commaEveryDay() : e.i18n.commaEveryX0Days(S);
|
|
493
|
+
}, function(S) {
|
|
494
|
+
return e.i18n.commaBetweenDayX0AndX1OfTheMonth(S);
|
|
495
|
+
}, function(S) {
|
|
496
|
+
return e.i18n.commaOnDayX0OfTheMonth(S);
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
return a;
|
|
503
|
+
}, t.prototype.getYearDescription = function() {
|
|
504
|
+
var e = this, a = this.getSegmentDescription(this.expressionParts[6], "", function(s) {
|
|
505
|
+
return /^\d+$/.test(s) ? new Date(parseInt(s), 1).getFullYear().toString() : s;
|
|
506
|
+
}, function(s) {
|
|
507
|
+
return r.StringUtilities.format(e.i18n.commaEveryX0Years(s), s);
|
|
508
|
+
}, function(s) {
|
|
509
|
+
return e.i18n.commaYearX0ThroughYearX1() || e.i18n.commaX0ThroughX1();
|
|
510
|
+
}, function(s) {
|
|
511
|
+
return e.i18n.commaOnlyInYearX0 ? e.i18n.commaOnlyInYearX0() : e.i18n.commaOnlyInX0();
|
|
512
|
+
});
|
|
513
|
+
return a;
|
|
514
|
+
}, t.prototype.getSegmentDescription = function(e, a, s, c, u, l) {
|
|
515
|
+
var f = null, O = e.indexOf("/") > -1, S = e.indexOf("-") > -1, b = e.indexOf(",") > -1;
|
|
516
|
+
if (!e)
|
|
517
|
+
f = "";
|
|
518
|
+
else if (e === "*")
|
|
519
|
+
f = a;
|
|
520
|
+
else if (!O && !S && !b)
|
|
521
|
+
f = r.StringUtilities.format(l(e), s(e));
|
|
522
|
+
else if (b) {
|
|
523
|
+
for (var h = e.split(","), j = "", w = 0; w < h.length; w++)
|
|
524
|
+
if (w > 0 && h.length > 2 && (j += ",", w < h.length - 1 && (j += " ")), w > 0 && h.length > 1 && (w == h.length - 1 || h.length == 2) && (j += "".concat(this.i18n.spaceAnd(), " ")), h[w].indexOf("/") > -1 || h[w].indexOf("-") > -1) {
|
|
525
|
+
var D = h[w].indexOf("-") > -1 && h[w].indexOf("/") == -1, _ = this.getSegmentDescription(h[w], a, s, c, D ? this.i18n.commaX0ThroughX1 : u, l);
|
|
526
|
+
D && (_ = _.replace(", ", "")), j += _;
|
|
527
|
+
} else O ? j += this.getSegmentDescription(h[w], a, s, c, u, l) : j += s(h[w]);
|
|
528
|
+
O ? f = j : f = r.StringUtilities.format(l(e), j);
|
|
529
|
+
} else if (O) {
|
|
530
|
+
var h = e.split("/");
|
|
531
|
+
if (f = r.StringUtilities.format(c(h[1]), h[1]), h[0].indexOf("-") > -1) {
|
|
532
|
+
var C = this.generateRangeSegmentDescription(h[0], u, s);
|
|
533
|
+
C.indexOf(", ") != 0 && (f += ", "), f += C;
|
|
534
|
+
} else if (h[0].indexOf("*") == -1) {
|
|
535
|
+
var E = r.StringUtilities.format(l(h[0]), s(h[0]));
|
|
536
|
+
E = E.replace(", ", ""), f += r.StringUtilities.format(this.i18n.commaStartingX0(), E);
|
|
537
|
+
}
|
|
538
|
+
} else S && (f = this.generateRangeSegmentDescription(e, u, s));
|
|
539
|
+
return f;
|
|
540
|
+
}, t.prototype.generateRangeSegmentDescription = function(e, a, s) {
|
|
541
|
+
var c = "", u = e.split("-"), l = s(u[0], 1), f = s(u[1], 2), O = a(e);
|
|
542
|
+
return c += r.StringUtilities.format(O, l, f), c;
|
|
543
|
+
}, t.prototype.formatTime = function(e, a, s) {
|
|
544
|
+
var c = 0, u = 0;
|
|
545
|
+
this.options.tzOffset && (c = this.options.tzOffset > 0 ? Math.floor(this.options.tzOffset) : Math.ceil(this.options.tzOffset), u = parseFloat((this.options.tzOffset % 1).toFixed(2)), u != 0 && (u *= 60));
|
|
546
|
+
var l = parseInt(e) + c, f = parseInt(a) + u;
|
|
547
|
+
f >= 60 ? (f -= 60, l += 1) : f < 0 && (f += 60, l -= 1), l >= 24 ? l = l - 24 : l < 0 && (l = 24 + l);
|
|
548
|
+
var O = "", S = !1;
|
|
549
|
+
this.options.use24HourTimeFormat || (S = !!(this.i18n.setPeriodBeforeTime && this.i18n.setPeriodBeforeTime()), O = S ? "".concat(this.getPeriod(l), " ") : " ".concat(this.getPeriod(l)), l > 12 && (l -= 12), l === 0 && (l = 12));
|
|
550
|
+
var b = "";
|
|
551
|
+
return s && (b = ":".concat(("00" + s).substring(s.length))), "".concat(S ? O : "").concat(("00" + l.toString()).substring(l.toString().length), ":").concat(("00" + f.toString()).substring(f.toString().length)).concat(b).concat(S ? "" : O);
|
|
552
|
+
}, t.prototype.transformVerbosity = function(e, a) {
|
|
553
|
+
return a || (e = e.replace(new RegExp(", ".concat(this.i18n.everyMinute()), "g"), ""), e = e.replace(new RegExp(", ".concat(this.i18n.everyHour()), "g"), ""), e = e.replace(new RegExp(this.i18n.commaEveryDay(), "g"), ""), e = e.replace(/\, ?$/, "")), e;
|
|
554
|
+
}, t.prototype.getPeriod = function(e) {
|
|
555
|
+
return e >= 12 ? this.i18n.pm && this.i18n.pm() || "PM" : this.i18n.am && this.i18n.am() || "AM";
|
|
556
|
+
}, t.locales = {}, t;
|
|
557
|
+
}();
|
|
558
|
+
p.ExpressionDescriptor = g;
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/***/
|
|
562
|
+
747: (
|
|
563
|
+
/***/
|
|
564
|
+
(y, p, x) => {
|
|
565
|
+
Object.defineProperty(p, "__esModule", { value: !0 }), p.enLocaleLoader = void 0;
|
|
566
|
+
var r = x(486), k = function() {
|
|
567
|
+
function g() {
|
|
568
|
+
}
|
|
569
|
+
return g.prototype.load = function(t) {
|
|
570
|
+
t.en = new r.en();
|
|
571
|
+
}, g;
|
|
572
|
+
}();
|
|
573
|
+
p.enLocaleLoader = k;
|
|
574
|
+
}
|
|
575
|
+
),
|
|
576
|
+
/***/
|
|
577
|
+
486: (
|
|
578
|
+
/***/
|
|
579
|
+
(y, p) => {
|
|
580
|
+
Object.defineProperty(p, "__esModule", { value: !0 }), p.en = void 0;
|
|
581
|
+
var x = function() {
|
|
582
|
+
function r() {
|
|
583
|
+
}
|
|
584
|
+
return r.prototype.atX0SecondsPastTheMinuteGt20 = function() {
|
|
585
|
+
return null;
|
|
586
|
+
}, r.prototype.atX0MinutesPastTheHourGt20 = function() {
|
|
587
|
+
return null;
|
|
588
|
+
}, r.prototype.commaMonthX0ThroughMonthX1 = function() {
|
|
589
|
+
return null;
|
|
590
|
+
}, r.prototype.commaYearX0ThroughYearX1 = function() {
|
|
591
|
+
return null;
|
|
592
|
+
}, r.prototype.use24HourTimeFormatByDefault = function() {
|
|
593
|
+
return !1;
|
|
594
|
+
}, r.prototype.anErrorOccuredWhenGeneratingTheExpressionD = function() {
|
|
595
|
+
return "An error occured when generating the expression description. Check the cron expression syntax.";
|
|
596
|
+
}, r.prototype.everyMinute = function() {
|
|
597
|
+
return "every minute";
|
|
598
|
+
}, r.prototype.everyHour = function() {
|
|
599
|
+
return "every hour";
|
|
600
|
+
}, r.prototype.atSpace = function() {
|
|
601
|
+
return "At ";
|
|
602
|
+
}, r.prototype.everyMinuteBetweenX0AndX1 = function() {
|
|
603
|
+
return "Every minute between %s and %s";
|
|
604
|
+
}, r.prototype.at = function() {
|
|
605
|
+
return "At";
|
|
606
|
+
}, r.prototype.spaceAnd = function() {
|
|
607
|
+
return " and";
|
|
608
|
+
}, r.prototype.everySecond = function() {
|
|
609
|
+
return "every second";
|
|
610
|
+
}, r.prototype.everyX0Seconds = function() {
|
|
611
|
+
return "every %s seconds";
|
|
612
|
+
}, r.prototype.secondsX0ThroughX1PastTheMinute = function() {
|
|
613
|
+
return "seconds %s through %s past the minute";
|
|
614
|
+
}, r.prototype.atX0SecondsPastTheMinute = function() {
|
|
615
|
+
return "at %s seconds past the minute";
|
|
616
|
+
}, r.prototype.everyX0Minutes = function() {
|
|
617
|
+
return "every %s minutes";
|
|
618
|
+
}, r.prototype.minutesX0ThroughX1PastTheHour = function() {
|
|
619
|
+
return "minutes %s through %s past the hour";
|
|
620
|
+
}, r.prototype.atX0MinutesPastTheHour = function() {
|
|
621
|
+
return "at %s minutes past the hour";
|
|
622
|
+
}, r.prototype.everyX0Hours = function() {
|
|
623
|
+
return "every %s hours";
|
|
624
|
+
}, r.prototype.betweenX0AndX1 = function() {
|
|
625
|
+
return "between %s and %s";
|
|
626
|
+
}, r.prototype.atX0 = function() {
|
|
627
|
+
return "at %s";
|
|
628
|
+
}, r.prototype.commaEveryDay = function() {
|
|
629
|
+
return ", every day";
|
|
630
|
+
}, r.prototype.commaEveryX0DaysOfTheWeek = function() {
|
|
631
|
+
return ", every %s days of the week";
|
|
632
|
+
}, r.prototype.commaX0ThroughX1 = function() {
|
|
633
|
+
return ", %s through %s";
|
|
634
|
+
}, r.prototype.commaAndX0ThroughX1 = function() {
|
|
635
|
+
return ", %s through %s";
|
|
636
|
+
}, r.prototype.first = function() {
|
|
637
|
+
return "first";
|
|
638
|
+
}, r.prototype.second = function() {
|
|
639
|
+
return "second";
|
|
640
|
+
}, r.prototype.third = function() {
|
|
641
|
+
return "third";
|
|
642
|
+
}, r.prototype.fourth = function() {
|
|
643
|
+
return "fourth";
|
|
644
|
+
}, r.prototype.fifth = function() {
|
|
645
|
+
return "fifth";
|
|
646
|
+
}, r.prototype.commaOnThe = function() {
|
|
647
|
+
return ", on the ";
|
|
648
|
+
}, r.prototype.spaceX0OfTheMonth = function() {
|
|
649
|
+
return " %s of the month";
|
|
650
|
+
}, r.prototype.lastDay = function() {
|
|
651
|
+
return "the last day";
|
|
652
|
+
}, r.prototype.commaOnTheLastX0OfTheMonth = function() {
|
|
653
|
+
return ", on the last %s of the month";
|
|
654
|
+
}, r.prototype.commaOnlyOnX0 = function() {
|
|
655
|
+
return ", only on %s";
|
|
656
|
+
}, r.prototype.commaAndOnX0 = function() {
|
|
657
|
+
return ", and on %s";
|
|
658
|
+
}, r.prototype.commaEveryX0Months = function() {
|
|
659
|
+
return ", every %s months";
|
|
660
|
+
}, r.prototype.commaOnlyInX0 = function() {
|
|
661
|
+
return ", only in %s";
|
|
662
|
+
}, r.prototype.commaOnTheLastDayOfTheMonth = function() {
|
|
663
|
+
return ", on the last day of the month";
|
|
664
|
+
}, r.prototype.commaOnTheLastWeekdayOfTheMonth = function() {
|
|
665
|
+
return ", on the last weekday of the month";
|
|
666
|
+
}, r.prototype.commaDaysBeforeTheLastDayOfTheMonth = function() {
|
|
667
|
+
return ", %s days before the last day of the month";
|
|
668
|
+
}, r.prototype.firstWeekday = function() {
|
|
669
|
+
return "first weekday";
|
|
670
|
+
}, r.prototype.weekdayNearestDayX0 = function() {
|
|
671
|
+
return "weekday nearest day %s";
|
|
672
|
+
}, r.prototype.commaOnTheX0OfTheMonth = function() {
|
|
673
|
+
return ", on the %s of the month";
|
|
674
|
+
}, r.prototype.commaEveryX0Days = function() {
|
|
675
|
+
return ", every %s days";
|
|
676
|
+
}, r.prototype.commaBetweenDayX0AndX1OfTheMonth = function() {
|
|
677
|
+
return ", between day %s and %s of the month";
|
|
678
|
+
}, r.prototype.commaOnDayX0OfTheMonth = function() {
|
|
679
|
+
return ", on day %s of the month";
|
|
680
|
+
}, r.prototype.commaEveryHour = function() {
|
|
681
|
+
return ", every hour";
|
|
682
|
+
}, r.prototype.commaEveryX0Years = function() {
|
|
683
|
+
return ", every %s years";
|
|
684
|
+
}, r.prototype.commaStartingX0 = function() {
|
|
685
|
+
return ", starting %s";
|
|
686
|
+
}, r.prototype.daysOfTheWeek = function() {
|
|
687
|
+
return ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
|
|
688
|
+
}, r.prototype.monthsOfTheYear = function() {
|
|
689
|
+
return [
|
|
690
|
+
"January",
|
|
691
|
+
"February",
|
|
692
|
+
"March",
|
|
693
|
+
"April",
|
|
694
|
+
"May",
|
|
695
|
+
"June",
|
|
696
|
+
"July",
|
|
697
|
+
"August",
|
|
698
|
+
"September",
|
|
699
|
+
"October",
|
|
700
|
+
"November",
|
|
701
|
+
"December"
|
|
702
|
+
];
|
|
703
|
+
}, r;
|
|
704
|
+
}();
|
|
705
|
+
p.en = x;
|
|
706
|
+
}
|
|
707
|
+
),
|
|
708
|
+
/***/
|
|
709
|
+
515: (
|
|
710
|
+
/***/
|
|
711
|
+
(y, p) => {
|
|
712
|
+
Object.defineProperty(p, "__esModule", { value: !0 });
|
|
713
|
+
function x(k, g) {
|
|
714
|
+
if (!k)
|
|
715
|
+
throw new Error(g);
|
|
716
|
+
}
|
|
717
|
+
var r = function() {
|
|
718
|
+
function k() {
|
|
719
|
+
}
|
|
720
|
+
return k.secondRange = function(g) {
|
|
721
|
+
for (var t = g.split(","), e = 0; e < t.length; e++)
|
|
722
|
+
if (!isNaN(parseInt(t[e], 10))) {
|
|
723
|
+
var a = parseInt(t[e], 10);
|
|
724
|
+
x(a >= 0 && a <= 59, "seconds part must be >= 0 and <= 59");
|
|
725
|
+
}
|
|
726
|
+
}, k.minuteRange = function(g) {
|
|
727
|
+
for (var t = g.split(","), e = 0; e < t.length; e++)
|
|
728
|
+
if (!isNaN(parseInt(t[e], 10))) {
|
|
729
|
+
var a = parseInt(t[e], 10);
|
|
730
|
+
x(a >= 0 && a <= 59, "minutes part must be >= 0 and <= 59");
|
|
731
|
+
}
|
|
732
|
+
}, k.hourRange = function(g) {
|
|
733
|
+
for (var t = g.split(","), e = 0; e < t.length; e++)
|
|
734
|
+
if (!isNaN(parseInt(t[e], 10))) {
|
|
735
|
+
var a = parseInt(t[e], 10);
|
|
736
|
+
x(a >= 0 && a <= 23, "hours part must be >= 0 and <= 23");
|
|
737
|
+
}
|
|
738
|
+
}, k.dayOfMonthRange = function(g) {
|
|
739
|
+
for (var t = g.split(","), e = 0; e < t.length; e++)
|
|
740
|
+
if (!isNaN(parseInt(t[e], 10))) {
|
|
741
|
+
var a = parseInt(t[e], 10);
|
|
742
|
+
x(a >= 1 && a <= 31, "DOM part must be >= 1 and <= 31");
|
|
743
|
+
}
|
|
744
|
+
}, k.monthRange = function(g, t) {
|
|
745
|
+
for (var e = g.split(","), a = 0; a < e.length; a++)
|
|
746
|
+
if (!isNaN(parseInt(e[a], 10))) {
|
|
747
|
+
var s = parseInt(e[a], 10);
|
|
748
|
+
x(s >= 1 && s <= 12, t ? "month part must be >= 0 and <= 11" : "month part must be >= 1 and <= 12");
|
|
749
|
+
}
|
|
750
|
+
}, k.dayOfWeekRange = function(g, t) {
|
|
751
|
+
for (var e = g.split(","), a = 0; a < e.length; a++)
|
|
752
|
+
if (!isNaN(parseInt(e[a], 10))) {
|
|
753
|
+
var s = parseInt(e[a], 10);
|
|
754
|
+
x(s >= 0 && s <= 6, t ? "DOW part must be >= 0 and <= 6" : "DOW part must be >= 1 and <= 7");
|
|
755
|
+
}
|
|
756
|
+
}, k;
|
|
757
|
+
}();
|
|
758
|
+
p.default = r;
|
|
759
|
+
}
|
|
760
|
+
),
|
|
761
|
+
/***/
|
|
762
|
+
823: (
|
|
763
|
+
/***/
|
|
764
|
+
(y, p) => {
|
|
765
|
+
Object.defineProperty(p, "__esModule", { value: !0 }), p.StringUtilities = void 0;
|
|
766
|
+
var x = function() {
|
|
767
|
+
function r() {
|
|
768
|
+
}
|
|
769
|
+
return r.format = function(k) {
|
|
770
|
+
for (var g = [], t = 1; t < arguments.length; t++)
|
|
771
|
+
g[t - 1] = arguments[t];
|
|
772
|
+
return k.replace(/%s/g, function(e) {
|
|
773
|
+
return g.shift();
|
|
774
|
+
});
|
|
775
|
+
}, r.containsAny = function(k, g) {
|
|
776
|
+
return g.some(function(t) {
|
|
777
|
+
return k.indexOf(t) > -1;
|
|
778
|
+
});
|
|
779
|
+
}, r;
|
|
780
|
+
}();
|
|
781
|
+
p.StringUtilities = x;
|
|
782
|
+
}
|
|
783
|
+
)
|
|
784
|
+
/******/
|
|
785
|
+
}, m = {};
|
|
786
|
+
function T(y) {
|
|
787
|
+
var p = m[y];
|
|
788
|
+
if (p !== void 0)
|
|
789
|
+
return p.exports;
|
|
790
|
+
var x = m[y] = {
|
|
791
|
+
/******/
|
|
792
|
+
// no module.id needed
|
|
793
|
+
/******/
|
|
794
|
+
// no module.loaded needed
|
|
795
|
+
/******/
|
|
796
|
+
exports: {}
|
|
797
|
+
/******/
|
|
798
|
+
};
|
|
799
|
+
return i[y](x, x.exports, T), x.exports;
|
|
800
|
+
}
|
|
801
|
+
var v = {};
|
|
802
|
+
return (() => {
|
|
803
|
+
var y = v;
|
|
804
|
+
Object.defineProperty(y, "__esModule", { value: !0 }), y.toString = void 0;
|
|
805
|
+
var p = T(333), x = T(747);
|
|
806
|
+
p.ExpressionDescriptor.initialize(new x.enLocaleLoader()), y.default = p.ExpressionDescriptor;
|
|
807
|
+
var r = p.ExpressionDescriptor.toString;
|
|
808
|
+
y.toString = r;
|
|
809
|
+
})(), v;
|
|
810
|
+
})()
|
|
811
|
+
));
|
|
812
|
+
})(he);
|
|
813
|
+
var tt = he.exports;
|
|
814
|
+
const B = /* @__PURE__ */ Ie(tt), nt = ({ scheduledTaskRows: n, triggerTask: o, updateTaskState: i, onClickRowAction: m }) => {
|
|
815
|
+
const T = (v, y) => {
|
|
816
|
+
m && m(v, y.ctrlKey || y.button === 1);
|
|
817
|
+
};
|
|
818
|
+
return d.jsx(d.Fragment, { children: n.map((v) => d.jsxs(te, { sx: {
|
|
819
|
+
"&:nth-of-type(odd)": {
|
|
820
|
+
backgroundColor: "action.hover"
|
|
821
|
+
// TODO: use something that doesn't osbcure the hover effect
|
|
822
|
+
},
|
|
823
|
+
"&:hover": {
|
|
824
|
+
cursor: "pointer"
|
|
825
|
+
}
|
|
826
|
+
}, hover: !0, role: "checkbox", tabIndex: -1, onClick: (y) => T(v.id, y), children: [oe.map((y) => {
|
|
827
|
+
const p = v[y.id];
|
|
828
|
+
let x;
|
|
829
|
+
y.id === "cronExpression" && (x = B.toString(p, {
|
|
830
|
+
use24HourTimeFormat: !0
|
|
831
|
+
}));
|
|
832
|
+
let r;
|
|
833
|
+
return y.cellRenderer && (r = y.cellRenderer(p)), d.jsx(U, { title: x, children: r || p }, y.id);
|
|
834
|
+
}), d.jsx(U, { sx: { display: "flex", flexDirection: "row" }, children: v.state === "PAUSED" ? d.jsx(A, { title: "Activate task", children: d.jsx(N, { onClick: () => i(v.id, "WAITING"), "aria-label": "activate task", children: d.jsx(le, {}) }) }) : v.state === "WAITING" ? d.jsxs(d.Fragment, { children: [d.jsx(A, { title: "Trigger task", children: d.jsx(N, { onClick: () => o(v.id), "aria-label": "trigger task", children: d.jsx(ce, {}) }) }), d.jsx(A, { title: "Pause task", children: d.jsx(N, { onClick: () => i(v.id, "PAUSED"), "aria-label": "pause task", children: d.jsx(ue, {}) }) })] }) : v.state === "RUNNING" && d.jsx(A, { title: "Stop task", children: d.jsx(N, { onClick: () => i(v.id, "WAITING"), "aria-label": "stop task", children: d.jsx(de, {}) }) }) }, `${v.id}-action-cell`)] }, v.id)) });
|
|
835
|
+
}, rt = ({ fetchStatus: n, scheduledTasks: o, scheduledTaskFilters: i, scheduledTasksTotalCount: m, scheduledTaskNotification: T, handlePageChange: v, triggerTask: y, updateTaskState: p, handleFilterFormSubmit: x, onClickRowAction: r }) => {
|
|
836
|
+
const [k, g] = I(!0), t = (e, a) => {
|
|
837
|
+
v(a);
|
|
838
|
+
};
|
|
839
|
+
return n === "loading" ? d.jsx(ye, {}) : d.jsxs(d.Fragment, { children: [T && k && d.jsx(ne, { onClose: () => g(!1), sx: {
|
|
840
|
+
marginBottom: 20
|
|
841
|
+
}, elevation: 6, severity: "info", variant: "filled", children: T }), d.jsx("form", { onSubmit: x, children: d.jsx(Te, { sx: {
|
|
842
|
+
maxHeight: 1200
|
|
843
|
+
}, children: d.jsxs(xe, { stickyHeader: !0, "aria-label": "sticky table", children: [d.jsx(ze, {}), d.jsx(Se, { children: d.jsx(nt, { scheduledTaskRows: o, triggerTask: y, updateTaskState: p, onClickRowAction: r }) })] }) }) }), d.jsx(ke, { component: "div", count: m, rowsPerPage: i.size || 100, page: i.page, onPageChange: t, rowsPerPageOptions: [] })] });
|
|
844
|
+
}, at = ({ label: n, value: o, name: i, onChange: m, errorTextOverride: T, helperTextOverride: v, options: y }) => {
|
|
845
|
+
const [p, x] = I(R(o, y)), [r, k] = I(R(o, y) ? "" : B.toString(o)), g = (t) => {
|
|
846
|
+
const e = t.target.value;
|
|
847
|
+
if (m && m(e), e) {
|
|
848
|
+
const a = R(e, y);
|
|
849
|
+
x(a), a || k(B.toString(e));
|
|
850
|
+
} else
|
|
851
|
+
x(void 0);
|
|
852
|
+
};
|
|
853
|
+
return d.jsx(M, { name: i, label: n, onChange: g, defaultValue: o, error: !!T || !!p, helperText: T || p || v || r });
|
|
854
|
+
}, it = (n) => {
|
|
855
|
+
if (!n)
|
|
856
|
+
return "Name is required";
|
|
857
|
+
}, st = (n) => {
|
|
858
|
+
if (!n)
|
|
859
|
+
return "Timezone is required";
|
|
860
|
+
try {
|
|
861
|
+
Intl.DateTimeFormat(void 0, { timeZone: n });
|
|
862
|
+
return;
|
|
863
|
+
} catch {
|
|
864
|
+
return "Invalid timezone";
|
|
865
|
+
}
|
|
866
|
+
}, ot = (n) => {
|
|
867
|
+
if (!n)
|
|
868
|
+
return "Triggerable is required";
|
|
869
|
+
}, ct = (n) => {
|
|
870
|
+
if (!n && n !== 0)
|
|
871
|
+
return "Priority is required";
|
|
872
|
+
}, ut = (n) => {
|
|
873
|
+
if (!n && n !== 0)
|
|
874
|
+
return "Timeout is required";
|
|
875
|
+
if (n < 0)
|
|
876
|
+
return "Timeout must be non-negative";
|
|
877
|
+
}, lt = (n) => {
|
|
878
|
+
if (!n)
|
|
879
|
+
return "Miss policy is required";
|
|
880
|
+
if (!se.find((o) => o === n))
|
|
881
|
+
return "Invalid miss policy";
|
|
882
|
+
}, dt = (n, o) => {
|
|
883
|
+
const i = {};
|
|
884
|
+
return i.name = it(n.name), i.cronExpression = R(n.cronExpression, o), i.timeZone = st(n.timeZone), i.triggerable = ot(n.triggerable), i.priority = ct(n.priority), i.timeoutMs = ut(n.timeoutMs), i.missPolicy = lt(n.missPolicy), i;
|
|
885
|
+
}, ht = De(/* @__PURE__ */ d.jsx("path", {
|
|
886
|
+
d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"
|
|
887
|
+
}), "ArrowBack"), ft = ({ task: n, onSave: o, onDelete: i, onBack: m }) => {
|
|
888
|
+
const [T, v] = I(n), { id: y, name: p, state: x, cronExpression: r, timeZone: k, triggerable: g, timeoutMs: t, priority: e, missPolicy: a, args: s, nextFireTime: c, lastFinishedTime: u, lastFiredTime: l } = T, f = dt(T, { requireSeconds: !0 }), O = Object.values(f).some((h) => !!h), S = y ? "Create a new task" : `Edit task ${p}, id: ${y}`, b = () => {
|
|
889
|
+
O || o(T);
|
|
890
|
+
};
|
|
891
|
+
return console.log(f), d.jsxs(L, { sx: {
|
|
892
|
+
display: "flex",
|
|
893
|
+
flexDirection: "column",
|
|
894
|
+
gap: "1em",
|
|
895
|
+
padding: "1em"
|
|
896
|
+
}, children: [d.jsx(J, { sx: { maxWidth: "100px" }, variant: "contained", onClick: m, startIcon: d.jsx(ht, {}), children: "Back" }), d.jsx(Oe, { variant: "h2", children: S }), d.jsxs(L, { sx: {
|
|
897
|
+
display: "flex",
|
|
898
|
+
flexDirection: "row",
|
|
899
|
+
flexWrap: "wrap",
|
|
900
|
+
gap: "2em",
|
|
901
|
+
"& > *": {
|
|
902
|
+
height: "100%",
|
|
903
|
+
minWidth: "300px"
|
|
904
|
+
}
|
|
905
|
+
}, children: [d.jsx(M, { onChange: (h) => {
|
|
906
|
+
v({ ...T, name: h.target.value });
|
|
907
|
+
}, label: "Task name", value: T.name, helperText: f.name, error: !!f.name }), d.jsx(z, { onChange: (h) => {
|
|
908
|
+
v({ ...T, state: h.target.value });
|
|
909
|
+
}, label: "Task state", value: x || "", children: Ue.map((h) => d.jsx(F, { value: h, children: h }, h)) }), d.jsx(at, { label: "Cron expression", value: r, onChange: (h) => {
|
|
910
|
+
v({ ...T, cronExpression: h });
|
|
911
|
+
}, options: { requireSeconds: !0 } }), d.jsxs(z, { name: "time-zone", label: "Time zone", onChange: (h) => {
|
|
912
|
+
v({ ...T, timeZone: h.target.value });
|
|
913
|
+
}, value: k || "", children: [d.jsx(F, { value: "Europe/Helsinki", children: "Europe/Helsinki" }), d.jsx(F, { value: "UTC", children: "UTC" })] }), d.jsx(M, { label: "Triggerable task to schedule", value: g || "", helperText: f.triggerable, error: !!f.triggerable, onChange: (h) => {
|
|
914
|
+
v({ ...T, triggerable: h.target.value });
|
|
915
|
+
}, sx: {
|
|
916
|
+
minWidth: "500px"
|
|
917
|
+
} }), d.jsx(M, { type: "number", label: "priority", onChange: (h) => {
|
|
918
|
+
v({ ...T, priority: parseInt(h.target.value, 10) });
|
|
919
|
+
}, value: (e == null ? void 0 : e.toString()) || "" }), d.jsx(M, { type: "number", label: "Timeout (ms)", onChange: (h) => {
|
|
920
|
+
v({ ...T, timeoutMs: parseInt(h.target.value, 10) });
|
|
921
|
+
}, value: (t == null ? void 0 : t.toString()) || "", helperText: f.timeoutMs, error: !!f.timeoutMs }), d.jsx(z, { label: "Miss policy", onChange: (h) => {
|
|
922
|
+
v({ ...T, missPolicy: h.target.value });
|
|
923
|
+
}, value: a || "", children: se.map((h) => d.jsx(F, { value: h, children: h }, h)) })] }), d.jsxs(L, { sx: {
|
|
924
|
+
display: "flex",
|
|
925
|
+
flexDirection: "row",
|
|
926
|
+
gap: "1em",
|
|
927
|
+
justifyContent: "flex-end",
|
|
928
|
+
"& >*": {
|
|
929
|
+
minWidth: "200px",
|
|
930
|
+
height: "40px"
|
|
931
|
+
}
|
|
932
|
+
}, children: [d.jsx(J, { disabled: O, variant: "contained", onClick: b, children: "Save" }), d.jsx(Me, { color: "error", variant: "outlined", confirmVariant: "contained", onConfirmed: i, confirmChildren: "Confirm deleting scheduled task", timeout: 4e3, children: "Delete scheduled task" })] }), d.jsxs(L, { children: [d.jsxs("pre", { children: ["args: ", JSON.stringify(s, null, 2)] }), d.jsxs("pre", { children: ["Last fired time: ", l || "-"] }), d.jsxs("pre", { children: ["Last finished time: ", u || "-"] }), d.jsxs("pre", { children: ["Next fire time: ", c || "-"] })] })] });
|
|
933
|
+
}, pt = (n) => async ({
|
|
934
|
+
request: o
|
|
935
|
+
}) => {
|
|
936
|
+
try {
|
|
937
|
+
const i = await o.json();
|
|
938
|
+
switch (i.type) {
|
|
939
|
+
case "save": {
|
|
940
|
+
if (!i.task)
|
|
941
|
+
return { status: 400, message: "Task data is required" };
|
|
942
|
+
const m = await Ne(
|
|
943
|
+
i.task,
|
|
944
|
+
n
|
|
945
|
+
);
|
|
946
|
+
if (m.status === 204) {
|
|
947
|
+
const T = i.task.id === void 0;
|
|
948
|
+
return {
|
|
949
|
+
status: 204,
|
|
950
|
+
message: T ? "Task created" : "Task updated",
|
|
951
|
+
redirect: T ? "/scheduled-tasks" : void 0
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
return { status: m.status, message: "Failed to save task" };
|
|
955
|
+
}
|
|
956
|
+
case "delete": {
|
|
957
|
+
if (!i.id)
|
|
958
|
+
return { status: 400, message: "Task ID is required" };
|
|
959
|
+
const m = await Le(
|
|
960
|
+
i.id,
|
|
961
|
+
n
|
|
962
|
+
);
|
|
963
|
+
return m.status === 204 ? {
|
|
964
|
+
status: 204,
|
|
965
|
+
message: "Task deleted",
|
|
966
|
+
redirect: "/scheduled-tasks"
|
|
967
|
+
} : m.status === 404 ? { status: 404, message: "Task not found" } : { status: m.status, message: "Failed to delete task" };
|
|
968
|
+
}
|
|
969
|
+
default:
|
|
970
|
+
return { status: 400, message: "Invalid action type" };
|
|
971
|
+
}
|
|
972
|
+
} catch (i) {
|
|
973
|
+
return console.error(i), {
|
|
974
|
+
status: 500,
|
|
975
|
+
message: "Failed to process request"
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
}, mt = async (n, o) => (o ?? ee()).post(`schedule/${n}/run`), gt = async (n, o, i) => (i ?? ee()).post(`schedule/${n}/state/${o}`), vt = (n) => async ({
|
|
979
|
+
request: o
|
|
980
|
+
}) => {
|
|
981
|
+
try {
|
|
982
|
+
const i = await o.json();
|
|
983
|
+
switch (i.type) {
|
|
984
|
+
case "trigger": {
|
|
985
|
+
if (!i.id)
|
|
986
|
+
return { status: 400, message: "Task ID is required" };
|
|
987
|
+
const m = await mt(i.id, n);
|
|
988
|
+
return m.status === 200 || m.status === 204 ? { status: m.status, message: "Task triggered" } : { status: m.status, message: "Failed to trigger task" };
|
|
989
|
+
}
|
|
990
|
+
case "updateState": {
|
|
991
|
+
if (!i.id || !i.state)
|
|
992
|
+
return {
|
|
993
|
+
status: 400,
|
|
994
|
+
message: "Task ID and state are required"
|
|
995
|
+
};
|
|
996
|
+
const m = await gt(
|
|
997
|
+
i.id,
|
|
998
|
+
i.state,
|
|
999
|
+
n
|
|
1000
|
+
);
|
|
1001
|
+
return m.status === 200 || m.status === 204 ? { status: m.status, message: "Task state updated" } : {
|
|
1002
|
+
status: m.status,
|
|
1003
|
+
message: "Failed to update task state"
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
default:
|
|
1007
|
+
return { status: 400, message: "Invalid action type" };
|
|
1008
|
+
}
|
|
1009
|
+
} catch (i) {
|
|
1010
|
+
return console.error(i), {
|
|
1011
|
+
status: 500,
|
|
1012
|
+
message: "Failed to process request"
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
}, Dt = vt(), Ct = pt(), yt = (n) => {
|
|
1016
|
+
const o = new URLSearchParams();
|
|
1017
|
+
return n.page !== 0 && o.set("page", n.page.toString()), n.size && n.size !== 100 && o.set("size", n.size.toString()), o;
|
|
1018
|
+
}, fe = (n) => {
|
|
1019
|
+
const o = {
|
|
1020
|
+
page: 0,
|
|
1021
|
+
size: 100
|
|
1022
|
+
};
|
|
1023
|
+
if (n.has("page"))
|
|
1024
|
+
try {
|
|
1025
|
+
const i = parseInt(n.get("page") ?? "", 10);
|
|
1026
|
+
isNaN(i) || (o.page = i);
|
|
1027
|
+
} catch {
|
|
1028
|
+
}
|
|
1029
|
+
if (n.has("size"))
|
|
1030
|
+
try {
|
|
1031
|
+
const i = parseInt(n.get("size") ?? "", 10);
|
|
1032
|
+
isNaN(i) || (o.size = i);
|
|
1033
|
+
} catch {
|
|
1034
|
+
}
|
|
1035
|
+
return o;
|
|
1036
|
+
}, Tt = (n) => async ({ params: o }) => {
|
|
1037
|
+
const i = o.id;
|
|
1038
|
+
if (console.log("id", i), i === "new")
|
|
1039
|
+
return Pe();
|
|
1040
|
+
if (!i && i !== "0" || Number.isNaN(parseInt(i, 10)))
|
|
1041
|
+
throw console.log("no id or id is not a number", i), new Response("", {
|
|
1042
|
+
status: 404,
|
|
1043
|
+
statusText: "Not found"
|
|
1044
|
+
});
|
|
1045
|
+
const m = parseInt(i, 10), T = await Ae(m, n), { data: v, status: y } = T;
|
|
1046
|
+
if (y >= 400 || !v)
|
|
1047
|
+
throw console.log("failed to fetch task", y, i), new Error("Failed to fetch scheduled task");
|
|
1048
|
+
return v;
|
|
1049
|
+
}, At = Tt(), xt = (n) => async ({ request: o }) => {
|
|
1050
|
+
try {
|
|
1051
|
+
const i = new URL(o.url), m = fe(
|
|
1052
|
+
i.searchParams
|
|
1053
|
+
), T = await ie(
|
|
1054
|
+
m,
|
|
1055
|
+
n
|
|
1056
|
+
), { data: v } = T;
|
|
1057
|
+
return v;
|
|
1058
|
+
} catch (i) {
|
|
1059
|
+
throw console.error(i), new Error("Failed to fetch scheduled tasks");
|
|
1060
|
+
}
|
|
1061
|
+
}, Nt = xt(), Lt = () => {
|
|
1062
|
+
const [n, o] = I(null), i = re(), m = we(), { id: T } = m, v = je(), y = ae(), p = _e(), x = () => {
|
|
1063
|
+
T !== "new" && y(
|
|
1064
|
+
{ type: "delete", id: i.id },
|
|
1065
|
+
{
|
|
1066
|
+
method: "POST",
|
|
1067
|
+
encType: "application/json"
|
|
1068
|
+
}
|
|
1069
|
+
);
|
|
1070
|
+
}, r = (k) => {
|
|
1071
|
+
y(
|
|
1072
|
+
{ type: "save", task: k },
|
|
1073
|
+
{
|
|
1074
|
+
method: "POST",
|
|
1075
|
+
encType: "application/json"
|
|
1076
|
+
}
|
|
1077
|
+
);
|
|
1078
|
+
};
|
|
1079
|
+
return me(() => {
|
|
1080
|
+
if (p) {
|
|
1081
|
+
const k = p.status < 300 ? "success" : "error";
|
|
1082
|
+
o({ severity: k, message: p.message });
|
|
1083
|
+
const g = p.redirect;
|
|
1084
|
+
g && setTimeout(() => v(g), 3e3);
|
|
1085
|
+
}
|
|
1086
|
+
}, [p, v]), /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
|
|
1087
|
+
/* @__PURE__ */ d.jsx(be, { in: n !== null, unmountOnExit: !0, children: /* @__PURE__ */ d.jsx(ne, { severity: n == null ? void 0 : n.severity, children: n == null ? void 0 : n.message }) }),
|
|
1088
|
+
/* @__PURE__ */ d.jsx(
|
|
1089
|
+
ft,
|
|
1090
|
+
{
|
|
1091
|
+
task: i,
|
|
1092
|
+
onSave: r,
|
|
1093
|
+
onDelete: x,
|
|
1094
|
+
onBack: () => {
|
|
1095
|
+
v("/scheduled-tasks");
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
)
|
|
1099
|
+
] });
|
|
1100
|
+
}, Ft = () => {
|
|
1101
|
+
const n = Xe(), o = ae(), [i, m] = Ee(), T = fe(i), v = n.state, y = re(), { content: p, totalElements: x } = y, r = (e) => {
|
|
1102
|
+
const a = yt({
|
|
1103
|
+
...T,
|
|
1104
|
+
page: e
|
|
1105
|
+
});
|
|
1106
|
+
m(a);
|
|
1107
|
+
}, k = (e) => {
|
|
1108
|
+
o(
|
|
1109
|
+
{ type: "trigger", id: e },
|
|
1110
|
+
{
|
|
1111
|
+
method: "POST",
|
|
1112
|
+
encType: "application/json"
|
|
1113
|
+
}
|
|
1114
|
+
);
|
|
1115
|
+
}, g = (e, a) => {
|
|
1116
|
+
o(
|
|
1117
|
+
{ type: "updateState", id: e, state: a },
|
|
1118
|
+
{
|
|
1119
|
+
method: "POST",
|
|
1120
|
+
encType: "application/json"
|
|
1121
|
+
}
|
|
1122
|
+
);
|
|
1123
|
+
}, t = (e) => {
|
|
1124
|
+
e.preventDefault();
|
|
1125
|
+
};
|
|
1126
|
+
return /* @__PURE__ */ d.jsx(
|
|
1127
|
+
rt,
|
|
1128
|
+
{
|
|
1129
|
+
fetchStatus: v,
|
|
1130
|
+
scheduledTasks: p || [],
|
|
1131
|
+
scheduledTaskFilters: T,
|
|
1132
|
+
scheduledTasksTotalCount: x || 0,
|
|
1133
|
+
handlePageChange: r,
|
|
1134
|
+
triggerTask: k,
|
|
1135
|
+
updateTaskState: g,
|
|
1136
|
+
handleFilterFormSubmit: t
|
|
1137
|
+
}
|
|
1138
|
+
);
|
|
1139
|
+
};
|
|
1140
|
+
export {
|
|
1141
|
+
Lt as S,
|
|
1142
|
+
vt as a,
|
|
1143
|
+
Dt as b,
|
|
1144
|
+
xt as c,
|
|
1145
|
+
Tt as d,
|
|
1146
|
+
Nt as e,
|
|
1147
|
+
At as f,
|
|
1148
|
+
pt as g,
|
|
1149
|
+
Ft as h,
|
|
1150
|
+
Ct as s
|
|
1151
|
+
};
|
|
1152
|
+
//# sourceMappingURL=ScheduledTasksRoute-CNhOAAKd.js.map
|