feat(sidebar): persist custom pinned item ordering
This commit is contained in:
1 parent
b635ea1466
commit
406b7acdbb
16 files changed
+1019
-82
No files matched your search
@@ -1844,6 +1844,7 @@ async function confirmRenameObject() {
|
||||
const newName = renameObjectName.value.trim();
|
||||
if (!objectType || !newName || newName === node.label || !node.connectionId || !node.database) return;
|
||||
renameObjectError.value = "";
|
||||
let renameApplied = false;
|
||||
try {
|
||||
const dbType = databaseTypeForNode(node);
|
||||
await connectionStore.ensureConnected(node.connectionId);
|
||||
@@ -1871,10 +1872,18 @@ async function confirmRenameObject() {
|
||||
});
|
||||
await executeTreeNodeSqlWithProductionGuard(node, sql, { database: node.database, schema: node.schema });
|
||||
}
|
||||
renameApplied = true;
|
||||
toast(t("contextMenu.renameObjectSuccess", { oldName: node.label, newName }), 3000);
|
||||
showRenameObjectDialog.value = false;
|
||||
const renamedNode: TreeNode = { ...node, label: newName, objectName: newName, tableName: newName };
|
||||
await refreshTableList(node);
|
||||
connectionStore.replacePinnedTreeNode(node, renamedNode);
|
||||
} catch (e: any) {
|
||||
if (renameApplied) {
|
||||
// The database mutation succeeded even when metadata refresh did not;
|
||||
// remove the old pin instead of allowing it to revive later.
|
||||
connectionStore.removePinnedTreeNodes([node]);
|
||||
}
|
||||
renameObjectError.value = e?.message || String(e);
|
||||
}
|
||||
}
|
||||
@@ -1891,6 +1900,9 @@ async function confirmDropObject() {
|
||||
const msgKey = node.type === "view" ? "contextMenu.dropViewSuccess" : node.type === "materialized_view" ? "contextMenu.dropViewSuccess" : node.type === "procedure" ? "contextMenu.dropProcedureSuccess" : "contextMenu.dropFunctionSuccess";
|
||||
toast(t(msgKey, { name: node.label }), 3000);
|
||||
closeDroppedTableObjectTabsForNode(node);
|
||||
// Procedure/function drops refresh their parent instead of removing this
|
||||
// node directly, so clear their pin before the old identity can survive.
|
||||
connectionStore.removePinnedTreeNodes([node]);
|
||||
if (node.type === "view" || node.type === "materialized_view") {
|
||||
connectionStore.removeTreeNode(node.id);
|
||||
releaseActiveNodeReference([node.id]);
|
||||
|
||||
Reference in new issue
Block a user