@v1ct0rbr/minivault-web 0.4.2 → 0.4.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 +94 -72
- package/package.json +1 -1
package/dist/minivault-web.js
CHANGED
|
@@ -849,7 +849,7 @@ function K() {
|
|
|
849
849
|
busy: b.isPending,
|
|
850
850
|
onCancel: () => c(null),
|
|
851
851
|
onConfirm: () => {
|
|
852
|
-
b.mutate(s.id
|
|
852
|
+
b.mutate(s.id, { onSettled: () => c(null) });
|
|
853
853
|
}
|
|
854
854
|
})
|
|
855
855
|
] });
|
|
@@ -1535,43 +1535,43 @@ function te(e) {
|
|
|
1535
1535
|
//#endregion
|
|
1536
1536
|
//#region src/components/StorageExplorerTab.tsx
|
|
1537
1537
|
function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
1538
|
-
let i = b(),
|
|
1538
|
+
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({
|
|
1539
1539
|
queryKey: [
|
|
1540
1540
|
"storage-files",
|
|
1541
|
-
|
|
1542
|
-
|
|
1541
|
+
C,
|
|
1542
|
+
c,
|
|
1543
1543
|
n
|
|
1544
1544
|
],
|
|
1545
|
-
queryFn: () => i.listStorageFiles(
|
|
1546
|
-
}),
|
|
1547
|
-
mutationFn: (e) => i.deleteStorageFile(e,
|
|
1545
|
+
queryFn: () => i.listStorageFiles(C, c || void 0, n)
|
|
1546
|
+
}), E = l({
|
|
1547
|
+
mutationFn: (e) => i.deleteStorageFile(e, C, n),
|
|
1548
1548
|
onSuccess: () => {
|
|
1549
|
-
|
|
1549
|
+
s.invalidateQueries({ queryKey: ["storage-files"] }), S(null);
|
|
1550
1550
|
}
|
|
1551
|
-
}),
|
|
1552
|
-
|
|
1553
|
-
}, []),
|
|
1554
|
-
let t =
|
|
1555
|
-
|
|
1556
|
-
}, [
|
|
1551
|
+
}), D = a(!1), O = t((e) => {
|
|
1552
|
+
h(e), _(e ? e.split("/").filter(Boolean) : []), y(/* @__PURE__ */ new Set());
|
|
1553
|
+
}, []), k = t((e) => {
|
|
1554
|
+
let t = g.slice(0, e + 1).join("/");
|
|
1555
|
+
O(t);
|
|
1556
|
+
}, [g, O]);
|
|
1557
1557
|
r(() => {
|
|
1558
|
-
|
|
1559
|
-
}, [
|
|
1560
|
-
let
|
|
1561
|
-
|
|
1558
|
+
_(c ? c.split("/").filter(Boolean) : []);
|
|
1559
|
+
}, [c]);
|
|
1560
|
+
let A = (e) => {
|
|
1561
|
+
y((t) => {
|
|
1562
1562
|
let n = new Set(t);
|
|
1563
1563
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
1564
1564
|
});
|
|
1565
|
-
},
|
|
1566
|
-
|
|
1567
|
-
},
|
|
1565
|
+
}, j = () => {
|
|
1566
|
+
w && (v.size === w.length ? y(/* @__PURE__ */ new Set()) : y(new Set(w.map((e) => e.path))));
|
|
1567
|
+
}, M = async (e) => {
|
|
1568
1568
|
try {
|
|
1569
|
-
let t = await i.downloadStorageFile(e,
|
|
1569
|
+
let t = await i.downloadStorageFile(e, C, n), r = e.split("/").pop() ?? e, a = window.URL.createObjectURL(t), o = document.createElement("a");
|
|
1570
1570
|
o.href = a, o.download = r, document.body.appendChild(o), o.click(), o.remove(), window.URL.revokeObjectURL(a);
|
|
1571
1571
|
} catch {}
|
|
1572
|
-
},
|
|
1573
|
-
for (let e of
|
|
1574
|
-
},
|
|
1572
|
+
}, N = async () => {
|
|
1573
|
+
for (let e of v) await M(e);
|
|
1574
|
+
}, P = (e) => e ? R(e) : "-";
|
|
1575
1575
|
return /* @__PURE__ */ m("div", {
|
|
1576
1576
|
className: "space-y-3",
|
|
1577
1577
|
children: [
|
|
@@ -1584,27 +1584,27 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1584
1584
|
"Explorador de Storage",
|
|
1585
1585
|
/* @__PURE__ */ p("span", {
|
|
1586
1586
|
className: "badge bg-secondary ms-2",
|
|
1587
|
-
children:
|
|
1587
|
+
children: C
|
|
1588
1588
|
})
|
|
1589
1589
|
]
|
|
1590
1590
|
}), /* @__PURE__ */ p("div", {
|
|
1591
1591
|
className: "d-flex gap-2",
|
|
1592
|
-
children:
|
|
1592
|
+
children: v.size > 0 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
|
|
1593
1593
|
className: "btn btn-sm btn-outline-primary",
|
|
1594
|
-
onClick:
|
|
1594
|
+
onClick: N,
|
|
1595
1595
|
children: [
|
|
1596
1596
|
/* @__PURE__ */ p("i", { className: "bi bi-download me-1" }),
|
|
1597
1597
|
"Baixar (",
|
|
1598
|
-
|
|
1598
|
+
v.size,
|
|
1599
1599
|
")"
|
|
1600
1600
|
]
|
|
1601
1601
|
}), /* @__PURE__ */ m("button", {
|
|
1602
1602
|
className: "btn btn-sm btn-outline-danger",
|
|
1603
|
-
onClick: () =>
|
|
1603
|
+
onClick: () => S("multiple"),
|
|
1604
1604
|
children: [
|
|
1605
1605
|
/* @__PURE__ */ p("i", { className: "bi bi-trash me-1" }),
|
|
1606
1606
|
"Excluir (",
|
|
1607
|
-
|
|
1607
|
+
v.size,
|
|
1608
1608
|
")"
|
|
1609
1609
|
]
|
|
1610
1610
|
})] })
|
|
@@ -1615,19 +1615,19 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1615
1615
|
children: /* @__PURE__ */ m("ol", {
|
|
1616
1616
|
className: "breadcrumb mb-0 small",
|
|
1617
1617
|
children: [/* @__PURE__ */ p("li", {
|
|
1618
|
-
className: `breadcrumb-item ${
|
|
1619
|
-
style: { cursor:
|
|
1620
|
-
onClick: () =>
|
|
1618
|
+
className: `breadcrumb-item ${g.length === 0 ? "active" : ""}`,
|
|
1619
|
+
style: { cursor: g.length > 0 ? "pointer" : "default" },
|
|
1620
|
+
onClick: () => O(""),
|
|
1621
1621
|
children: /* @__PURE__ */ p("i", { className: "bi bi-house" })
|
|
1622
|
-
}),
|
|
1623
|
-
className: `breadcrumb-item ${t ===
|
|
1624
|
-
style: { cursor: t <
|
|
1625
|
-
onClick: () => t <
|
|
1622
|
+
}), g.map((e, t) => /* @__PURE__ */ p("li", {
|
|
1623
|
+
className: `breadcrumb-item ${t === g.length - 1 ? "active" : ""}`,
|
|
1624
|
+
style: { cursor: t < g.length - 1 ? "pointer" : "default" },
|
|
1625
|
+
onClick: () => t < g.length - 1 && k(t),
|
|
1626
1626
|
children: e
|
|
1627
1627
|
}, t))]
|
|
1628
1628
|
})
|
|
1629
1629
|
}),
|
|
1630
|
-
|
|
1630
|
+
T ? /* @__PURE__ */ m("div", {
|
|
1631
1631
|
className: "text-center py-5",
|
|
1632
1632
|
children: [/* @__PURE__ */ p("div", {
|
|
1633
1633
|
className: "spinner-border text-primary",
|
|
@@ -1636,14 +1636,14 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1636
1636
|
className: "mt-2 small text-muted",
|
|
1637
1637
|
children: "Carregando arquivos..."
|
|
1638
1638
|
})]
|
|
1639
|
-
}) : !
|
|
1639
|
+
}) : !w || w.length === 0 ? /* @__PURE__ */ m("div", {
|
|
1640
1640
|
className: "text-center py-5 text-muted",
|
|
1641
1641
|
children: [
|
|
1642
1642
|
/* @__PURE__ */ p("i", { className: "bi bi-folder-x fs-1 d-block mb-2" }),
|
|
1643
1643
|
"Nenhum arquivo encontrado",
|
|
1644
|
-
|
|
1644
|
+
c && /* @__PURE__ */ p("button", {
|
|
1645
1645
|
className: "btn btn-sm btn-link mt-2",
|
|
1646
|
-
onClick: () =>
|
|
1646
|
+
onClick: () => O(""),
|
|
1647
1647
|
children: "Voltar ao inicio"
|
|
1648
1648
|
})
|
|
1649
1649
|
]
|
|
@@ -1651,11 +1651,11 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1651
1651
|
className: "d-flex align-items-center gap-2 mb-2",
|
|
1652
1652
|
children: [/* @__PURE__ */ m("button", {
|
|
1653
1653
|
className: "btn btn-sm btn-outline-secondary",
|
|
1654
|
-
onClick:
|
|
1655
|
-
children: [
|
|
1654
|
+
onClick: j,
|
|
1655
|
+
children: [v.size === w.length ? "Desmarcar" : "Selecionar", " Todos"]
|
|
1656
1656
|
}), /* @__PURE__ */ m("span", {
|
|
1657
1657
|
className: "small text-muted",
|
|
1658
|
-
children: [
|
|
1658
|
+
children: [w.length, " item(ns)"]
|
|
1659
1659
|
})]
|
|
1660
1660
|
}), /* @__PURE__ */ p("div", {
|
|
1661
1661
|
className: "table-responsive",
|
|
@@ -1679,18 +1679,18 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1679
1679
|
children: "Acoes"
|
|
1680
1680
|
})
|
|
1681
1681
|
] })
|
|
1682
|
-
}), /* @__PURE__ */ p("tbody", { children:
|
|
1683
|
-
className:
|
|
1682
|
+
}), /* @__PURE__ */ p("tbody", { children: w.map((e) => /* @__PURE__ */ m("tr", {
|
|
1683
|
+
className: v.has(e.path) ? "table-active" : "",
|
|
1684
1684
|
children: [
|
|
1685
1685
|
/* @__PURE__ */ p("td", { children: /* @__PURE__ */ p("input", {
|
|
1686
1686
|
type: "checkbox",
|
|
1687
1687
|
className: "form-check-input",
|
|
1688
|
-
checked:
|
|
1689
|
-
onChange: () =>
|
|
1688
|
+
checked: v.has(e.path),
|
|
1689
|
+
onChange: () => A(e.path)
|
|
1690
1690
|
}) }),
|
|
1691
1691
|
/* @__PURE__ */ p("td", { children: e.directory ? /* @__PURE__ */ m("button", {
|
|
1692
1692
|
className: "btn btn-sm btn-link text-decoration-none p-0 text-start",
|
|
1693
|
-
onClick: () =>
|
|
1693
|
+
onClick: () => O(e.path),
|
|
1694
1694
|
children: [/* @__PURE__ */ p("i", { className: "bi bi-folder-fill text-warning me-2" }), /* @__PURE__ */ p("span", {
|
|
1695
1695
|
className: "font-monospace",
|
|
1696
1696
|
children: e.name
|
|
@@ -1705,19 +1705,19 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1705
1705
|
}),
|
|
1706
1706
|
/* @__PURE__ */ p("td", {
|
|
1707
1707
|
className: "text-muted small",
|
|
1708
|
-
children:
|
|
1708
|
+
children: P(e.lastModified)
|
|
1709
1709
|
}),
|
|
1710
1710
|
/* @__PURE__ */ p("td", { children: !e.directory && /* @__PURE__ */ m("div", {
|
|
1711
1711
|
className: "d-flex gap-1",
|
|
1712
1712
|
children: [/* @__PURE__ */ p("button", {
|
|
1713
1713
|
className: "btn btn-sm btn-outline-primary py-0",
|
|
1714
1714
|
title: "Baixar",
|
|
1715
|
-
onClick: () =>
|
|
1715
|
+
onClick: () => M(e.path),
|
|
1716
1716
|
children: /* @__PURE__ */ p("i", { className: "bi bi-download" })
|
|
1717
1717
|
}), /* @__PURE__ */ p("button", {
|
|
1718
1718
|
className: "btn btn-sm btn-outline-danger py-0",
|
|
1719
1719
|
title: "Excluir",
|
|
1720
|
-
onClick: () =>
|
|
1720
|
+
onClick: () => S(e.path),
|
|
1721
1721
|
children: /* @__PURE__ */ p("i", { className: "bi bi-trash" })
|
|
1722
1722
|
})]
|
|
1723
1723
|
}) })
|
|
@@ -1725,7 +1725,7 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1725
1725
|
}, e.path)) })]
|
|
1726
1726
|
})
|
|
1727
1727
|
})] }),
|
|
1728
|
-
|
|
1728
|
+
x && /* @__PURE__ */ p("div", {
|
|
1729
1729
|
className: "modal d-block",
|
|
1730
1730
|
tabIndex: -1,
|
|
1731
1731
|
style: { background: "rgba(0,0,0,.5)" },
|
|
@@ -1741,38 +1741,60 @@ function X({ storageType: e = "LOCAL", storageConfig: n }) {
|
|
|
1741
1741
|
children: "Confirmar exclusao"
|
|
1742
1742
|
}), /* @__PURE__ */ p("button", {
|
|
1743
1743
|
className: "btn-close",
|
|
1744
|
-
onClick: () =>
|
|
1744
|
+
onClick: () => S(null)
|
|
1745
1745
|
})]
|
|
1746
1746
|
}),
|
|
1747
1747
|
/* @__PURE__ */ m("div", {
|
|
1748
1748
|
className: "modal-body",
|
|
1749
|
-
children: [
|
|
1750
|
-
"
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1749
|
+
children: [
|
|
1750
|
+
x === "multiple" ? /* @__PURE__ */ m("p", { children: [
|
|
1751
|
+
"Excluir ",
|
|
1752
|
+
v.size,
|
|
1753
|
+
" arquivo(s) selecionado(s)?"
|
|
1754
|
+
] }) : /* @__PURE__ */ m("p", { children: [
|
|
1755
|
+
"Excluir ",
|
|
1756
|
+
/* @__PURE__ */ p("code", { children: x.split("/").pop() }),
|
|
1757
|
+
"?"
|
|
1758
|
+
] }),
|
|
1759
|
+
/* @__PURE__ */ p("p", {
|
|
1760
|
+
className: "text-danger small mb-0",
|
|
1761
|
+
children: "Esta acao nao pode ser desfeita."
|
|
1762
|
+
}),
|
|
1763
|
+
E.isError && /* @__PURE__ */ m("div", {
|
|
1764
|
+
className: "alert alert-danger small mt-2 mb-0 py-1",
|
|
1765
|
+
children: [
|
|
1766
|
+
/* @__PURE__ */ p("i", {
|
|
1767
|
+
className: "bi bi-exclamation-triangle me-1",
|
|
1768
|
+
"aria-hidden": !0
|
|
1769
|
+
}),
|
|
1770
|
+
"Falha ao excluir:",
|
|
1771
|
+
" ",
|
|
1772
|
+
E.error instanceof Error ? E.error.message : String(E.error)
|
|
1773
|
+
]
|
|
1774
|
+
})
|
|
1775
|
+
]
|
|
1761
1776
|
}),
|
|
1762
1777
|
/* @__PURE__ */ m("div", {
|
|
1763
1778
|
className: "modal-footer",
|
|
1764
1779
|
children: [/* @__PURE__ */ p("button", {
|
|
1765
1780
|
className: "btn btn-sm btn-secondary",
|
|
1766
|
-
onClick: () =>
|
|
1781
|
+
onClick: () => S(null),
|
|
1767
1782
|
children: "Cancelar"
|
|
1768
1783
|
}), /* @__PURE__ */ p("button", {
|
|
1769
1784
|
className: "btn btn-sm btn-danger",
|
|
1770
|
-
disabled:
|
|
1785
|
+
disabled: E.isPending,
|
|
1771
1786
|
onClick: async () => {
|
|
1772
|
-
if (
|
|
1773
|
-
|
|
1787
|
+
if (!D.current) {
|
|
1788
|
+
D.current = !0;
|
|
1789
|
+
try {
|
|
1790
|
+
if (x === "multiple") for (let e of v) await E.mutateAsync(e);
|
|
1791
|
+
else await E.mutateAsync(x);
|
|
1792
|
+
} finally {
|
|
1793
|
+
D.current = !1;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1774
1796
|
},
|
|
1775
|
-
children:
|
|
1797
|
+
children: E.isPending ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", { className: "spinner-border spinner-border-sm me-1" }), "Excluindo..."] }) : "Excluir"
|
|
1776
1798
|
})]
|
|
1777
1799
|
})
|
|
1778
1800
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v1ct0rbr/minivault-web",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.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",
|