mirror of
https://github.com/t8y2/dbx.git
synced 2026-11-02 08:30:35 +00:00
fix: disable native context menu and add sidebar refresh button (#159)
Prevent browser native "Reload" from resetting app state in Tauri, and add a refresh button to the sidebar header for convenience.
This commit is contained in:
@@ -800,6 +800,22 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
persistSidebarLayoutDebounced();
|
||||
}
|
||||
|
||||
function refreshAllTree() {
|
||||
const resetChildren = (nodes: TreeNode[]) => {
|
||||
for (const node of nodes) {
|
||||
if (node.type === "connection-group") {
|
||||
if (node.children) resetChildren(node.children);
|
||||
continue;
|
||||
}
|
||||
if (node.isExpanded) {
|
||||
node.isExpanded = false;
|
||||
node.children = [];
|
||||
}
|
||||
}
|
||||
};
|
||||
resetChildren(treeNodes.value);
|
||||
}
|
||||
|
||||
async function exportConnectionsToFile(passphrase: string) {
|
||||
const { encryptConfig } = await import("@/lib/configCrypto");
|
||||
const exportData = { connections: connections.value, layout: sidebarLayout.value };
|
||||
@@ -946,6 +962,7 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
connections,
|
||||
activeConnectionId,
|
||||
treeNodes,
|
||||
refreshAllTree,
|
||||
connectedIds,
|
||||
connectionErrors,
|
||||
setConnectionError,
|
||||
|
||||
Reference in New Issue
Block a user