@evolver-fi/evolver-basics-admin-components 0.0.20 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/ArrowBack-Bifnzxvs.js +6430 -0
  2. package/dist/ArrowBack-Bifnzxvs.js.map +1 -0
  3. package/dist/{BreadCrumbs-BzG2oi8Z.js → BreadCrumbs-DMuPCevY.js} +2 -2
  4. package/dist/BreadCrumbs-DMuPCevY.js.map +1 -0
  5. package/dist/EnumSelectFilter-BdGla5Yf.js +36 -0
  6. package/dist/EnumSelectFilter-BdGla5Yf.js.map +1 -0
  7. package/dist/ExpandMore-DUn2zrFA.js +1644 -0
  8. package/dist/ExpandMore-DUn2zrFA.js.map +1 -0
  9. package/dist/FilterLink-DIeFjfZX.js +49 -0
  10. package/dist/FilterLink-DIeFjfZX.js.map +1 -0
  11. package/dist/JwtTokensRoute-C74zNV7A.js +2374 -0
  12. package/dist/JwtTokensRoute-C74zNV7A.js.map +1 -0
  13. package/dist/ScheduledTasksRoute-BAetDHqN.js +611 -0
  14. package/dist/ScheduledTasksRoute-BAetDHqN.js.map +1 -0
  15. package/dist/SingleLogMessageRoute-Dl2NFfqG.js +419 -0
  16. package/dist/SingleLogMessageRoute-Dl2NFfqG.js.map +1 -0
  17. package/dist/SingleMessageRoute-fC94BR1C.js +306 -0
  18. package/dist/SingleMessageRoute-fC94BR1C.js.map +1 -0
  19. package/dist/Table-DWiRP1za.js +120 -0
  20. package/dist/Table-DWiRP1za.js.map +1 -0
  21. package/dist/TextFilter-BHWY2B7i.js +67 -0
  22. package/dist/TextFilter-BHWY2B7i.js.map +1 -0
  23. package/dist/{TriggerablesRoute-opCAjNCv.js → TriggerablesRoute-DiEEX1cR.js} +572 -576
  24. package/dist/TriggerablesRoute-DiEEX1cR.js.map +1 -0
  25. package/dist/api-BD_4zyJw.js +38 -0
  26. package/dist/api-BD_4zyJw.js.map +1 -0
  27. package/dist/breadcrumbs/index.js +1 -1
  28. package/dist/client/index.js +380 -0
  29. package/dist/client/index.js.map +1 -0
  30. package/dist/configuration-values/index.js +13 -0
  31. package/dist/configuration-values/index.js.map +1 -0
  32. package/dist/control-values/index.js +10 -0
  33. package/dist/control-values/index.js.map +1 -0
  34. package/dist/createSvgIcon-dA_Vj2W0.js +3914 -0
  35. package/dist/{createSvgIcon-Cf1cru4R.js.map → createSvgIcon-dA_Vj2W0.js.map} +1 -1
  36. package/dist/exhaustiveValues-Dx50G3yz.js +5 -0
  37. package/dist/exhaustiveValues-Dx50G3yz.js.map +1 -0
  38. package/dist/filter/index.js +5 -6
  39. package/dist/formData-BH8saYep.js +65 -0
  40. package/dist/formData-BH8saYep.js.map +1 -0
  41. package/dist/{jsx-runtime-B6kdoens.js → jsx-runtime-D858t2LC.js} +201 -219
  42. package/dist/{jsx-runtime-B6kdoens.js.map → jsx-runtime-D858t2LC.js.map} +1 -1
  43. package/dist/jwt-tokens/index.js +6 -4
  44. package/dist/loader-CrveWlGb.js +375 -0
  45. package/dist/loader-CrveWlGb.js.map +1 -0
  46. package/dist/loader-D-oC32OJ.js +3612 -0
  47. package/dist/loader-D-oC32OJ.js.map +1 -0
  48. package/dist/loader-rVy8Z9xH.js +130 -0
  49. package/dist/loader-rVy8Z9xH.js.map +1 -0
  50. package/dist/main/index.js +84 -48
  51. package/dist/main/index.js.map +1 -1
  52. package/dist/message-log/index.js +7 -5
  53. package/dist/message-sending/index.js +4 -4
  54. package/dist/message-targets/index.js +15 -0
  55. package/dist/message-targets/index.js.map +1 -0
  56. package/dist/pagination-Dy4ansKN.js +21 -0
  57. package/dist/pagination-Dy4ansKN.js.map +1 -0
  58. package/dist/scheduled-tasks/index.js +11 -9
  59. package/dist/schemas-CBHIJ_eF.js +3059 -0
  60. package/dist/schemas-CBHIJ_eF.js.map +1 -0
  61. package/dist/table/index.js +1 -1
  62. package/dist/triggerables/index.js +5 -3
  63. package/dist/triggerables/index.js.map +1 -1
  64. package/dist/types/breadcrumbs.d.ts +0 -1
  65. package/dist/types/client.d.ts +1 -0
  66. package/dist/types/configuration-values.d.ts +1 -0
  67. package/dist/types/control-values.d.ts +1 -0
  68. package/dist/types/filter.d.ts +0 -1
  69. package/dist/types/jwt-tokens.d.ts +0 -1
  70. package/dist/types/main.d.ts +0 -1
  71. package/dist/types/message-log.d.ts +0 -1
  72. package/dist/types/message-sending.d.ts +0 -1
  73. package/dist/types/message-targets.d.ts +1 -0
  74. package/dist/types/scheduled-tasks.d.ts +0 -1
  75. package/dist/types/table.d.ts +0 -1
  76. package/dist/types/triggerables.d.ts +0 -1
  77. package/package.json +51 -27
  78. package/dist/BreadCrumbs-BzG2oi8Z.js.map +0 -1
  79. package/dist/ConfirmButton-jayUa8_J.js +0 -16
  80. package/dist/ConfirmButton-jayUa8_J.js.map +0 -1
  81. package/dist/EnumSelectFilter-DiJhYa2m.js +0 -40
  82. package/dist/EnumSelectFilter-DiJhYa2m.js.map +0 -1
  83. package/dist/ExpandMore-D6gf2UVG.js +0 -14
  84. package/dist/ExpandMore-D6gf2UVG.js.map +0 -1
  85. package/dist/FilterLink-CHw7-m82.js +0 -43
  86. package/dist/FilterLink-CHw7-m82.js.map +0 -1
  87. package/dist/JwtTokensRoute-B3SgLM0q.js +0 -2335
  88. package/dist/JwtTokensRoute-B3SgLM0q.js.map +0 -1
  89. package/dist/ScheduledTasksRoute-CNhOAAKd.js +0 -1152
  90. package/dist/ScheduledTasksRoute-CNhOAAKd.js.map +0 -1
  91. package/dist/SingleLogMessageRoute-C9CL51r-.js +0 -274
  92. package/dist/SingleLogMessageRoute-C9CL51r-.js.map +0 -1
  93. package/dist/SingleMessageRoute-DaaWvgfS.js +0 -293
  94. package/dist/SingleMessageRoute-DaaWvgfS.js.map +0 -1
  95. package/dist/Table-DgRqEB1x.js +0 -154
  96. package/dist/Table-DgRqEB1x.js.map +0 -1
  97. package/dist/TableMetadataDisplay-C7RP2ZrM.js +0 -122
  98. package/dist/TableMetadataDisplay-C7RP2ZrM.js.map +0 -1
  99. package/dist/TextFilter-BKUfkFQe.js +0 -70
  100. package/dist/TextFilter-BKUfkFQe.js.map +0 -1
  101. package/dist/TriggerablesRoute-opCAjNCv.js.map +0 -1
  102. package/dist/createSvgIcon-Cf1cru4R.js +0 -3945
  103. package/dist/evolverClient-B_TZXnpV.js +0 -1602
  104. package/dist/evolverClient-B_TZXnpV.js.map +0 -1
  105. package/dist/parser-Bj3mcA83.js +0 -6096
  106. package/dist/parser-Bj3mcA83.js.map +0 -1
  107. package/dist/types/admin-components/src/common/format.d.ts +0 -1
  108. package/dist/types/admin-components/src/common/types.d.ts +0 -27
  109. package/dist/types/admin-components/src/common/validation.d.ts +0 -5
  110. package/dist/types/admin-components/src/components/breadcrumbs/BreadCrumbs.d.ts +0 -10
  111. package/dist/types/admin-components/src/components/breadcrumbs/index.d.ts +0 -1
  112. package/dist/types/admin-components/src/components/filter/EnumSelectFilter.d.ts +0 -11
  113. package/dist/types/admin-components/src/components/filter/FilterHelperTexts.d.ts +0 -4
  114. package/dist/types/admin-components/src/components/filter/FilterLink.d.ts +0 -2
  115. package/dist/types/admin-components/src/components/filter/TextFilter.d.ts +0 -2
  116. package/dist/types/admin-components/src/components/filter/index.d.ts +0 -5
  117. package/dist/types/admin-components/src/components/filter/types.d.ts +0 -20
  118. package/dist/types/admin-components/src/components/metadata/TableMetadataDisplay.d.ts +0 -2
  119. package/dist/types/admin-components/src/components/metadata/utils.d.ts +0 -1
  120. package/dist/types/admin-components/src/components/table/Pagination.d.ts +0 -7
  121. package/dist/types/admin-components/src/components/table/Table.d.ts +0 -3
  122. package/dist/types/admin-components/src/components/table/index.d.ts +0 -3
  123. package/dist/types/admin-components/src/components/table/types.d.ts +0 -48
  124. package/dist/types/admin-components/src/index.d.ts +0 -8
  125. package/dist/types/admin-components/src/routes/jwt-tokens/JwtTokensRoute.d.ts +0 -2
  126. package/dist/types/admin-components/src/routes/jwt-tokens/index.d.ts +0 -2
  127. package/dist/types/admin-components/src/routes/jwt-tokens/loader.d.ts +0 -11
  128. package/dist/types/admin-components/src/routes/message-log/MessageLogRoute.d.ts +0 -2
  129. package/dist/types/admin-components/src/routes/message-log/SingleLogMessageRoute.d.ts +0 -2
  130. package/dist/types/admin-components/src/routes/message-log/index.d.ts +0 -3
  131. package/dist/types/admin-components/src/routes/message-log/loader.d.ts +0 -7
  132. package/dist/types/admin-components/src/routes/message-log/messageLogColumns.d.ts +0 -3
  133. package/dist/types/admin-components/src/routes/message-log/types.d.ts +0 -35
  134. package/dist/types/admin-components/src/routes/message-sending/MessageSendingRoute.d.ts +0 -2
  135. package/dist/types/admin-components/src/routes/message-sending/SingleMessageRoute.d.ts +0 -2
  136. package/dist/types/admin-components/src/routes/message-sending/index.d.ts +0 -3
  137. package/dist/types/admin-components/src/routes/message-sending/loader.d.ts +0 -6
  138. package/dist/types/admin-components/src/routes/message-sending/messageSendingColumns.d.ts +0 -3
  139. package/dist/types/admin-components/src/routes/message-sending/types.d.ts +0 -41
  140. package/dist/types/admin-components/src/routes/scheduled-tasks/ScheduledTaskFormRoute.d.ts +0 -2
  141. package/dist/types/admin-components/src/routes/scheduled-tasks/ScheduledTasksRoute.d.ts +0 -2
  142. package/dist/types/admin-components/src/routes/scheduled-tasks/action.d.ts +0 -20
  143. package/dist/types/admin-components/src/routes/scheduled-tasks/index.d.ts +0 -4
  144. package/dist/types/admin-components/src/routes/scheduled-tasks/loader.d.ts +0 -9
  145. package/dist/types/admin-components/src/routes/triggerables/TriggerablesRoute.d.ts +0 -2
  146. package/dist/types/admin-components/src/routes/triggerables/action.d.ts +0 -10
  147. package/dist/types/admin-components/src/routes/triggerables/index.d.ts +0 -3
  148. package/dist/types/admin-components/src/routes/triggerables/loader.d.ts +0 -9
  149. package/dist/types/admin-ui/src/front-page/FrontPage.d.ts +0 -2
  150. package/dist/validation-DStiilqx.js +0 -22
  151. package/dist/validation-DStiilqx.js.map +0 -1
@@ -0,0 +1,611 @@
1
+ import { redirect as M, useLoaderData as W, useParams as X, useNavigate as _, useSubmit as B, useActionData as Y, useNavigation as ee, useSearchParams as se } from "react-router";
2
+ import { a as H, g as te } from "./pagination-Dy4ansKN.js";
3
+ import { a as re } from "./api-BD_4zyJw.js";
4
+ import { j as e } from "./jsx-runtime-D858t2LC.js";
5
+ import K from "cronstrue";
6
+ import { useState as F } from "react";
7
+ import { Box as v, Collapse as ae, Alert as ie, Paper as ne, Typography as h, Stack as z, TextField as x, FormControl as E, InputLabel as C, Select as A, MenuItem as y, FormHelperText as oe, Button as g, CircularProgress as le, TableContainer as ce, Table as de, TableHead as ue, TableRow as U, TableCell as o, TableBody as me, TablePagination as he } from "@mui/material";
8
+ import { e as D } from "./exhaustiveValues-Dx50G3yz.js";
9
+ import { s as p, N as $, o as G, _ as Z, n as T } from "./schemas-CBHIJ_eF.js";
10
+ const ge = async (r, t) => {
11
+ const s = await t.GET("/schedule", {
12
+ params: {
13
+ query: r
14
+ }
15
+ });
16
+ if ("error" in s)
17
+ throw new Error(`Failed to fetch scheduled tasks: ${s.response.status}`);
18
+ return s.data;
19
+ }, pe = async (r, t) => {
20
+ const s = await t.GET("/schedule/{id}", {
21
+ params: {
22
+ path: { id: r }
23
+ }
24
+ });
25
+ if ("error" in s)
26
+ throw new Error(`Failed to fetch scheduled task: ${s.response.status}`);
27
+ return s.data;
28
+ }, xe = async (r, t) => {
29
+ const s = await t.POST("/schedule", {
30
+ body: r
31
+ });
32
+ if ("error" in s)
33
+ throw new Error(`Failed to save scheduled task: ${s.response.status}`);
34
+ return s.response.status;
35
+ }, Te = async (r, t) => {
36
+ const s = await t.POST("/schedule/{id}/delete", {
37
+ params: {
38
+ path: { id: r }
39
+ }
40
+ });
41
+ if ("error" in s)
42
+ throw new Error(`Failed to delete scheduled task: ${s.response.status}`);
43
+ return s.response.status;
44
+ }, je = async (r, t) => {
45
+ const s = await t.POST("/schedule/{id}/run", {
46
+ params: {
47
+ path: { id: r }
48
+ }
49
+ });
50
+ if ("error" in s)
51
+ throw new Error(`Failed to trigger scheduled task: ${s.response.status}`);
52
+ return s.response.status;
53
+ }, fe = async (r, t, s) => {
54
+ if (!t)
55
+ throw new Error("State is required to update scheduled task state");
56
+ const a = await s.POST("/schedule/{id}/state/{state}", {
57
+ params: {
58
+ path: { id: r, state: t }
59
+ }
60
+ });
61
+ if ("error" in a)
62
+ throw new Error(`Failed to update scheduled task state: ${a.response.status}`);
63
+ return a.response.status;
64
+ }, We = (r) => async ({ request: t }) => {
65
+ try {
66
+ const s = await t.json();
67
+ switch (s.type) {
68
+ case "save": {
69
+ if (!s.task)
70
+ return { status: 400, message: "Task data is required" };
71
+ const a = await xe(s.task, r);
72
+ if (a === 204) {
73
+ if (s.task.id === void 0 || s.task.id === 0)
74
+ throw M("/scheduled-tasks");
75
+ return {
76
+ status: 204,
77
+ message: "Task updated"
78
+ };
79
+ }
80
+ return { status: a, message: "Failed to save task" };
81
+ }
82
+ case "delete": {
83
+ if (!s.id)
84
+ return { status: 400, message: "Task ID is required" };
85
+ const a = await Te(s.id, r);
86
+ if (a === 204)
87
+ throw M("/scheduled-tasks");
88
+ return a === 404 ? { status: 404, message: "Task not found" } : { status: a, message: "Failed to delete task" };
89
+ }
90
+ default:
91
+ return { status: 400, message: "Invalid action type" };
92
+ }
93
+ } catch (s) {
94
+ if (s instanceof Response && s.status >= 300 && s.status < 400)
95
+ throw s;
96
+ return console.error(s), {
97
+ status: 500,
98
+ message: "Failed to process request"
99
+ };
100
+ }
101
+ }, _e = (r) => async ({ request: t }) => {
102
+ try {
103
+ const s = await t.json();
104
+ switch (s.type) {
105
+ case "trigger": {
106
+ if (!s.id)
107
+ return { status: 400, message: "Task ID is required" };
108
+ const a = await je(s.id, r);
109
+ return a === 200 || a === 204 ? { status: a, message: "Task triggered" } : { status: a, message: "Failed to trigger task" };
110
+ }
111
+ case "updateState": {
112
+ if (!s.id || !s.state)
113
+ return {
114
+ status: 400,
115
+ message: "Task ID and state are required"
116
+ };
117
+ const a = await fe(s.id, s.state, r);
118
+ return a === 200 || a === 204 ? { status: a, message: "Task state updated" } : {
119
+ status: a,
120
+ message: "Failed to update task state"
121
+ };
122
+ }
123
+ default:
124
+ return { status: 400, message: "Invalid action type" };
125
+ }
126
+ } catch (s) {
127
+ return console.error(s), {
128
+ status: 500,
129
+ message: "Failed to process request"
130
+ };
131
+ }
132
+ }, be = () => ({
133
+ name: "",
134
+ state: "WAITING",
135
+ cronExpression: "",
136
+ timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC",
137
+ triggerable: "",
138
+ priority: 0,
139
+ timeoutMs: 0,
140
+ missPolicy: "SKIP_ALL",
141
+ args: {}
142
+ }), Be = (r) => async ({ params: t }) => {
143
+ const s = t.id, a = await re(r);
144
+ if (s === "new")
145
+ return {
146
+ task: be(),
147
+ triggerables: a
148
+ };
149
+ if (!s && s !== "0" || Number.isNaN(parseInt(s, 10)))
150
+ throw new Response("", {
151
+ status: 404,
152
+ statusText: "Not found"
153
+ });
154
+ const d = parseInt(s, 10);
155
+ return {
156
+ task: await pe(d, r),
157
+ triggerables: a
158
+ };
159
+ }, He = (r) => async ({ request: t }) => {
160
+ try {
161
+ const s = new URL(t.url), a = H(s.searchParams);
162
+ return await ge(a, r);
163
+ } catch (s) {
164
+ throw console.error(s), new Error("Failed to fetch scheduled tasks");
165
+ }
166
+ }, R = D()([
167
+ "WAITING",
168
+ "RUNNING",
169
+ "PAUSED"
170
+ ]), L = D()([
171
+ "SKIP_ALL",
172
+ "RUN_ONCE",
173
+ "RUN_ALL"
174
+ ]), ke = (r) => R.some((t) => t === r), ye = (r) => L.some((t) => t === r), ve = (r) => {
175
+ const t = r.trim();
176
+ try {
177
+ return K.toString(t, {
178
+ use24HourTimeFormat: !0
179
+ }), !0;
180
+ } catch {
181
+ return !1;
182
+ }
183
+ }, Se = (r) => {
184
+ try {
185
+ return Intl.DateTimeFormat(void 0, { timeZone: r }), !0;
186
+ } catch {
187
+ return !1;
188
+ }
189
+ }, we = p().transform((r, t) => {
190
+ try {
191
+ const s = JSON.parse(r || "{}");
192
+ return !s || typeof s != "object" || Array.isArray(s) ? (t.addIssue({
193
+ code: "custom",
194
+ message: "Args must be a JSON object"
195
+ }), $) : Object.fromEntries(
196
+ Object.entries(s).map(([a, d]) => [a, String(d)])
197
+ );
198
+ } catch {
199
+ return t.addIssue({
200
+ code: "custom",
201
+ message: "Args must be valid JSON"
202
+ }), $;
203
+ }
204
+ }), Ie = G({
205
+ task: G({
206
+ id: T().optional(),
207
+ name: p().trim().min(1, { message: "Name is required" }),
208
+ state: Z(R).optional(),
209
+ cronExpression: p().trim().min(1, { message: "Cron expression is required" }).refine(ve, {
210
+ message: "Cron expression must be a valid Spring cron expression"
211
+ }),
212
+ timeZone: p().trim().min(1, { message: "Time zone is required" }).refine(Se, { message: "Invalid IANA time zone" }),
213
+ lastFiredTime: T().optional(),
214
+ lastFinishedTime: T().optional(),
215
+ nextFireTime: T().optional(),
216
+ triggerable: p().trim().min(1, { message: "Triggerable is required" }),
217
+ priority: T().refine(Number.isFinite, { message: "Priority is required" }).refine(Number.isInteger, { message: "Priority must be an integer" }),
218
+ timeoutMs: T().refine(Number.isFinite, { message: "Timeout is required" }).refine(Number.isInteger, { message: "Timeout must be an integer" }).refine((r) => r >= 0, { message: "Timeout must be zero or greater" }),
219
+ missPolicy: Z(L),
220
+ lastInitiator: p().optional(),
221
+ running: p().optional()
222
+ }),
223
+ argsText: we
224
+ }).transform(
225
+ ({ task: r, argsText: t }) => ({
226
+ ...r,
227
+ args: t
228
+ })
229
+ ), Ne = D()([
230
+ "id",
231
+ "name",
232
+ "state",
233
+ "cronExpression",
234
+ "timeZone",
235
+ "lastFiredTime",
236
+ "lastFinishedTime",
237
+ "nextFireTime",
238
+ "triggerable",
239
+ "priority",
240
+ "timeoutMs",
241
+ "missPolicy",
242
+ "lastInitiator",
243
+ "running",
244
+ "args"
245
+ ]), Pe = (r) => typeof r == "string" && Ne.some((t) => t === r), Fe = (r) => {
246
+ const [t, s] = r;
247
+ if (t === "argsText")
248
+ return "args";
249
+ if (t === "task" && Pe(s))
250
+ return s;
251
+ }, Ee = (r, t) => {
252
+ const s = Ie.safeParse({ task: r, argsText: t });
253
+ if (s.success)
254
+ return { ok: !0, value: s.data };
255
+ const a = {};
256
+ return s.error.issues.forEach((d) => {
257
+ const l = Fe(d.path);
258
+ l !== void 0 && !(l in a) && (a[l] = d.message);
259
+ }), { ok: !1, errors: a };
260
+ }, O = (r) => r === void 0 ? "-" : new Date(r).toISOString(), Ce = (r) => JSON.stringify(r ?? {}, null, 2), Ae = (r) => {
261
+ const t = r.name ?? "(unnamed)", s = r.type ? `: ${r.type}` : "", a = r.required ? "required" : "optional";
262
+ return `${t}${s} (${a})`;
263
+ }, Oe = (r) => {
264
+ if (r.trim())
265
+ try {
266
+ return K.toString(r, {
267
+ use24HourTimeFormat: !0
268
+ });
269
+ } catch {
270
+ return;
271
+ }
272
+ }, Ke = () => {
273
+ const r = W(), [t, s] = F(r.task), [a, d] = F(Ce(r.task.args)), [l, j] = F({}), f = Object.keys(r.triggerables).sort((i, u) => i.localeCompare(u)), S = t.triggerable && !f.includes(t.triggerable) ? [t.triggerable, ...f] : f, k = r.triggerables[t.triggerable] ?? [], w = k.length ? k.map(Ae).join(", ") : "Selected triggerable does not declare args.", I = Oe(t.cronExpression), b = X(), { id: n } = b, c = _(), m = B(), N = Y(), J = () => {
274
+ n === "new" || t.id === void 0 || !window.confirm(`Delete scheduled task "${t.name || t.id}"?`) || m(
275
+ { type: "delete", id: t.id },
276
+ {
277
+ method: "POST",
278
+ encType: "application/json"
279
+ }
280
+ );
281
+ }, V = () => {
282
+ const i = Ee(t, a);
283
+ if (!i.ok) {
284
+ j(i.errors);
285
+ return;
286
+ }
287
+ j({});
288
+ let u;
289
+ if (n !== "new" && i.value.id !== 0)
290
+ u = i.value;
291
+ else {
292
+ const { id: qe, ...Q } = i.value;
293
+ u = Q;
294
+ }
295
+ m(
296
+ { type: "save", task: u },
297
+ {
298
+ method: "POST",
299
+ encType: "application/json"
300
+ }
301
+ );
302
+ }, P = N ? {
303
+ severity: N.status < 300 ? "success" : "error",
304
+ message: N.message
305
+ } : null;
306
+ return /* @__PURE__ */ e.jsxs(v, { component: "section", sx: { p: 2, maxWidth: 1e3 }, children: [
307
+ /* @__PURE__ */ e.jsx(ae, { in: P !== null, unmountOnExit: !0, children: /* @__PURE__ */ e.jsx(ie, { severity: P?.severity, children: P?.message }) }),
308
+ /* @__PURE__ */ e.jsxs(ne, { sx: { p: 2, mt: 2 }, children: [
309
+ /* @__PURE__ */ e.jsx(h, { variant: "h4", component: "h1", sx: { mb: 2 }, children: n === "new" ? "New scheduled task" : "Edit scheduled task" }),
310
+ /* @__PURE__ */ e.jsxs(z, { gap: 2, children: [
311
+ /* @__PURE__ */ e.jsx(
312
+ x,
313
+ {
314
+ label: "Name",
315
+ required: !0,
316
+ value: t.name,
317
+ error: !!l.name,
318
+ helperText: l.name,
319
+ onChange: (i) => s({ ...t, name: i.target.value })
320
+ }
321
+ ),
322
+ /* @__PURE__ */ e.jsxs(E, { children: [
323
+ /* @__PURE__ */ e.jsx(C, { id: "scheduled-task-state-label", children: "State" }),
324
+ /* @__PURE__ */ e.jsx(
325
+ A,
326
+ {
327
+ labelId: "scheduled-task-state-label",
328
+ label: "State",
329
+ value: t.state ?? "WAITING",
330
+ onChange: (i) => {
331
+ const u = i.target.value;
332
+ ke(u) && s({
333
+ ...t,
334
+ state: u
335
+ });
336
+ },
337
+ children: R.map((i) => /* @__PURE__ */ e.jsx(y, { value: i, children: i }, i))
338
+ }
339
+ )
340
+ ] }),
341
+ /* @__PURE__ */ e.jsx(
342
+ x,
343
+ {
344
+ label: "Cron expression",
345
+ required: !0,
346
+ value: t.cronExpression,
347
+ error: !!l.cronExpression,
348
+ helperText: l.cronExpression ?? I ?? "Cron preview unavailable. The value will still be submitted to the backend.",
349
+ onChange: (i) => s({ ...t, cronExpression: i.target.value })
350
+ }
351
+ ),
352
+ /* @__PURE__ */ e.jsx(
353
+ x,
354
+ {
355
+ label: "Time zone",
356
+ required: !0,
357
+ value: t.timeZone,
358
+ error: !!l.timeZone,
359
+ helperText: l.timeZone ?? "IANA time zone, for example Europe/Helsinki or UTC.",
360
+ onChange: (i) => s({ ...t, timeZone: i.target.value })
361
+ }
362
+ ),
363
+ /* @__PURE__ */ e.jsxs(E, { required: !0, error: !!l.triggerable, children: [
364
+ /* @__PURE__ */ e.jsx(C, { id: "scheduled-task-triggerable-label", children: "Triggerable" }),
365
+ /* @__PURE__ */ e.jsxs(
366
+ A,
367
+ {
368
+ labelId: "scheduled-task-triggerable-label",
369
+ label: "Triggerable",
370
+ value: t.triggerable,
371
+ onChange: (i) => s({ ...t, triggerable: i.target.value }),
372
+ children: [
373
+ /* @__PURE__ */ e.jsx(y, { value: "", children: /* @__PURE__ */ e.jsx("em", { children: "Select triggerable" }) }),
374
+ S.map((i) => /* @__PURE__ */ e.jsx(y, { value: i, children: i }, i))
375
+ ]
376
+ }
377
+ ),
378
+ /* @__PURE__ */ e.jsx(oe, { children: l.triggerable ?? "Fetched from the triggerables endpoint." })
379
+ ] }),
380
+ /* @__PURE__ */ e.jsx(
381
+ x,
382
+ {
383
+ type: "number",
384
+ label: "Priority",
385
+ value: t.priority,
386
+ error: !!l.priority,
387
+ helperText: l.priority,
388
+ onChange: (i) => s({
389
+ ...t,
390
+ priority: Number.parseInt(i.target.value, 10)
391
+ })
392
+ }
393
+ ),
394
+ /* @__PURE__ */ e.jsx(
395
+ x,
396
+ {
397
+ type: "number",
398
+ label: "Timeout, ms",
399
+ value: t.timeoutMs,
400
+ error: !!l.timeoutMs,
401
+ helperText: l.timeoutMs,
402
+ onChange: (i) => s({
403
+ ...t,
404
+ timeoutMs: Number.parseInt(i.target.value, 10)
405
+ })
406
+ }
407
+ ),
408
+ /* @__PURE__ */ e.jsxs(E, { children: [
409
+ /* @__PURE__ */ e.jsx(C, { id: "scheduled-task-miss-policy-label", children: "Miss policy" }),
410
+ /* @__PURE__ */ e.jsx(
411
+ A,
412
+ {
413
+ labelId: "scheduled-task-miss-policy-label",
414
+ label: "Miss policy",
415
+ value: t.missPolicy,
416
+ onChange: (i) => {
417
+ const u = i.target.value;
418
+ ye(u) && s({
419
+ ...t,
420
+ missPolicy: u
421
+ });
422
+ },
423
+ children: L.map((i) => /* @__PURE__ */ e.jsx(y, { value: i, children: i }, i))
424
+ }
425
+ )
426
+ ] }),
427
+ /* @__PURE__ */ e.jsx(
428
+ x,
429
+ {
430
+ label: "Args",
431
+ multiline: !0,
432
+ minRows: 4,
433
+ value: a,
434
+ error: !!l.args,
435
+ helperText: l.args ?? "JSON object. Values are saved as strings.",
436
+ onChange: (i) => d(i.target.value)
437
+ }
438
+ ),
439
+ t.triggerable && /* @__PURE__ */ e.jsxs(
440
+ v,
441
+ {
442
+ sx: {
443
+ mt: -1,
444
+ px: 1.75,
445
+ py: 1,
446
+ bgcolor: "grey.100",
447
+ borderRadius: 1
448
+ },
449
+ children: [
450
+ /* @__PURE__ */ e.jsxs(h, { variant: "caption", color: "text.secondary", component: "div", children: [
451
+ "Declared args for ",
452
+ t.triggerable
453
+ ] }),
454
+ /* @__PURE__ */ e.jsx(h, { variant: "body2", children: w })
455
+ ]
456
+ }
457
+ ),
458
+ n !== "new" && /* @__PURE__ */ e.jsxs(v, { component: "dl", sx: { display: "grid", gridTemplateColumns: "160px 1fr", gap: 1 }, children: [
459
+ /* @__PURE__ */ e.jsx(h, { component: "dt", children: "Last fired" }),
460
+ /* @__PURE__ */ e.jsx(h, { component: "dd", sx: { m: 0 }, children: O(t.lastFiredTime) }),
461
+ /* @__PURE__ */ e.jsx(h, { component: "dt", children: "Last finished" }),
462
+ /* @__PURE__ */ e.jsx(h, { component: "dd", sx: { m: 0 }, children: O(t.lastFinishedTime) }),
463
+ /* @__PURE__ */ e.jsx(h, { component: "dt", children: "Next fire" }),
464
+ /* @__PURE__ */ e.jsx(h, { component: "dd", sx: { m: 0 }, children: O(t.nextFireTime) })
465
+ ] }),
466
+ /* @__PURE__ */ e.jsxs(z, { direction: "row", gap: 1, children: [
467
+ /* @__PURE__ */ e.jsx(g, { variant: "contained", onClick: V, children: "Save" }),
468
+ n !== "new" && /* @__PURE__ */ e.jsx(g, { color: "error", variant: "outlined", onClick: J, children: "Delete" }),
469
+ /* @__PURE__ */ e.jsx(g, { variant: "outlined", onClick: () => c("/scheduled-tasks"), children: "Cancel" })
470
+ ] })
471
+ ] })
472
+ ] })
473
+ ] });
474
+ }, q = (r) => r === void 0 ? "-" : new Date(r).toISOString(), Je = () => {
475
+ const r = _(), t = ee(), s = B(), [a, d] = se(), l = H(a), j = t.state, f = W(), { content: S, totalElements: k } = f, w = (n) => {
476
+ d(te(a, n));
477
+ }, I = (n) => {
478
+ s(
479
+ { type: "trigger", id: n },
480
+ {
481
+ method: "POST",
482
+ encType: "application/json"
483
+ }
484
+ );
485
+ }, b = (n, c) => {
486
+ s(
487
+ { type: "updateState", id: n, state: c },
488
+ {
489
+ method: "POST",
490
+ encType: "application/json"
491
+ }
492
+ );
493
+ };
494
+ return j === "loading" ? /* @__PURE__ */ e.jsx(le, {}) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
495
+ /* @__PURE__ */ e.jsx(v, { sx: { p: 1 }, children: /* @__PURE__ */ e.jsx(g, { variant: "contained", onClick: () => r("./new", { relative: "path" }), children: "New scheduled task" }) }),
496
+ /* @__PURE__ */ e.jsx(ce, { sx: { height: "calc(100vh - 180px)" }, children: /* @__PURE__ */ e.jsxs(de, { size: "small", stickyHeader: !0, children: [
497
+ /* @__PURE__ */ e.jsx(ue, { children: /* @__PURE__ */ e.jsxs(U, { children: [
498
+ /* @__PURE__ */ e.jsx(o, { children: "Name" }),
499
+ /* @__PURE__ */ e.jsx(o, { children: "State" }),
500
+ /* @__PURE__ */ e.jsx(o, { children: "Cron expression" }),
501
+ /* @__PURE__ */ e.jsx(o, { children: "Time zone" }),
502
+ /* @__PURE__ */ e.jsx(o, { children: "Last fired" }),
503
+ /* @__PURE__ */ e.jsx(o, { children: "Last finished" }),
504
+ /* @__PURE__ */ e.jsx(o, { children: "Next fire" }),
505
+ /* @__PURE__ */ e.jsx(o, { children: "Triggerable" }),
506
+ /* @__PURE__ */ e.jsx(o, { children: "Priority" }),
507
+ /* @__PURE__ */ e.jsx(o, { children: "Timeout, ms" }),
508
+ /* @__PURE__ */ e.jsx(o, { children: "Miss policy" }),
509
+ /* @__PURE__ */ e.jsx(o, { children: "Trigger" }),
510
+ /* @__PURE__ */ e.jsx(o, { children: "State action" })
511
+ ] }) }),
512
+ /* @__PURE__ */ e.jsx(me, { children: (S ?? []).map((n) => {
513
+ const c = n.id;
514
+ return /* @__PURE__ */ e.jsxs(
515
+ U,
516
+ {
517
+ hover: !0,
518
+ sx: { cursor: c !== void 0 ? "pointer" : "default" },
519
+ onClick: () => {
520
+ c !== void 0 && r(`/scheduled-tasks/${c}`);
521
+ },
522
+ children: [
523
+ /* @__PURE__ */ e.jsx(o, { children: n.name }),
524
+ /* @__PURE__ */ e.jsx(o, { children: n.state }),
525
+ /* @__PURE__ */ e.jsx(o, { children: n.cronExpression }),
526
+ /* @__PURE__ */ e.jsx(o, { children: n.timeZone }),
527
+ /* @__PURE__ */ e.jsx(o, { children: q(n.lastFiredTime) }),
528
+ /* @__PURE__ */ e.jsx(o, { children: q(n.lastFinishedTime) }),
529
+ /* @__PURE__ */ e.jsx(o, { children: q(n.nextFireTime) }),
530
+ /* @__PURE__ */ e.jsx(o, { children: n.triggerable }),
531
+ /* @__PURE__ */ e.jsx(o, { children: n.priority }),
532
+ /* @__PURE__ */ e.jsx(o, { children: n.timeoutMs }),
533
+ /* @__PURE__ */ e.jsx(o, { children: n.missPolicy }),
534
+ /* @__PURE__ */ e.jsx(o, { children: c !== void 0 && n.state !== "RUNNING" && /* @__PURE__ */ e.jsx(
535
+ g,
536
+ {
537
+ size: "small",
538
+ onClick: (m) => {
539
+ m.stopPropagation(), I(c);
540
+ },
541
+ children: "Trigger"
542
+ }
543
+ ) }),
544
+ /* @__PURE__ */ e.jsxs(o, { children: [
545
+ c !== void 0 && n.state === "PAUSED" && /* @__PURE__ */ e.jsx(
546
+ g,
547
+ {
548
+ size: "small",
549
+ onClick: (m) => {
550
+ m.stopPropagation(), b(c, "WAITING");
551
+ },
552
+ children: "Activate"
553
+ }
554
+ ),
555
+ c !== void 0 && n.state === "WAITING" && /* @__PURE__ */ e.jsx(
556
+ g,
557
+ {
558
+ size: "small",
559
+ onClick: (m) => {
560
+ m.stopPropagation(), b(c, "PAUSED");
561
+ },
562
+ children: "Pause"
563
+ }
564
+ ),
565
+ c !== void 0 && n.state === "RUNNING" && /* @__PURE__ */ e.jsx(
566
+ g,
567
+ {
568
+ size: "small",
569
+ onClick: (m) => {
570
+ m.stopPropagation(), b(c, "WAITING");
571
+ },
572
+ children: "Stop"
573
+ }
574
+ )
575
+ ] })
576
+ ]
577
+ },
578
+ c ?? n.name
579
+ );
580
+ }) })
581
+ ] }) }),
582
+ /* @__PURE__ */ e.jsx(
583
+ he,
584
+ {
585
+ component: "div",
586
+ count: k ?? 0,
587
+ rowsPerPage: l.size ?? 100,
588
+ page: l.page,
589
+ onPageChange: (n, c) => w(c),
590
+ rowsPerPageOptions: [],
591
+ showFirstButton: !0,
592
+ showLastButton: !0
593
+ }
594
+ )
595
+ ] });
596
+ };
597
+ export {
598
+ Ke as S,
599
+ Je as a,
600
+ ge as b,
601
+ _e as c,
602
+ Te as d,
603
+ He as e,
604
+ pe as f,
605
+ We as g,
606
+ Be as h,
607
+ je as r,
608
+ xe as s,
609
+ fe as u
610
+ };
611
+ //# sourceMappingURL=ScheduledTasksRoute-BAetDHqN.js.map