@evolver-fi/evolver-basics-admin-components 1.0.0 → 8.2.2-alpha.2

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 (198) hide show
  1. package/dist/EnumSelectFilter-DDWIjz5i.js +35 -0
  2. package/dist/EnumSelectFilter-DDWIjz5i.js.map +1 -0
  3. package/dist/FilterLink-OxQDWR5G.js +29 -0
  4. package/dist/FilterLink-OxQDWR5G.js.map +1 -0
  5. package/dist/Table-IciQttr3.js +79 -0
  6. package/dist/Table-IciQttr3.js.map +1 -0
  7. package/dist/TableMetadataDisplay-BM61EulC.js +49 -0
  8. package/dist/TableMetadataDisplay-BM61EulC.js.map +1 -0
  9. package/dist/TextFilter-CLOKjiSd.js +54 -0
  10. package/dist/TextFilter-CLOKjiSd.js.map +1 -0
  11. package/dist/api-CMiZYkfc.js +32 -0
  12. package/dist/api-CMiZYkfc.js.map +1 -0
  13. package/dist/breadcrumbs/index.js +2 -5
  14. package/dist/breadcrumbs-BAwnKRxL.js +32 -0
  15. package/dist/breadcrumbs-BAwnKRxL.js.map +1 -0
  16. package/dist/breadcrumbs.css +1 -0
  17. package/dist/client/index.js +330 -369
  18. package/dist/client/index.js.map +1 -1
  19. package/dist/configuration-values/index.js +2 -13
  20. package/dist/configuration-values-CjOfmPRq.js +3464 -0
  21. package/dist/configuration-values-CjOfmPRq.js.map +1 -0
  22. package/dist/control-values/index.js +2 -10
  23. package/dist/control-values-CzQOB4WJ.js +144 -0
  24. package/dist/control-values-CzQOB4WJ.js.map +1 -0
  25. package/dist/exhaustiveValues-BYWkg9M1.js +6 -0
  26. package/dist/exhaustiveValues-BYWkg9M1.js.map +1 -0
  27. package/dist/filter/index.js +4 -10
  28. package/dist/formData-BO275hRZ.js +43 -0
  29. package/dist/formData-BO275hRZ.js.map +1 -0
  30. package/dist/jwt-tokens/index.js +2 -9
  31. package/dist/jwt-tokens-DnKsHei4.js +71 -0
  32. package/dist/jwt-tokens-DnKsHei4.js.map +1 -0
  33. package/dist/main/index.js +17 -87
  34. package/dist/message-log/index.js +2 -12
  35. package/dist/message-log-BdrJtbsP.js +337 -0
  36. package/dist/message-log-BdrJtbsP.js.map +1 -0
  37. package/dist/message-sending/index.js +2 -10
  38. package/dist/message-sending-dvTw2fFm.js +181 -0
  39. package/dist/message-sending-dvTw2fFm.js.map +1 -0
  40. package/dist/message-targets/index.js +2 -15
  41. package/dist/message-targets-8EppIJde.js +406 -0
  42. package/dist/message-targets-8EppIJde.js.map +1 -0
  43. package/dist/pagination-C4QUYRMf.js +20 -0
  44. package/dist/pagination-C4QUYRMf.js.map +1 -0
  45. package/dist/scheduled-tasks/index.js +2 -16
  46. package/dist/scheduled-tasks-BtBnBrE7.js +647 -0
  47. package/dist/scheduled-tasks-BtBnBrE7.js.map +1 -0
  48. package/dist/schemas-D-8_LuND.js +2986 -0
  49. package/dist/schemas-D-8_LuND.js.map +1 -0
  50. package/dist/table/index.js +2 -6
  51. package/dist/triggerables/index.js +3 -11
  52. package/dist/triggerables-DgrIeQMi.js +51 -0
  53. package/dist/triggerables-DgrIeQMi.js.map +1 -0
  54. package/dist/types/breadcrumbs.d.ts +1 -0
  55. package/dist/types/client/index.d.ts +5 -0
  56. package/dist/types/client.d.ts +1 -0
  57. package/dist/types/common/exhaustiveValues.d.ts +5 -0
  58. package/dist/types/common/formData.d.ts +20 -0
  59. package/dist/types/common/format.d.ts +1 -0
  60. package/dist/types/common/pagination.d.ts +8 -0
  61. package/dist/types/common/types.d.ts +27 -0
  62. package/dist/types/common/validation.d.ts +5 -0
  63. package/dist/types/components/breadcrumbs/BreadCrumbs.d.ts +10 -0
  64. package/dist/types/components/breadcrumbs/index.d.ts +1 -0
  65. package/dist/types/components/filter/EnumSelectFilter.d.ts +7 -0
  66. package/dist/types/components/filter/FilterHelperTexts.d.ts +4 -0
  67. package/dist/types/components/filter/FilterLink.d.ts +2 -0
  68. package/dist/types/components/filter/TextFilter.d.ts +2 -0
  69. package/dist/types/components/filter/createEnumSelectFilter.d.ts +5 -0
  70. package/dist/types/components/filter/index.d.ts +5 -0
  71. package/dist/types/components/filter/types.d.ts +20 -0
  72. package/dist/types/components/metadata/TableMetadataDisplay.d.ts +2 -0
  73. package/dist/types/components/metadata/utils.d.ts +1 -0
  74. package/dist/types/components/table/Pagination.d.ts +7 -0
  75. package/dist/types/components/table/Table.d.ts +3 -0
  76. package/dist/types/components/table/index.d.ts +3 -0
  77. package/dist/types/components/table/types.d.ts +48 -0
  78. package/dist/types/configuration-values.d.ts +1 -0
  79. package/dist/types/control-values.d.ts +1 -0
  80. package/dist/types/filter.d.ts +1 -0
  81. package/dist/types/index.d.ts +11 -0
  82. package/dist/types/jwt-tokens.d.ts +1 -0
  83. package/dist/types/main.d.ts +1 -0
  84. package/dist/types/message-log.d.ts +1 -0
  85. package/dist/types/message-sending.d.ts +1 -0
  86. package/dist/types/message-targets.d.ts +1 -0
  87. package/dist/types/routes/configuration-values/ConfigurationValueFormRoute.d.ts +2 -0
  88. package/dist/types/routes/configuration-values/ConfigurationValuesRoute.d.ts +2 -0
  89. package/dist/types/routes/configuration-values/action.d.ts +8 -0
  90. package/dist/types/routes/configuration-values/api.d.ts +53 -0
  91. package/dist/types/routes/configuration-values/configurationValueColumns.d.ts +4 -0
  92. package/dist/types/routes/configuration-values/index.d.ts +5 -0
  93. package/dist/types/routes/configuration-values/loader.d.ts +52 -0
  94. package/dist/types/routes/control-values/ControlValuesRoute.d.ts +2 -0
  95. package/dist/types/routes/control-values/SingleControlValueRoute.d.ts +2 -0
  96. package/dist/types/routes/control-values/api.d.ts +43 -0
  97. package/dist/types/routes/control-values/controlValueColumns.d.ts +4 -0
  98. package/dist/types/routes/control-values/index.d.ts +4 -0
  99. package/dist/types/routes/control-values/loader.d.ts +43 -0
  100. package/dist/types/routes/jwt-tokens/JwtTokensRoute.d.ts +6 -0
  101. package/dist/types/routes/jwt-tokens/api.d.ts +41 -0
  102. package/dist/types/routes/jwt-tokens/index.d.ts +3 -0
  103. package/dist/types/routes/jwt-tokens/loader.d.ts +35 -0
  104. package/dist/types/routes/message-log/LogBodyLink.d.ts +6 -0
  105. package/dist/types/routes/message-log/MessageLogRoute.d.ts +2 -0
  106. package/dist/types/routes/message-log/SingleLogMessageRoute.d.ts +6 -0
  107. package/dist/types/routes/message-log/api.d.ts +88 -0
  108. package/dist/types/routes/message-log/index.d.ts +4 -0
  109. package/dist/types/routes/message-log/loader.d.ts +53 -0
  110. package/dist/types/routes/message-log/messageLogColumns.d.ts +3 -0
  111. package/dist/types/routes/message-log/types.d.ts +37 -0
  112. package/dist/types/routes/message-sending/MessageSendingRoute.d.ts +2 -0
  113. package/dist/types/routes/message-sending/SingleMessageRoute.d.ts +2 -0
  114. package/dist/types/routes/message-sending/api.d.ts +92 -0
  115. package/dist/types/routes/message-sending/index.d.ts +4 -0
  116. package/dist/types/routes/message-sending/loader.d.ts +34 -0
  117. package/dist/types/routes/message-sending/messageSendingColumns.d.ts +3 -0
  118. package/dist/types/routes/message-sending/types.d.ts +43 -0
  119. package/dist/types/routes/message-targets/MessageTargetFormRoute.d.ts +2 -0
  120. package/dist/types/routes/message-targets/MessageTargetsRoute.d.ts +2 -0
  121. package/dist/types/routes/message-targets/action.d.ts +8 -0
  122. package/dist/types/routes/message-targets/api.d.ts +12 -0
  123. package/dist/types/routes/message-targets/index.d.ts +5 -0
  124. package/dist/types/routes/message-targets/loader.d.ts +15 -0
  125. package/dist/types/routes/scheduled-tasks/ScheduledTaskFormRoute.d.ts +2 -0
  126. package/dist/types/routes/scheduled-tasks/ScheduledTasksRoute.d.ts +2 -0
  127. package/dist/types/routes/scheduled-tasks/action.d.ts +21 -0
  128. package/dist/types/routes/scheduled-tasks/api.d.ts +75 -0
  129. package/dist/types/routes/scheduled-tasks/index.d.ts +5 -0
  130. package/dist/types/routes/scheduled-tasks/loader.d.ts +57 -0
  131. package/dist/types/routes/scheduled-tasks/parseScheduledTask.d.ts +15 -0
  132. package/dist/types/routes/triggerables/TriggerablesRoute.d.ts +2 -0
  133. package/dist/types/routes/triggerables/action.d.ts +6 -0
  134. package/dist/types/routes/triggerables/api.d.ts +33 -0
  135. package/dist/types/routes/triggerables/index.d.ts +4 -0
  136. package/dist/types/routes/triggerables/loader.d.ts +3 -0
  137. package/dist/types/scheduled-tasks.d.ts +1 -0
  138. package/dist/types/table.d.ts +1 -0
  139. package/dist/types/triggerables.d.ts +1 -0
  140. package/dist/types/types/openapiTypes.d.ts +3321 -0
  141. package/package.json +12 -5
  142. package/dist/ArrowBack-Bifnzxvs.js +0 -6430
  143. package/dist/ArrowBack-Bifnzxvs.js.map +0 -1
  144. package/dist/BreadCrumbs-DMuPCevY.js +0 -19
  145. package/dist/BreadCrumbs-DMuPCevY.js.map +0 -1
  146. package/dist/BreadCrumbs.css +0 -1
  147. package/dist/EnumSelectFilter-BdGla5Yf.js +0 -36
  148. package/dist/EnumSelectFilter-BdGla5Yf.js.map +0 -1
  149. package/dist/ExpandMore-DUn2zrFA.js +0 -1644
  150. package/dist/ExpandMore-DUn2zrFA.js.map +0 -1
  151. package/dist/FilterLink-DIeFjfZX.js +0 -49
  152. package/dist/FilterLink-DIeFjfZX.js.map +0 -1
  153. package/dist/JwtTokensRoute-C74zNV7A.js +0 -2374
  154. package/dist/JwtTokensRoute-C74zNV7A.js.map +0 -1
  155. package/dist/ScheduledTasksRoute-BAetDHqN.js +0 -611
  156. package/dist/ScheduledTasksRoute-BAetDHqN.js.map +0 -1
  157. package/dist/SingleLogMessageRoute-Dl2NFfqG.js +0 -419
  158. package/dist/SingleLogMessageRoute-Dl2NFfqG.js.map +0 -1
  159. package/dist/SingleMessageRoute-fC94BR1C.js +0 -306
  160. package/dist/SingleMessageRoute-fC94BR1C.js.map +0 -1
  161. package/dist/Table-DWiRP1za.js +0 -120
  162. package/dist/Table-DWiRP1za.js.map +0 -1
  163. package/dist/TextFilter-BHWY2B7i.js +0 -67
  164. package/dist/TextFilter-BHWY2B7i.js.map +0 -1
  165. package/dist/TriggerablesRoute-DiEEX1cR.js +0 -3552
  166. package/dist/TriggerablesRoute-DiEEX1cR.js.map +0 -1
  167. package/dist/api-BD_4zyJw.js +0 -38
  168. package/dist/api-BD_4zyJw.js.map +0 -1
  169. package/dist/breadcrumbs/index.js.map +0 -1
  170. package/dist/configuration-values/index.js.map +0 -1
  171. package/dist/control-values/index.js.map +0 -1
  172. package/dist/createSvgIcon-dA_Vj2W0.js +0 -3914
  173. package/dist/createSvgIcon-dA_Vj2W0.js.map +0 -1
  174. package/dist/exhaustiveValues-Dx50G3yz.js +0 -5
  175. package/dist/exhaustiveValues-Dx50G3yz.js.map +0 -1
  176. package/dist/filter/index.js.map +0 -1
  177. package/dist/formData-BH8saYep.js +0 -65
  178. package/dist/formData-BH8saYep.js.map +0 -1
  179. package/dist/jsx-runtime-D858t2LC.js +0 -617
  180. package/dist/jsx-runtime-D858t2LC.js.map +0 -1
  181. package/dist/jwt-tokens/index.js.map +0 -1
  182. package/dist/loader-CrveWlGb.js +0 -375
  183. package/dist/loader-CrveWlGb.js.map +0 -1
  184. package/dist/loader-D-oC32OJ.js +0 -3612
  185. package/dist/loader-D-oC32OJ.js.map +0 -1
  186. package/dist/loader-rVy8Z9xH.js +0 -130
  187. package/dist/loader-rVy8Z9xH.js.map +0 -1
  188. package/dist/main/index.js.map +0 -1
  189. package/dist/message-log/index.js.map +0 -1
  190. package/dist/message-sending/index.js.map +0 -1
  191. package/dist/message-targets/index.js.map +0 -1
  192. package/dist/pagination-Dy4ansKN.js +0 -21
  193. package/dist/pagination-Dy4ansKN.js.map +0 -1
  194. package/dist/scheduled-tasks/index.js.map +0 -1
  195. package/dist/schemas-CBHIJ_eF.js +0 -3059
  196. package/dist/schemas-CBHIJ_eF.js.map +0 -1
  197. package/dist/table/index.js.map +0 -1
  198. package/dist/triggerables/index.js.map +0 -1
@@ -1,611 +0,0 @@
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