@v1ct0rbr/minivault-web 0.6.1 → 0.6.3
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/minivault-web.js +119 -110
- package/package.json +1 -1
package/dist/minivault-web.js
CHANGED
|
@@ -207,8 +207,12 @@ var S = {
|
|
|
207
207
|
all: ["minivault", "backups"],
|
|
208
208
|
db: ["minivault", "db"],
|
|
209
209
|
diagnostics: ["minivault", "diagnostics"]
|
|
210
|
-
}
|
|
211
|
-
|
|
210
|
+
}, C = /* @__PURE__ */ new Set([
|
|
211
|
+
"PENDING",
|
|
212
|
+
"IN_PROGRESS",
|
|
213
|
+
"RESTORING"
|
|
214
|
+
]), w = 3e3;
|
|
215
|
+
function T(e = !0) {
|
|
212
216
|
let t = x();
|
|
213
217
|
return u({
|
|
214
218
|
queryKey: S.diagnostics,
|
|
@@ -216,8 +220,8 @@ function C(e = !0) {
|
|
|
216
220
|
enabled: e && !!t
|
|
217
221
|
});
|
|
218
222
|
}
|
|
219
|
-
function
|
|
220
|
-
let r = x();
|
|
223
|
+
function E(e = 0, t = 10, n = !0) {
|
|
224
|
+
let r = x(), i = d().getDefaultOptions().queries?.refetchInterval, a = typeof i == "number" ? i : 15e3;
|
|
221
225
|
return u({
|
|
222
226
|
queryKey: [
|
|
223
227
|
...S.all,
|
|
@@ -225,10 +229,11 @@ function w(e = 0, t = 10, n = !0) {
|
|
|
225
229
|
t
|
|
226
230
|
],
|
|
227
231
|
queryFn: () => r.listBackups(e, t),
|
|
228
|
-
enabled: n && !!r
|
|
232
|
+
enabled: n && !!r,
|
|
233
|
+
refetchInterval: (e) => (e.state.data?.content)?.some((e) => C.has(e.status)) ? w : a
|
|
229
234
|
});
|
|
230
235
|
}
|
|
231
|
-
function
|
|
236
|
+
function D(e = !0) {
|
|
232
237
|
let t = x();
|
|
233
238
|
return u({
|
|
234
239
|
queryKey: [...S.db, "info"],
|
|
@@ -236,7 +241,7 @@ function T(e = !0) {
|
|
|
236
241
|
enabled: e && !!t
|
|
237
242
|
});
|
|
238
243
|
}
|
|
239
|
-
function
|
|
244
|
+
function O(e = !0) {
|
|
240
245
|
let t = x();
|
|
241
246
|
return u({
|
|
242
247
|
queryKey: [...S.db, "tables"],
|
|
@@ -244,7 +249,7 @@ function E(e = !0) {
|
|
|
244
249
|
enabled: e && !!t
|
|
245
250
|
});
|
|
246
251
|
}
|
|
247
|
-
function
|
|
252
|
+
function k(e, t = !0) {
|
|
248
253
|
let n = x();
|
|
249
254
|
return u({
|
|
250
255
|
queryKey: [
|
|
@@ -256,7 +261,7 @@ function D(e, t = !0) {
|
|
|
256
261
|
enabled: t && !!n && !!e
|
|
257
262
|
});
|
|
258
263
|
}
|
|
259
|
-
function
|
|
264
|
+
function A(e = !0) {
|
|
260
265
|
let t = x();
|
|
261
266
|
return u({
|
|
262
267
|
queryKey: [...S.db, "relationships"],
|
|
@@ -264,74 +269,74 @@ function O(e = !0) {
|
|
|
264
269
|
enabled: e && !!t
|
|
265
270
|
});
|
|
266
271
|
}
|
|
267
|
-
function
|
|
272
|
+
function j() {
|
|
268
273
|
let e = b(), t = d();
|
|
269
274
|
return l({
|
|
270
275
|
mutationFn: (t) => e.createBackup(t.database, t.originStorage, t.dumpOptions, t.backupType),
|
|
271
276
|
onSuccess: () => t.invalidateQueries({ queryKey: S.all })
|
|
272
277
|
});
|
|
273
278
|
}
|
|
274
|
-
function
|
|
279
|
+
function M() {
|
|
275
280
|
let e = b(), t = d();
|
|
276
281
|
return l({
|
|
277
282
|
mutationFn: (t) => e.restoreBackup(t.id, t.database, t.originStorage),
|
|
278
283
|
onSuccess: () => t.invalidateQueries({ queryKey: S.all })
|
|
279
284
|
});
|
|
280
285
|
}
|
|
281
|
-
function
|
|
286
|
+
function N() {
|
|
282
287
|
let e = b(), t = d();
|
|
283
288
|
return l({
|
|
284
289
|
mutationFn: (t) => e.deleteBackup(t),
|
|
285
290
|
onSuccess: () => t.invalidateQueries({ queryKey: S.all })
|
|
286
291
|
});
|
|
287
292
|
}
|
|
288
|
-
function
|
|
293
|
+
function P() {
|
|
289
294
|
let e = b(), t = d();
|
|
290
295
|
return l({
|
|
291
296
|
mutationFn: (t) => e.verifyBackup(t),
|
|
292
297
|
onSuccess: () => t.invalidateQueries({ queryKey: S.all })
|
|
293
298
|
});
|
|
294
299
|
}
|
|
295
|
-
function
|
|
300
|
+
function ee() {
|
|
296
301
|
let e = b();
|
|
297
302
|
return l({ mutationFn: (t) => e.downloadBackup(t.id) });
|
|
298
303
|
}
|
|
299
|
-
function
|
|
304
|
+
function F() {
|
|
300
305
|
let e = b();
|
|
301
306
|
return l({ mutationFn: (t) => e.importDump(t.file, t.database) });
|
|
302
307
|
}
|
|
303
|
-
function
|
|
308
|
+
function I() {
|
|
304
309
|
let e = b();
|
|
305
310
|
return l({ mutationFn: (t) => e.importFromStorage(t.storageType, t.storagePath, t.database, t.storageConfig) });
|
|
306
311
|
}
|
|
307
312
|
//#endregion
|
|
308
313
|
//#region src/utils/format.ts
|
|
309
|
-
var
|
|
314
|
+
var te = new Intl.DateTimeFormat("pt-BR", {
|
|
310
315
|
day: "2-digit",
|
|
311
316
|
month: "2-digit",
|
|
312
317
|
year: "numeric",
|
|
313
318
|
hour: "2-digit",
|
|
314
319
|
minute: "2-digit"
|
|
315
|
-
}),
|
|
320
|
+
}), L = [
|
|
316
321
|
"B",
|
|
317
322
|
"KB",
|
|
318
323
|
"MB",
|
|
319
324
|
"GB",
|
|
320
325
|
"TB"
|
|
321
326
|
];
|
|
322
|
-
function
|
|
327
|
+
function R(e) {
|
|
323
328
|
if (e == null || e < 0) return "—";
|
|
324
329
|
if (e < 1024) return `${e} B`;
|
|
325
330
|
let t = e, n = 0;
|
|
326
|
-
for (; t >= 1024 && n <
|
|
327
|
-
return `${Number.isInteger(t) ? t : Number(t.toFixed(1))} ${
|
|
331
|
+
for (; t >= 1024 && n < L.length - 1;) t /= 1024, n += 1;
|
|
332
|
+
return `${Number.isInteger(t) ? t : Number(t.toFixed(1))} ${L[n]}`;
|
|
328
333
|
}
|
|
329
|
-
function
|
|
334
|
+
function z(e) {
|
|
330
335
|
if (!e) return "—";
|
|
331
336
|
let t = new Date(e);
|
|
332
|
-
return Number.isNaN(t.getTime()) ? "—" :
|
|
337
|
+
return Number.isNaN(t.getTime()) ? "—" : te.format(t);
|
|
333
338
|
}
|
|
334
|
-
var
|
|
339
|
+
var B = {
|
|
335
340
|
PENDING: "Pendente",
|
|
336
341
|
IN_PROGRESS: "Em andamento",
|
|
337
342
|
COMPLETED: "Concluído",
|
|
@@ -339,7 +344,7 @@ var R = {
|
|
|
339
344
|
RESTORING: "Restaurando",
|
|
340
345
|
RESTORED: "Restaurado",
|
|
341
346
|
RESTORE_FAILED: "Falha na restauração"
|
|
342
|
-
},
|
|
347
|
+
}, V = {
|
|
343
348
|
PENDING: "text-bg-secondary",
|
|
344
349
|
IN_PROGRESS: "text-bg-primary",
|
|
345
350
|
COMPLETED: "text-bg-success",
|
|
@@ -347,7 +352,7 @@ var R = {
|
|
|
347
352
|
RESTORING: "text-bg-warning",
|
|
348
353
|
RESTORED: "text-bg-info",
|
|
349
354
|
RESTORE_FAILED: "text-bg-danger"
|
|
350
|
-
},
|
|
355
|
+
}, H = {
|
|
351
356
|
postgresql: "PostgreSQL",
|
|
352
357
|
postgres: "PostgreSQL",
|
|
353
358
|
mysql: "MySQL",
|
|
@@ -364,8 +369,8 @@ var R = {
|
|
|
364
369
|
};
|
|
365
370
|
//#endregion
|
|
366
371
|
//#region src/components/StatusBadge.tsx
|
|
367
|
-
function
|
|
368
|
-
let t =
|
|
372
|
+
function U({ status: e }) {
|
|
373
|
+
let t = V[e] ?? "text-bg-secondary", n = B[e] ?? e;
|
|
369
374
|
return /* @__PURE__ */ p("span", {
|
|
370
375
|
className: `badge rounded-pill ${t}`,
|
|
371
376
|
children: n
|
|
@@ -373,7 +378,7 @@ function V({ status: e }) {
|
|
|
373
378
|
}
|
|
374
379
|
//#endregion
|
|
375
380
|
//#region src/components/DatabaseBanner.tsx
|
|
376
|
-
function
|
|
381
|
+
function W({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
|
|
377
382
|
if (t) return /* @__PURE__ */ p("div", {
|
|
378
383
|
className: "mb-3",
|
|
379
384
|
children: /* @__PURE__ */ m("small", {
|
|
@@ -392,7 +397,7 @@ function H({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
|
|
|
392
397
|
"aria-hidden": !0
|
|
393
398
|
}),
|
|
394
399
|
"Não foi possível consultar o banco configurado: ",
|
|
395
|
-
|
|
400
|
+
K(n)
|
|
396
401
|
]
|
|
397
402
|
});
|
|
398
403
|
if (!e || !e.configured) return i ? /* @__PURE__ */ m("div", {
|
|
@@ -414,7 +419,7 @@ function H({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
|
|
|
414
419
|
"). A criação e a importação usam esse banco."
|
|
415
420
|
]
|
|
416
421
|
});
|
|
417
|
-
let a =
|
|
422
|
+
let a = H[e.databaseType ?? ""] ?? e.databaseType ?? "postgresql";
|
|
418
423
|
return i ? /* @__PURE__ */ m("div", {
|
|
419
424
|
className: "mb-3",
|
|
420
425
|
children: [
|
|
@@ -532,10 +537,10 @@ function H({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
|
|
|
532
537
|
}
|
|
533
538
|
//#endregion
|
|
534
539
|
//#region src/components/RestoreModal.tsx
|
|
535
|
-
function
|
|
536
|
-
let n =
|
|
540
|
+
function G({ backup: e, onClose: t }) {
|
|
541
|
+
let n = M(), r = D(), i = () => {
|
|
537
542
|
n.mutate({ id: e.id });
|
|
538
|
-
}, a = n.isPending;
|
|
543
|
+
}, a = n.isPending, o = e.backupType === "STORAGE";
|
|
539
544
|
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "modal-backdrop show" }), /* @__PURE__ */ p("div", {
|
|
540
545
|
className: "modal show d-block",
|
|
541
546
|
tabIndex: -1,
|
|
@@ -571,15 +576,19 @@ function U({ backup: e, onClose: t }) {
|
|
|
571
576
|
/* @__PURE__ */ m("div", {
|
|
572
577
|
className: "modal-body",
|
|
573
578
|
children: [
|
|
574
|
-
/* @__PURE__ */
|
|
579
|
+
/* @__PURE__ */ p("p", {
|
|
575
580
|
className: "text-muted small mb-3",
|
|
576
|
-
children: [
|
|
581
|
+
children: o ? /* @__PURE__ */ m(f, { children: [
|
|
582
|
+
"O snapshot ",
|
|
583
|
+
/* @__PURE__ */ p("code", { children: e.filename }),
|
|
584
|
+
" será aplicado na pasta de storage de origem configurada no servidor."
|
|
585
|
+
] }) : /* @__PURE__ */ m(f, { children: [
|
|
577
586
|
"O arquivo ",
|
|
578
587
|
/* @__PURE__ */ p("code", { children: e.filename }),
|
|
579
588
|
" será aplicado no banco configurado abaixo."
|
|
580
|
-
]
|
|
589
|
+
] })
|
|
581
590
|
}),
|
|
582
|
-
/* @__PURE__ */ p(
|
|
591
|
+
!o && /* @__PURE__ */ p(W, {
|
|
583
592
|
label: "Banco de destino",
|
|
584
593
|
dbInfo: r.data,
|
|
585
594
|
isLoading: r.isLoading,
|
|
@@ -590,7 +599,7 @@ function U({ backup: e, onClose: t }) {
|
|
|
590
599
|
children: [/* @__PURE__ */ p("i", {
|
|
591
600
|
className: "bi bi-x-circle me-2",
|
|
592
601
|
"aria-hidden": !0
|
|
593
|
-
}),
|
|
602
|
+
}), K(n.error)]
|
|
594
603
|
}),
|
|
595
604
|
n.isSuccess && /* @__PURE__ */ m("div", {
|
|
596
605
|
className: "alert alert-success mt-3 mb-0",
|
|
@@ -613,7 +622,7 @@ function U({ backup: e, onClose: t }) {
|
|
|
613
622
|
type: "button",
|
|
614
623
|
className: "btn btn-primary",
|
|
615
624
|
onClick: i,
|
|
616
|
-
disabled: a || !r.data?.configured,
|
|
625
|
+
disabled: a || !o && !r.data?.configured,
|
|
617
626
|
children: [a && /* @__PURE__ */ p(f, { children: /* @__PURE__ */ p("span", {
|
|
618
627
|
className: "spinner-border spinner-border-sm me-2",
|
|
619
628
|
"aria-hidden": !0
|
|
@@ -625,13 +634,13 @@ function U({ backup: e, onClose: t }) {
|
|
|
625
634
|
})
|
|
626
635
|
})] });
|
|
627
636
|
}
|
|
628
|
-
function
|
|
637
|
+
function K(e) {
|
|
629
638
|
return e instanceof Error ? e.message : String(e);
|
|
630
639
|
}
|
|
631
640
|
//#endregion
|
|
632
641
|
//#region src/components/BackupsTab.tsx
|
|
633
|
-
function
|
|
634
|
-
let [e, t] = o(0), [n, a] = o(null), [s, c] = o(null), [l, u] = o({}), { data: d, isLoading: f, isError: h, error: g, refetch: _, isFetching: v } =
|
|
642
|
+
function q() {
|
|
643
|
+
let [e, t] = o(0), [n, a] = o(null), [s, c] = o(null), [l, u] = o({}), { data: d, isLoading: f, isError: h, error: g, refetch: _, isFetching: v } = E(e, 10, !0), y = ee(), b = N(), x = P();
|
|
635
644
|
r(() => {
|
|
636
645
|
if (!y.data || !y.variables) return;
|
|
637
646
|
let e = URL.createObjectURL(y.data), t = document.createElement("a");
|
|
@@ -673,7 +682,7 @@ function G() {
|
|
|
673
682
|
"aria-hidden": !0
|
|
674
683
|
}),
|
|
675
684
|
"Não foi possível carregar os backups: ",
|
|
676
|
-
|
|
685
|
+
J(g)
|
|
677
686
|
]
|
|
678
687
|
}),
|
|
679
688
|
y.isError && /* @__PURE__ */ m("div", {
|
|
@@ -684,7 +693,7 @@ function G() {
|
|
|
684
693
|
"aria-hidden": !0
|
|
685
694
|
}),
|
|
686
695
|
"Falha no download: ",
|
|
687
|
-
|
|
696
|
+
J(y.error)
|
|
688
697
|
]
|
|
689
698
|
}),
|
|
690
699
|
b.isError && /* @__PURE__ */ m("div", {
|
|
@@ -695,7 +704,7 @@ function G() {
|
|
|
695
704
|
"aria-hidden": !0
|
|
696
705
|
}),
|
|
697
706
|
"Falha ao excluir: ",
|
|
698
|
-
|
|
707
|
+
J(b.error)
|
|
699
708
|
]
|
|
700
709
|
}),
|
|
701
710
|
x.isError && /* @__PURE__ */ m("div", {
|
|
@@ -706,7 +715,7 @@ function G() {
|
|
|
706
715
|
"aria-hidden": !0
|
|
707
716
|
}),
|
|
708
717
|
"Falha ao verificar: ",
|
|
709
|
-
|
|
718
|
+
J(x.error)
|
|
710
719
|
]
|
|
711
720
|
}),
|
|
712
721
|
Object.entries(l).map(([e, t]) => /* @__PURE__ */ m("div", {
|
|
@@ -805,12 +814,12 @@ function G() {
|
|
|
805
814
|
className: "text-muted",
|
|
806
815
|
children: "—"
|
|
807
816
|
}) }),
|
|
808
|
-
/* @__PURE__ */ p("td", { children:
|
|
817
|
+
/* @__PURE__ */ p("td", { children: H[e.databaseType] ?? e.databaseType }),
|
|
809
818
|
/* @__PURE__ */ p("td", {
|
|
810
819
|
className: "text-end",
|
|
811
|
-
children:
|
|
820
|
+
children: R(e.fileSize)
|
|
812
821
|
}),
|
|
813
|
-
/* @__PURE__ */ p("td", { children: /* @__PURE__ */ p(
|
|
822
|
+
/* @__PURE__ */ p("td", { children: /* @__PURE__ */ p(U, { status: e.status }) }),
|
|
814
823
|
/* @__PURE__ */ p("td", { children: e.sha256 ? /* @__PURE__ */ m("code", {
|
|
815
824
|
title: e.sha256,
|
|
816
825
|
style: { fontSize: "0.8em" },
|
|
@@ -833,7 +842,7 @@ function G() {
|
|
|
833
842
|
className: "text-muted",
|
|
834
843
|
children: "—"
|
|
835
844
|
}) }),
|
|
836
|
-
/* @__PURE__ */ p("td", { children:
|
|
845
|
+
/* @__PURE__ */ p("td", { children: z(e.createdAt) }),
|
|
837
846
|
/* @__PURE__ */ m("td", {
|
|
838
847
|
className: "text-end text-nowrap",
|
|
839
848
|
children: [
|
|
@@ -857,8 +866,8 @@ function G() {
|
|
|
857
866
|
/* @__PURE__ */ p("button", {
|
|
858
867
|
type: "button",
|
|
859
868
|
className: "btn btn-sm btn-outline-primary me-1",
|
|
860
|
-
title: "Baixar",
|
|
861
|
-
disabled: y.isPending,
|
|
869
|
+
title: e.backupType === "STORAGE" ? "Backup de storage é restaurado no servidor" : "Baixar",
|
|
870
|
+
disabled: e.backupType === "STORAGE" || y.isPending,
|
|
862
871
|
onClick: () => y.mutate({
|
|
863
872
|
id: e.id,
|
|
864
873
|
filename: e.filename
|
|
@@ -926,7 +935,7 @@ function G() {
|
|
|
926
935
|
})]
|
|
927
936
|
})]
|
|
928
937
|
}),
|
|
929
|
-
n && /* @__PURE__ */ p(
|
|
938
|
+
n && /* @__PURE__ */ p(G, {
|
|
930
939
|
backup: n,
|
|
931
940
|
onClose: () => a(null)
|
|
932
941
|
}),
|
|
@@ -1006,13 +1015,13 @@ function ie(e) {
|
|
|
1006
1015
|
})
|
|
1007
1016
|
})] });
|
|
1008
1017
|
}
|
|
1009
|
-
function
|
|
1018
|
+
function J(e) {
|
|
1010
1019
|
return e instanceof Error ? e.message : String(e);
|
|
1011
1020
|
}
|
|
1012
1021
|
//#endregion
|
|
1013
1022
|
//#region src/components/CreateBackupTab.tsx
|
|
1014
|
-
function
|
|
1015
|
-
let e =
|
|
1023
|
+
function Y() {
|
|
1024
|
+
let e = j(), t = D(), n = O(t.data?.configured), [r, a] = o(!0), [s, c] = o({
|
|
1016
1025
|
format: "plain",
|
|
1017
1026
|
includeData: !0,
|
|
1018
1027
|
includeDropTable: !1,
|
|
@@ -1020,7 +1029,7 @@ function q() {
|
|
|
1020
1029
|
includeIndexes: !0,
|
|
1021
1030
|
includeConstraints: !0,
|
|
1022
1031
|
includeRelatedTables: !1
|
|
1023
|
-
}), [l, u] = o(() => /* @__PURE__ */ new Set()), [d, f] = o(null), [h, g] = o({}), [_, v] = o(""), y =
|
|
1032
|
+
}), [l, u] = o(() => /* @__PURE__ */ new Set()), [d, f] = o(null), [h, g] = o({}), [_, v] = o(""), y = k(d, t.data?.configured), b = i(() => new Set((t.data?.exportExcludedTables ?? []).map(oe)), [t.data?.exportExcludedTables]), x = i(() => {
|
|
1024
1033
|
let e = n.data ?? [], t = _.trim().toLowerCase();
|
|
1025
1034
|
return t ? e.filter((e) => e.fullName.toLowerCase().includes(t)) : e;
|
|
1026
1035
|
}, [n.data, _]), S = i(() => Object.values(h).reduce((e, t) => e + t.length, 0), [h]), C = (e) => {
|
|
@@ -1036,7 +1045,7 @@ function q() {
|
|
|
1036
1045
|
[e]: i
|
|
1037
1046
|
};
|
|
1038
1047
|
});
|
|
1039
|
-
},
|
|
1048
|
+
}, T = () => {
|
|
1040
1049
|
let t;
|
|
1041
1050
|
if (r) {
|
|
1042
1051
|
t = { ...s }, l.size > 0 && (t.tables = [...l]);
|
|
@@ -1049,7 +1058,7 @@ function q() {
|
|
|
1049
1058
|
backupType: "DATABASE",
|
|
1050
1059
|
dumpOptions: t
|
|
1051
1060
|
});
|
|
1052
|
-
},
|
|
1061
|
+
}, E = e.isPending, A = t.data?.configured && !E;
|
|
1053
1062
|
return /* @__PURE__ */ m("div", { children: [
|
|
1054
1063
|
/* @__PURE__ */ m("div", {
|
|
1055
1064
|
className: "mb-3",
|
|
@@ -1061,7 +1070,7 @@ function q() {
|
|
|
1061
1070
|
children: "Selecione as tabelas no grid e expanda um card para marcar colunas cujo conteúdo será nulificado na exportação. Apenas o dump do banco é enviado ao storage de destino."
|
|
1062
1071
|
})]
|
|
1063
1072
|
}),
|
|
1064
|
-
/* @__PURE__ */ p(
|
|
1073
|
+
/* @__PURE__ */ p(W, {
|
|
1065
1074
|
label: "Banco de destino",
|
|
1066
1075
|
dbInfo: t.data,
|
|
1067
1076
|
isLoading: t.isLoading,
|
|
@@ -1120,7 +1129,7 @@ function q() {
|
|
|
1120
1129
|
"aria-hidden": !0
|
|
1121
1130
|
}),
|
|
1122
1131
|
"Falha ao listar tabelas: ",
|
|
1123
|
-
|
|
1132
|
+
K(n.error)
|
|
1124
1133
|
]
|
|
1125
1134
|
}),
|
|
1126
1135
|
x.length === 0 && !n.isLoading && /* @__PURE__ */ p("div", {
|
|
@@ -1297,7 +1306,7 @@ function q() {
|
|
|
1297
1306
|
"aria-hidden": !0
|
|
1298
1307
|
}),
|
|
1299
1308
|
"Falha ao criar backup: ",
|
|
1300
|
-
|
|
1309
|
+
K(e.error)
|
|
1301
1310
|
]
|
|
1302
1311
|
}),
|
|
1303
1312
|
e.isSuccess && /* @__PURE__ */ m("div", {
|
|
@@ -1309,9 +1318,9 @@ function q() {
|
|
|
1309
1318
|
}),
|
|
1310
1319
|
"Backup #",
|
|
1311
1320
|
e.data.id,
|
|
1312
|
-
"
|
|
1321
|
+
" enfileirado (",
|
|
1313
1322
|
e.data.filename,
|
|
1314
|
-
")."
|
|
1323
|
+
"). O progresso é exibido na aba Backups."
|
|
1315
1324
|
]
|
|
1316
1325
|
}),
|
|
1317
1326
|
/* @__PURE__ */ p("div", {
|
|
@@ -1319,10 +1328,10 @@ function q() {
|
|
|
1319
1328
|
children: /* @__PURE__ */ m("button", {
|
|
1320
1329
|
type: "button",
|
|
1321
1330
|
className: "btn btn-primary",
|
|
1322
|
-
onClick:
|
|
1323
|
-
disabled: !
|
|
1331
|
+
onClick: T,
|
|
1332
|
+
disabled: !A,
|
|
1324
1333
|
children: [
|
|
1325
|
-
|
|
1334
|
+
E && /* @__PURE__ */ p("span", {
|
|
1326
1335
|
className: "spinner-border spinner-border-sm me-2",
|
|
1327
1336
|
"aria-hidden": !0
|
|
1328
1337
|
}),
|
|
@@ -1400,7 +1409,7 @@ function ae({ table: e, disabled: t, selected: n, expanded: r, excluded: i, deta
|
|
|
1400
1409
|
}),
|
|
1401
1410
|
a?.isError && /* @__PURE__ */ m("small", {
|
|
1402
1411
|
className: "text-danger",
|
|
1403
|
-
children: ["Erro: ",
|
|
1412
|
+
children: ["Erro: ", K(a.error)]
|
|
1404
1413
|
}),
|
|
1405
1414
|
a?.data && /* @__PURE__ */ m(f, { children: [a.data.columns.map((e) => /* @__PURE__ */ m("div", {
|
|
1406
1415
|
className: "d-flex align-items-center gap-2 py-1",
|
|
@@ -1457,8 +1466,8 @@ function oe(e) {
|
|
|
1457
1466
|
}
|
|
1458
1467
|
//#endregion
|
|
1459
1468
|
//#region src/components/DiagnosticsTab.tsx
|
|
1460
|
-
function
|
|
1461
|
-
let { data: e, isLoading: t, isError: n, error: r, refetch: a, isFetching: o } =
|
|
1469
|
+
function X() {
|
|
1470
|
+
let { data: e, isLoading: t, isError: n, error: r, refetch: a, isFetching: o } = T(), s = i(() => e ? {
|
|
1462
1471
|
total: e.length,
|
|
1463
1472
|
okCount: e.filter((e) => e.ok).length,
|
|
1464
1473
|
notConfigured: e.filter((e) => !e.configured).length
|
|
@@ -1498,7 +1507,7 @@ function J() {
|
|
|
1498
1507
|
"aria-hidden": !0
|
|
1499
1508
|
}),
|
|
1500
1509
|
"Não foi possível executar as checagens: ",
|
|
1501
|
-
|
|
1510
|
+
K(r)
|
|
1502
1511
|
]
|
|
1503
1512
|
}),
|
|
1504
1513
|
s && /* @__PURE__ */ m("div", {
|
|
@@ -1579,7 +1588,7 @@ function se({ check: e }) {
|
|
|
1579
1588
|
}
|
|
1580
1589
|
//#endregion
|
|
1581
1590
|
//#region src/components/StorageExplorerTab.tsx
|
|
1582
|
-
function
|
|
1591
|
+
function Z({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
1583
1592
|
let i = b(), s = d(), [c, h] = o(""), [g, _] = o([]), [v, y] = o(/* @__PURE__ */ new Set()), [x, S] = o(null), C = n?.type ?? e, { data: w, isLoading: T } = u({
|
|
1584
1593
|
queryKey: [
|
|
1585
1594
|
"storage-files",
|
|
@@ -1616,7 +1625,7 @@ function Y({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1616
1625
|
} catch {}
|
|
1617
1626
|
}, N = async () => {
|
|
1618
1627
|
for (let e of v) await M(e);
|
|
1619
|
-
}, P = (e) => e ?
|
|
1628
|
+
}, P = (e) => e ? z(e) : "-";
|
|
1620
1629
|
return /* @__PURE__ */ m("div", {
|
|
1621
1630
|
className: "space-y-3",
|
|
1622
1631
|
children: [
|
|
@@ -1746,7 +1755,7 @@ function Y({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1746
1755
|
}) }),
|
|
1747
1756
|
/* @__PURE__ */ p("td", {
|
|
1748
1757
|
className: "text-muted small",
|
|
1749
|
-
children: e.directory ? "-" :
|
|
1758
|
+
children: e.directory ? "-" : R(e.size)
|
|
1750
1759
|
}),
|
|
1751
1760
|
/* @__PURE__ */ p("td", {
|
|
1752
1761
|
className: "text-muted small",
|
|
@@ -1851,8 +1860,8 @@ function Y({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1851
1860
|
}
|
|
1852
1861
|
//#endregion
|
|
1853
1862
|
//#region src/components/ImportDumpTab.tsx
|
|
1854
|
-
function
|
|
1855
|
-
let e =
|
|
1863
|
+
function Q() {
|
|
1864
|
+
let e = F(), t = I(), n = D(), r = a(null), [i, s] = o("upload"), [c, l] = o(null), [u, d] = o(""), [f, h] = o(!1), g = () => {
|
|
1856
1865
|
i === "upload" && c ? e.mutate({ file: c }) : i === "storage" && u && t.mutate({
|
|
1857
1866
|
storageType: "LOCAL",
|
|
1858
1867
|
storagePath: u
|
|
@@ -1974,7 +1983,7 @@ function X() {
|
|
|
1974
1983
|
maxHeight: 350,
|
|
1975
1984
|
overflow: "auto"
|
|
1976
1985
|
},
|
|
1977
|
-
children: /* @__PURE__ */ p(
|
|
1986
|
+
children: /* @__PURE__ */ p(Z, {
|
|
1978
1987
|
storageType: "LOCAL",
|
|
1979
1988
|
storageConfig: {
|
|
1980
1989
|
type: "LOCAL",
|
|
@@ -1997,7 +2006,7 @@ function X() {
|
|
|
1997
2006
|
children: [/* @__PURE__ */ p("p", {
|
|
1998
2007
|
className: "small text-body-secondary mb-3",
|
|
1999
2008
|
children: "O dump será aplicado no banco configurado no servidor. Tabelas bloqueadas por segurança são ignoradas automaticamente na importação."
|
|
2000
|
-
}), /* @__PURE__ */ p(
|
|
2009
|
+
}), /* @__PURE__ */ p(W, {
|
|
2001
2010
|
label: "Banco de destino",
|
|
2002
2011
|
dbInfo: n.data,
|
|
2003
2012
|
isLoading: n.isLoading,
|
|
@@ -2013,7 +2022,7 @@ function X() {
|
|
|
2013
2022
|
"aria-hidden": !0
|
|
2014
2023
|
}),
|
|
2015
2024
|
"Falha na importacao: ",
|
|
2016
|
-
|
|
2025
|
+
K(y)
|
|
2017
2026
|
]
|
|
2018
2027
|
}),
|
|
2019
2028
|
v && /* @__PURE__ */ m("div", {
|
|
@@ -2055,8 +2064,8 @@ function X() {
|
|
|
2055
2064
|
}
|
|
2056
2065
|
//#endregion
|
|
2057
2066
|
//#region src/components/StorageBackupTab.tsx
|
|
2058
|
-
function
|
|
2059
|
-
let e =
|
|
2067
|
+
function ce() {
|
|
2068
|
+
let e = j(), t = T(), n = t.data?.find((e) => e.name === "ORIGIN_STORAGE"), r = t.data?.find((e) => e.name === "OUTPUT_STORAGE"), i = e.isPending;
|
|
2060
2069
|
return /* @__PURE__ */ m("div", { children: [
|
|
2061
2070
|
/* @__PURE__ */ m("div", {
|
|
2062
2071
|
className: "mb-3",
|
|
@@ -2098,12 +2107,12 @@ function Z() {
|
|
|
2098
2107
|
}),
|
|
2099
2108
|
t.data && /* @__PURE__ */ m("div", {
|
|
2100
2109
|
className: "d-flex flex-column gap-2",
|
|
2101
|
-
children: [/* @__PURE__ */ p(
|
|
2110
|
+
children: [/* @__PURE__ */ p(le, {
|
|
2102
2111
|
label: n?.label ?? "Storage de origem",
|
|
2103
2112
|
configured: n?.configured,
|
|
2104
2113
|
ok: n?.ok,
|
|
2105
2114
|
message: n?.message
|
|
2106
|
-
}), /* @__PURE__ */ p(
|
|
2115
|
+
}), /* @__PURE__ */ p(le, {
|
|
2107
2116
|
label: r?.label ?? "Storage de destino",
|
|
2108
2117
|
configured: r?.configured,
|
|
2109
2118
|
ok: r?.ok,
|
|
@@ -2121,7 +2130,7 @@ function Z() {
|
|
|
2121
2130
|
"aria-hidden": !0
|
|
2122
2131
|
}),
|
|
2123
2132
|
"Falha ao criar backup de storage: ",
|
|
2124
|
-
|
|
2133
|
+
K(e.error)
|
|
2125
2134
|
]
|
|
2126
2135
|
}),
|
|
2127
2136
|
e.isSuccess && /* @__PURE__ */ m("div", {
|
|
@@ -2133,9 +2142,9 @@ function Z() {
|
|
|
2133
2142
|
}),
|
|
2134
2143
|
"Backup de storage #",
|
|
2135
2144
|
e.data.id,
|
|
2136
|
-
"
|
|
2145
|
+
" enfileirado (",
|
|
2137
2146
|
e.data.filename,
|
|
2138
|
-
")."
|
|
2147
|
+
"). O progresso é exibido na aba Backups."
|
|
2139
2148
|
]
|
|
2140
2149
|
}),
|
|
2141
2150
|
/* @__PURE__ */ p("div", {
|
|
@@ -2162,7 +2171,7 @@ function Z() {
|
|
|
2162
2171
|
})
|
|
2163
2172
|
] });
|
|
2164
2173
|
}
|
|
2165
|
-
function
|
|
2174
|
+
function le({ label: e, configured: t, ok: n, message: r }) {
|
|
2166
2175
|
return t === !1 ? /* @__PURE__ */ m("div", {
|
|
2167
2176
|
className: "d-flex align-items-center gap-2 small text-muted",
|
|
2168
2177
|
children: [/* @__PURE__ */ p("i", {
|
|
@@ -2186,7 +2195,7 @@ function Q({ label: e, configured: t, ok: n, message: r }) {
|
|
|
2186
2195
|
function $() {
|
|
2187
2196
|
return typeof document < "u" && document.documentElement.classList.contains("dark");
|
|
2188
2197
|
}
|
|
2189
|
-
function
|
|
2198
|
+
function ue(e) {
|
|
2190
2199
|
let [t, n] = o($), [i, a] = o(() => typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches === !0);
|
|
2191
2200
|
return r(() => {
|
|
2192
2201
|
let e = document.documentElement, t = new MutationObserver(() => n($()));
|
|
@@ -2202,8 +2211,8 @@ function ce(e) {
|
|
|
2202
2211
|
}
|
|
2203
2212
|
//#endregion
|
|
2204
2213
|
//#region src/components/MinivaultModule.tsx
|
|
2205
|
-
function
|
|
2206
|
-
let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l =
|
|
2214
|
+
function de(e) {
|
|
2215
|
+
let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l = ue(n), [u] = o(() => new s({ defaultOptions: { queries: {
|
|
2207
2216
|
refetchInterval: r,
|
|
2208
2217
|
retry: 1
|
|
2209
2218
|
} } }));
|
|
@@ -2214,15 +2223,15 @@ function le(e) {
|
|
|
2214
2223
|
children: /* @__PURE__ */ m("div", {
|
|
2215
2224
|
className: "minivault-module h-full w-full overflow-auto",
|
|
2216
2225
|
"data-minivault-theme": l,
|
|
2217
|
-
children: [/* @__PURE__ */ p(
|
|
2226
|
+
children: [/* @__PURE__ */ p(fe, {
|
|
2218
2227
|
companyAcronym: t,
|
|
2219
2228
|
theme: l
|
|
2220
|
-
}), /* @__PURE__ */ p(
|
|
2229
|
+
}), /* @__PURE__ */ p(pe, { storageType: i })]
|
|
2221
2230
|
})
|
|
2222
2231
|
})
|
|
2223
2232
|
});
|
|
2224
2233
|
}
|
|
2225
|
-
function
|
|
2234
|
+
function fe({ companyAcronym: e, theme: t }) {
|
|
2226
2235
|
return /* @__PURE__ */ m("div", {
|
|
2227
2236
|
className: "d-flex align-items-center justify-content-between flex-wrap gap-2 px-3 py-2 border-bottom",
|
|
2228
2237
|
style: {
|
|
@@ -2251,7 +2260,7 @@ function ue({ companyAcronym: e, theme: t }) {
|
|
|
2251
2260
|
})]
|
|
2252
2261
|
});
|
|
2253
2262
|
}
|
|
2254
|
-
function
|
|
2263
|
+
function pe({ storageType: e }) {
|
|
2255
2264
|
let [t, n] = o("backups");
|
|
2256
2265
|
return /* @__PURE__ */ m("div", {
|
|
2257
2266
|
className: "p-3",
|
|
@@ -2333,23 +2342,23 @@ function de({ storageType: e }) {
|
|
|
2333
2342
|
})
|
|
2334
2343
|
]
|
|
2335
2344
|
}),
|
|
2336
|
-
t === "backups" && /* @__PURE__ */ p(
|
|
2337
|
-
t === "create" && /* @__PURE__ */ p(
|
|
2338
|
-
t === "createStorage" && /* @__PURE__ */ p(
|
|
2339
|
-
t === "import" && /* @__PURE__ */ p(
|
|
2340
|
-
t === "storage" && /* @__PURE__ */ p(
|
|
2341
|
-
t === "diagnostics" && /* @__PURE__ */ p(
|
|
2345
|
+
t === "backups" && /* @__PURE__ */ p(q, {}),
|
|
2346
|
+
t === "create" && /* @__PURE__ */ p(Y, {}),
|
|
2347
|
+
t === "createStorage" && /* @__PURE__ */ p(ce, {}),
|
|
2348
|
+
t === "import" && /* @__PURE__ */ p(Q, {}),
|
|
2349
|
+
t === "storage" && /* @__PURE__ */ p(Z, { storageType: e }),
|
|
2350
|
+
t === "diagnostics" && /* @__PURE__ */ p(X, {})
|
|
2342
2351
|
]
|
|
2343
2352
|
});
|
|
2344
2353
|
}
|
|
2345
2354
|
//#endregion
|
|
2346
2355
|
//#region src/components/CredentialsFields.tsx
|
|
2347
|
-
var
|
|
2356
|
+
var me = [
|
|
2348
2357
|
"postgresql",
|
|
2349
2358
|
"mysql",
|
|
2350
2359
|
"sqlserver"
|
|
2351
2360
|
];
|
|
2352
|
-
function
|
|
2361
|
+
function he() {
|
|
2353
2362
|
return {
|
|
2354
2363
|
host: "localhost",
|
|
2355
2364
|
port: 5432,
|
|
@@ -2359,19 +2368,19 @@ function pe() {
|
|
|
2359
2368
|
databaseType: "postgresql"
|
|
2360
2369
|
};
|
|
2361
2370
|
}
|
|
2362
|
-
function
|
|
2371
|
+
function ge(e) {
|
|
2363
2372
|
return e === "postgresql" || e === "postgres" ? 5432 : e === "mysql" ? 3306 : 1433;
|
|
2364
2373
|
}
|
|
2365
|
-
function
|
|
2374
|
+
function _e({ value: e, onChange: t, onValidatedChange: n }) {
|
|
2366
2375
|
let r = {
|
|
2367
|
-
...
|
|
2376
|
+
...he(),
|
|
2368
2377
|
...e
|
|
2369
2378
|
}, i = (e) => {
|
|
2370
2379
|
let n = {
|
|
2371
2380
|
...r,
|
|
2372
2381
|
databaseType: e
|
|
2373
2382
|
};
|
|
2374
|
-
(r.port ===
|
|
2383
|
+
(r.port === ge(r.databaseType) || !r.port) && (n.port = ge(e)), t(n);
|
|
2375
2384
|
}, a = (e) => {
|
|
2376
2385
|
let i = {
|
|
2377
2386
|
...r,
|
|
@@ -2393,9 +2402,9 @@ function he({ value: e, onChange: t, onValidatedChange: n }) {
|
|
|
2393
2402
|
className: "form-select",
|
|
2394
2403
|
value: r.databaseType,
|
|
2395
2404
|
onChange: (e) => i(e.target.value),
|
|
2396
|
-
children:
|
|
2405
|
+
children: me.map((e) => /* @__PURE__ */ p("option", {
|
|
2397
2406
|
value: e,
|
|
2398
|
-
children:
|
|
2407
|
+
children: H[e] ?? e
|
|
2399
2408
|
}, e))
|
|
2400
2409
|
})]
|
|
2401
2410
|
}),
|
|
@@ -2467,4 +2476,4 @@ function he({ value: e, onChange: t, onValidatedChange: n }) {
|
|
|
2467
2476
|
});
|
|
2468
2477
|
}
|
|
2469
2478
|
//#endregion
|
|
2470
|
-
export {
|
|
2479
|
+
export { q as BackupsTab, Y as CreateBackupTab, _e as CredentialsFields, H as DATABASE_TYPE_LABELS, W as DatabaseBanner, X as DiagnosticsTab, Q as ImportDumpTab, g as MinivaultApi, h as MinivaultApiError, y as MinivaultApiProvider, de as MinivaultModule, G as RestoreModal, V as STATUS_BADGE, B as STATUS_LABELS, U as StatusBadge, ce as StorageBackupTab, Z as StorageExplorerTab, z as formatDate, R as formatFileSize, E as useBackups, j as useCreateBackup, D as useDbInfo, A as useDbRelationships, k as useDbTableDetail, O as useDbTables, N as useDeleteBackup, T as useDiagnostics, ee as useDownloadBackup, F as useImportDump, I as useImportFromStorage, b as useMinivaultApi, M as useRestoreBackup };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v1ct0rbr/minivault-web",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Módulo independente de gerenciamento de backups (minivault). Consumível como pacote npm em qualquer app React. Cliente do minivault REST API (acesso tipicamente via proxy autenticado).",
|
|
5
5
|
"author": "Victor Queiroga (https://www.linkedin.com/in/victor-queiroga)",
|
|
6
6
|
"license": "MIT",
|