Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

feat(sidebar): add toggle for users and permissions entries (#13054)

二丫讲梵c44388bbd6e0
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
index 6916fac0a6..88ab03524c 100644
--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue
+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue
@@ -1017,6 +1017,7 @@ const editRedisDatabaseDisplayLimit = ref(settingsStore.editorSettings.redisData
const editSidebarObjectInfoMode = ref<SidebarObjectInfoMode>(settingsStore.editorSettings.sidebarObjectInfoMode);
const editSidebarAllowHorizontalScroll = ref(settingsStore.editorSettings.sidebarAllowHorizontalScroll);
const editSidebarShowTooltips = ref(settingsStore.editorSettings.sidebarShowTooltips);
+const editSidebarShowUserAdmin = ref(settingsStore.editorSettings.sidebarShowUserAdmin);
const editSidebarIndent = ref(settingsStore.editorSettings.sidebarIndent);
const editSidebarFontSize = ref(settingsStore.editorSettings.sidebarFontSize);
const editSidebarDensity = ref<SidebarDensity>(settingsStore.editorSettings.sidebarDensity);
@@ -1311,6 +1312,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft {
sidebarObjectInfoMode: editSidebarObjectInfoMode.value,
sidebarAllowHorizontalScroll: editSidebarAllowHorizontalScroll.value,
sidebarShowTooltips: editSidebarShowTooltips.value,
+ sidebarShowUserAdmin: editSidebarShowUserAdmin.value,
sidebarIndent: editSidebarIndent.value,
sidebarFontSize: editSidebarFontSize.value,
sidebarDensity: editSidebarDensity.value,
@@ -2015,6 +2017,7 @@ function syncEditorSettingsDraftFromStore() {
editSidebarObjectInfoMode.value = settingsStore.editorSettings.sidebarObjectInfoMode;
editSidebarAllowHorizontalScroll.value = settingsStore.editorSettings.sidebarAllowHorizontalScroll;
editSidebarShowTooltips.value = settingsStore.editorSettings.sidebarShowTooltips;
+ editSidebarShowUserAdmin.value = settingsStore.editorSettings.sidebarShowUserAdmin;
editSidebarIndent.value = settingsStore.editorSettings.sidebarIndent;
editSidebarFontSize.value = settingsStore.editorSettings.sidebarFontSize;
editSidebarDensity.value = settingsStore.editorSettings.sidebarDensity;
@@ -2181,6 +2184,7 @@ const editorSettingsDraftRefs: EditorSettingsDraftRefMap = {
sidebarObjectInfoMode: editSidebarObjectInfoMode,
sidebarAllowHorizontalScroll: editSidebarAllowHorizontalScroll,
sidebarShowTooltips: editSidebarShowTooltips,
+ sidebarShowUserAdmin: editSidebarShowUserAdmin,
sidebarIndent: editSidebarIndent,
sidebarFontSize: editSidebarFontSize,
sidebarDensity: editSidebarDensity,
@@ -2751,6 +2755,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
editSidebarObjectInfoMode.value = DEFAULT_EDITOR_SETTINGS.sidebarObjectInfoMode;
editSidebarAllowHorizontalScroll.value = DEFAULT_EDITOR_SETTINGS.sidebarAllowHorizontalScroll;
editSidebarShowTooltips.value = DEFAULT_EDITOR_SETTINGS.sidebarShowTooltips;
+ editSidebarShowUserAdmin.value = DEFAULT_EDITOR_SETTINGS.sidebarShowUserAdmin;
editSidebarIndent.value = DEFAULT_EDITOR_SETTINGS.sidebarIndent;
editSidebarFontSize.value = DEFAULT_EDITOR_SETTINGS.sidebarFontSize;
editSidebarDensity.value = DEFAULT_EDITOR_SETTINGS.sidebarDensity;
@@ -2975,6 +2980,7 @@ function resetAllDefaults() {
editSidebarObjectInfoMode.value = DEFAULT_EDITOR_SETTINGS.sidebarObjectInfoMode;
editSidebarAllowHorizontalScroll.value = DEFAULT_EDITOR_SETTINGS.sidebarAllowHorizontalScroll;
editSidebarShowTooltips.value = DEFAULT_EDITOR_SETTINGS.sidebarShowTooltips;
+ editSidebarShowUserAdmin.value = DEFAULT_EDITOR_SETTINGS.sidebarShowUserAdmin;
editSidebarIndent.value = DEFAULT_EDITOR_SETTINGS.sidebarIndent;
editSidebarFontSize.value = DEFAULT_EDITOR_SETTINGS.sidebarFontSize;
editSidebarDensity.value = DEFAULT_EDITOR_SETTINGS.sidebarDensity;
@@ -9318,6 +9324,17 @@ onUnmounted(() => {
</div>
<Switch id="sidebar-show-tooltips" v-model="editSidebarShowTooltips" />
</div>
+ <div class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
+ <div class="flex items-center gap-2">
+ <Label for="sidebar-show-user-admin">
+ {{ t("settings.sidebarShowUserAdmin") }}
+ </Label>
+ <HelpTooltip :label="t('settings.sidebarShowUserAdmin')">
+ {{ t("settings.sidebarShowUserAdminDescription") }}
+ </HelpTooltip>
+ </div>
+ <Switch id="sidebar-show-user-admin" v-model="editSidebarShowUserAdmin" />
+ </div>
<div class="settings-item flex items-center justify-between gap-4 rounded-md border bg-muted/20 px-3 py-2">
<div class="space-y-1">
<Label for="sidebar-indent">{{ t("settings.sidebarIndent") }}</Label>
diff --git a/apps/desktop/src/components/sidebar/ConnectionTree.vue b/apps/desktop/src/components/sidebar/ConnectionTree.vue
index fa42050f63..b543006b5b 100644
--- a/apps/desktop/src/components/sidebar/ConnectionTree.vue
+++ b/apps/desktop/src/components/sidebar/ConnectionTree.vue
@@ -42,6 +42,7 @@ import { copyToClipboard } from "@/lib/common/clipboard";
import { connectionPasteTargetGroupId, copySelectedConnectionsToClipboards, selectedConnectionDisconnectTargets, selectedConnectionEditTarget } from "@/lib/sidebar/sidebarConnectionSelection";
import { formatSidebarTableCopyText } from "@/lib/sidebar/sidebarTableNameCopy";
import { pruneTreeSelectionToVisibleNodeIds } from "@/lib/sidebar/sidebarTreeSelection";
+import { sidebarUserAdminVisibility } from "@/lib/sidebar/sidebarUserAdminVisibility";
import { isEditableSidebarTypeSearchTarget, sidebarTypeSearchNextQuery } from "@/lib/sidebar/sidebarTypeSearch";
import { isInternalDorisCatalog, usesTreeSchemaMode } from "@/lib/database/databaseFeatureSupport";
import { connectionObjectTreeNodeSchema, connectionShouldDiscoverJdbcSchemas, connectionUsesConnectionRootSchemaMode, connectionUsesDatabaseObjectTreeMode, effectiveDatabaseTypeForConnection } from "@/lib/database/jdbcDialect";
@@ -715,7 +716,8 @@ function restoreTableSearchInput(focusRestore: TableSearchFocusRestore) {
});
}
-const displayedTreeNodes = computed(() => sortConnectionListForDisplay(store.treeNodes, settingsStore.editorSettings.sidebarConnectionSortMode));
+const userAdminVisibility = computed(() => sidebarUserAdminVisibility(store.treeNodes, settingsStore.editorSettings.sidebarShowUserAdmin !== false));
+const displayedTreeNodes = computed(() => sortConnectionListForDisplay(userAdminVisibility.value.nodes, settingsStore.editorSettings.sidebarConnectionSortMode));
const localTableSearchResults = ref<Record<string, TableInfo[] | null>>({});
const localTableSearchRequestRevisions = new Map<string, number>();
type InvalidatedTableSearchScope = SidebarRegexScopeIdentity & { parentNodeId: string };
@@ -1085,6 +1087,26 @@ watch(useVirtualTree, (virtual, wasVirtual) => {
const activeTab = computed(() => queryStore.tabs.find((tab) => tab.id === queryStore.activeTabId));
const hasTreeMultiSelection = computed(() => store.connectionMultiSelectActive || store.selectedTreeNodeIds.length > 1);
+watch(
+ () => [userAdminVisibility.value.hiddenNodeIds, store.selectedTreeNodeId, store.treeSelectionAnchorId, [...store.selectedTreeNodeIds]] as const,
+ ([hiddenNodeIds]) => {
+ if (!hiddenNodeIds.size) return;
+ const next = pruneTreeSelectionToVisibleNodeIds(
+ { has: (id) => !hiddenNodeIds.has(id) },
+ {
+ nodeIds: store.selectedTreeNodeIds,
+ activeNodeId: store.selectedTreeNodeId,
+ anchorNodeId: store.treeSelectionAnchorId,
+ },
+ );
+ if (next.nodeIds.length !== store.selectedTreeNodeIds.length) store.selectedTreeNodeIds = [...next.nodeIds];
+ if (next.activeNodeId !== store.selectedTreeNodeId) store.selectedTreeNodeId = next.activeNodeId;
+ if (next.anchorNodeId !== store.treeSelectionAnchorId) store.treeSelectionAnchorId = next.anchorNodeId;
+ if (!next.nodeIds.length) store.connectionMultiSelectActive = false;
+ },
+ { flush: "post", immediate: true },
+);
+
watch(
() => (hasTreeMultiSelection.value ? flatTreeIndex.value.nodeById : null),
(visibleNodeIds) => {
diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.ts
index 22c96299a8..0458123e04 100644
--- a/apps/desktop/src/i18n/locales/az.ts
+++ b/apps/desktop/src/i18n/locales/az.ts
@@ -7885,6 +7885,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "Yan paneldə üfüqi sürüşdürməyə icazə verərək uzun cədvəl, görünüş və kolleksiya adlarını tam göstər.",
sidebarShowTooltips: "Yan paneldə kursor üzərinə gətirildikdə ipucları",
sidebarShowTooltipsDescription: "Kursor yan paneldəki əlaqələrin və verilənlər bazası obyektlərinin üzərinə gətirildikdə ətraflı ipucları göstər. Bu pəncərələri dayandırmaq üçün söndürün.",
+ sidebarShowUserAdmin: "İstifadəçi və icazə bölmələrini göstər",
+ sidebarShowUserAdminDescription: "Xugu daxil olmaqla, yan panel ağacında istifadəçi və icazə bölmələrini göstərir. Yalnız ağacın görünüşünə təsir edir; mövcud kontekst menyusu bölmələri dəyişmir.",
sidebarIndent: "Yan panel abzası",
sidebarIndentDescription: "Ağacın hər dərinlik səviyyəsi üçün əlavə olunan üfüqi məsafə, piksellə.",
sidebarFontSize: "Yan panel şriftinin ölçüsü",
diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.ts
index 13a2626990..0691c7b4ce 100644
--- a/apps/desktop/src/i18n/locales/en.ts
+++ b/apps/desktop/src/i18n/locales/en.ts
@@ -9554,6 +9554,8 @@ export default {
sidebarAllowHorizontalScrollDescription: "Show long table, view, and collection names in full by allowing horizontal sidebar scrolling.",
sidebarShowTooltips: "Sidebar hover tooltips",
sidebarShowTooltipsDescription: "Show detail tooltips when hovering connections and database objects in the sidebar. Turn off to stop hover popups.",
+ sidebarShowUserAdmin: "Show users and permissions entries",
+ sidebarShowUserAdminDescription: "Show users and permissions entries in the sidebar tree, including Xugu. This only affects tree visibility; existing context menu entries are unchanged.",
sidebarIndent: "Sidebar indentation",
sidebarIndentDescription: "Horizontal offset added per tree depth level, in pixels.",
sidebarFontSize: "Sidebar font size",
diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.ts
index 7ebfdebcd9..4e924db92b 100644
--- a/apps/desktop/src/i18n/locales/es.ts
+++ b/apps/desktop/src/i18n/locales/es.ts
@@ -8550,6 +8550,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "Muestra completos los nombres largos de tablas, vistas y colecciones permitiendo desplazamiento horizontal en la barra lateral.",
sidebarShowTooltips: "Sugerencias al pasar el cursor en la barra lateral",
sidebarShowTooltipsDescription: "Muestra sugerencias con detalles al pasar el cursor sobre conexiones y objetos de la base de datos en la barra lateral. Desactívalo para ocultarlas.",
+ sidebarShowUserAdmin: "Mostrar usuarios y permisos",
+ sidebarShowUserAdminDescription: "Muestra las entradas de usuarios y permisos en el árbol lateral, incluidas las de Xugu. Solo afecta a la visibilidad del árbol; no modifica las entradas existentes del menú contextual.",
snippetsDescription: "Personaliza plantillas SQL activadas en el editor.",
snippetTriggerKey: "Tecla de activación de fragmentos",
snippetTriggerKeyDescription: "Elija la tecla utilizada para activar la expansión de fragmentos en el editor (Tab, Espacio o Ambos).",
diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.ts
index dfed7a9142..88e8b3743e 100644
--- a/apps/desktop/src/i18n/locales/id.ts
+++ b/apps/desktop/src/i18n/locales/id.ts
@@ -8655,6 +8655,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "Tampilkan nama tabel, tampilan, dan koleksi yang panjang secara lengkap dengan mengizinkan gulir horizontal pada bilah sisi.",
sidebarShowTooltips: "Tooltip hover bilah sisi",
sidebarShowTooltipsDescription: "Tampilkan tooltip detail saat mengarahkan kursor ke koneksi dan objek database di bilah sisi. Nonaktifkan untuk menghentikan popup hover.",
+ sidebarShowUserAdmin: "Tampilkan pengguna dan izin",
+ sidebarShowUserAdminDescription: "Tampilkan entri pengguna dan izin di pohon bilah sisi, termasuk Xugu. Hanya memengaruhi tampilan pohon; entri menu konteks yang ada tidak berubah.",
sidebarIndent: "Indentasi bilah sisi",
sidebarIndentDescription: "Offset horizontal yang ditambahkan per tingkat kedalaman pohon, dalam piksel.",
sidebarFontSize: "Ukuran font bilah sisi",
diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.ts
index e935faaa07..75d7f5f69d 100644
--- a/apps/desktop/src/i18n/locales/it.ts
+++ b/apps/desktop/src/i18n/locales/it.ts
@@ -8329,6 +8329,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "Mostra i nomi lunghi di tabelle, viste e collezioni per intero consentendo lo scorrimento orizzontale della barra laterale.",
sidebarShowTooltips: "Tooltip al passaggio del mouse nella barra laterale",
sidebarShowTooltipsDescription: "Mostra tooltip con dettagli al passaggio del mouse su connessioni e oggetti del database nella barra laterale. Disattiva per nasconderli.",
+ sidebarShowUserAdmin: "Mostra utenti e permessi",
+ sidebarShowUserAdminDescription: "Mostra le voci utenti e permessi nell’albero laterale, incluse quelle di Xugu. Modifica solo la visibilità nell’albero; le voci esistenti del menu contestuale restano invariate.",
snippetsDescription: "Personalizza i modelli di snippet SQL attivati nell'editor.",
snippetTriggerKey: "Tasto di attivazione dello snippet",
snippetTriggerKeyDescription: "Scegli il tasto utilizzato per attivare l'espansione dello snippet nell'editor (Tab, Spazio o Entrambi).",
diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.ts
index 3b1ebe9790..408e8169b6 100644
--- a/apps/desktop/src/i18n/locales/ja.ts
+++ b/apps/desktop/src/i18n/locales/ja.ts
@@ -8341,6 +8341,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "サイドバーの横スクロールを許可して、長いテーブル、ビュー、コレクション名を完全に表示します。",
sidebarShowTooltips: "サイドバーのホバーツールチップ",
sidebarShowTooltipsDescription: "サイドバーで接続やデータベースオブジェクトにホバーしたときに詳細ツールチップを表示します。オフにすると表示されません。",
+ sidebarShowUserAdmin: "ユーザーと権限の項目を表示",
+ sidebarShowUserAdminDescription: "サイドバーツリーにユーザーと権限の項目を表示します(Xugu を含む)。ツリーの表示のみが対象で、既存の右クリックメニューは変更されません。",
snippetsDescription: "エディターでトリガーされるSQLスニペットテンプレートをカスタマイズします。",
snippetTriggerKey: "スニペットトリガーキー",
snippetTriggerKeyDescription: "エディターでスニペットを展開するトリガーキーを設定します(Tab、スペース、または両方)。",
diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.ts
index 08ec61786d..e2dfb2393a 100644
--- a/apps/desktop/src/i18n/locales/ko.ts
+++ b/apps/desktop/src/i18n/locales/ko.ts
@@ -8289,6 +8289,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "사이드바 가로 스크롤을 허용하여 긴 테이블, 뷰, 컬렉션 이름을 전체로 표시합니다.",
sidebarShowTooltips: "사이드바 호버 툴팁",
sidebarShowTooltipsDescription: "사이드바에서 연결 및 데이터베이스 개체에 마우스를 올리면 상세 툴팁을 표시합니다. 끄면 표시되지 않습니다.",
+ sidebarShowUserAdmin: "사용자 및 권한 항목 표시",
+ sidebarShowUserAdminDescription: "사이드바 트리에 사용자 및 권한 항목을 표시합니다(Xugu 포함). 트리 표시만 변경하며 기존 컨텍스트 메뉴 항목에는 영향을 주지 않습니다.",
sidebarDensity: "사이드바 표시 밀도",
sidebarDensityDescription: "사이드바 탐색 트리의 행 높이 및 표시 밀도입니다.",
sidebarDensity_default: "기본",
diff --git a/apps/desktop/src/i18n/locales/pl.ts b/apps/desktop/src/i18n/locales/pl.ts
index f187bf3ab5..76511b886c 100644
--- a/apps/desktop/src/i18n/locales/pl.ts
+++ b/apps/desktop/src/i18n/locales/pl.ts
@@ -8726,6 +8726,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "Pokazuj długie nazwy tabel, widoków i kolekcji w całości, zezwalając na przewijanie w poziomie.",
sidebarShowTooltips: "Podpowiedzi na pasku bocznym",
sidebarShowTooltipsDescription: "Pokazuj dymki ze szczegółami po najechaniu na połączenia i obiekty bazy danych na pasku bocznym. Wyłącz, aby zatrzymać wyskakujące podpowiedzi.",
+ sidebarShowUserAdmin: "Pokaż użytkowników i uprawnienia",
+ sidebarShowUserAdminDescription: "Pokazuj pozycje użytkowników i uprawnień w drzewie panelu bocznego, w tym Xugu. Zmienia tylko widoczność w drzewie; istniejące pozycje menu kontekstowego pozostają bez zmian.",
sidebarIndent: "Wcięcie paska bocznego",
sidebarIndentDescription: "Poziome przesunięcie dodawane na każdy poziom głębokości drzewa, w pikselach.",
sidebarFontSize: "Rozmiar czcionki paska bocznego",
diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.ts
index 9ceb6d4daf..470666ba60 100644
--- a/apps/desktop/src/i18n/locales/pt-BR.ts
+++ b/apps/desktop/src/i18n/locales/pt-BR.ts
@@ -8328,6 +8328,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "Mostrar nomes longos de tabelas, views e coleções por completo, permitindo a rolagem horizontal da barra lateral.",
sidebarShowTooltips: "Dicas ao passar o mouse na barra lateral",
sidebarShowTooltipsDescription: "Mostra dicas com detalhes ao passar o mouse sobre conexões e objetos do banco de dados na barra lateral. Desative para ocultá-las.",
+ sidebarShowUserAdmin: "Mostrar usuários e permissões",
+ sidebarShowUserAdminDescription: "Mostra as entradas de usuários e permissões na árvore lateral, incluindo Xugu. Afeta apenas a visibilidade da árvore; as entradas existentes do menu de contexto não são alteradas.",
snippetsDescription: "Personalize os modelos de snippets SQL acionados no editor.",
snippetTriggerKey: "Tecla de ativação de snippets",
snippetTriggerKeyDescription: "Escolha a tecla usada para acionar a expansão de snippets no editor (Tab, Espaço ou Ambos).",
diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.ts
index f05d46df3e..03c9b3da66 100644
--- a/apps/desktop/src/i18n/locales/ru.ts
+++ b/apps/desktop/src/i18n/locales/ru.ts
@@ -9740,6 +9740,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "Показывать длинные имена таблиц, представлений и коллекций полностью, разрешив горизонтальную прокрутку боковой панели.",
sidebarShowTooltips: "Подсказки при наведении в боковой панели",
sidebarShowTooltipsDescription: "Показывать подробные подсказки при наведении на подключения и объекты базы данных в боковой панели. Отключите, чтобы убрать всплывающие подсказки.",
+ sidebarShowUserAdmin: "Показывать пользователей и права",
+ sidebarShowUserAdminDescription: "Показывать пункты пользователей и прав в дереве боковой панели, включая Xugu. Влияет только на отображение дерева; существующие пункты контекстного меню не изменяются.",
sidebarIndent: "Отступ боковой панели",
sidebarIndentDescription: "Горизонтальный отступ, добавляемый на каждый уровень глубины дерева, в пикселях.",
sidebarFontSize: "Размер шрифта боковой панели",
diff --git a/apps/desktop/src/i18n/locales/th.ts b/apps/desktop/src/i18n/locales/th.ts
index 898a2c364a..34dff75207 100644
--- a/apps/desktop/src/i18n/locales/th.ts
+++ b/apps/desktop/src/i18n/locales/th.ts
@@ -10189,6 +10189,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "แสดงชื่อตาราง View และ Collection แบบเต็ม โดยอนุญาตให้ Sidebar เลื่อนแนวนอน",
sidebarShowTooltips: "Tooltip เมื่อวางเหนือ Sidebar",
sidebarShowTooltipsDescription: "แสดง Tooltip รายละเอียดเมื่อวางเหนือการเชื่อมต่อและออบเจ็กต์ฐานข้อมูลใน Sidebar ปิดเพื่อหยุด Popup",
+ sidebarShowUserAdmin: "แสดงรายการผู้ใช้และสิทธิ์",
+ sidebarShowUserAdminDescription: "แสดงรายการผู้ใช้และสิทธิ์ในโครงสร้างแถบด้านข้าง รวมถึง Xugu มีผลเฉพาะการแสดงผลในโครงสร้าง โดยไม่เปลี่ยนแปลงรายการเมนูคลิกขวาที่มีอยู่",
sidebarIndent: "การเยื้อง Sidebar",
sidebarIndentDescription: "ระยะเยื้องแนวนอนที่เพิ่มในแต่ละระดับของ Tree หน่วยเป็นพิกเซล",
sidebarFontSize: "ขนาดฟอนต์ Sidebar",
diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.ts
index e699284619..82966a45ae 100644
--- a/apps/desktop/src/i18n/locales/tr.ts
+++ b/apps/desktop/src/i18n/locales/tr.ts
@@ -7783,6 +7783,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "Yatay kenar çubuğu kaydırmasına izin vererek uzun tablo, görünüm ve koleksiyon adlarını tam göster.",
sidebarShowTooltips: "Kenar çubuğu ipuçları",
sidebarShowTooltipsDescription: "Kenar çubuğunda bağlantıların ve veritabanı nesnelerinin üzerine gelindiğinde ayrıntı ipuçlarını göster. Açılır ipuçlarını durdurmak için kapatın.",
+ sidebarShowUserAdmin: "Kullanıcı ve izin girişlerini göster",
+ sidebarShowUserAdminDescription: "Xugu dahil, kenar çubuğu ağacında kullanıcı ve izin girişlerini gösterir. Yalnızca ağaç görünürlüğünü etkiler; mevcut bağlam menüsü girişleri değişmez.",
sidebarIndent: "Kenar çubuğu girintisi",
sidebarIndentDescription: "Ağaç derinliğinin her düzeyi için piksel cinsinden eklenen yatay kaydırma.",
sidebarFontSize: "Kenar çubuğu yazı tipi boyutu",
diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.ts
index 942946a946..dd2b87ed0d 100644
--- a/apps/desktop/src/i18n/locales/zh-CN.ts
+++ b/apps/desktop/src/i18n/locales/zh-CN.ts
@@ -9521,6 +9521,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "完整显示较长的表、视图和集合名称;默认关闭以保留省略号截断。",
sidebarShowTooltips: "侧边栏悬浮提示",
sidebarShowTooltipsDescription: "在侧边栏的连接和数据库对象上悬浮时显示详情提示;关闭后悬浮不再弹出。",
+ sidebarShowUserAdmin: "显示用户与权限入口",
+ sidebarShowUserAdminDescription: "在侧边栏树中显示用户与权限入口(含虚谷)。仅影响树节点显示,不改变现有右键菜单入口。",
sidebarIndent: "侧边栏缩进",
sidebarIndentDescription: "每个树层级缩进的像素偏移量。",
sidebarFontSize: "侧边栏字体大小",
diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.ts
index 3e822f6d86..777350590c 100644
--- a/apps/desktop/src/i18n/locales/zh-TW.ts
+++ b/apps/desktop/src/i18n/locales/zh-TW.ts
@@ -7674,6 +7674,8 @@ export default withEnglishFallback({
sidebarAllowHorizontalScrollDescription: "透過啟用側邊欄的水平捲動功能,完整顯示長表格、檢視和集合的名稱",
sidebarShowTooltips: "側邊欄懸浮提示",
sidebarShowTooltipsDescription: "在側邊欄的連線與資料庫物件上懸浮時顯示詳細提示;關閉後懸浮不再彈出。",
+ sidebarShowUserAdmin: "顯示使用者與權限入口",
+ sidebarShowUserAdminDescription: "在側邊欄樹中顯示使用者與權限入口(含虛谷)。僅影響樹節點顯示,不變更現有右鍵選單入口。",
snippetsDescription: "自訂編輯器中觸發的 SQL 程式碼片段範本。",
snippetTriggerKey: "程式碼片段觸發鍵",
snippetTriggerKeyDescription: "設定在編輯器中觸發插入程式碼片段的按鍵(Tab、空格或兩者皆可)。",
diff --git a/apps/desktop/src/lib/settings/editorSettingsDraft.ts b/apps/desktop/src/lib/settings/editorSettingsDraft.ts
index 4176eb9690..fec426ffb3 100644
--- a/apps/desktop/src/lib/settings/editorSettingsDraft.ts
+++ b/apps/desktop/src/lib/settings/editorSettingsDraft.ts
@@ -142,6 +142,7 @@ export const EDITOR_SETTINGS_DRAFT_KEYS = [
"sidebarObjectInfoMode",
"sidebarAllowHorizontalScroll",
"sidebarShowTooltips",
+ "sidebarShowUserAdmin",
"sidebarIndent",
"sidebarFontSize",
"sidebarDensity",
diff --git a/apps/desktop/src/lib/settings/settingsSearch.ts b/apps/desktop/src/lib/settings/settingsSearch.ts
index 55fbb22298..c962eccec8 100644
--- a/apps/desktop/src/lib/settings/settingsSearch.ts
+++ b/apps/desktop/src/lib/settings/settingsSearch.ts
@@ -379,6 +379,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
},
{ id: "navigation-sidebar-scroll", category: "navigation", titleKey: "settings.sidebarAllowHorizontalScroll", descriptionKey: "settings.sidebarAllowHorizontalScrollDescription", targetId: "navigation" },
{ id: "navigation-sidebar-tooltips", category: "navigation", titleKey: "settings.sidebarShowTooltips", descriptionKey: "settings.sidebarShowTooltipsDescription", targetId: "navigation" },
+ { id: "navigation-sidebar-user-admin", category: "navigation", titleKey: "settings.sidebarShowUserAdmin", descriptionKey: "settings.sidebarShowUserAdminDescription", targetId: "navigation" },
{ id: "navigation-sidebar-indent", category: "navigation", titleKey: "settings.sidebarIndent", descriptionKey: "settings.sidebarIndentDescription", targetId: "navigation" },
{ id: "navigation-sidebar-font-size", category: "navigation", titleKey: "settings.sidebarFontSize", descriptionKey: "settings.sidebarFontSizeDescription", targetId: "navigation" },
{ id: "navigation-sidebar-density", category: "navigation", titleKey: "settings.sidebarDensity", descriptionKey: "settings.sidebarDensityDescription", targetId: "navigation" },
diff --git a/apps/desktop/src/lib/settings/settingsTransfer.ts b/apps/desktop/src/lib/settings/settingsTransfer.ts
index 32d6b6d736..fa407a49b4 100644
--- a/apps/desktop/src/lib/settings/settingsTransfer.ts
+++ b/apps/desktop/src/lib/settings/settingsTransfer.ts
@@ -148,6 +148,7 @@ const SETTINGS_TRANSFER_CATEGORY_KEYS: Record<SettingsTransferCategoryId, readon
"sidebarObjectInfoMode",
"sidebarAllowHorizontalScroll",
"sidebarShowTooltips",
+ "sidebarShowUserAdmin",
"sidebarIndent",
"sidebarFontSize",
"sidebarDensity",
@@ -325,6 +326,7 @@ const PASS_THROUGH_BOOLEAN_KEYS = [
"sidebarPinDefaultDatabase",
"sidebarAllowHorizontalScroll",
"sidebarShowTooltips",
+ "sidebarShowUserAdmin",
"updateNotificationsEnabled",
"autoDownloadUpdates",
"autoUpdateApp",
diff --git a/apps/desktop/src/lib/sidebar/sidebarUserAdminVisibility.ts b/apps/desktop/src/lib/sidebar/sidebarUserAdminVisibility.ts
new file mode 100644
index 0000000000..57f7bfc3dc
--- /dev/null
+++ b/apps/desktop/src/lib/sidebar/sidebarUserAdminVisibility.ts
@@ -0,0 +1,30 @@
+import type { TreeNode } from "@/types/database";
+
+export function sidebarUserAdminVisibility(nodes: TreeNode[], showUserAdmin: boolean): { nodes: TreeNode[]; hiddenNodeIds: ReadonlySet<string> } {
+ const hiddenNodeIds = new Set<string>();
+ if (showUserAdmin) return { nodes, hiddenNodeIds };
+
+ function filterNodes(source: TreeNode[]): TreeNode[] {
+ let changed = false;
+ const visible: TreeNode[] = [];
+ for (const node of source) {
+ if (node.type === "user-admin" || node.type === "xugu-user-admin") {
+ hiddenNodeIds.add(node.id);
+ changed = true;
+ continue;
+ }
+ const children = node.children ? filterNodes(node.children) : undefined;
+ const hiddenChildren = node.hiddenChildren ? filterNodes(node.hiddenChildren) : undefined;
+ if (children !== node.children || hiddenChildren !== node.hiddenChildren) {
+ visible.push({ ...node, children, hiddenChildren });
+ changed = true;
+ } else {
+ visible.push(node);
+ }
+ }
+ return changed ? visible : source;
+ }
+
+ // Preserve the live tree so showing the entries again requires no metadata reload.
+ return { nodes: filterNodes(nodes), hiddenNodeIds };
+}
diff --git a/apps/desktop/src/stores/settingsStore.ts b/apps/desktop/src/stores/settingsStore.ts
index b4fb9dc1a2..b821aad00c 100644
--- a/apps/desktop/src/stores/settingsStore.ts
+++ b/apps/desktop/src/stores/settingsStore.ts
@@ -1195,6 +1195,7 @@ export interface EditorSettings {
sidebarObjectInfoMode: SidebarObjectInfoMode;
sidebarShowConnectionNotes: boolean;
sidebarShowTooltips: boolean;
+ sidebarShowUserAdmin: boolean;
sidebarAllowHorizontalScroll: boolean;
sidebarIndent: number;
sidebarFontSize: number;
@@ -1544,6 +1545,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
sidebarObjectInfoMode: "comment-inline",
sidebarShowConnectionNotes: false,
sidebarShowTooltips: true,
+ sidebarShowUserAdmin: true,
sidebarAllowHorizontalScroll: false,
sidebarIndent: SIDEBAR_INDENT_DEFAULT,
sidebarFontSize: SIDEBAR_FONT_SIZE_DEFAULT,
@@ -2269,6 +2271,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
),
sidebarShowConnectionNotes: settings.sidebarShowConnectionNotes === true,
sidebarShowTooltips: settings.sidebarShowTooltips ?? DEFAULT_EDITOR_SETTINGS.sidebarShowTooltips,
+ sidebarShowUserAdmin: settings.sidebarShowUserAdmin ?? DEFAULT_EDITOR_SETTINGS.sidebarShowUserAdmin,
sidebarAllowHorizontalScroll: settings.sidebarAllowHorizontalScroll ?? DEFAULT_EDITOR_SETTINGS.sidebarAllowHorizontalScroll,
sidebarIndent: normalizeSidebarIndent(settings.sidebarIndent),
sidebarFontSize: normalizeSidebarFontSize(settings.sidebarFontSize),
@@ -3165,6 +3168,7 @@ export const useSettingsStore = defineStore("settings", () => {
if (partial.sidebarObjectInfoMode !== undefined) editorSettings.value.sidebarObjectInfoMode = normalizeSidebarObjectInfoMode(partial.sidebarObjectInfoMode);
if (partial.sidebarShowConnectionNotes !== undefined) editorSettings.value.sidebarShowConnectionNotes = partial.sidebarShowConnectionNotes === true;
if (partial.sidebarShowTooltips !== undefined) editorSettings.value.sidebarShowTooltips = partial.sidebarShowTooltips;
+ if (partial.sidebarShowUserAdmin !== undefined) editorSettings.value.sidebarShowUserAdmin = partial.sidebarShowUserAdmin;
if (partial.sidebarAllowHorizontalScroll !== undefined) editorSettings.value.sidebarAllowHorizontalScroll = partial.sidebarAllowHorizontalScroll;
if (partial.sidebarIndent !== undefined) editorSettings.value.sidebarIndent = normalizeSidebarIndent(partial.sidebarIndent);
if (partial.sidebarFontSize !== undefined) editorSettings.value.sidebarFontSize = normalizeSidebarFontSize(partial.sidebarFontSize);