@evolver-fi/evolver-basics-admin-components 0.0.19 → 0.0.21

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