@v1ct0rbr/minivault-web 0.6.0 → 0.6.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/minivault-web.js +100 -81
- package/dist/types/minivault.d.ts +2 -0
- package/dist/utils/format.d.ts +3 -1
- package/package.json +1 -1
package/dist/minivault-web.js
CHANGED
|
@@ -312,26 +312,26 @@ var ee = new Intl.DateTimeFormat("pt-BR", {
|
|
|
312
312
|
year: "numeric",
|
|
313
313
|
hour: "2-digit",
|
|
314
314
|
minute: "2-digit"
|
|
315
|
-
}),
|
|
315
|
+
}), te = [
|
|
316
316
|
"B",
|
|
317
317
|
"KB",
|
|
318
318
|
"MB",
|
|
319
319
|
"GB",
|
|
320
320
|
"TB"
|
|
321
321
|
];
|
|
322
|
-
function
|
|
322
|
+
function I(e) {
|
|
323
323
|
if (e == null || e < 0) return "—";
|
|
324
324
|
if (e < 1024) return `${e} B`;
|
|
325
325
|
let t = e, n = 0;
|
|
326
|
-
for (; t >= 1024 && n <
|
|
327
|
-
return `${Number.isInteger(t) ? t : Number(t.toFixed(1))} ${
|
|
326
|
+
for (; t >= 1024 && n < te.length - 1;) t /= 1024, n += 1;
|
|
327
|
+
return `${Number.isInteger(t) ? t : Number(t.toFixed(1))} ${te[n]}`;
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function L(e) {
|
|
330
330
|
if (!e) return "—";
|
|
331
331
|
let t = new Date(e);
|
|
332
332
|
return Number.isNaN(t.getTime()) ? "—" : ee.format(t);
|
|
333
333
|
}
|
|
334
|
-
var
|
|
334
|
+
var R = {
|
|
335
335
|
PENDING: "Pendente",
|
|
336
336
|
IN_PROGRESS: "Em andamento",
|
|
337
337
|
COMPLETED: "Concluído",
|
|
@@ -339,7 +339,7 @@ var z = {
|
|
|
339
339
|
RESTORING: "Restaurando",
|
|
340
340
|
RESTORED: "Restaurado",
|
|
341
341
|
RESTORE_FAILED: "Falha na restauração"
|
|
342
|
-
},
|
|
342
|
+
}, z = {
|
|
343
343
|
PENDING: "text-bg-secondary",
|
|
344
344
|
IN_PROGRESS: "text-bg-primary",
|
|
345
345
|
COMPLETED: "text-bg-success",
|
|
@@ -347,17 +347,25 @@ var z = {
|
|
|
347
347
|
RESTORING: "text-bg-warning",
|
|
348
348
|
RESTORED: "text-bg-info",
|
|
349
349
|
RESTORE_FAILED: "text-bg-danger"
|
|
350
|
-
},
|
|
350
|
+
}, B = {
|
|
351
351
|
postgresql: "PostgreSQL",
|
|
352
352
|
postgres: "PostgreSQL",
|
|
353
353
|
mysql: "MySQL",
|
|
354
354
|
sqlserver: "SQL Server",
|
|
355
355
|
mssql: "SQL Server"
|
|
356
|
+
}, ne = {
|
|
357
|
+
DATABASE: "Banco de dados",
|
|
358
|
+
STORAGE: "Storage",
|
|
359
|
+
FULL: "Completo"
|
|
360
|
+
}, re = {
|
|
361
|
+
DATABASE: "text-bg-primary",
|
|
362
|
+
STORAGE: "text-bg-info",
|
|
363
|
+
FULL: "text-bg-secondary"
|
|
356
364
|
};
|
|
357
365
|
//#endregion
|
|
358
366
|
//#region src/components/StatusBadge.tsx
|
|
359
|
-
function
|
|
360
|
-
let t =
|
|
367
|
+
function V({ status: e }) {
|
|
368
|
+
let t = z[e] ?? "text-bg-secondary", n = R[e] ?? e;
|
|
361
369
|
return /* @__PURE__ */ p("span", {
|
|
362
370
|
className: `badge rounded-pill ${t}`,
|
|
363
371
|
children: n
|
|
@@ -365,7 +373,7 @@ function H({ status: e }) {
|
|
|
365
373
|
}
|
|
366
374
|
//#endregion
|
|
367
375
|
//#region src/components/DatabaseBanner.tsx
|
|
368
|
-
function
|
|
376
|
+
function H({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
|
|
369
377
|
if (t) return /* @__PURE__ */ p("div", {
|
|
370
378
|
className: "mb-3",
|
|
371
379
|
children: /* @__PURE__ */ m("small", {
|
|
@@ -384,7 +392,7 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
|
|
|
384
392
|
"aria-hidden": !0
|
|
385
393
|
}),
|
|
386
394
|
"Não foi possível consultar o banco configurado: ",
|
|
387
|
-
|
|
395
|
+
W(n)
|
|
388
396
|
]
|
|
389
397
|
});
|
|
390
398
|
if (!e || !e.configured) return i ? /* @__PURE__ */ m("div", {
|
|
@@ -406,7 +414,7 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
|
|
|
406
414
|
"). A criação e a importação usam esse banco."
|
|
407
415
|
]
|
|
408
416
|
});
|
|
409
|
-
let a =
|
|
417
|
+
let a = B[e.databaseType ?? ""] ?? e.databaseType ?? "postgresql";
|
|
410
418
|
return i ? /* @__PURE__ */ m("div", {
|
|
411
419
|
className: "mb-3",
|
|
412
420
|
children: [
|
|
@@ -524,7 +532,7 @@ function U({ dbInfo: e, isLoading: t, error: n, label: r, compact: i = !1 }) {
|
|
|
524
532
|
}
|
|
525
533
|
//#endregion
|
|
526
534
|
//#region src/components/RestoreModal.tsx
|
|
527
|
-
function
|
|
535
|
+
function U({ backup: e, onClose: t }) {
|
|
528
536
|
let n = A(), r = T(), i = () => {
|
|
529
537
|
n.mutate({ id: e.id });
|
|
530
538
|
}, a = n.isPending;
|
|
@@ -571,7 +579,7 @@ function W({ backup: e, onClose: t }) {
|
|
|
571
579
|
" será aplicado no banco configurado abaixo."
|
|
572
580
|
]
|
|
573
581
|
}),
|
|
574
|
-
/* @__PURE__ */ p(
|
|
582
|
+
/* @__PURE__ */ p(H, {
|
|
575
583
|
label: "Banco de destino",
|
|
576
584
|
dbInfo: r.data,
|
|
577
585
|
isLoading: r.isLoading,
|
|
@@ -582,7 +590,7 @@ function W({ backup: e, onClose: t }) {
|
|
|
582
590
|
children: [/* @__PURE__ */ p("i", {
|
|
583
591
|
className: "bi bi-x-circle me-2",
|
|
584
592
|
"aria-hidden": !0
|
|
585
|
-
}),
|
|
593
|
+
}), W(n.error)]
|
|
586
594
|
}),
|
|
587
595
|
n.isSuccess && /* @__PURE__ */ m("div", {
|
|
588
596
|
className: "alert alert-success mt-3 mb-0",
|
|
@@ -617,12 +625,12 @@ function W({ backup: e, onClose: t }) {
|
|
|
617
625
|
})
|
|
618
626
|
})] });
|
|
619
627
|
}
|
|
620
|
-
function
|
|
628
|
+
function W(e) {
|
|
621
629
|
return e instanceof Error ? e.message : String(e);
|
|
622
630
|
}
|
|
623
631
|
//#endregion
|
|
624
632
|
//#region src/components/BackupsTab.tsx
|
|
625
|
-
function
|
|
633
|
+
function G() {
|
|
626
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 } = w(e, 10, !0), y = N(), b = j(), x = M();
|
|
627
635
|
r(() => {
|
|
628
636
|
if (!y.data || !y.variables) return;
|
|
@@ -665,7 +673,7 @@ function K() {
|
|
|
665
673
|
"aria-hidden": !0
|
|
666
674
|
}),
|
|
667
675
|
"Não foi possível carregar os backups: ",
|
|
668
|
-
|
|
676
|
+
K(g)
|
|
669
677
|
]
|
|
670
678
|
}),
|
|
671
679
|
y.isError && /* @__PURE__ */ m("div", {
|
|
@@ -676,7 +684,7 @@ function K() {
|
|
|
676
684
|
"aria-hidden": !0
|
|
677
685
|
}),
|
|
678
686
|
"Falha no download: ",
|
|
679
|
-
|
|
687
|
+
K(y.error)
|
|
680
688
|
]
|
|
681
689
|
}),
|
|
682
690
|
b.isError && /* @__PURE__ */ m("div", {
|
|
@@ -687,7 +695,7 @@ function K() {
|
|
|
687
695
|
"aria-hidden": !0
|
|
688
696
|
}),
|
|
689
697
|
"Falha ao excluir: ",
|
|
690
|
-
|
|
698
|
+
K(b.error)
|
|
691
699
|
]
|
|
692
700
|
}),
|
|
693
701
|
x.isError && /* @__PURE__ */ m("div", {
|
|
@@ -698,7 +706,7 @@ function K() {
|
|
|
698
706
|
"aria-hidden": !0
|
|
699
707
|
}),
|
|
700
708
|
"Falha ao verificar: ",
|
|
701
|
-
|
|
709
|
+
K(x.error)
|
|
702
710
|
]
|
|
703
711
|
}),
|
|
704
712
|
Object.entries(l).map(([e, t]) => /* @__PURE__ */ m("div", {
|
|
@@ -741,6 +749,10 @@ function K() {
|
|
|
741
749
|
scope: "col",
|
|
742
750
|
children: "Arquivo"
|
|
743
751
|
}),
|
|
752
|
+
/* @__PURE__ */ p("th", {
|
|
753
|
+
scope: "col",
|
|
754
|
+
children: "Tipo"
|
|
755
|
+
}),
|
|
744
756
|
/* @__PURE__ */ p("th", {
|
|
745
757
|
scope: "col",
|
|
746
758
|
children: "Banco"
|
|
@@ -772,7 +784,7 @@ function K() {
|
|
|
772
784
|
children: "Ações"
|
|
773
785
|
})
|
|
774
786
|
] }) }), /* @__PURE__ */ m("tbody", { children: [S.length === 0 && /* @__PURE__ */ p("tr", { children: /* @__PURE__ */ p("td", {
|
|
775
|
-
colSpan:
|
|
787
|
+
colSpan: 10,
|
|
776
788
|
className: "text-center text-muted py-4",
|
|
777
789
|
children: "Nenhum backup cadastrado."
|
|
778
790
|
}) }), S.map((e) => /* @__PURE__ */ m("tr", { children: [
|
|
@@ -786,12 +798,19 @@ function K() {
|
|
|
786
798
|
"aria-hidden": !0
|
|
787
799
|
}), e.filename]
|
|
788
800
|
}),
|
|
789
|
-
/* @__PURE__ */ p("td", { children:
|
|
801
|
+
/* @__PURE__ */ p("td", { children: e.backupType ? /* @__PURE__ */ p("span", {
|
|
802
|
+
className: `badge ${re[e.backupType] ?? "text-bg-secondary"}`,
|
|
803
|
+
children: ne[e.backupType] ?? e.backupType
|
|
804
|
+
}) : /* @__PURE__ */ p("span", {
|
|
805
|
+
className: "text-muted",
|
|
806
|
+
children: "—"
|
|
807
|
+
}) }),
|
|
808
|
+
/* @__PURE__ */ p("td", { children: B[e.databaseType] ?? e.databaseType }),
|
|
790
809
|
/* @__PURE__ */ p("td", {
|
|
791
810
|
className: "text-end",
|
|
792
|
-
children:
|
|
811
|
+
children: I(e.fileSize)
|
|
793
812
|
}),
|
|
794
|
-
/* @__PURE__ */ p("td", { children: /* @__PURE__ */ p(
|
|
813
|
+
/* @__PURE__ */ p("td", { children: /* @__PURE__ */ p(V, { status: e.status }) }),
|
|
795
814
|
/* @__PURE__ */ p("td", { children: e.sha256 ? /* @__PURE__ */ m("code", {
|
|
796
815
|
title: e.sha256,
|
|
797
816
|
style: { fontSize: "0.8em" },
|
|
@@ -814,7 +833,7 @@ function K() {
|
|
|
814
833
|
className: "text-muted",
|
|
815
834
|
children: "—"
|
|
816
835
|
}) }),
|
|
817
|
-
/* @__PURE__ */ p("td", { children:
|
|
836
|
+
/* @__PURE__ */ p("td", { children: L(e.createdAt) }),
|
|
818
837
|
/* @__PURE__ */ m("td", {
|
|
819
838
|
className: "text-end text-nowrap",
|
|
820
839
|
children: [
|
|
@@ -907,11 +926,11 @@ function K() {
|
|
|
907
926
|
})]
|
|
908
927
|
})]
|
|
909
928
|
}),
|
|
910
|
-
n && /* @__PURE__ */ p(
|
|
929
|
+
n && /* @__PURE__ */ p(U, {
|
|
911
930
|
backup: n,
|
|
912
931
|
onClose: () => a(null)
|
|
913
932
|
}),
|
|
914
|
-
s && /* @__PURE__ */ p(
|
|
933
|
+
s && /* @__PURE__ */ p(ie, {
|
|
915
934
|
backup: s,
|
|
916
935
|
busy: b.isPending,
|
|
917
936
|
onCancel: () => c(null),
|
|
@@ -921,7 +940,7 @@ function K() {
|
|
|
921
940
|
})
|
|
922
941
|
] });
|
|
923
942
|
}
|
|
924
|
-
function
|
|
943
|
+
function ie(e) {
|
|
925
944
|
let { backup: t, busy: n, onCancel: r, onConfirm: i } = e;
|
|
926
945
|
return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { className: "modal-backdrop show" }), /* @__PURE__ */ p("div", {
|
|
927
946
|
className: "modal show d-block",
|
|
@@ -987,12 +1006,12 @@ function te(e) {
|
|
|
987
1006
|
})
|
|
988
1007
|
})] });
|
|
989
1008
|
}
|
|
990
|
-
function
|
|
1009
|
+
function K(e) {
|
|
991
1010
|
return e instanceof Error ? e.message : String(e);
|
|
992
1011
|
}
|
|
993
1012
|
//#endregion
|
|
994
1013
|
//#region src/components/CreateBackupTab.tsx
|
|
995
|
-
function
|
|
1014
|
+
function q() {
|
|
996
1015
|
let e = k(), t = T(), n = E(t.data?.configured), [r, a] = o(!0), [s, c] = o({
|
|
997
1016
|
format: "plain",
|
|
998
1017
|
includeData: !0,
|
|
@@ -1001,7 +1020,7 @@ function J() {
|
|
|
1001
1020
|
includeIndexes: !0,
|
|
1002
1021
|
includeConstraints: !0,
|
|
1003
1022
|
includeRelatedTables: !1
|
|
1004
|
-
}), [l, u] = o(() => /* @__PURE__ */ new Set()), [d, f] = o(null), [h, g] = o({}), [_, v] = o(""), y = D(d, t.data?.configured), b = i(() => new Set((t.data?.exportExcludedTables ?? []).map(
|
|
1023
|
+
}), [l, u] = o(() => /* @__PURE__ */ new Set()), [d, f] = o(null), [h, g] = o({}), [_, v] = o(""), y = D(d, t.data?.configured), b = i(() => new Set((t.data?.exportExcludedTables ?? []).map(oe)), [t.data?.exportExcludedTables]), x = i(() => {
|
|
1005
1024
|
let e = n.data ?? [], t = _.trim().toLowerCase();
|
|
1006
1025
|
return t ? e.filter((e) => e.fullName.toLowerCase().includes(t)) : e;
|
|
1007
1026
|
}, [n.data, _]), S = i(() => Object.values(h).reduce((e, t) => e + t.length, 0), [h]), C = (e) => {
|
|
@@ -1042,7 +1061,7 @@ function J() {
|
|
|
1042
1061
|
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."
|
|
1043
1062
|
})]
|
|
1044
1063
|
}),
|
|
1045
|
-
/* @__PURE__ */ p(
|
|
1064
|
+
/* @__PURE__ */ p(H, {
|
|
1046
1065
|
label: "Banco de destino",
|
|
1047
1066
|
dbInfo: t.data,
|
|
1048
1067
|
isLoading: t.isLoading,
|
|
@@ -1101,7 +1120,7 @@ function J() {
|
|
|
1101
1120
|
"aria-hidden": !0
|
|
1102
1121
|
}),
|
|
1103
1122
|
"Falha ao listar tabelas: ",
|
|
1104
|
-
|
|
1123
|
+
W(n.error)
|
|
1105
1124
|
]
|
|
1106
1125
|
}),
|
|
1107
1126
|
x.length === 0 && !n.isLoading && /* @__PURE__ */ p("div", {
|
|
@@ -1117,7 +1136,7 @@ function J() {
|
|
|
1117
1136
|
maxHeight: 420,
|
|
1118
1137
|
overflow: "auto"
|
|
1119
1138
|
},
|
|
1120
|
-
children: x.map((e) => /* @__PURE__ */ p(
|
|
1139
|
+
children: x.map((e) => /* @__PURE__ */ p(ae, {
|
|
1121
1140
|
table: e,
|
|
1122
1141
|
disabled: b.has(e.fullName),
|
|
1123
1142
|
selected: l.has(e.fullName),
|
|
@@ -1278,7 +1297,7 @@ function J() {
|
|
|
1278
1297
|
"aria-hidden": !0
|
|
1279
1298
|
}),
|
|
1280
1299
|
"Falha ao criar backup: ",
|
|
1281
|
-
|
|
1300
|
+
W(e.error)
|
|
1282
1301
|
]
|
|
1283
1302
|
}),
|
|
1284
1303
|
e.isSuccess && /* @__PURE__ */ m("div", {
|
|
@@ -1317,7 +1336,7 @@ function J() {
|
|
|
1317
1336
|
})
|
|
1318
1337
|
] });
|
|
1319
1338
|
}
|
|
1320
|
-
function
|
|
1339
|
+
function ae({ table: e, disabled: t, selected: n, expanded: r, excluded: i, detail: a, onToggleTable: o, onToggleExpand: s, onToggleColumn: c }) {
|
|
1321
1340
|
return /* @__PURE__ */ p("div", {
|
|
1322
1341
|
className: `card h-100 ${n ? "border-primary" : ""}`,
|
|
1323
1342
|
style: { minWidth: 0 },
|
|
@@ -1381,7 +1400,7 @@ function ne({ table: e, disabled: t, selected: n, expanded: r, excluded: i, deta
|
|
|
1381
1400
|
}),
|
|
1382
1401
|
a?.isError && /* @__PURE__ */ m("small", {
|
|
1383
1402
|
className: "text-danger",
|
|
1384
|
-
children: ["Erro: ",
|
|
1403
|
+
children: ["Erro: ", W(a.error)]
|
|
1385
1404
|
}),
|
|
1386
1405
|
a?.data && /* @__PURE__ */ m(f, { children: [a.data.columns.map((e) => /* @__PURE__ */ m("div", {
|
|
1387
1406
|
className: "d-flex align-items-center gap-2 py-1",
|
|
@@ -1432,13 +1451,13 @@ function ne({ table: e, disabled: t, selected: n, expanded: r, excluded: i, deta
|
|
|
1432
1451
|
})
|
|
1433
1452
|
});
|
|
1434
1453
|
}
|
|
1435
|
-
function
|
|
1454
|
+
function oe(e) {
|
|
1436
1455
|
let t = e.trim();
|
|
1437
1456
|
return t.includes(".") ? t : `public.${t}`;
|
|
1438
1457
|
}
|
|
1439
1458
|
//#endregion
|
|
1440
1459
|
//#region src/components/DiagnosticsTab.tsx
|
|
1441
|
-
function
|
|
1460
|
+
function J() {
|
|
1442
1461
|
let { data: e, isLoading: t, isError: n, error: r, refetch: a, isFetching: o } = C(), s = i(() => e ? {
|
|
1443
1462
|
total: e.length,
|
|
1444
1463
|
okCount: e.filter((e) => e.ok).length,
|
|
@@ -1479,7 +1498,7 @@ function Y() {
|
|
|
1479
1498
|
"aria-hidden": !0
|
|
1480
1499
|
}),
|
|
1481
1500
|
"Não foi possível executar as checagens: ",
|
|
1482
|
-
|
|
1501
|
+
W(r)
|
|
1483
1502
|
]
|
|
1484
1503
|
}),
|
|
1485
1504
|
s && /* @__PURE__ */ m("div", {
|
|
@@ -1516,7 +1535,7 @@ function Y() {
|
|
|
1516
1535
|
className: "card",
|
|
1517
1536
|
children: /* @__PURE__ */ m("ul", {
|
|
1518
1537
|
className: "list-group list-group-flush",
|
|
1519
|
-
children: [(e ?? []).map((e) => /* @__PURE__ */ p(
|
|
1538
|
+
children: [(e ?? []).map((e) => /* @__PURE__ */ p(se, { check: e }, e.name)), e && e.length === 0 && /* @__PURE__ */ p("li", {
|
|
1520
1539
|
className: "list-group-item text-center text-muted py-4",
|
|
1521
1540
|
children: "Nenhuma checagem retornada."
|
|
1522
1541
|
})]
|
|
@@ -1524,7 +1543,7 @@ function Y() {
|
|
|
1524
1543
|
})
|
|
1525
1544
|
] });
|
|
1526
1545
|
}
|
|
1527
|
-
function
|
|
1546
|
+
function se({ check: e }) {
|
|
1528
1547
|
let t = e.configured ? e.ok ? "bi-check-circle-fill text-success" : "bi-x-octagon-fill text-danger" : "bi-dash-circle text-secondary", n = e.configured ? e.ok ? "text-bg-success" : "text-bg-danger" : "text-bg-secondary", r = e.configured ? e.ok ? "OK" : "Falha" : "Não configurado";
|
|
1529
1548
|
return /* @__PURE__ */ m("li", {
|
|
1530
1549
|
className: "list-group-item d-flex align-items-start gap-3",
|
|
@@ -1560,7 +1579,7 @@ function ie({ check: e }) {
|
|
|
1560
1579
|
}
|
|
1561
1580
|
//#endregion
|
|
1562
1581
|
//#region src/components/StorageExplorerTab.tsx
|
|
1563
|
-
function
|
|
1582
|
+
function Y({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
1564
1583
|
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({
|
|
1565
1584
|
queryKey: [
|
|
1566
1585
|
"storage-files",
|
|
@@ -1597,7 +1616,7 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1597
1616
|
} catch {}
|
|
1598
1617
|
}, N = async () => {
|
|
1599
1618
|
for (let e of v) await M(e);
|
|
1600
|
-
}, P = (e) => e ?
|
|
1619
|
+
}, P = (e) => e ? L(e) : "-";
|
|
1601
1620
|
return /* @__PURE__ */ m("div", {
|
|
1602
1621
|
className: "space-y-3",
|
|
1603
1622
|
children: [
|
|
@@ -1727,7 +1746,7 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1727
1746
|
}) }),
|
|
1728
1747
|
/* @__PURE__ */ p("td", {
|
|
1729
1748
|
className: "text-muted small",
|
|
1730
|
-
children: e.directory ? "-" :
|
|
1749
|
+
children: e.directory ? "-" : I(e.size)
|
|
1731
1750
|
}),
|
|
1732
1751
|
/* @__PURE__ */ p("td", {
|
|
1733
1752
|
className: "text-muted small",
|
|
@@ -1832,7 +1851,7 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1832
1851
|
}
|
|
1833
1852
|
//#endregion
|
|
1834
1853
|
//#region src/components/ImportDumpTab.tsx
|
|
1835
|
-
function
|
|
1854
|
+
function X() {
|
|
1836
1855
|
let e = P(), t = F(), n = T(), r = a(null), [i, s] = o("upload"), [c, l] = o(null), [u, d] = o(""), [f, h] = o(!1), g = () => {
|
|
1837
1856
|
i === "upload" && c ? e.mutate({ file: c }) : i === "storage" && u && t.mutate({
|
|
1838
1857
|
storageType: "LOCAL",
|
|
@@ -1955,7 +1974,7 @@ function Z() {
|
|
|
1955
1974
|
maxHeight: 350,
|
|
1956
1975
|
overflow: "auto"
|
|
1957
1976
|
},
|
|
1958
|
-
children: /* @__PURE__ */ p(
|
|
1977
|
+
children: /* @__PURE__ */ p(Y, {
|
|
1959
1978
|
storageType: "LOCAL",
|
|
1960
1979
|
storageConfig: {
|
|
1961
1980
|
type: "LOCAL",
|
|
@@ -1978,7 +1997,7 @@ function Z() {
|
|
|
1978
1997
|
children: [/* @__PURE__ */ p("p", {
|
|
1979
1998
|
className: "small text-body-secondary mb-3",
|
|
1980
1999
|
children: "O dump será aplicado no banco configurado no servidor. Tabelas bloqueadas por segurança são ignoradas automaticamente na importação."
|
|
1981
|
-
}), /* @__PURE__ */ p(
|
|
2000
|
+
}), /* @__PURE__ */ p(H, {
|
|
1982
2001
|
label: "Banco de destino",
|
|
1983
2002
|
dbInfo: n.data,
|
|
1984
2003
|
isLoading: n.isLoading,
|
|
@@ -1994,7 +2013,7 @@ function Z() {
|
|
|
1994
2013
|
"aria-hidden": !0
|
|
1995
2014
|
}),
|
|
1996
2015
|
"Falha na importacao: ",
|
|
1997
|
-
|
|
2016
|
+
W(y)
|
|
1998
2017
|
]
|
|
1999
2018
|
}),
|
|
2000
2019
|
v && /* @__PURE__ */ m("div", {
|
|
@@ -2036,7 +2055,7 @@ function Z() {
|
|
|
2036
2055
|
}
|
|
2037
2056
|
//#endregion
|
|
2038
2057
|
//#region src/components/StorageBackupTab.tsx
|
|
2039
|
-
function
|
|
2058
|
+
function Z() {
|
|
2040
2059
|
let e = k(), t = C(), n = t.data?.find((e) => e.name === "ORIGIN_STORAGE"), r = t.data?.find((e) => e.name === "OUTPUT_STORAGE"), i = e.isPending;
|
|
2041
2060
|
return /* @__PURE__ */ m("div", { children: [
|
|
2042
2061
|
/* @__PURE__ */ m("div", {
|
|
@@ -2079,12 +2098,12 @@ function Q() {
|
|
|
2079
2098
|
}),
|
|
2080
2099
|
t.data && /* @__PURE__ */ m("div", {
|
|
2081
2100
|
className: "d-flex flex-column gap-2",
|
|
2082
|
-
children: [/* @__PURE__ */ p(
|
|
2101
|
+
children: [/* @__PURE__ */ p(Q, {
|
|
2083
2102
|
label: n?.label ?? "Storage de origem",
|
|
2084
2103
|
configured: n?.configured,
|
|
2085
2104
|
ok: n?.ok,
|
|
2086
2105
|
message: n?.message
|
|
2087
|
-
}), /* @__PURE__ */ p(
|
|
2106
|
+
}), /* @__PURE__ */ p(Q, {
|
|
2088
2107
|
label: r?.label ?? "Storage de destino",
|
|
2089
2108
|
configured: r?.configured,
|
|
2090
2109
|
ok: r?.ok,
|
|
@@ -2102,7 +2121,7 @@ function Q() {
|
|
|
2102
2121
|
"aria-hidden": !0
|
|
2103
2122
|
}),
|
|
2104
2123
|
"Falha ao criar backup de storage: ",
|
|
2105
|
-
|
|
2124
|
+
W(e.error)
|
|
2106
2125
|
]
|
|
2107
2126
|
}),
|
|
2108
2127
|
e.isSuccess && /* @__PURE__ */ m("div", {
|
|
@@ -2143,7 +2162,7 @@ function Q() {
|
|
|
2143
2162
|
})
|
|
2144
2163
|
] });
|
|
2145
2164
|
}
|
|
2146
|
-
function
|
|
2165
|
+
function Q({ label: e, configured: t, ok: n, message: r }) {
|
|
2147
2166
|
return t === !1 ? /* @__PURE__ */ m("div", {
|
|
2148
2167
|
className: "d-flex align-items-center gap-2 small text-muted",
|
|
2149
2168
|
children: [/* @__PURE__ */ p("i", {
|
|
@@ -2164,13 +2183,13 @@ function $({ label: e, configured: t, ok: n, message: r }) {
|
|
|
2164
2183
|
}
|
|
2165
2184
|
//#endregion
|
|
2166
2185
|
//#region src/hooks/useAutoTheme.ts
|
|
2167
|
-
function
|
|
2186
|
+
function $() {
|
|
2168
2187
|
return typeof document < "u" && document.documentElement.classList.contains("dark");
|
|
2169
2188
|
}
|
|
2170
|
-
function
|
|
2171
|
-
let [t, n] = o(
|
|
2189
|
+
function ce(e) {
|
|
2190
|
+
let [t, n] = o($), [i, a] = o(() => typeof window < "u" && window.matchMedia?.("(prefers-color-scheme: dark)")?.matches === !0);
|
|
2172
2191
|
return r(() => {
|
|
2173
|
-
let e = document.documentElement, t = new MutationObserver(() => n(
|
|
2192
|
+
let e = document.documentElement, t = new MutationObserver(() => n($()));
|
|
2174
2193
|
return t.observe(e, {
|
|
2175
2194
|
attributes: !0,
|
|
2176
2195
|
attributeFilter: ["class"]
|
|
@@ -2183,8 +2202,8 @@ function oe(e) {
|
|
|
2183
2202
|
}
|
|
2184
2203
|
//#endregion
|
|
2185
2204
|
//#region src/components/MinivaultModule.tsx
|
|
2186
|
-
function
|
|
2187
|
-
let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l =
|
|
2205
|
+
function le(e) {
|
|
2206
|
+
let { companyAcronym: t = "Minivault", theme: n, refetchIntervalMs: r = 15e3, storageType: i = "LOCAL", ...a } = e, l = ce(n), [u] = o(() => new s({ defaultOptions: { queries: {
|
|
2188
2207
|
refetchInterval: r,
|
|
2189
2208
|
retry: 1
|
|
2190
2209
|
} } }));
|
|
@@ -2195,15 +2214,15 @@ function se(e) {
|
|
|
2195
2214
|
children: /* @__PURE__ */ m("div", {
|
|
2196
2215
|
className: "minivault-module h-full w-full overflow-auto",
|
|
2197
2216
|
"data-minivault-theme": l,
|
|
2198
|
-
children: [/* @__PURE__ */ p(
|
|
2217
|
+
children: [/* @__PURE__ */ p(ue, {
|
|
2199
2218
|
companyAcronym: t,
|
|
2200
2219
|
theme: l
|
|
2201
|
-
}), /* @__PURE__ */ p(
|
|
2220
|
+
}), /* @__PURE__ */ p(de, { storageType: i })]
|
|
2202
2221
|
})
|
|
2203
2222
|
})
|
|
2204
2223
|
});
|
|
2205
2224
|
}
|
|
2206
|
-
function
|
|
2225
|
+
function ue({ companyAcronym: e, theme: t }) {
|
|
2207
2226
|
return /* @__PURE__ */ m("div", {
|
|
2208
2227
|
className: "d-flex align-items-center justify-content-between flex-wrap gap-2 px-3 py-2 border-bottom",
|
|
2209
2228
|
style: {
|
|
@@ -2232,7 +2251,7 @@ function ce({ companyAcronym: e, theme: t }) {
|
|
|
2232
2251
|
})]
|
|
2233
2252
|
});
|
|
2234
2253
|
}
|
|
2235
|
-
function
|
|
2254
|
+
function de({ storageType: e }) {
|
|
2236
2255
|
let [t, n] = o("backups");
|
|
2237
2256
|
return /* @__PURE__ */ m("div", {
|
|
2238
2257
|
className: "p-3",
|
|
@@ -2314,23 +2333,23 @@ function le({ storageType: e }) {
|
|
|
2314
2333
|
})
|
|
2315
2334
|
]
|
|
2316
2335
|
}),
|
|
2317
|
-
t === "backups" && /* @__PURE__ */ p(
|
|
2318
|
-
t === "create" && /* @__PURE__ */ p(
|
|
2319
|
-
t === "createStorage" && /* @__PURE__ */ p(
|
|
2320
|
-
t === "import" && /* @__PURE__ */ p(
|
|
2321
|
-
t === "storage" && /* @__PURE__ */ p(
|
|
2322
|
-
t === "diagnostics" && /* @__PURE__ */ p(
|
|
2336
|
+
t === "backups" && /* @__PURE__ */ p(G, {}),
|
|
2337
|
+
t === "create" && /* @__PURE__ */ p(q, {}),
|
|
2338
|
+
t === "createStorage" && /* @__PURE__ */ p(Z, {}),
|
|
2339
|
+
t === "import" && /* @__PURE__ */ p(X, {}),
|
|
2340
|
+
t === "storage" && /* @__PURE__ */ p(Y, { storageType: e }),
|
|
2341
|
+
t === "diagnostics" && /* @__PURE__ */ p(J, {})
|
|
2323
2342
|
]
|
|
2324
2343
|
});
|
|
2325
2344
|
}
|
|
2326
2345
|
//#endregion
|
|
2327
2346
|
//#region src/components/CredentialsFields.tsx
|
|
2328
|
-
var
|
|
2347
|
+
var fe = [
|
|
2329
2348
|
"postgresql",
|
|
2330
2349
|
"mysql",
|
|
2331
2350
|
"sqlserver"
|
|
2332
2351
|
];
|
|
2333
|
-
function
|
|
2352
|
+
function pe() {
|
|
2334
2353
|
return {
|
|
2335
2354
|
host: "localhost",
|
|
2336
2355
|
port: 5432,
|
|
@@ -2340,19 +2359,19 @@ function de() {
|
|
|
2340
2359
|
databaseType: "postgresql"
|
|
2341
2360
|
};
|
|
2342
2361
|
}
|
|
2343
|
-
function
|
|
2362
|
+
function me(e) {
|
|
2344
2363
|
return e === "postgresql" || e === "postgres" ? 5432 : e === "mysql" ? 3306 : 1433;
|
|
2345
2364
|
}
|
|
2346
|
-
function
|
|
2365
|
+
function he({ value: e, onChange: t, onValidatedChange: n }) {
|
|
2347
2366
|
let r = {
|
|
2348
|
-
...
|
|
2367
|
+
...pe(),
|
|
2349
2368
|
...e
|
|
2350
2369
|
}, i = (e) => {
|
|
2351
2370
|
let n = {
|
|
2352
2371
|
...r,
|
|
2353
2372
|
databaseType: e
|
|
2354
2373
|
};
|
|
2355
|
-
(r.port ===
|
|
2374
|
+
(r.port === me(r.databaseType) || !r.port) && (n.port = me(e)), t(n);
|
|
2356
2375
|
}, a = (e) => {
|
|
2357
2376
|
let i = {
|
|
2358
2377
|
...r,
|
|
@@ -2374,9 +2393,9 @@ function pe({ value: e, onChange: t, onValidatedChange: n }) {
|
|
|
2374
2393
|
className: "form-select",
|
|
2375
2394
|
value: r.databaseType,
|
|
2376
2395
|
onChange: (e) => i(e.target.value),
|
|
2377
|
-
children:
|
|
2396
|
+
children: fe.map((e) => /* @__PURE__ */ p("option", {
|
|
2378
2397
|
value: e,
|
|
2379
|
-
children:
|
|
2398
|
+
children: B[e] ?? e
|
|
2380
2399
|
}, e))
|
|
2381
2400
|
})]
|
|
2382
2401
|
}),
|
|
@@ -2448,4 +2467,4 @@ function pe({ value: e, onChange: t, onValidatedChange: n }) {
|
|
|
2448
2467
|
});
|
|
2449
2468
|
}
|
|
2450
2469
|
//#endregion
|
|
2451
|
-
export {
|
|
2470
|
+
export { G as BackupsTab, q as CreateBackupTab, he as CredentialsFields, B as DATABASE_TYPE_LABELS, H as DatabaseBanner, J as DiagnosticsTab, X as ImportDumpTab, g as MinivaultApi, h as MinivaultApiError, y as MinivaultApiProvider, le as MinivaultModule, U as RestoreModal, z as STATUS_BADGE, R as STATUS_LABELS, V as StatusBadge, Z as StorageBackupTab, Y as StorageExplorerTab, L as formatDate, I as formatFileSize, w as useBackups, k as useCreateBackup, T as useDbInfo, O as useDbRelationships, D as useDbTableDetail, E as useDbTables, j as useDeleteBackup, C as useDiagnostics, N as useDownloadBackup, P as useImportDump, F as useImportFromStorage, b as useMinivaultApi, A as useRestoreBackup };
|
package/dist/utils/format.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { BackupStatus } from '../types/minivault';
|
|
1
|
+
import { BackupStatus, BackupType } from '../types/minivault';
|
|
2
2
|
export declare function formatFileSize(bytes: number | null | undefined): string;
|
|
3
3
|
export declare function formatDate(value: string | null | undefined): string;
|
|
4
4
|
export declare const STATUS_LABELS: Record<BackupStatus, string>;
|
|
5
5
|
export declare const STATUS_BADGE: Record<BackupStatus, string>;
|
|
6
6
|
export declare const DATABASE_TYPE_LABELS: Record<string, string>;
|
|
7
|
+
export declare const BACKUP_TYPE_LABELS: Record<BackupType, string>;
|
|
8
|
+
export declare const BACKUP_TYPE_BADGE: Record<BackupType, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v1ct0rbr/minivault-web",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|