@devtable/settings-form 8.56.0 → 8.57.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/settings-form.es.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Box as v, TextInput as z, Divider as V, Group as w, NumberInput as ie, PasswordInput as L, Button as b, Modal as O, Stack as B, Alert as oe, SegmentedControl as ae, useMantineTheme as se, Tooltip as ce, Text as I, LoadingOverlay as H, Table as $, Select as le, Switch as de } from "@mantine/core";
|
|
1
|
+
import { Box as v, TextInput as z, Divider as V, Group as w, NumberInput as ie, PasswordInput as F, Button as b, Modal as R, Stack as B, Alert as oe, SegmentedControl as ae, useMantineTheme as se, Tooltip as ce, Text as L, LoadingOverlay as H, Table as $, Select as le, Switch as de } from "@mantine/core";
|
|
3
2
|
import { showNotification as _, updateNotification as S } from "@mantine/notifications";
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
3
|
+
import * as O from "react";
|
|
4
|
+
import E, { useEffect as G, forwardRef as J, useState as ee, useMemo as te } from "react";
|
|
6
5
|
import { Recycle as ue, AlertCircle as pe, PlaylistAdd as Q, Trash as W, Edit as ge } from "tabler-icons-react";
|
|
7
6
|
import me from "axios";
|
|
8
7
|
import he from "crypto-js";
|
|
9
8
|
import fe from "lodash";
|
|
10
9
|
import { useForm as q, Controller as m } from "react-hook-form";
|
|
10
|
+
import * as X from "../../node_modules/react/jsx-runtime.js";
|
|
11
11
|
import { useBoolean as be, useRequest as T } from "ahooks";
|
|
12
|
-
import we, { loader as
|
|
13
|
-
import { useModals as
|
|
14
|
-
const C = K.Fragment, e = K.jsx, d = K.jsxs;
|
|
12
|
+
import we, { loader as N } from "@monaco-editor/react";
|
|
13
|
+
import { useModals as j, closeAllModals as Se } from "@mantine/modals";
|
|
15
14
|
function ze(t) {
|
|
16
15
|
t = t || {};
|
|
17
16
|
const n = Object.keys(t).sort(), r = [];
|
|
@@ -40,7 +39,7 @@ const f = {
|
|
|
40
39
|
getAuthentication(t) {
|
|
41
40
|
if (!this.app_id || !this.app_secret)
|
|
42
41
|
return;
|
|
43
|
-
const n =
|
|
42
|
+
const n = new Date().getTime().toString();
|
|
44
43
|
return {
|
|
45
44
|
app_id: this.app_id,
|
|
46
45
|
nonce_str: n,
|
|
@@ -69,7 +68,7 @@ const f = {
|
|
|
69
68
|
};
|
|
70
69
|
}
|
|
71
70
|
};
|
|
72
|
-
function
|
|
71
|
+
function M(t) {
|
|
73
72
|
f.baseURL !== t.apiBaseURL && (f.baseURL = t.apiBaseURL), t.app_id && (f.app_id = t.app_id), t.app_secret && (f.app_secret = t.app_secret);
|
|
74
73
|
}
|
|
75
74
|
const ve = {
|
|
@@ -91,13 +90,7 @@ const ve = {
|
|
|
91
90
|
pagesize: 100
|
|
92
91
|
}
|
|
93
92
|
}),
|
|
94
|
-
/**
|
|
95
|
-
* get current account
|
|
96
|
-
*/
|
|
97
93
|
get: async () => await f.getRequest("GET")("/account/get", {}),
|
|
98
|
-
/**
|
|
99
|
-
* update current account
|
|
100
|
-
*/
|
|
101
94
|
update: async (t, n) => {
|
|
102
95
|
const r = {
|
|
103
96
|
name: t,
|
|
@@ -105,9 +98,6 @@ const ve = {
|
|
|
105
98
|
};
|
|
106
99
|
return await f.getRequest("PUT")("/account/update", r);
|
|
107
100
|
},
|
|
108
|
-
/**
|
|
109
|
-
* change current account's password
|
|
110
|
-
*/
|
|
111
101
|
changepassword: async (t, n) => {
|
|
112
102
|
const r = {
|
|
113
103
|
old_password: t,
|
|
@@ -123,7 +113,7 @@ const ve = {
|
|
|
123
113
|
}),
|
|
124
114
|
edit: async (t) => (t.reset_password || (t.new_password = void 0), await f.getRequest("PUT")("/account/edit", t)),
|
|
125
115
|
delete: async (t) => {
|
|
126
|
-
if (t)
|
|
116
|
+
if (!!t)
|
|
127
117
|
return f.getRequest("POST")("/account/delete", {
|
|
128
118
|
id: t
|
|
129
119
|
});
|
|
@@ -147,7 +137,7 @@ const ve = {
|
|
|
147
137
|
role_id: n
|
|
148
138
|
}),
|
|
149
139
|
delete: async (t) => {
|
|
150
|
-
if (t)
|
|
140
|
+
if (!!t)
|
|
151
141
|
return f.getRequest("POST")("/api/key/delete", {
|
|
152
142
|
id: t
|
|
153
143
|
});
|
|
@@ -187,7 +177,7 @@ const ve = {
|
|
|
187
177
|
button: {
|
|
188
178
|
size: "xs"
|
|
189
179
|
}
|
|
190
|
-
};
|
|
180
|
+
}, C = X.Fragment, e = X.jsx, d = X.jsxs;
|
|
191
181
|
function ye({
|
|
192
182
|
submit: t,
|
|
193
183
|
styles: n = D,
|
|
@@ -212,47 +202,130 @@ function ye({
|
|
|
212
202
|
});
|
|
213
203
|
return G(() => {
|
|
214
204
|
s("type", r);
|
|
215
|
-
}, [s, r]), /* @__PURE__ */ e(v, {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
205
|
+
}, [s, r]), /* @__PURE__ */ e(v, {
|
|
206
|
+
mx: "auto",
|
|
207
|
+
children: /* @__PURE__ */ d("form", {
|
|
208
|
+
onSubmit: o(t),
|
|
209
|
+
children: [/* @__PURE__ */ e(m, {
|
|
210
|
+
name: "key",
|
|
211
|
+
control: i,
|
|
212
|
+
render: ({
|
|
213
|
+
field: a
|
|
214
|
+
}) => /* @__PURE__ */ e(z, {
|
|
215
|
+
mb: n.spacing,
|
|
216
|
+
size: n.size,
|
|
217
|
+
required: !0,
|
|
218
|
+
label: "Name",
|
|
219
|
+
placeholder: "A unique name",
|
|
220
|
+
...a
|
|
221
|
+
})
|
|
222
|
+
}), /* @__PURE__ */ e(V, {
|
|
223
|
+
label: "Connection Info",
|
|
224
|
+
labelPosition: "center"
|
|
225
|
+
}), /* @__PURE__ */ d(w, {
|
|
226
|
+
grow: !0,
|
|
227
|
+
children: [/* @__PURE__ */ e(m, {
|
|
228
|
+
name: "config.host",
|
|
229
|
+
control: i,
|
|
230
|
+
render: ({
|
|
231
|
+
field: a
|
|
232
|
+
}) => /* @__PURE__ */ e(z, {
|
|
233
|
+
mb: n.spacing,
|
|
234
|
+
size: n.size,
|
|
235
|
+
required: !0,
|
|
236
|
+
label: "Host",
|
|
237
|
+
sx: {
|
|
238
|
+
flexGrow: 1
|
|
239
|
+
},
|
|
240
|
+
...a
|
|
241
|
+
})
|
|
242
|
+
}), /* @__PURE__ */ e(m, {
|
|
243
|
+
name: "config.port",
|
|
244
|
+
control: i,
|
|
245
|
+
render: ({
|
|
246
|
+
field: a
|
|
247
|
+
}) => /* @__PURE__ */ e(ie, {
|
|
248
|
+
mb: n.spacing,
|
|
249
|
+
size: n.size,
|
|
250
|
+
required: !0,
|
|
251
|
+
label: "Port",
|
|
252
|
+
hideControls: !0,
|
|
253
|
+
sx: {
|
|
254
|
+
width: "8em"
|
|
255
|
+
},
|
|
256
|
+
...a
|
|
257
|
+
})
|
|
258
|
+
})]
|
|
259
|
+
}), /* @__PURE__ */ e(m, {
|
|
260
|
+
name: "config.username",
|
|
261
|
+
control: i,
|
|
262
|
+
render: ({
|
|
263
|
+
field: a
|
|
264
|
+
}) => /* @__PURE__ */ e(z, {
|
|
265
|
+
mb: n.spacing,
|
|
266
|
+
size: n.size,
|
|
267
|
+
required: !0,
|
|
268
|
+
label: "Username",
|
|
269
|
+
...a
|
|
270
|
+
})
|
|
271
|
+
}), /* @__PURE__ */ e(m, {
|
|
272
|
+
name: "config.password",
|
|
273
|
+
control: i,
|
|
274
|
+
render: ({
|
|
275
|
+
field: a
|
|
276
|
+
}) => /* @__PURE__ */ e(F, {
|
|
277
|
+
mb: n.spacing,
|
|
278
|
+
size: n.size,
|
|
279
|
+
required: !0,
|
|
280
|
+
label: "Password",
|
|
281
|
+
...a
|
|
282
|
+
})
|
|
283
|
+
}), /* @__PURE__ */ e(m, {
|
|
284
|
+
name: "config.database",
|
|
285
|
+
control: i,
|
|
286
|
+
render: ({
|
|
287
|
+
field: a
|
|
288
|
+
}) => /* @__PURE__ */ e(z, {
|
|
289
|
+
mb: n.spacing,
|
|
290
|
+
size: n.size,
|
|
291
|
+
required: !0,
|
|
292
|
+
label: "Database",
|
|
293
|
+
...a
|
|
294
|
+
})
|
|
295
|
+
}), /* @__PURE__ */ e(w, {
|
|
296
|
+
position: "right",
|
|
297
|
+
mt: n.spacing,
|
|
298
|
+
children: /* @__PURE__ */ e(b, {
|
|
299
|
+
type: "submit",
|
|
300
|
+
size: n.button.size,
|
|
301
|
+
children: "Save"
|
|
302
|
+
})
|
|
303
|
+
})]
|
|
304
|
+
})
|
|
305
|
+
});
|
|
243
306
|
}
|
|
244
307
|
const ke = ({
|
|
245
308
|
value: t,
|
|
246
309
|
onChange: n
|
|
247
|
-
}) => /* @__PURE__ */ e(v, {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
310
|
+
}) => /* @__PURE__ */ e(v, {
|
|
311
|
+
sx: {
|
|
312
|
+
position: "relative"
|
|
313
|
+
},
|
|
314
|
+
children: /* @__PURE__ */ e(we, {
|
|
315
|
+
height: "500px",
|
|
316
|
+
defaultLanguage: "javascript",
|
|
317
|
+
value: t,
|
|
318
|
+
onChange: (i) => {
|
|
319
|
+
!i || n(i);
|
|
320
|
+
},
|
|
321
|
+
theme: "vs-dark",
|
|
322
|
+
options: {
|
|
323
|
+
minimap: {
|
|
324
|
+
enabled: !1
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
})
|
|
328
|
+
}), Z = J(({
|
|
256
329
|
value: t,
|
|
257
330
|
onChange: n,
|
|
258
331
|
label: r,
|
|
@@ -261,33 +334,62 @@ const ke = ({
|
|
|
261
334
|
styles: o
|
|
262
335
|
}, a) => {
|
|
263
336
|
const [c, {
|
|
264
|
-
setTrue:
|
|
337
|
+
setTrue: p,
|
|
265
338
|
setFalse: g
|
|
266
|
-
}] = be(), [
|
|
267
|
-
g(), n(
|
|
339
|
+
}] = be(), [h, u] = ee(t), l = () => {
|
|
340
|
+
g(), n(h);
|
|
268
341
|
}, A = () => {
|
|
269
|
-
g(),
|
|
342
|
+
g(), u(t);
|
|
270
343
|
}, k = () => {
|
|
271
|
-
|
|
344
|
+
u(s);
|
|
272
345
|
};
|
|
273
346
|
return G(() => {
|
|
274
|
-
|
|
275
|
-
}, [t]), /* @__PURE__ */ d(C, {
|
|
276
|
-
/* @__PURE__ */ e(b, {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
347
|
+
u(t);
|
|
348
|
+
}, [t]), /* @__PURE__ */ d(C, {
|
|
349
|
+
children: [/* @__PURE__ */ e(b, {
|
|
350
|
+
variant: "filled",
|
|
351
|
+
size: o.button.size,
|
|
352
|
+
onClick: p,
|
|
353
|
+
sx: {
|
|
354
|
+
flexGrow: 1
|
|
355
|
+
},
|
|
356
|
+
children: r
|
|
357
|
+
}), /* @__PURE__ */ e(R, {
|
|
358
|
+
size: 800,
|
|
359
|
+
title: i,
|
|
360
|
+
opened: c,
|
|
361
|
+
onClose: g,
|
|
362
|
+
closeOnClickOutside: !1,
|
|
363
|
+
withCloseButton: !1,
|
|
364
|
+
children: c && /* @__PURE__ */ d(B, {
|
|
365
|
+
children: [/* @__PURE__ */ e(ke, {
|
|
366
|
+
value: h,
|
|
367
|
+
onChange: u
|
|
368
|
+
}), /* @__PURE__ */ d(w, {
|
|
369
|
+
position: "apart",
|
|
370
|
+
children: [/* @__PURE__ */ e(b, {
|
|
371
|
+
onClick: k,
|
|
372
|
+
color: "red",
|
|
373
|
+
leftIcon: /* @__PURE__ */ e(ue, {
|
|
374
|
+
size: 20
|
|
375
|
+
}),
|
|
376
|
+
children: "Rest"
|
|
377
|
+
}), /* @__PURE__ */ d(w, {
|
|
378
|
+
position: "right",
|
|
379
|
+
children: [/* @__PURE__ */ e(b, {
|
|
380
|
+
onClick: A,
|
|
381
|
+
variant: "subtle",
|
|
382
|
+
children: "Cancel"
|
|
383
|
+
}), /* @__PURE__ */ e(b, {
|
|
384
|
+
onClick: l,
|
|
385
|
+
children: "OK"
|
|
386
|
+
})]
|
|
387
|
+
})]
|
|
388
|
+
})]
|
|
389
|
+
})
|
|
390
|
+
})]
|
|
391
|
+
});
|
|
392
|
+
}), I = {
|
|
291
393
|
pre: ["function pre_process({ method, url, params, headers, data }, utils) {", " // your code goes here", " return { method, url, params, headers, data }", "}"].join(`
|
|
292
394
|
`),
|
|
293
395
|
post: ["function post_process(res, utils) {", " // your code goes here", " return data", "}"].join(`
|
|
@@ -308,49 +410,109 @@ function De({
|
|
|
308
410
|
config: {
|
|
309
411
|
host: "",
|
|
310
412
|
processing: {
|
|
311
|
-
pre:
|
|
312
|
-
post:
|
|
413
|
+
pre: I.pre,
|
|
414
|
+
post: I.post
|
|
313
415
|
}
|
|
314
416
|
}
|
|
315
417
|
}
|
|
316
418
|
});
|
|
317
|
-
return /* @__PURE__ */ e(v, {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
419
|
+
return /* @__PURE__ */ e(v, {
|
|
420
|
+
mx: "auto",
|
|
421
|
+
children: /* @__PURE__ */ d("form", {
|
|
422
|
+
onSubmit: s(t),
|
|
423
|
+
children: [/* @__PURE__ */ e(m, {
|
|
424
|
+
name: "key",
|
|
425
|
+
control: r,
|
|
426
|
+
render: ({
|
|
427
|
+
field: o
|
|
428
|
+
}) => /* @__PURE__ */ e(z, {
|
|
429
|
+
mb: n.spacing,
|
|
430
|
+
size: n.size,
|
|
431
|
+
required: !0,
|
|
432
|
+
label: "Name",
|
|
433
|
+
placeholder: "A unique name",
|
|
434
|
+
...o
|
|
435
|
+
})
|
|
436
|
+
}), /* @__PURE__ */ e(V, {
|
|
437
|
+
label: "Connection Info",
|
|
438
|
+
labelPosition: "center"
|
|
439
|
+
}), /* @__PURE__ */ e(m, {
|
|
440
|
+
name: "config.host",
|
|
441
|
+
control: r,
|
|
442
|
+
render: ({
|
|
443
|
+
field: o
|
|
444
|
+
}) => /* @__PURE__ */ e(z, {
|
|
445
|
+
mb: n.spacing,
|
|
446
|
+
size: n.size,
|
|
447
|
+
required: !0,
|
|
448
|
+
label: "Base URL",
|
|
449
|
+
sx: {
|
|
450
|
+
flexGrow: 1
|
|
451
|
+
},
|
|
452
|
+
...o
|
|
453
|
+
})
|
|
454
|
+
}), /* @__PURE__ */ d(w, {
|
|
455
|
+
grow: !0,
|
|
456
|
+
children: [/* @__PURE__ */ e(m, {
|
|
457
|
+
name: "config.processing.pre",
|
|
458
|
+
control: r,
|
|
459
|
+
render: ({
|
|
460
|
+
field: o
|
|
461
|
+
}) => /* @__PURE__ */ e(Z, {
|
|
462
|
+
label: "Pre Processing",
|
|
463
|
+
modalTitle: "This function will run before sending the request (for scenarios like encryption)",
|
|
464
|
+
defaultValue: I.pre,
|
|
465
|
+
...o,
|
|
466
|
+
styles: n
|
|
467
|
+
})
|
|
468
|
+
}), /* @__PURE__ */ e(m, {
|
|
469
|
+
name: "config.processing.post",
|
|
470
|
+
control: r,
|
|
471
|
+
render: ({
|
|
472
|
+
field: o
|
|
473
|
+
}) => /* @__PURE__ */ e(Z, {
|
|
474
|
+
label: "Post Processing",
|
|
475
|
+
modalTitle: "This function will run after sending the request (for scenarios like decryption)",
|
|
476
|
+
defaultValue: I.post,
|
|
477
|
+
...o,
|
|
478
|
+
styles: n
|
|
479
|
+
})
|
|
480
|
+
})]
|
|
481
|
+
}), /* @__PURE__ */ e(w, {
|
|
482
|
+
position: "right",
|
|
483
|
+
mt: n.spacing,
|
|
484
|
+
children: /* @__PURE__ */ e(b, {
|
|
485
|
+
type: "submit",
|
|
486
|
+
size: n.button.size,
|
|
487
|
+
children: "Save"
|
|
488
|
+
})
|
|
489
|
+
})]
|
|
490
|
+
})
|
|
491
|
+
});
|
|
337
492
|
}
|
|
338
493
|
function Te({
|
|
339
494
|
styles: t = D
|
|
340
495
|
}) {
|
|
341
|
-
return /* @__PURE__ */ e(v, {
|
|
342
|
-
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
|
|
345
|
-
|
|
496
|
+
return /* @__PURE__ */ e(v, {
|
|
497
|
+
mx: "auto",
|
|
498
|
+
children: /* @__PURE__ */ d(oe, {
|
|
499
|
+
mt: t.spacing,
|
|
500
|
+
icon: /* @__PURE__ */ e(pe, {
|
|
501
|
+
size: 16
|
|
502
|
+
}),
|
|
503
|
+
children: ["Only ", /* @__PURE__ */ e("b", {
|
|
504
|
+
children: "SELECT"
|
|
505
|
+
}), " privilege is needed."]
|
|
506
|
+
})
|
|
507
|
+
});
|
|
346
508
|
}
|
|
347
509
|
function qe({
|
|
348
510
|
postSubmit: t,
|
|
349
511
|
styles: n = D
|
|
350
512
|
}) {
|
|
351
|
-
const [r, i] =
|
|
513
|
+
const [r, i] = ee("postgresql"), s = async ({
|
|
352
514
|
type: c,
|
|
353
|
-
key:
|
|
515
|
+
key: p,
|
|
354
516
|
config: g
|
|
355
517
|
}) => {
|
|
356
518
|
_({
|
|
@@ -362,76 +524,107 @@ function qe({
|
|
|
362
524
|
try {
|
|
363
525
|
console.log({
|
|
364
526
|
type: c,
|
|
365
|
-
key:
|
|
527
|
+
key: p,
|
|
366
528
|
config: g
|
|
367
|
-
}), await P.datasource.create(c,
|
|
529
|
+
}), await P.datasource.create(c, p, g), S({
|
|
368
530
|
id: "for-creating",
|
|
369
531
|
title: "Successful",
|
|
370
532
|
message: "Data source is added",
|
|
371
533
|
color: "green"
|
|
372
534
|
}), t();
|
|
373
|
-
} catch (
|
|
535
|
+
} catch (h) {
|
|
374
536
|
S({
|
|
375
537
|
id: "for-creating",
|
|
376
538
|
title: "Failed",
|
|
377
|
-
message:
|
|
539
|
+
message: h.message,
|
|
378
540
|
color: "red"
|
|
379
541
|
});
|
|
380
542
|
}
|
|
381
543
|
}, o = r === "postgresql" || r === "mysql", a = r === "http";
|
|
382
|
-
return /* @__PURE__ */ d(v, {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
544
|
+
return /* @__PURE__ */ d(v, {
|
|
545
|
+
mx: "auto",
|
|
546
|
+
children: [/* @__PURE__ */ e(ae, {
|
|
547
|
+
fullWidth: !0,
|
|
548
|
+
mb: n.spacing,
|
|
549
|
+
size: n.size,
|
|
550
|
+
data: [{
|
|
551
|
+
label: "PostgreSQL",
|
|
552
|
+
value: "postgresql"
|
|
553
|
+
}, {
|
|
554
|
+
label: "MySQL",
|
|
555
|
+
value: "mysql"
|
|
556
|
+
}, {
|
|
557
|
+
label: "HTTP",
|
|
558
|
+
value: "http"
|
|
559
|
+
}],
|
|
560
|
+
value: r,
|
|
561
|
+
onChange: (c) => i(c)
|
|
562
|
+
}), o && /* @__PURE__ */ e(Te, {
|
|
563
|
+
styles: n
|
|
564
|
+
}), o && /* @__PURE__ */ e(ye, {
|
|
565
|
+
submit: s,
|
|
566
|
+
styles: n,
|
|
567
|
+
type: r
|
|
568
|
+
}), a && /* @__PURE__ */ e(De, {
|
|
569
|
+
submit: s,
|
|
570
|
+
styles: n
|
|
571
|
+
})]
|
|
572
|
+
});
|
|
397
573
|
}
|
|
398
574
|
function xe({
|
|
399
575
|
onSuccess: t,
|
|
400
576
|
styles: n = D
|
|
401
577
|
}) {
|
|
402
|
-
const [r, i] =
|
|
403
|
-
return /* @__PURE__ */ d(C, {
|
|
404
|
-
/* @__PURE__ */ e(
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
578
|
+
const [r, i] = E.useState(!1), s = () => i(!0), o = () => i(!1);
|
|
579
|
+
return /* @__PURE__ */ d(C, {
|
|
580
|
+
children: [/* @__PURE__ */ e(R, {
|
|
581
|
+
overflow: "inside",
|
|
582
|
+
opened: r,
|
|
583
|
+
onClose: () => i(!1),
|
|
584
|
+
title: "Add a data source",
|
|
585
|
+
trapFocus: !0,
|
|
586
|
+
onDragStart: (c) => {
|
|
587
|
+
c.stopPropagation();
|
|
588
|
+
},
|
|
589
|
+
children: /* @__PURE__ */ e(qe, {
|
|
590
|
+
postSubmit: () => {
|
|
591
|
+
t(), o();
|
|
592
|
+
},
|
|
593
|
+
styles: n
|
|
594
|
+
})
|
|
595
|
+
}), /* @__PURE__ */ e(b, {
|
|
596
|
+
size: n.button.size,
|
|
597
|
+
onClick: s,
|
|
598
|
+
leftIcon: /* @__PURE__ */ e(Q, {
|
|
599
|
+
size: 20
|
|
600
|
+
}),
|
|
601
|
+
children: "Add a Data Source"
|
|
602
|
+
})]
|
|
603
|
+
});
|
|
411
604
|
}
|
|
412
605
|
const Oe = (t) => t.replace(/([^:])(\/\/+)/g, "$1/");
|
|
413
606
|
function Re(t) {
|
|
414
607
|
G(() => {
|
|
415
|
-
if (
|
|
608
|
+
if (N.__getMonacoInstance())
|
|
416
609
|
return;
|
|
417
610
|
console.log("loading monaco for @devtable/settings-form");
|
|
418
611
|
const r = Oe(t);
|
|
419
|
-
|
|
612
|
+
N.config({
|
|
420
613
|
paths: {
|
|
421
614
|
vs: r
|
|
422
615
|
}
|
|
423
|
-
}),
|
|
616
|
+
}), N.init().then((i) => console.log("monaco instance:", i));
|
|
424
617
|
}, []);
|
|
425
618
|
}
|
|
426
|
-
function
|
|
427
|
-
return
|
|
619
|
+
function K() {
|
|
620
|
+
return K = Object.assign ? Object.assign.bind() : function(t) {
|
|
428
621
|
for (var n = 1; n < arguments.length; n++) {
|
|
429
622
|
var r = arguments[n];
|
|
430
623
|
for (var i in r)
|
|
431
624
|
Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i]);
|
|
432
625
|
}
|
|
433
626
|
return t;
|
|
434
|
-
},
|
|
627
|
+
}, K.apply(this, arguments);
|
|
435
628
|
}
|
|
436
629
|
function Ie(t, n) {
|
|
437
630
|
if (t == null)
|
|
@@ -439,10 +632,10 @@ function Ie(t, n) {
|
|
|
439
632
|
var r, i, s = function(a, c) {
|
|
440
633
|
if (a == null)
|
|
441
634
|
return {};
|
|
442
|
-
var
|
|
443
|
-
for (g = 0; g <
|
|
444
|
-
|
|
445
|
-
return
|
|
635
|
+
var p, g, h = {}, u = Object.keys(a);
|
|
636
|
+
for (g = 0; g < u.length; g++)
|
|
637
|
+
p = u[g], c.indexOf(p) >= 0 || (h[p] = a[p]);
|
|
638
|
+
return h;
|
|
446
639
|
}(t, n);
|
|
447
640
|
if (Object.getOwnPropertySymbols) {
|
|
448
641
|
var o = Object.getOwnPropertySymbols(t);
|
|
@@ -454,7 +647,7 @@ function Ie(t, n) {
|
|
|
454
647
|
var Le = ["size", "color", "stroke"];
|
|
455
648
|
function Fe(t) {
|
|
456
649
|
var n = t.size, r = n === void 0 ? 24 : n, i = t.color, s = i === void 0 ? "currentColor" : i, o = t.stroke, a = o === void 0 ? 2 : o, c = Ie(t, Le);
|
|
457
|
-
return
|
|
650
|
+
return O.createElement("svg", K({ xmlns: "http://www.w3.org/2000/svg", className: "icon icon-tabler icon-tabler-lock", width: r, height: r, viewBox: "0 0 24 24", strokeWidth: a, stroke: s, fill: "none", strokeLinecap: "round", strokeLinejoin: "round" }, c), O.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }), O.createElement("rect", { x: 5, y: 11, width: 14, height: 10, rx: 2 }), O.createElement("circle", { cx: 12, cy: 16, r: 1 }), O.createElement("path", { d: "M8 11v-4a4 4 0 0 1 8 0v4" }));
|
|
458
651
|
}
|
|
459
652
|
function Ee({
|
|
460
653
|
id: t,
|
|
@@ -463,8 +656,8 @@ function Ee({
|
|
|
463
656
|
onSuccess: i,
|
|
464
657
|
styles: s = D
|
|
465
658
|
}) {
|
|
466
|
-
const o =
|
|
467
|
-
t
|
|
659
|
+
const o = j(), a = async () => {
|
|
660
|
+
!t || (_({
|
|
468
661
|
id: "for-deleting",
|
|
469
662
|
title: "Pending",
|
|
470
663
|
message: "Deleting data source...",
|
|
@@ -477,25 +670,46 @@ function Ee({
|
|
|
477
670
|
}), i());
|
|
478
671
|
}, c = () => o.openConfirmModal({
|
|
479
672
|
title: "Delete this data source?",
|
|
480
|
-
children: /* @__PURE__ */ e(
|
|
673
|
+
children: /* @__PURE__ */ e(L, {
|
|
674
|
+
size: s.size,
|
|
675
|
+
children: "This action won't affect your database."
|
|
676
|
+
}),
|
|
481
677
|
labels: {
|
|
482
678
|
confirm: "Confirm",
|
|
483
679
|
cancel: "Cancel"
|
|
484
680
|
},
|
|
485
681
|
onCancel: () => console.log("Cancel"),
|
|
486
682
|
onConfirm: a
|
|
487
|
-
}),
|
|
488
|
-
return r ? /* @__PURE__ */ e(ce, {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
683
|
+
}), p = se();
|
|
684
|
+
return r ? /* @__PURE__ */ e(ce, {
|
|
685
|
+
withArrow: !0,
|
|
686
|
+
events: {
|
|
687
|
+
hover: !0,
|
|
688
|
+
touch: !1,
|
|
689
|
+
focus: !1
|
|
690
|
+
},
|
|
691
|
+
label: "This is a preset datasource, it can not be deleted",
|
|
692
|
+
children: /* @__PURE__ */ e("span", {
|
|
693
|
+
children: /* @__PURE__ */ e(Fe, {
|
|
694
|
+
size: 16,
|
|
695
|
+
color: p.colors.gray[7]
|
|
696
|
+
})
|
|
697
|
+
})
|
|
698
|
+
}) : /* @__PURE__ */ e(b, {
|
|
699
|
+
size: s.button.size,
|
|
700
|
+
color: "red",
|
|
701
|
+
onClick: c,
|
|
702
|
+
leftIcon: /* @__PURE__ */ e(W, {
|
|
703
|
+
size: 20
|
|
704
|
+
}),
|
|
705
|
+
children: "Delete"
|
|
706
|
+
});
|
|
493
707
|
}
|
|
494
708
|
function ot({
|
|
495
709
|
styles: t = D,
|
|
496
710
|
config: n
|
|
497
711
|
}) {
|
|
498
|
-
Re(n.monacoPath),
|
|
712
|
+
Re(n.monacoPath), M(n);
|
|
499
713
|
const {
|
|
500
714
|
data: r = [],
|
|
501
715
|
loading: i,
|
|
@@ -508,41 +722,84 @@ function ot({
|
|
|
508
722
|
}, {
|
|
509
723
|
refreshDeps: []
|
|
510
724
|
});
|
|
511
|
-
return /* @__PURE__ */ d(C, {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
position: "
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
725
|
+
return /* @__PURE__ */ d(C, {
|
|
726
|
+
children: [/* @__PURE__ */ e(w, {
|
|
727
|
+
pt: t.spacing,
|
|
728
|
+
position: "right",
|
|
729
|
+
children: /* @__PURE__ */ e(xe, {
|
|
730
|
+
onSuccess: s
|
|
731
|
+
})
|
|
732
|
+
}), /* @__PURE__ */ d(v, {
|
|
733
|
+
mt: t.spacing,
|
|
734
|
+
sx: {
|
|
735
|
+
position: "relative"
|
|
736
|
+
},
|
|
737
|
+
children: [/* @__PURE__ */ e(H, {
|
|
738
|
+
visible: i
|
|
739
|
+
}), /* @__PURE__ */ d($, {
|
|
740
|
+
horizontalSpacing: t.spacing,
|
|
741
|
+
verticalSpacing: t.spacing,
|
|
742
|
+
fontSize: t.size,
|
|
743
|
+
highlightOnHover: !0,
|
|
744
|
+
children: [/* @__PURE__ */ e("thead", {
|
|
745
|
+
children: /* @__PURE__ */ d("tr", {
|
|
746
|
+
children: [/* @__PURE__ */ e("th", {
|
|
747
|
+
children: "Type"
|
|
748
|
+
}), /* @__PURE__ */ e("th", {
|
|
749
|
+
children: "Name"
|
|
750
|
+
}), /* @__PURE__ */ e("th", {
|
|
751
|
+
children: "Action"
|
|
752
|
+
})]
|
|
753
|
+
})
|
|
754
|
+
}), /* @__PURE__ */ e("tbody", {
|
|
755
|
+
children: r.map(({
|
|
756
|
+
id: o,
|
|
757
|
+
key: a,
|
|
758
|
+
type: c,
|
|
759
|
+
is_preset: p
|
|
760
|
+
}) => /* @__PURE__ */ d("tr", {
|
|
761
|
+
children: [/* @__PURE__ */ e("td", {
|
|
762
|
+
width: 200,
|
|
763
|
+
children: c
|
|
764
|
+
}), /* @__PURE__ */ e("td", {
|
|
765
|
+
children: a
|
|
766
|
+
}), /* @__PURE__ */ e("td", {
|
|
767
|
+
width: 200,
|
|
768
|
+
children: /* @__PURE__ */ e(w, {
|
|
769
|
+
position: "left",
|
|
770
|
+
children: /* @__PURE__ */ e(Ee, {
|
|
771
|
+
isProtected: p,
|
|
772
|
+
id: o,
|
|
773
|
+
name: a,
|
|
774
|
+
onSuccess: s
|
|
775
|
+
})
|
|
776
|
+
})
|
|
777
|
+
})]
|
|
778
|
+
}, a))
|
|
779
|
+
})]
|
|
780
|
+
})]
|
|
781
|
+
})]
|
|
782
|
+
});
|
|
536
783
|
}
|
|
537
784
|
const je = J(({
|
|
538
785
|
label: t,
|
|
539
786
|
value: n,
|
|
540
787
|
description: r,
|
|
541
788
|
...i
|
|
542
|
-
}, s) => /* @__PURE__ */ d(B, {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
789
|
+
}, s) => /* @__PURE__ */ d(B, {
|
|
790
|
+
spacing: 2,
|
|
791
|
+
ref: s,
|
|
792
|
+
...i,
|
|
793
|
+
children: [/* @__PURE__ */ e(L, {
|
|
794
|
+
size: "sm",
|
|
795
|
+
children: t
|
|
796
|
+
}), /* @__PURE__ */ e(L, {
|
|
797
|
+
size: "xs",
|
|
798
|
+
color: "dimmed",
|
|
799
|
+
className: "role-description",
|
|
800
|
+
children: r
|
|
801
|
+
})]
|
|
802
|
+
})), Y = J(({
|
|
546
803
|
styles: t,
|
|
547
804
|
value: n,
|
|
548
805
|
onChange: r
|
|
@@ -555,36 +812,32 @@ const je = J(({
|
|
|
555
812
|
value: c.id,
|
|
556
813
|
description: c.description,
|
|
557
814
|
disabled: c.id === 50
|
|
558
|
-
// SUPERADMIN
|
|
559
815
|
})), {
|
|
560
816
|
refreshDeps: []
|
|
561
817
|
});
|
|
562
|
-
return /* @__PURE__ */ e(
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
".role-description": {
|
|
578
|
-
color: "rgba(255,255,255,.8)"
|
|
579
|
-
}
|
|
818
|
+
return /* @__PURE__ */ e(le, {
|
|
819
|
+
ref: i,
|
|
820
|
+
mb: t.spacing,
|
|
821
|
+
size: t.size,
|
|
822
|
+
required: !0,
|
|
823
|
+
label: "Role",
|
|
824
|
+
itemComponent: je,
|
|
825
|
+
data: s,
|
|
826
|
+
disabled: o,
|
|
827
|
+
styles: () => ({
|
|
828
|
+
item: {
|
|
829
|
+
"&[data-selected]": {
|
|
830
|
+
"&, &:hover": {
|
|
831
|
+
".role-description": {
|
|
832
|
+
color: "rgba(255,255,255,.8)"
|
|
580
833
|
}
|
|
581
834
|
}
|
|
582
835
|
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
);
|
|
836
|
+
}
|
|
837
|
+
}),
|
|
838
|
+
value: n,
|
|
839
|
+
onChange: r
|
|
840
|
+
});
|
|
588
841
|
}), y = {
|
|
589
842
|
size: "sm",
|
|
590
843
|
spacing: "md",
|
|
@@ -608,62 +861,126 @@ function Me({
|
|
|
608
861
|
password: ""
|
|
609
862
|
}
|
|
610
863
|
});
|
|
611
|
-
return /* @__PURE__ */ e(v, {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
864
|
+
return /* @__PURE__ */ e(v, {
|
|
865
|
+
mx: "auto",
|
|
866
|
+
children: /* @__PURE__ */ d("form", {
|
|
867
|
+
onSubmit: s(async ({
|
|
868
|
+
name: a,
|
|
869
|
+
email: c,
|
|
870
|
+
password: p,
|
|
871
|
+
role_id: g
|
|
872
|
+
}) => {
|
|
873
|
+
try {
|
|
874
|
+
_({
|
|
875
|
+
id: "for-creating",
|
|
876
|
+
title: "Pending",
|
|
877
|
+
message: "Adding account...",
|
|
878
|
+
loading: !0
|
|
879
|
+
}), await P.account.create(a, c, p, g), S({
|
|
880
|
+
id: "for-creating",
|
|
881
|
+
title: "Successful",
|
|
882
|
+
message: "Account is added",
|
|
883
|
+
color: "green"
|
|
884
|
+
}), t();
|
|
885
|
+
} catch (h) {
|
|
886
|
+
S({
|
|
887
|
+
id: "for-creating",
|
|
888
|
+
title: "Failed",
|
|
889
|
+
message: h.message,
|
|
890
|
+
color: "red"
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
}),
|
|
894
|
+
children: [/* @__PURE__ */ e(m, {
|
|
895
|
+
name: "name",
|
|
896
|
+
control: i,
|
|
897
|
+
render: ({
|
|
898
|
+
field: a
|
|
899
|
+
}) => /* @__PURE__ */ e(z, {
|
|
900
|
+
mb: n.spacing,
|
|
901
|
+
size: n.size,
|
|
902
|
+
required: !0,
|
|
903
|
+
label: "Username",
|
|
904
|
+
...a
|
|
905
|
+
})
|
|
906
|
+
}), /* @__PURE__ */ e(m, {
|
|
907
|
+
name: "email",
|
|
908
|
+
control: i,
|
|
909
|
+
render: ({
|
|
910
|
+
field: a
|
|
911
|
+
}) => /* @__PURE__ */ e(z, {
|
|
912
|
+
mb: n.spacing,
|
|
913
|
+
size: n.size,
|
|
914
|
+
required: !0,
|
|
915
|
+
label: "Email",
|
|
916
|
+
...a
|
|
917
|
+
})
|
|
918
|
+
}), /* @__PURE__ */ e(m, {
|
|
919
|
+
name: "password",
|
|
920
|
+
control: i,
|
|
921
|
+
render: ({
|
|
922
|
+
field: a
|
|
923
|
+
}) => /* @__PURE__ */ e(F, {
|
|
924
|
+
mb: n.spacing,
|
|
925
|
+
size: n.size,
|
|
926
|
+
required: !0,
|
|
927
|
+
label: "Password",
|
|
928
|
+
description: "Password must be at least 8 characters long",
|
|
929
|
+
...a
|
|
930
|
+
})
|
|
931
|
+
}), /* @__PURE__ */ e(m, {
|
|
932
|
+
name: "role_id",
|
|
933
|
+
control: i,
|
|
934
|
+
render: ({
|
|
935
|
+
field: a
|
|
936
|
+
}) => /* @__PURE__ */ e(Y, {
|
|
937
|
+
styles: n,
|
|
938
|
+
...a
|
|
939
|
+
})
|
|
940
|
+
}), /* @__PURE__ */ e(w, {
|
|
941
|
+
position: "right",
|
|
942
|
+
mt: n.spacing,
|
|
943
|
+
children: /* @__PURE__ */ e(b, {
|
|
944
|
+
type: "submit",
|
|
945
|
+
size: n.button.size,
|
|
946
|
+
children: "Save"
|
|
947
|
+
})
|
|
948
|
+
})]
|
|
949
|
+
})
|
|
950
|
+
});
|
|
652
951
|
}
|
|
653
952
|
function Ue({
|
|
654
953
|
onSuccess: t,
|
|
655
954
|
styles: n = y,
|
|
656
955
|
initialRoleID: r
|
|
657
956
|
}) {
|
|
658
|
-
const [i, s] =
|
|
659
|
-
return /* @__PURE__ */ d(C, {
|
|
660
|
-
/* @__PURE__ */ e(
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
957
|
+
const [i, s] = E.useState(!1), o = () => s(!0), a = () => s(!1);
|
|
958
|
+
return /* @__PURE__ */ d(C, {
|
|
959
|
+
children: [/* @__PURE__ */ e(R, {
|
|
960
|
+
overflow: "inside",
|
|
961
|
+
opened: i,
|
|
962
|
+
onClose: () => s(!1),
|
|
963
|
+
title: "Add an Account",
|
|
964
|
+
trapFocus: !0,
|
|
965
|
+
onDragStart: (p) => {
|
|
966
|
+
p.stopPropagation();
|
|
967
|
+
},
|
|
968
|
+
children: /* @__PURE__ */ e(Me, {
|
|
969
|
+
postSubmit: () => {
|
|
970
|
+
t(), a();
|
|
971
|
+
},
|
|
972
|
+
styles: n,
|
|
973
|
+
initialRoleID: r
|
|
974
|
+
})
|
|
975
|
+
}), /* @__PURE__ */ e(b, {
|
|
976
|
+
size: n.button.size,
|
|
977
|
+
onClick: o,
|
|
978
|
+
leftIcon: /* @__PURE__ */ e(Q, {
|
|
979
|
+
size: 20
|
|
980
|
+
}),
|
|
981
|
+
children: "Add an Account"
|
|
982
|
+
})]
|
|
983
|
+
});
|
|
667
984
|
}
|
|
668
985
|
function Ne({
|
|
669
986
|
id: t,
|
|
@@ -671,8 +988,8 @@ function Ne({
|
|
|
671
988
|
onSuccess: r,
|
|
672
989
|
styles: i = y
|
|
673
990
|
}) {
|
|
674
|
-
const s =
|
|
675
|
-
if (t) {
|
|
991
|
+
const s = j(), o = async () => {
|
|
992
|
+
if (!!t) {
|
|
676
993
|
_({
|
|
677
994
|
id: "for-deleting",
|
|
678
995
|
title: "Pending",
|
|
@@ -704,7 +1021,15 @@ function Ne({
|
|
|
704
1021
|
onCancel: () => console.log("Cancel"),
|
|
705
1022
|
onConfirm: o
|
|
706
1023
|
});
|
|
707
|
-
return /* @__PURE__ */ e(b, {
|
|
1024
|
+
return /* @__PURE__ */ e(b, {
|
|
1025
|
+
size: i.button.size,
|
|
1026
|
+
color: "red",
|
|
1027
|
+
onClick: a,
|
|
1028
|
+
leftIcon: /* @__PURE__ */ e(W, {
|
|
1029
|
+
size: 20
|
|
1030
|
+
}),
|
|
1031
|
+
children: "Delete"
|
|
1032
|
+
});
|
|
708
1033
|
}
|
|
709
1034
|
function Ke({
|
|
710
1035
|
id: t,
|
|
@@ -717,7 +1042,7 @@ function Ke({
|
|
|
717
1042
|
const {
|
|
718
1043
|
control: a,
|
|
719
1044
|
handleSubmit: c,
|
|
720
|
-
watch:
|
|
1045
|
+
watch: p
|
|
721
1046
|
} = q({
|
|
722
1047
|
defaultValues: {
|
|
723
1048
|
name: n,
|
|
@@ -727,10 +1052,10 @@ function Ke({
|
|
|
727
1052
|
new_password: ""
|
|
728
1053
|
}
|
|
729
1054
|
}), g = async ({
|
|
730
|
-
name:
|
|
1055
|
+
name: l,
|
|
731
1056
|
email: A,
|
|
732
1057
|
role_id: k,
|
|
733
|
-
reset_password:
|
|
1058
|
+
reset_password: x,
|
|
734
1059
|
new_password: ne
|
|
735
1060
|
}) => {
|
|
736
1061
|
try {
|
|
@@ -741,10 +1066,10 @@ function Ke({
|
|
|
741
1066
|
loading: !0
|
|
742
1067
|
}), await P.account.edit({
|
|
743
1068
|
id: t,
|
|
744
|
-
name:
|
|
1069
|
+
name: l,
|
|
745
1070
|
email: A,
|
|
746
1071
|
role_id: k,
|
|
747
|
-
reset_password:
|
|
1072
|
+
reset_password: x,
|
|
748
1073
|
new_password: ne
|
|
749
1074
|
}), S({
|
|
750
1075
|
id: "for-updating",
|
|
@@ -760,115 +1085,226 @@ function Ke({
|
|
|
760
1085
|
color: "red"
|
|
761
1086
|
});
|
|
762
1087
|
}
|
|
763
|
-
}, [
|
|
764
|
-
return /* @__PURE__ */ e(v, {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1088
|
+
}, [h, u] = p(["reset_password", "new_password"]);
|
|
1089
|
+
return /* @__PURE__ */ e(v, {
|
|
1090
|
+
mx: "auto",
|
|
1091
|
+
children: /* @__PURE__ */ d("form", {
|
|
1092
|
+
onSubmit: c(g),
|
|
1093
|
+
children: [/* @__PURE__ */ e(m, {
|
|
1094
|
+
name: "name",
|
|
1095
|
+
control: a,
|
|
1096
|
+
render: ({
|
|
1097
|
+
field: l
|
|
1098
|
+
}) => /* @__PURE__ */ e(z, {
|
|
1099
|
+
mb: o.spacing,
|
|
1100
|
+
size: o.size,
|
|
1101
|
+
required: !0,
|
|
1102
|
+
label: "Username",
|
|
1103
|
+
...l
|
|
1104
|
+
})
|
|
1105
|
+
}), /* @__PURE__ */ e(m, {
|
|
1106
|
+
name: "email",
|
|
1107
|
+
control: a,
|
|
1108
|
+
render: ({
|
|
1109
|
+
field: l
|
|
1110
|
+
}) => /* @__PURE__ */ e(z, {
|
|
1111
|
+
mb: o.spacing,
|
|
1112
|
+
size: o.size,
|
|
1113
|
+
required: !0,
|
|
1114
|
+
label: "Email",
|
|
1115
|
+
...l
|
|
1116
|
+
})
|
|
1117
|
+
}), /* @__PURE__ */ e(m, {
|
|
1118
|
+
name: "role_id",
|
|
1119
|
+
control: a,
|
|
1120
|
+
render: ({
|
|
1121
|
+
field: l
|
|
1122
|
+
}) => /* @__PURE__ */ e(Y, {
|
|
1123
|
+
styles: o,
|
|
1124
|
+
...l
|
|
1125
|
+
})
|
|
1126
|
+
}), /* @__PURE__ */ e(V, {
|
|
1127
|
+
my: 20,
|
|
1128
|
+
variant: "dashed",
|
|
1129
|
+
label: "",
|
|
1130
|
+
labelPosition: "center"
|
|
1131
|
+
}), /* @__PURE__ */ e(m, {
|
|
1132
|
+
name: "reset_password",
|
|
1133
|
+
control: a,
|
|
1134
|
+
render: ({
|
|
1135
|
+
field: l
|
|
1136
|
+
}) => /* @__PURE__ */ e(de, {
|
|
1137
|
+
mb: o.spacing,
|
|
1138
|
+
size: o.size,
|
|
1139
|
+
label: "Reset password",
|
|
1140
|
+
checked: l.value,
|
|
1141
|
+
onChange: (A) => l.onChange(A.currentTarget.checked),
|
|
1142
|
+
styles: {
|
|
1143
|
+
label: {
|
|
1144
|
+
verticalAlign: "middle"
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
})
|
|
1148
|
+
}), h && /* @__PURE__ */ e(m, {
|
|
785
1149
|
name: "new_password",
|
|
786
1150
|
control: a,
|
|
787
1151
|
render: ({
|
|
788
|
-
field:
|
|
789
|
-
}) => /* @__PURE__ */ e(
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
1152
|
+
field: l
|
|
1153
|
+
}) => /* @__PURE__ */ e(F, {
|
|
1154
|
+
autoComplete: "off",
|
|
1155
|
+
mb: o.spacing,
|
|
1156
|
+
size: o.size,
|
|
1157
|
+
required: !0,
|
|
1158
|
+
description: "Password must be at least 8 characters long",
|
|
1159
|
+
label: "New Password",
|
|
1160
|
+
...l
|
|
1161
|
+
})
|
|
1162
|
+
}), /* @__PURE__ */ e(w, {
|
|
1163
|
+
position: "right",
|
|
1164
|
+
mt: o.spacing,
|
|
1165
|
+
children: /* @__PURE__ */ e(b, {
|
|
1166
|
+
type: "submit",
|
|
1167
|
+
size: o.button.size,
|
|
1168
|
+
children: "Submit"
|
|
1169
|
+
})
|
|
1170
|
+
})]
|
|
1171
|
+
})
|
|
1172
|
+
});
|
|
794
1173
|
}
|
|
795
1174
|
function Ve({
|
|
796
1175
|
account: t,
|
|
797
1176
|
onSuccess: n,
|
|
798
1177
|
styles: r = y
|
|
799
1178
|
}) {
|
|
800
|
-
const [i, s] =
|
|
1179
|
+
const [i, s] = E.useState(!1), o = () => s(!0), a = () => s(!1), c = () => {
|
|
801
1180
|
n(), a();
|
|
802
1181
|
};
|
|
803
|
-
return /* @__PURE__ */ d(C, {
|
|
804
|
-
/* @__PURE__ */ e(
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
1182
|
+
return /* @__PURE__ */ d(C, {
|
|
1183
|
+
children: [/* @__PURE__ */ e(R, {
|
|
1184
|
+
overflow: "inside",
|
|
1185
|
+
opened: i,
|
|
1186
|
+
onClose: () => s(!1),
|
|
1187
|
+
title: `Editing ${t.name}`,
|
|
1188
|
+
trapFocus: !0,
|
|
1189
|
+
onDragStart: (p) => {
|
|
1190
|
+
p.stopPropagation();
|
|
1191
|
+
},
|
|
1192
|
+
children: /* @__PURE__ */ e(Ke, {
|
|
1193
|
+
...t,
|
|
1194
|
+
postSubmit: c,
|
|
1195
|
+
styles: r
|
|
1196
|
+
})
|
|
1197
|
+
}), /* @__PURE__ */ e(b, {
|
|
1198
|
+
size: r.button.size,
|
|
1199
|
+
onClick: o,
|
|
1200
|
+
leftIcon: /* @__PURE__ */ e(ge, {
|
|
1201
|
+
size: 20
|
|
1202
|
+
}),
|
|
1203
|
+
children: "Edit"
|
|
1204
|
+
})]
|
|
1205
|
+
});
|
|
809
1206
|
}
|
|
810
1207
|
function at({
|
|
811
1208
|
styles: t = y,
|
|
812
1209
|
config: n
|
|
813
1210
|
}) {
|
|
814
|
-
var g;
|
|
815
|
-
|
|
1211
|
+
var g, h;
|
|
1212
|
+
M(n);
|
|
816
1213
|
const {
|
|
817
1214
|
data: r = [],
|
|
818
1215
|
loading: i,
|
|
819
1216
|
refresh: s
|
|
820
1217
|
} = T(async () => {
|
|
821
1218
|
const {
|
|
822
|
-
data:
|
|
1219
|
+
data: u
|
|
823
1220
|
} = await P.account.list();
|
|
824
|
-
return
|
|
1221
|
+
return u;
|
|
825
1222
|
}, {
|
|
826
1223
|
refreshDeps: []
|
|
827
1224
|
}), {
|
|
828
1225
|
data: o = [],
|
|
829
1226
|
loading: a
|
|
830
|
-
} = T(async () => (await P.role.list()).map((
|
|
831
|
-
label:
|
|
832
|
-
value:
|
|
833
|
-
description:
|
|
834
|
-
disabled:
|
|
835
|
-
// SUPERADMIN
|
|
1227
|
+
} = T(async () => (await P.role.list()).map((l) => ({
|
|
1228
|
+
label: l.name,
|
|
1229
|
+
value: l.id,
|
|
1230
|
+
description: l.description,
|
|
1231
|
+
disabled: l.id === 50
|
|
836
1232
|
})), {
|
|
837
1233
|
refreshDeps: []
|
|
838
|
-
}), c =
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
1234
|
+
}), c = te(() => o.reduce((u, l) => (u.set(l.value, l.label), u), /* @__PURE__ */ new Map()), [o]), p = (u) => {
|
|
1235
|
+
var l;
|
|
1236
|
+
return (l = c.get(u)) != null ? l : u;
|
|
1237
|
+
};
|
|
1238
|
+
return /* @__PURE__ */ d(C, {
|
|
1239
|
+
children: [/* @__PURE__ */ e(w, {
|
|
1240
|
+
pt: t.spacing,
|
|
1241
|
+
position: "right",
|
|
1242
|
+
children: /* @__PURE__ */ e(Ue, {
|
|
1243
|
+
onSuccess: s,
|
|
1244
|
+
initialRoleID: (h = (g = o == null ? void 0 : o[0]) == null ? void 0 : g.value) != null ? h : 0
|
|
1245
|
+
})
|
|
1246
|
+
}), /* @__PURE__ */ d(v, {
|
|
1247
|
+
mt: t.spacing,
|
|
1248
|
+
sx: {
|
|
1249
|
+
position: "relative"
|
|
1250
|
+
},
|
|
1251
|
+
children: [/* @__PURE__ */ e(H, {
|
|
1252
|
+
visible: i || a
|
|
1253
|
+
}), /* @__PURE__ */ d($, {
|
|
1254
|
+
horizontalSpacing: t.spacing,
|
|
1255
|
+
verticalSpacing: t.spacing,
|
|
1256
|
+
fontSize: t.size,
|
|
1257
|
+
highlightOnHover: !0,
|
|
1258
|
+
children: [/* @__PURE__ */ e("thead", {
|
|
1259
|
+
children: /* @__PURE__ */ d("tr", {
|
|
1260
|
+
children: [/* @__PURE__ */ e("th", {
|
|
1261
|
+
children: "Username"
|
|
1262
|
+
}), /* @__PURE__ */ e("th", {
|
|
1263
|
+
children: "Email"
|
|
1264
|
+
}), /* @__PURE__ */ e("th", {
|
|
1265
|
+
children: "Role"
|
|
1266
|
+
}), /* @__PURE__ */ e("th", {
|
|
1267
|
+
children: "Action"
|
|
1268
|
+
})]
|
|
1269
|
+
})
|
|
1270
|
+
}), /* @__PURE__ */ e("tbody", {
|
|
1271
|
+
children: r.map((u) => {
|
|
1272
|
+
const {
|
|
1273
|
+
id: l,
|
|
1274
|
+
name: A,
|
|
1275
|
+
email: k,
|
|
1276
|
+
role_id: x
|
|
1277
|
+
} = u;
|
|
1278
|
+
return /* @__PURE__ */ d("tr", {
|
|
1279
|
+
children: [/* @__PURE__ */ e("td", {
|
|
1280
|
+
width: 200,
|
|
1281
|
+
children: A
|
|
1282
|
+
}), /* @__PURE__ */ e("td", {
|
|
1283
|
+
width: 200,
|
|
1284
|
+
children: k
|
|
1285
|
+
}), /* @__PURE__ */ e("td", {
|
|
1286
|
+
width: 200,
|
|
1287
|
+
children: p(x)
|
|
1288
|
+
}), /* @__PURE__ */ e("td", {
|
|
1289
|
+
width: 200,
|
|
1290
|
+
children: /* @__PURE__ */ d(w, {
|
|
1291
|
+
position: "left",
|
|
1292
|
+
children: [/* @__PURE__ */ e(Ve, {
|
|
1293
|
+
account: u,
|
|
1294
|
+
onSuccess: s
|
|
1295
|
+
}), /* @__PURE__ */ e(Ne, {
|
|
1296
|
+
id: l,
|
|
1297
|
+
name: A,
|
|
1298
|
+
onSuccess: s
|
|
1299
|
+
})]
|
|
1300
|
+
})
|
|
1301
|
+
})]
|
|
1302
|
+
}, l);
|
|
1303
|
+
})
|
|
1304
|
+
})]
|
|
1305
|
+
})]
|
|
1306
|
+
})]
|
|
1307
|
+
});
|
|
872
1308
|
}
|
|
873
1309
|
function Be({
|
|
874
1310
|
postSubmit: t,
|
|
@@ -883,52 +1319,91 @@ function Be({
|
|
|
883
1319
|
password: ""
|
|
884
1320
|
}
|
|
885
1321
|
});
|
|
886
|
-
return /* @__PURE__ */ e(v, {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1322
|
+
return /* @__PURE__ */ e(v, {
|
|
1323
|
+
mx: "auto",
|
|
1324
|
+
children: /* @__PURE__ */ d("form", {
|
|
1325
|
+
onSubmit: i(async ({
|
|
1326
|
+
name: o,
|
|
1327
|
+
password: a
|
|
1328
|
+
}) => {
|
|
1329
|
+
try {
|
|
1330
|
+
_({
|
|
1331
|
+
id: "for-login",
|
|
1332
|
+
title: "Pending",
|
|
1333
|
+
message: "Loggin in...",
|
|
1334
|
+
loading: !0
|
|
1335
|
+
});
|
|
1336
|
+
const c = await P.account.login(o, a);
|
|
1337
|
+
window.localStorage.setItem("token", c.token), S({
|
|
1338
|
+
id: "for-login",
|
|
1339
|
+
title: "Successful",
|
|
1340
|
+
message: "Logged in",
|
|
1341
|
+
color: "green"
|
|
1342
|
+
}), t(c);
|
|
1343
|
+
} catch (c) {
|
|
1344
|
+
S({
|
|
1345
|
+
id: "for-login",
|
|
1346
|
+
title: "Login Failed",
|
|
1347
|
+
message: c.message,
|
|
1348
|
+
color: "red"
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
}),
|
|
1352
|
+
children: [/* @__PURE__ */ e(m, {
|
|
1353
|
+
name: "name",
|
|
1354
|
+
control: r,
|
|
1355
|
+
render: ({
|
|
1356
|
+
field: o
|
|
1357
|
+
}) => /* @__PURE__ */ e(z, {
|
|
1358
|
+
mb: n.spacing,
|
|
1359
|
+
size: n.size,
|
|
1360
|
+
required: !0,
|
|
1361
|
+
label: "Username",
|
|
1362
|
+
...o
|
|
1363
|
+
})
|
|
1364
|
+
}), /* @__PURE__ */ e(m, {
|
|
1365
|
+
name: "password",
|
|
1366
|
+
control: r,
|
|
1367
|
+
render: ({
|
|
1368
|
+
field: o
|
|
1369
|
+
}) => /* @__PURE__ */ e(F, {
|
|
1370
|
+
mb: n.spacing,
|
|
1371
|
+
size: n.size,
|
|
1372
|
+
required: !0,
|
|
1373
|
+
label: "Password",
|
|
1374
|
+
...o
|
|
1375
|
+
})
|
|
1376
|
+
}), /* @__PURE__ */ e(w, {
|
|
1377
|
+
position: "right",
|
|
1378
|
+
mt: n.spacing,
|
|
1379
|
+
children: /* @__PURE__ */ e(b, {
|
|
1380
|
+
type: "submit",
|
|
1381
|
+
size: n.button.size,
|
|
1382
|
+
children: "Submit"
|
|
1383
|
+
})
|
|
1384
|
+
})]
|
|
1385
|
+
})
|
|
1386
|
+
});
|
|
921
1387
|
}
|
|
922
1388
|
function st({
|
|
923
1389
|
styles: t = y,
|
|
924
1390
|
config: n,
|
|
925
1391
|
onSuccess: r
|
|
926
1392
|
}) {
|
|
927
|
-
return
|
|
928
|
-
|
|
929
|
-
|
|
1393
|
+
return M(n), /* @__PURE__ */ e(C, {
|
|
1394
|
+
children: /* @__PURE__ */ e(v, {
|
|
1395
|
+
mt: t.spacing,
|
|
1396
|
+
sx: {
|
|
1397
|
+
position: "relative"
|
|
1398
|
+
},
|
|
1399
|
+
children: /* @__PURE__ */ e(Be, {
|
|
1400
|
+
styles: t,
|
|
1401
|
+
postSubmit: r
|
|
1402
|
+
})
|
|
1403
|
+
})
|
|
1404
|
+
});
|
|
930
1405
|
}
|
|
931
|
-
const
|
|
1406
|
+
const U = {
|
|
932
1407
|
size: "sm",
|
|
933
1408
|
spacing: "md",
|
|
934
1409
|
button: {
|
|
@@ -937,7 +1412,7 @@ const M = {
|
|
|
937
1412
|
};
|
|
938
1413
|
function He({
|
|
939
1414
|
postSubmit: t,
|
|
940
|
-
styles: n =
|
|
1415
|
+
styles: n = U,
|
|
941
1416
|
initialRoleID: r
|
|
942
1417
|
}) {
|
|
943
1418
|
const {
|
|
@@ -949,89 +1424,148 @@ function He({
|
|
|
949
1424
|
role_id: r
|
|
950
1425
|
}
|
|
951
1426
|
});
|
|
952
|
-
return /* @__PURE__ */ e(v, {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1427
|
+
return /* @__PURE__ */ e(v, {
|
|
1428
|
+
mx: "auto",
|
|
1429
|
+
children: /* @__PURE__ */ d("form", {
|
|
1430
|
+
onSubmit: s(async ({
|
|
1431
|
+
name: a,
|
|
1432
|
+
role_id: c
|
|
1433
|
+
}) => {
|
|
1434
|
+
try {
|
|
1435
|
+
_({
|
|
1436
|
+
id: "for-creating",
|
|
1437
|
+
title: "Pending",
|
|
1438
|
+
message: "Adding API Key...",
|
|
1439
|
+
loading: !0
|
|
1440
|
+
});
|
|
1441
|
+
const {
|
|
1442
|
+
app_id: p,
|
|
1443
|
+
app_secret: g
|
|
1444
|
+
} = await P.api_key.create(a, c);
|
|
1445
|
+
S({
|
|
1446
|
+
id: "for-creating",
|
|
1447
|
+
title: "Successful",
|
|
1448
|
+
message: "API Key is added",
|
|
1449
|
+
color: "green"
|
|
1450
|
+
}), t(p, g);
|
|
1451
|
+
} catch (p) {
|
|
1452
|
+
S({
|
|
1453
|
+
id: "for-creating",
|
|
1454
|
+
title: "Failed",
|
|
1455
|
+
message: p.message,
|
|
1456
|
+
color: "red"
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
}),
|
|
1460
|
+
children: [/* @__PURE__ */ e(m, {
|
|
1461
|
+
name: "name",
|
|
1462
|
+
control: i,
|
|
1463
|
+
render: ({
|
|
1464
|
+
field: a
|
|
1465
|
+
}) => /* @__PURE__ */ e(z, {
|
|
1466
|
+
mb: n.spacing,
|
|
1467
|
+
size: n.size,
|
|
1468
|
+
required: !0,
|
|
1469
|
+
label: "Name",
|
|
1470
|
+
...a
|
|
1471
|
+
})
|
|
1472
|
+
}), /* @__PURE__ */ e(m, {
|
|
1473
|
+
name: "role_id",
|
|
1474
|
+
control: i,
|
|
1475
|
+
render: ({
|
|
1476
|
+
field: a
|
|
1477
|
+
}) => /* @__PURE__ */ e(Y, {
|
|
1478
|
+
styles: n,
|
|
1479
|
+
...a
|
|
1480
|
+
})
|
|
1481
|
+
}), /* @__PURE__ */ e(w, {
|
|
1482
|
+
position: "right",
|
|
1483
|
+
mt: n.spacing,
|
|
1484
|
+
children: /* @__PURE__ */ e(b, {
|
|
1485
|
+
type: "submit",
|
|
1486
|
+
size: n.button.size,
|
|
1487
|
+
children: "Save"
|
|
1488
|
+
})
|
|
1489
|
+
})]
|
|
1490
|
+
})
|
|
1491
|
+
});
|
|
990
1492
|
}
|
|
991
1493
|
function $e({
|
|
992
1494
|
onSuccess: t,
|
|
993
|
-
styles: n =
|
|
1495
|
+
styles: n = U,
|
|
994
1496
|
initialRoleID: r
|
|
995
1497
|
}) {
|
|
996
|
-
const i =
|
|
997
|
-
return /* @__PURE__ */ d(C, {
|
|
998
|
-
/* @__PURE__ */ e(
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1498
|
+
const i = j(), [s, o] = E.useState(!1), a = () => o(!0), c = () => o(!1);
|
|
1499
|
+
return /* @__PURE__ */ d(C, {
|
|
1500
|
+
children: [/* @__PURE__ */ e(R, {
|
|
1501
|
+
overflow: "inside",
|
|
1502
|
+
opened: s,
|
|
1503
|
+
onClose: () => o(!1),
|
|
1504
|
+
title: "Add an API Key",
|
|
1505
|
+
trapFocus: !0,
|
|
1506
|
+
onDragStart: (g) => {
|
|
1507
|
+
g.stopPropagation();
|
|
1508
|
+
},
|
|
1509
|
+
children: /* @__PURE__ */ e(He, {
|
|
1510
|
+
postSubmit: (g, h) => {
|
|
1511
|
+
c(), i.openModal({
|
|
1512
|
+
title: "API Key is generated",
|
|
1513
|
+
children: /* @__PURE__ */ d(B, {
|
|
1514
|
+
children: [/* @__PURE__ */ e(L, {
|
|
1515
|
+
color: "dimmed",
|
|
1516
|
+
children: "Make sure you save it - you won't be able to access it again."
|
|
1517
|
+
}), /* @__PURE__ */ e(z, {
|
|
1518
|
+
defaultValue: g,
|
|
1519
|
+
disabled: !0,
|
|
1520
|
+
label: "APP ID",
|
|
1521
|
+
styles: {
|
|
1522
|
+
input: {
|
|
1523
|
+
cursor: "text !important"
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
}), /* @__PURE__ */ e(z, {
|
|
1527
|
+
defaultValue: h,
|
|
1528
|
+
disabled: !0,
|
|
1529
|
+
label: "APP Secret",
|
|
1530
|
+
styles: {
|
|
1531
|
+
input: {
|
|
1532
|
+
cursor: "text !important"
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
}), /* @__PURE__ */ e(b, {
|
|
1536
|
+
size: "sm",
|
|
1537
|
+
onClick: () => {
|
|
1538
|
+
Se();
|
|
1539
|
+
},
|
|
1540
|
+
children: "I've saved this API Key"
|
|
1541
|
+
})]
|
|
1542
|
+
}),
|
|
1543
|
+
onClose: () => {
|
|
1544
|
+
t();
|
|
1008
1545
|
}
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
}, styles: n, initialRoleID: r }) }),
|
|
1024
|
-
/* @__PURE__ */ e(b, { size: n.button.size, onClick: a, leftIcon: /* @__PURE__ */ e(Q, { size: 20 }), children: "Add an API Key" })
|
|
1025
|
-
] });
|
|
1546
|
+
});
|
|
1547
|
+
},
|
|
1548
|
+
styles: n,
|
|
1549
|
+
initialRoleID: r
|
|
1550
|
+
})
|
|
1551
|
+
}), /* @__PURE__ */ e(b, {
|
|
1552
|
+
size: n.button.size,
|
|
1553
|
+
onClick: a,
|
|
1554
|
+
leftIcon: /* @__PURE__ */ e(Q, {
|
|
1555
|
+
size: 20
|
|
1556
|
+
}),
|
|
1557
|
+
children: "Add an API Key"
|
|
1558
|
+
})]
|
|
1559
|
+
});
|
|
1026
1560
|
}
|
|
1027
1561
|
function Ge({
|
|
1028
1562
|
id: t,
|
|
1029
1563
|
name: n,
|
|
1030
1564
|
onSuccess: r,
|
|
1031
|
-
styles: i =
|
|
1565
|
+
styles: i = U
|
|
1032
1566
|
}) {
|
|
1033
|
-
const s =
|
|
1034
|
-
if (t) {
|
|
1567
|
+
const s = j(), o = async () => {
|
|
1568
|
+
if (!!t) {
|
|
1035
1569
|
_({
|
|
1036
1570
|
id: "for-deleting",
|
|
1037
1571
|
title: "Pending",
|
|
@@ -1063,69 +1597,116 @@ function Ge({
|
|
|
1063
1597
|
onCancel: () => console.log("Cancel"),
|
|
1064
1598
|
onConfirm: o
|
|
1065
1599
|
});
|
|
1066
|
-
return /* @__PURE__ */ e(b, {
|
|
1600
|
+
return /* @__PURE__ */ e(b, {
|
|
1601
|
+
size: i.button.size,
|
|
1602
|
+
color: "red",
|
|
1603
|
+
onClick: a,
|
|
1604
|
+
leftIcon: /* @__PURE__ */ e(W, {
|
|
1605
|
+
size: 20
|
|
1606
|
+
}),
|
|
1607
|
+
children: "Delete"
|
|
1608
|
+
});
|
|
1067
1609
|
}
|
|
1068
1610
|
function ct({
|
|
1069
|
-
styles: t =
|
|
1611
|
+
styles: t = U,
|
|
1070
1612
|
config: n
|
|
1071
1613
|
}) {
|
|
1072
|
-
var g;
|
|
1073
|
-
|
|
1614
|
+
var g, h;
|
|
1615
|
+
M(n);
|
|
1074
1616
|
const {
|
|
1075
1617
|
data: r = [],
|
|
1076
1618
|
loading: i,
|
|
1077
1619
|
refresh: s
|
|
1078
1620
|
} = T(async () => {
|
|
1079
1621
|
const {
|
|
1080
|
-
data:
|
|
1622
|
+
data: u
|
|
1081
1623
|
} = await P.api_key.list();
|
|
1082
|
-
return
|
|
1624
|
+
return u;
|
|
1083
1625
|
}, {
|
|
1084
1626
|
refreshDeps: []
|
|
1085
1627
|
}), {
|
|
1086
1628
|
data: o = [],
|
|
1087
1629
|
loading: a
|
|
1088
|
-
} = T(async () => (await P.role.list()).map((
|
|
1089
|
-
label:
|
|
1090
|
-
value:
|
|
1091
|
-
description:
|
|
1092
|
-
disabled:
|
|
1093
|
-
// SUPERADMIN
|
|
1630
|
+
} = T(async () => (await P.role.list()).map((l) => ({
|
|
1631
|
+
label: l.name,
|
|
1632
|
+
value: l.id,
|
|
1633
|
+
description: l.description,
|
|
1634
|
+
disabled: l.id === 50
|
|
1094
1635
|
})), {
|
|
1095
1636
|
refreshDeps: []
|
|
1096
|
-
}), c =
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1637
|
+
}), c = te(() => o.reduce((u, l) => (u.set(l.value, l.label), u), /* @__PURE__ */ new Map()), [o]), p = (u) => {
|
|
1638
|
+
var l;
|
|
1639
|
+
return (l = c.get(u)) != null ? l : u;
|
|
1640
|
+
};
|
|
1641
|
+
return /* @__PURE__ */ d(C, {
|
|
1642
|
+
children: [/* @__PURE__ */ e(w, {
|
|
1643
|
+
pt: t.spacing,
|
|
1644
|
+
position: "right",
|
|
1645
|
+
children: /* @__PURE__ */ e($e, {
|
|
1646
|
+
onSuccess: s,
|
|
1647
|
+
initialRoleID: (h = (g = o == null ? void 0 : o[0]) == null ? void 0 : g.value) != null ? h : 0
|
|
1648
|
+
})
|
|
1649
|
+
}), /* @__PURE__ */ d(v, {
|
|
1650
|
+
mt: t.spacing,
|
|
1651
|
+
sx: {
|
|
1652
|
+
position: "relative"
|
|
1653
|
+
},
|
|
1654
|
+
children: [/* @__PURE__ */ e(H, {
|
|
1655
|
+
visible: i || a
|
|
1656
|
+
}), /* @__PURE__ */ d($, {
|
|
1657
|
+
horizontalSpacing: t.spacing,
|
|
1658
|
+
verticalSpacing: t.spacing,
|
|
1659
|
+
fontSize: t.size,
|
|
1660
|
+
highlightOnHover: !0,
|
|
1661
|
+
children: [/* @__PURE__ */ e("thead", {
|
|
1662
|
+
children: /* @__PURE__ */ d("tr", {
|
|
1663
|
+
children: [/* @__PURE__ */ e("th", {
|
|
1664
|
+
children: "Name"
|
|
1665
|
+
}), /* @__PURE__ */ e("th", {
|
|
1666
|
+
children: "APP ID"
|
|
1667
|
+
}), /* @__PURE__ */ e("th", {
|
|
1668
|
+
children: "Role"
|
|
1669
|
+
}), /* @__PURE__ */ e("th", {
|
|
1670
|
+
children: "Action"
|
|
1671
|
+
})]
|
|
1672
|
+
})
|
|
1673
|
+
}), /* @__PURE__ */ e("tbody", {
|
|
1674
|
+
children: r.map((u) => {
|
|
1675
|
+
const {
|
|
1676
|
+
id: l,
|
|
1677
|
+
name: A,
|
|
1678
|
+
app_id: k,
|
|
1679
|
+
role_id: x
|
|
1680
|
+
} = u;
|
|
1681
|
+
return /* @__PURE__ */ d("tr", {
|
|
1682
|
+
children: [/* @__PURE__ */ e("td", {
|
|
1683
|
+
width: 200,
|
|
1684
|
+
children: A
|
|
1685
|
+
}), /* @__PURE__ */ e("td", {
|
|
1686
|
+
width: 200,
|
|
1687
|
+
children: k
|
|
1688
|
+
}), /* @__PURE__ */ e("td", {
|
|
1689
|
+
width: 200,
|
|
1690
|
+
children: p(x)
|
|
1691
|
+
}), /* @__PURE__ */ e("td", {
|
|
1692
|
+
width: 200,
|
|
1693
|
+
children: /* @__PURE__ */ e(w, {
|
|
1694
|
+
position: "left",
|
|
1695
|
+
children: /* @__PURE__ */ e(Ge, {
|
|
1696
|
+
id: l,
|
|
1697
|
+
name: A,
|
|
1698
|
+
onSuccess: s
|
|
1699
|
+
})
|
|
1700
|
+
})
|
|
1701
|
+
})]
|
|
1702
|
+
}, l);
|
|
1703
|
+
})
|
|
1704
|
+
})]
|
|
1705
|
+
})]
|
|
1706
|
+
})]
|
|
1707
|
+
});
|
|
1127
1708
|
}
|
|
1128
|
-
const lt = () => import("./package
|
|
1709
|
+
const lt = () => import("./package.5579293f.mjs").then(({
|
|
1129
1710
|
version: t
|
|
1130
1711
|
}) => (console.log(`[@devtable/dashboard] version: ${t}`), t));
|
|
1131
1712
|
export {
|