feat(layout): allow configuring web logo position or hiding it
This commit is contained in:
1 parent
30e86367ca
commit
a90b00e77a
21 files changed
+182
-5
No files matched your search
@@ -115,6 +115,7 @@ import {
|
||||
normalizeMcpGlobalPolicy,
|
||||
type ClickTableNavigationTarget,
|
||||
type EditorSettings,
|
||||
type WebLogoPosition,
|
||||
type SnippetTriggerKey,
|
||||
type SqlCompletionTriggerMode,
|
||||
type SqlTableCompletionSchemaQualification,
|
||||
@@ -718,6 +719,7 @@ const editAppCloseUnsavedTabsMode = ref<AppCloseUnsavedTabsMode>(settingsStore.e
|
||||
const editSavedSqlOpenTargetMode = ref<SavedSqlOpenTargetMode>(settingsStore.editorSettings.savedSqlOpenTargetMode);
|
||||
const editWelcomePageMode = ref<WelcomePageMode>(settingsStore.editorSettings.welcomePageMode);
|
||||
const editAppLayout = ref(settingsStore.editorSettings.appLayout);
|
||||
const editWebLogoPosition = ref<WebLogoPosition>(settingsStore.editorSettings.webLogoPosition);
|
||||
const editTabLayout = ref(settingsStore.editorSettings.tabLayout);
|
||||
const editTabPlacement = ref<TabPlacement>(settingsStore.editorSettings.tabPlacement);
|
||||
const editColorizeConnectionTabs = ref(settingsStore.editorSettings.colorizeConnectionTabs);
|
||||
@@ -1097,6 +1099,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft {
|
||||
savedSqlOpenTargetMode: editSavedSqlOpenTargetMode.value,
|
||||
welcomePageMode: editWelcomePageMode.value,
|
||||
appLayout: editAppLayout.value,
|
||||
webLogoPosition: editWebLogoPosition.value,
|
||||
tabLayout: editTabLayout.value,
|
||||
tabPlacement: editTabPlacement.value,
|
||||
colorizeConnectionTabs: editColorizeConnectionTabs.value,
|
||||
@@ -1777,6 +1780,7 @@ function syncEditorSettingsDraftFromStore() {
|
||||
editSavedSqlOpenTargetMode.value = settingsStore.editorSettings.savedSqlOpenTargetMode;
|
||||
editWelcomePageMode.value = settingsStore.editorSettings.welcomePageMode;
|
||||
editAppLayout.value = settingsStore.editorSettings.appLayout;
|
||||
editWebLogoPosition.value = settingsStore.editorSettings.webLogoPosition;
|
||||
editTabLayout.value = settingsStore.editorSettings.tabLayout;
|
||||
editTabPlacement.value = settingsStore.editorSettings.tabPlacement;
|
||||
editColorizeConnectionTabs.value = settingsStore.editorSettings.colorizeConnectionTabs;
|
||||
@@ -1932,6 +1936,7 @@ const editorSettingsDraftRefs: EditorSettingsDraftRefMap = {
|
||||
savedSqlOpenTargetMode: editSavedSqlOpenTargetMode,
|
||||
welcomePageMode: editWelcomePageMode,
|
||||
appLayout: editAppLayout,
|
||||
webLogoPosition: editWebLogoPosition,
|
||||
tabLayout: editTabLayout,
|
||||
tabPlacement: editTabPlacement,
|
||||
colorizeConnectionTabs: editColorizeConnectionTabs,
|
||||
@@ -2484,6 +2489,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
|
||||
editActiveCustomThemeId.value = DEFAULT_EDITOR_SETTINGS.activeCustomThemeId;
|
||||
editWelcomePageMode.value = DEFAULT_EDITOR_SETTINGS.welcomePageMode;
|
||||
editAppLayout.value = DEFAULT_EDITOR_SETTINGS.appLayout;
|
||||
editWebLogoPosition.value = DEFAULT_EDITOR_SETTINGS.webLogoPosition;
|
||||
editTabLayout.value = DEFAULT_EDITOR_SETTINGS.tabLayout;
|
||||
editTabPlacement.value = DEFAULT_EDITOR_SETTINGS.tabPlacement;
|
||||
editColorizeConnectionTabs.value = DEFAULT_EDITOR_SETTINGS.colorizeConnectionTabs;
|
||||
@@ -2646,6 +2652,7 @@ function resetAllDefaults() {
|
||||
editSqlVariableSyntaxOverrides.value = normalizeSqlVariableSyntaxOverrides(DEFAULT_EDITOR_SETTINGS.sqlVariableSyntaxOverrides);
|
||||
editWelcomePageMode.value = DEFAULT_EDITOR_SETTINGS.welcomePageMode;
|
||||
editAppLayout.value = DEFAULT_EDITOR_SETTINGS.appLayout;
|
||||
editWebLogoPosition.value = DEFAULT_EDITOR_SETTINGS.webLogoPosition;
|
||||
editShowTrayIcon.value = DEFAULT_DESKTOP_SETTINGS.show_tray_icon;
|
||||
editQuitOnClose.value = DEFAULT_DESKTOP_SETTINGS.quit_on_close;
|
||||
desktopCloseBehaviorResetPending.value = true;
|
||||
@@ -7807,6 +7814,24 @@ onUnmounted(() => {
|
||||
<p>{{ t("settings.toolbarHiddenHint") }}</p>
|
||||
</HelpTooltip>
|
||||
</div>
|
||||
<div v-if="isWeb" data-settings-search-id="appearance-web-logo-position" :class="['settings-item flex items-center justify-between gap-4 rounded-md border border-border/60 p-3', settingsSearchTargetClass('appearance-web-logo-position')]">
|
||||
<div class="space-y-1">
|
||||
<Label for="web-logo-position">{{ t("settings.webLogoPosition") }}</Label>
|
||||
<p class="text-xs text-muted-foreground">
|
||||
{{ t("settings.webLogoPositionDescription") }}
|
||||
</p>
|
||||
</div>
|
||||
<Select :model-value="editWebLogoPosition" @update:model-value="editWebLogoPosition = $event as WebLogoPosition">
|
||||
<SelectTrigger id="web-logo-position" class="h-8 w-44 shrink-0">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="left">{{ t("settings.webLogoPositionLeft") }}</SelectItem>
|
||||
<SelectItem value="right">{{ t("settings.webLogoPositionRight") }}</SelectItem>
|
||||
<SelectItem value="hidden">{{ t("settings.webLogoPositionHidden") }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="settings-item flex items-center justify-between gap-4 rounded-md border border-border/60 p-3">
|
||||
<div class="space-y-1">
|
||||
<Label for="exclusive-right-sidebar-panels" class="text-sm cursor-pointer">{{ t("settings.exclusiveRightSidebarPanels") }}</Label>
|
||||
|
||||
@@ -88,6 +88,7 @@ const { toast } = useToast();
|
||||
|
||||
const settingsStore = useSettingsStore();
|
||||
const toolbarItems = computed(() => settingsStore.editorSettings.toolbarItems);
|
||||
const webLogoPosition = computed(() => settingsStore.editorSettings.webLogoPosition ?? "left");
|
||||
const showToolbarUpdateEntry = computed(() => toolbarItems.value.checkUpdates || props.hasUpdateAvailable);
|
||||
const { isMac, isDesktop, showControls, isMaximized, isFullscreen, isAlwaysOnTop, minimize, toggleMaximize, toggleAlwaysOnTop, close } = useWindowControls();
|
||||
// The always-on-top control is opt-in (外观 → 工具栏): the right side of the
|
||||
@@ -413,6 +414,11 @@ function handleWindowResize() {
|
||||
}
|
||||
|
||||
watch(collapsibleRightItemDefs, () => scheduleToolbarLayout(), { flush: "post" });
|
||||
watch(
|
||||
() => settingsStore.editorSettings.webLogoPosition,
|
||||
() => scheduleToolbarLayout(),
|
||||
{ flush: "post" },
|
||||
);
|
||||
watch(
|
||||
() => props.showSidebarExpand,
|
||||
() => scheduleToolbarLayout(),
|
||||
@@ -566,7 +572,7 @@ const toolbarStyle = computed(() => {
|
||||
<template>
|
||||
<div ref="toolbarEl" class="app-toolbar h-10 flex items-center gap-1 px-2 border-b bg-muted/30 shrink-0 overflow-hidden" :style="toolbarStyle" data-tauri-drag-region @dblclick="onToolbarDblClick">
|
||||
<a
|
||||
v-if="!isDesktop"
|
||||
v-if="!isDesktop && webLogoPosition === 'left'"
|
||||
href="https://dbxio.com"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
@@ -816,6 +822,19 @@ const toolbarStyle = computed(() => {
|
||||
</div>
|
||||
<!-- /rightWrapper -->
|
||||
|
||||
<a
|
||||
v-if="!isDesktop && webLogoPosition === 'right'"
|
||||
href="https://dbxio.com"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="flex items-center gap-1.5 h-8 px-2 rounded-md hover:bg-muted/60 transition-colors shrink-0 select-none focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||
title="DBX"
|
||||
data-testid="web-brand-logo"
|
||||
>
|
||||
<AppLogo class="h-5 w-5 rounded shrink-0 pointer-events-none" />
|
||||
<span class="font-bold text-xs tracking-tight text-foreground/90 translate-y-px">DBX</span>
|
||||
</a>
|
||||
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<Button variant="ghost" size="icon" class="toolbar-action-button relative h-8 w-8 shrink-0" :class="{ 'toolbar-action-button--active bg-accent': showSettingsPage }" @click="emit('open-settings')">
|
||||
|
||||
+52
-3
@@ -53,6 +53,7 @@ vi.mock("@/components/layout/ToolbarUpdateIcon.vue", () => ({
|
||||
default: { name: "ToolbarUpdateIconStub", template: `<span />` },
|
||||
}));
|
||||
|
||||
import { useSettingsStore } from "@/stores/settingsStore";
|
||||
import AppToolbar from "../AppToolbar.vue";
|
||||
|
||||
const defaultToolbarProps = {
|
||||
@@ -80,6 +81,7 @@ const defaultToolbarProps = {
|
||||
hasConnections: false,
|
||||
canNewQuery: false,
|
||||
hasSqlFileConnections: false,
|
||||
immediateSyncing: false,
|
||||
};
|
||||
|
||||
let pinia: ReturnType<typeof createPinia>;
|
||||
@@ -118,7 +120,7 @@ function mount(props: Record<string, unknown> = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
describe("AppToolbar web branding (#8703)", () => {
|
||||
describe("AppToolbar web branding (#8703, #11053)", () => {
|
||||
beforeEach(() => {
|
||||
document.body.innerHTML = "";
|
||||
mockIsTauriRuntime = false;
|
||||
@@ -130,7 +132,7 @@ describe("AppToolbar web branding (#8703)", () => {
|
||||
document.body.innerHTML = "";
|
||||
});
|
||||
|
||||
it("renders the DBX brand logo and title on web mode", async () => {
|
||||
it("renders the DBX brand logo and title on web mode on the left by default", async () => {
|
||||
mockIsTauriRuntime = false;
|
||||
const { host, unmount } = mount();
|
||||
await nextTick();
|
||||
@@ -146,11 +148,58 @@ describe("AppToolbar web branding (#8703)", () => {
|
||||
expect(logoImg).not.toBeNull();
|
||||
expect(logoImg?.getAttribute("alt")).toBe("DBX");
|
||||
|
||||
// Located at the very start of toolbar (left position)
|
||||
const toolbar = host.querySelector(".app-toolbar");
|
||||
expect(toolbar?.firstElementChild).toBe(brandEl);
|
||||
|
||||
unmount();
|
||||
});
|
||||
|
||||
it("does not render the web DBX brand logo in desktop mode", async () => {
|
||||
it("renders the DBX brand logo on the right when configured (#11053)", async () => {
|
||||
mockIsTauriRuntime = false;
|
||||
const settingsStore = useSettingsStore();
|
||||
settingsStore.updateEditorSettings({ webLogoPosition: "right" });
|
||||
|
||||
const { host, unmount } = mount();
|
||||
await nextTick();
|
||||
|
||||
const brandEl = host.querySelector('[data-testid="web-brand-logo"]');
|
||||
expect(brandEl).not.toBeNull();
|
||||
expect(brandEl?.textContent).toContain("DBX");
|
||||
|
||||
const toolbar = host.querySelector(".app-toolbar");
|
||||
const children = Array.from(toolbar?.children ?? []);
|
||||
const brandIndex = children.indexOf(brandEl as Element);
|
||||
|
||||
// Should not be the first child (it was moved from left to right)
|
||||
expect(brandIndex).toBeGreaterThan(0);
|
||||
|
||||
// Toolbar settings button should be after the brand logo
|
||||
const settingsBtn = host.querySelector('button[class*="toolbar-action-button"]');
|
||||
expect(settingsBtn).not.toBeNull();
|
||||
|
||||
unmount();
|
||||
});
|
||||
|
||||
it("does not render the brand logo when webLogoPosition is hidden (#11053)", async () => {
|
||||
mockIsTauriRuntime = false;
|
||||
const settingsStore = useSettingsStore();
|
||||
settingsStore.updateEditorSettings({ webLogoPosition: "hidden" });
|
||||
|
||||
const { host, unmount } = mount();
|
||||
await nextTick();
|
||||
|
||||
const brandEl = host.querySelector('[data-testid="web-brand-logo"]');
|
||||
expect(brandEl).toBeNull();
|
||||
|
||||
unmount();
|
||||
});
|
||||
|
||||
it("does not render the web DBX brand logo in desktop mode regardless of setting", async () => {
|
||||
mockIsTauriRuntime = true;
|
||||
const settingsStore = useSettingsStore();
|
||||
settingsStore.updateEditorSettings({ webLogoPosition: "right" });
|
||||
|
||||
const { host, unmount } = mount();
|
||||
await nextTick();
|
||||
|
||||
|
||||
@@ -7058,6 +7058,11 @@ export default withEnglishFallback({
|
||||
fontSize: "Şrift ölçüsü",
|
||||
toolbarTitle: "Alətlər paneli",
|
||||
toolbarHiddenHint: 'Bəzi gizli və ya yer çatmadığı üçün göstərilməyən düymələr "Daha çox" açılan menyusunda görünür.',
|
||||
webLogoPosition: "Veb Loqo Mövqeyi",
|
||||
webLogoPositionDescription: "Veb alətlər panelində DBX loqosunun mövqeyini dəyişdirin və ya sol tərəfdə yer açmaq üçün gizlədin.",
|
||||
webLogoPositionLeft: "Sol (Defolt)",
|
||||
webLogoPositionRight: "Sağ",
|
||||
webLogoPositionHidden: "Gizli",
|
||||
exclusiveRightSidebarPanels: "Sağ yan paneldə eyni anda bir panel göstər",
|
||||
exclusiveRightSidebarPanelsDescription: "Sağ yan paneldə bir panelin açılması digərlərini bağlayır. Bir neçə panelə icazə vermək üçün bunu deaktiv edin.",
|
||||
uiScale: "İnterfeys miqyası",
|
||||
|
||||
@@ -7938,6 +7938,11 @@ export default {
|
||||
fontSize: "Font Size",
|
||||
toolbarTitle: "Toolbar",
|
||||
toolbarHiddenHint: 'Some hidden or overflowed buttons appear in the "More" dropdown.',
|
||||
webLogoPosition: "Web Logo Position",
|
||||
webLogoPositionDescription: "Change where the DBX logo appears in the web toolbar, or hide it to free up space on the left.",
|
||||
webLogoPositionLeft: "Left (Default)",
|
||||
webLogoPositionRight: "Right",
|
||||
webLogoPositionHidden: "Hidden",
|
||||
exclusiveRightSidebarPanels: "Show one right sidebar panel at a time",
|
||||
exclusiveRightSidebarPanelsDescription: "Opening a right sidebar panel closes the others. Disable this to allow multiple panels.",
|
||||
uiScale: "UI Scale",
|
||||
|
||||
@@ -7274,6 +7274,11 @@ export default withEnglishFallback({
|
||||
fontSize: "Tamaño de fuente",
|
||||
toolbarTitle: "Barra de herramientas",
|
||||
toolbarHiddenHint: "Algunos botones ocultos o desbordados aparecerán en el menú «Más».",
|
||||
webLogoPosition: "Posición del logo en Web",
|
||||
webLogoPositionDescription: "Cambia la ubicación del logo de DBX en la barra de herramientas web o escóndelo para liberar espacio a la izquierda.",
|
||||
webLogoPositionLeft: "Izquierda (predeterminado)",
|
||||
webLogoPositionRight: "Derecha",
|
||||
webLogoPositionHidden: "Oculto",
|
||||
exclusiveRightSidebarPanels: "Mostrar un panel lateral derecho a la vez",
|
||||
exclusiveRightSidebarPanelsDescription: "Al abrir un panel lateral derecho se cierran los demás. Desactívalo para permitir varios paneles.",
|
||||
uiScale: "Escala de interfaz",
|
||||
|
||||
@@ -7720,6 +7720,11 @@ export default withEnglishFallback({
|
||||
fontSize: "Ukuran Font",
|
||||
toolbarTitle: "Bilah Alat",
|
||||
toolbarHiddenHint: 'Beberapa tombol yang tersembunyi atau meluap akan muncul di dropdown "Lainnya".',
|
||||
webLogoPosition: "Posisi Logo Web",
|
||||
webLogoPositionDescription: "Ubah posisi logo DBX di toolbar web, atau sembunyikan untuk mengosongkan ruang di sebelah kiri.",
|
||||
webLogoPositionLeft: "Kiri (Default)",
|
||||
webLogoPositionRight: "Kanan",
|
||||
webLogoPositionHidden: "Tersembunyi",
|
||||
exclusiveRightSidebarPanels: "Tampilkan satu panel bilah sisi kanan dalam satu waktu",
|
||||
exclusiveRightSidebarPanelsDescription: "Membuka panel bilah sisi kanan akan menutup panel lainnya. Nonaktifkan untuk mengizinkan beberapa panel sekaligus.",
|
||||
uiScale: "Skala UI",
|
||||
|
||||
@@ -7052,6 +7052,11 @@ export default withEnglishFallback({
|
||||
fontSize: "Dimensione Carattere",
|
||||
toolbarTitle: "Barra degli strumenti",
|
||||
toolbarHiddenHint: "Alcuni pulsanti nascosti o in eccesso appariranno nel menu «Altro».",
|
||||
webLogoPosition: "Posizione logo Web",
|
||||
webLogoPositionDescription: "Modifica la posizione del logo DBX nella barra degli strumenti web oppure nascondilo per liberare spazio a sinistra.",
|
||||
webLogoPositionLeft: "Sinistra (predefinito)",
|
||||
webLogoPositionRight: "Destra",
|
||||
webLogoPositionHidden: "Nascosto",
|
||||
exclusiveRightSidebarPanels: "Mostra un pannello laterale destro alla volta",
|
||||
exclusiveRightSidebarPanelsDescription: "L'apertura di un pannello laterale destro chiude gli altri. Disattiva per consentire più pannelli.",
|
||||
uiScale: "Scala UI",
|
||||
|
||||
@@ -7083,6 +7083,11 @@ export default withEnglishFallback({
|
||||
fontSize: "フォントサイズ",
|
||||
toolbarTitle: "ツールバー",
|
||||
toolbarHiddenHint: "非表示または幅が足りない一部のボタンは、「もっと見る」ドロップダウン内に表示されます。",
|
||||
webLogoPosition: "Web版ロゴの位置",
|
||||
webLogoPositionDescription: "上部ツールバーのDBXロゴの表示位置を変更するか、非表示にして左側の操作領域を広くします。",
|
||||
webLogoPositionLeft: "左側(デフォルト)",
|
||||
webLogoPositionRight: "右側",
|
||||
webLogoPositionHidden: "非表示",
|
||||
exclusiveRightSidebarPanels: "右サイドバーのパネルを一度に1つだけ表示",
|
||||
exclusiveRightSidebarPanelsDescription: "右サイドバーのパネルを開くと他のパネルを閉じます。複数表示するには無効にします。",
|
||||
uiScale: "UIスケール",
|
||||
|
||||
@@ -6858,6 +6858,11 @@ export default withEnglishFallback({
|
||||
fontSize: "글꼴 크기",
|
||||
toolbarTitle: "도구 모음",
|
||||
toolbarHiddenHint: '숨겨지거나 넘친 일부 버튼은 "더보기" 드롭다운에 나타납니다.',
|
||||
webLogoPosition: "웹 로고 위치",
|
||||
webLogoPositionDescription: "상단 툴바에서 DBX 로고의 표시 위치를 변경하거나 숨겨서 왼쪽 작업 영역을 확보합니다.",
|
||||
webLogoPositionLeft: "왼쪽 (기본값)",
|
||||
webLogoPositionRight: "오른쪽",
|
||||
webLogoPositionHidden: "숨김",
|
||||
exclusiveRightSidebarPanels: "오른쪽 사이드바 패널 한 번에 하나만 표시",
|
||||
exclusiveRightSidebarPanelsDescription: "오른쪽 사이드바 패널을 열면 다른 패널을 닫습니다. 여러 패널을 허용하려면 비활성화하세요.",
|
||||
uiScale: "UI 배율",
|
||||
|
||||
@@ -7054,6 +7054,11 @@ export default withEnglishFallback({
|
||||
fontSize: "Tamanho da fonte",
|
||||
toolbarTitle: "Barra de ferramentas",
|
||||
toolbarHiddenHint: "Alguns botões ocultos ou excedentes aparecerão no menu «Mais».",
|
||||
webLogoPosition: "Posição do logo na Web",
|
||||
webLogoPositionDescription: "Altere a posição do logo do DBX na barra de ferramentas web ou oculte-o para liberar espaço à esquerda.",
|
||||
webLogoPositionLeft: "Esquerda (padrão)",
|
||||
webLogoPositionRight: "Direita",
|
||||
webLogoPositionHidden: "Oculto",
|
||||
exclusiveRightSidebarPanels: "Mostrar um painel lateral direito por vez",
|
||||
exclusiveRightSidebarPanelsDescription: "Abrir um painel lateral direito fecha os demais. Desative para permitir vários painéis.",
|
||||
uiScale: "Escala da UI",
|
||||
|
||||
@@ -8258,6 +8258,11 @@ export default withEnglishFallback({
|
||||
fontSize: "Размер шрифта",
|
||||
toolbarTitle: "Панель инструментов",
|
||||
toolbarHiddenHint: "Некоторые скрытые или не поместившиеся кнопки отображаются в раскрывающемся меню «Ещё».",
|
||||
webLogoPosition: "Положение логотипа в Web",
|
||||
webLogoPositionDescription: "Измените расположение логотипа DBX на верхней панели веб-версии или скройте его, чтобы освободить место слева.",
|
||||
webLogoPositionLeft: "Слева (по умолчанию)",
|
||||
webLogoPositionRight: "Справа",
|
||||
webLogoPositionHidden: "Скрыть",
|
||||
exclusiveRightSidebarPanels: "Показывать по одной панели правой боковой панели за раз",
|
||||
exclusiveRightSidebarPanelsDescription: "Открытие панели правой боковой панели закрывает остальные. Отключите, чтобы разрешить несколько панелей.",
|
||||
uiScale: "Масштаб интерфейса",
|
||||
|
||||
@@ -6940,6 +6940,11 @@ export default withEnglishFallback({
|
||||
fontSize: "Yazı Tipi Boyutu",
|
||||
toolbarTitle: "Araç çubuğu",
|
||||
toolbarHiddenHint: 'Gizlenen veya taşan bazı düğmeler "Daha fazla" menüsünde görünür.',
|
||||
webLogoPosition: "Web Logo Konumu",
|
||||
webLogoPositionDescription: "Web araç çubuğundaki DBX logosunun konumunu değiştirin veya sol tarafta yer açmak için gizleyin.",
|
||||
webLogoPositionLeft: "Sol (Varsayılan)",
|
||||
webLogoPositionRight: "Sağ",
|
||||
webLogoPositionHidden: "Gizli",
|
||||
exclusiveRightSidebarPanels: "Aynı anda tek bir sağ kenar paneli göster",
|
||||
exclusiveRightSidebarPanelsDescription: "Bir sağ kenar paneli açıldığında diğerleri kapanır. Birden çok panele izin vermek için bunu kapatın.",
|
||||
uiScale: "Arayüz Ölçeği",
|
||||
|
||||
@@ -7924,6 +7924,11 @@ export default withEnglishFallback({
|
||||
fontSize: "字号",
|
||||
toolbarTitle: "工具栏",
|
||||
toolbarHiddenHint: '部分关闭或空间不足的按钮会自动收进"更多"下拉菜单。',
|
||||
webLogoPosition: "Web 端 Logo 位置",
|
||||
webLogoPositionDescription: "调整顶部工具栏中 DBX Logo 的显示位置,或将其隐藏以避免占用左侧直觉操作区。",
|
||||
webLogoPositionLeft: "左侧(默认)",
|
||||
webLogoPositionRight: "右侧",
|
||||
webLogoPositionHidden: "隐藏",
|
||||
exclusiveRightSidebarPanels: "右侧边栏一次仅显示一个面板",
|
||||
exclusiveRightSidebarPanelsDescription: "打开一个右侧面板时关闭其他面板。关闭此选项可同时显示多个面板。",
|
||||
uiScale: "界面缩放",
|
||||
|
||||
@@ -6406,6 +6406,11 @@ export default withEnglishFallback({
|
||||
fontSize: "字級",
|
||||
toolbarTitle: "工具列",
|
||||
toolbarHiddenHint: "部分關閉或空間不足的按鈕會自動收進「更多」下拉選單。",
|
||||
webLogoPosition: "Web 端 Logo 位置",
|
||||
webLogoPositionDescription: "調整頂部工具列中 DBX Logo 的顯示位置,或將其隱藏以避免佔用左側直覺操作區。",
|
||||
webLogoPositionLeft: "左側(預設)",
|
||||
webLogoPositionRight: "右側",
|
||||
webLogoPositionHidden: "隱藏",
|
||||
exclusiveRightSidebarPanels: "右側邊欄一次僅顯示一個面板",
|
||||
exclusiveRightSidebarPanelsDescription: "開啟一個右側面板時關閉其他面板。關閉此選項可同時顯示多個面板。",
|
||||
uiScale: "介面縮放",
|
||||
|
||||
@@ -307,6 +307,7 @@ describe("settings search", () => {
|
||||
{ titleKey: "transfer.dataTransfer", category: "appearance", targetId: "appearance" },
|
||||
{ titleKey: "toolbar.driverManager", category: "appearance", targetId: "appearance" },
|
||||
{ titleKey: "toolbar.theme", category: "appearance", targetId: "appearance" },
|
||||
{ titleKey: "settings.webLogoPosition", category: "appearance", targetId: "appearance-web-logo-position" },
|
||||
{ titleKey: "settings.sidebarObjectInfoMode", category: "navigation", targetId: "navigation" },
|
||||
{ titleKey: "settings.insertSpaceAfterCompletion", category: "editor", targetId: "editor" },
|
||||
{ titleKey: "settings.functionCompletionIncludeParams", category: "editor", targetId: "editor" },
|
||||
|
||||
@@ -48,6 +48,7 @@ export const EDITOR_SETTINGS_DRAFT_KEYS = [
|
||||
"savedSqlOpenTargetMode",
|
||||
"welcomePageMode",
|
||||
"appLayout",
|
||||
"webLogoPosition",
|
||||
"tabLayout",
|
||||
"tabPlacement",
|
||||
"colorizeConnectionTabs",
|
||||
@@ -186,6 +187,7 @@ function normalizedDraftValue(key: EditorSettingsDraftKey, value: unknown): unkn
|
||||
if (key === "csvNullMode") return normalizeCsvNullMode(value);
|
||||
if (key === "backgroundImage") return normalizeBackgroundImageSettings(value);
|
||||
if (key === "snippetTriggerKey") return value === "space" || value === "both" ? value : "tab";
|
||||
if (key === "webLogoPosition") return value === "right" || value === "hidden" ? value : "left";
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,6 +195,7 @@ export const SETTINGS_SEARCH_DEFINITIONS: readonly SettingsSearchDefinition[] =
|
||||
{ id: "appearance-tab-max-width", category: "appearance", titleKey: "settings.tabMaxWidth", descriptionKey: "settings.tabMaxWidthDescription", targetId: "appearance" },
|
||||
{ id: "appearance-connection-tab-colors", category: "appearance", titleKey: "settings.colorizeConnectionTabs", descriptionKey: "settings.colorizeConnectionTabsDescription", targetId: "appearance" },
|
||||
{ id: "appearance-icons", category: "appearance", titleKey: "settings.iconTheme", targetId: "appearance", visible: desktopOnly },
|
||||
{ id: "appearance-web-logo-position", category: "appearance", titleKey: "settings.webLogoPosition", descriptionKey: "settings.webLogoPositionDescription", targetId: "appearance-web-logo-position", visible: webOnly },
|
||||
{ id: "appearance-tray", category: "appearance", titleKey: "settings.showTrayIcon", descriptionKey: "settings.showTrayIconDescription", targetId: "appearance", visible: desktopOnly },
|
||||
{ id: "appearance-quit", category: "appearance", titleKey: "settings.quitOnClose", descriptionKey: "settings.quitOnCloseDescription", targetId: "appearance", visible: desktopOnly },
|
||||
{ id: "about-debug-logs", category: "about", titleKey: "settings.debugLoggingEnabled", descriptionKey: "settings.debugLoggingEnabledDescription", targetId: "about", visible: desktopOnly },
|
||||
|
||||
@@ -71,7 +71,7 @@ export function serializeSettingsTransfer(settings: EditorSettings, meta: Settin
|
||||
const SETTINGS_TRANSFER_CATEGORY_ORDER: readonly SettingsTransferCategoryId[] = ["appearance", "editor", "formatter", "navigation", "data", "shortcuts", "snippets", "other"];
|
||||
|
||||
const SETTINGS_TRANSFER_CATEGORY_KEYS: Record<SettingsTransferCategoryId, readonly EditorSettingsDraftKey[]> = {
|
||||
appearance: ["fontFamily", "fontSize", "tableFontFamily", "uiFontFamily", "uiScale", "theme", "customThemes", "activeCustomThemeId", "backgroundImage", "toolbarItems", "welcomePageMode"],
|
||||
appearance: ["fontFamily", "fontSize", "tableFontFamily", "uiFontFamily", "uiScale", "theme", "customThemes", "activeCustomThemeId", "backgroundImage", "toolbarItems", "welcomePageMode", "webLogoPosition"],
|
||||
editor: [
|
||||
"executeMode",
|
||||
"defaultTransactionMode",
|
||||
@@ -319,6 +319,7 @@ const PASS_THROUGH_FIELD_VALIDATORS: Partial<Record<EditorSettingsDraftKey, (val
|
||||
fontSize: (value) => typeof value === "number" && Number.isFinite(value) && value >= EDITOR_MIN_FONT_SIZE && value <= EDITOR_MAX_FONT_SIZE,
|
||||
welcomePageMode: (value) => value === "intro" || value === "workspace",
|
||||
appLayout: (value) => value === "separated" || value === "classic",
|
||||
webLogoPosition: (value) => value === "left" || value === "right" || value === "hidden",
|
||||
resultTabNamingMode: (value) => value === "source" || value === "ordinal" || value === "comment",
|
||||
activeCustomThemeId: (value) => typeof value === "string" && value.trim().length > 0,
|
||||
// normalizeToolbarItems keeps unknown/typed values for every known key, so
|
||||
|
||||
@@ -32,6 +32,15 @@ describe("normalizeEditorSettings", () => {
|
||||
expect(normalizeEditorSettings({ resultTabPreferComments: "false" } as any).resultTabPreferComments).toBe(true);
|
||||
});
|
||||
|
||||
it("defaults webLogoPosition to left and validates positions (#11053)", () => {
|
||||
expect(DEFAULT_EDITOR_SETTINGS.webLogoPosition).toBe("left");
|
||||
expect(normalizeEditorSettings({}).webLogoPosition).toBe("left");
|
||||
expect(normalizeEditorSettings({ webLogoPosition: "right" }).webLogoPosition).toBe("right");
|
||||
expect(normalizeEditorSettings({ webLogoPosition: "hidden" }).webLogoPosition).toBe("hidden");
|
||||
expect(normalizeEditorSettings({ webLogoPosition: "invalid" as any }).webLogoPosition).toBe("left");
|
||||
expect(normalizeEditorSettings({ webLogoPosition: undefined }).webLogoPosition).toBe("left");
|
||||
});
|
||||
|
||||
it("defaults the welcome page to the workspace overview and honors an explicitly saved intro mode", () => {
|
||||
expect(DEFAULT_EDITOR_SETTINGS.welcomePageMode).toBe("workspace");
|
||||
expect(normalizeEditorSettings({}).welcomePageMode).toBe("workspace");
|
||||
|
||||
@@ -855,6 +855,8 @@ export interface RememberedConnectionDatabase {
|
||||
|
||||
export type SnippetTriggerKey = "tab" | "space" | "both";
|
||||
|
||||
export type WebLogoPosition = "left" | "right" | "hidden";
|
||||
|
||||
export interface EditorSettings {
|
||||
snippetTriggerKey: SnippetTriggerKey;
|
||||
fontFamily: string;
|
||||
@@ -920,6 +922,7 @@ export interface EditorSettings {
|
||||
/** 水平标签页最大显示宽度(像素,0 表示不限制)。 */
|
||||
tabMaxWidth: number;
|
||||
appLayout: "separated" | "classic";
|
||||
webLogoPosition: WebLogoPosition;
|
||||
pageSize: number;
|
||||
tableOpenPageSize: number;
|
||||
tableOpenSortMode: "none" | "database" | "local";
|
||||
@@ -1255,6 +1258,7 @@ export const DEFAULT_EDITOR_SETTINGS: EditorSettings = {
|
||||
tabSortMode: "manual",
|
||||
tabMaxWidth: 0,
|
||||
appLayout: "classic",
|
||||
webLogoPosition: "left",
|
||||
pageSize: 100,
|
||||
tableOpenPageSize: 100,
|
||||
tableOpenSortMode: "none",
|
||||
@@ -1449,6 +1453,10 @@ function normalizeTabLayout(value: unknown): TabLayoutMode {
|
||||
return TAB_LAYOUT_MODES.includes(value as TabLayoutMode) ? (value as TabLayoutMode) : DEFAULT_EDITOR_SETTINGS.tabLayout;
|
||||
}
|
||||
|
||||
export function normalizeWebLogoPosition(value: unknown): WebLogoPosition {
|
||||
return value === "right" || value === "hidden" ? value : "left";
|
||||
}
|
||||
|
||||
function normalizeTabPlacement(value: unknown): TabPlacement {
|
||||
return TAB_PLACEMENTS.includes(value as TabPlacement) ? (value as TabPlacement) : DEFAULT_EDITOR_SETTINGS.tabPlacement;
|
||||
}
|
||||
@@ -1872,6 +1880,7 @@ export function normalizeEditorSettings(settings: Partial<EditorSettings>, exist
|
||||
tabSortMode: normalizeTabSortMode(settings.tabSortMode),
|
||||
tabMaxWidth: normalizeTabMaxWidth(settings.tabMaxWidth),
|
||||
appLayout: settings.appLayout ?? DEFAULT_EDITOR_SETTINGS.appLayout,
|
||||
webLogoPosition: normalizeWebLogoPosition(settings.webLogoPosition),
|
||||
pageSize: normalizeResultPageSize(settings.pageSize),
|
||||
tableOpenPageSize: normalizeResultPageSize(settings.tableOpenPageSize, DEFAULT_EDITOR_SETTINGS.tableOpenPageSize),
|
||||
tableOpenSortMode: settings.tableOpenSortMode === "database" || settings.tableOpenSortMode === "local" ? settings.tableOpenSortMode : "none",
|
||||
@@ -2731,6 +2740,7 @@ export const useSettingsStore = defineStore("settings", () => {
|
||||
if (partial.tabSortMode !== undefined) editorSettings.value.tabSortMode = normalizeTabSortMode(partial.tabSortMode);
|
||||
if (partial.tabMaxWidth !== undefined) editorSettings.value.tabMaxWidth = normalizeTabMaxWidth(partial.tabMaxWidth);
|
||||
if (partial.appLayout !== undefined) editorSettings.value.appLayout = partial.appLayout;
|
||||
if (partial.webLogoPosition !== undefined) editorSettings.value.webLogoPosition = normalizeWebLogoPosition(partial.webLogoPosition);
|
||||
if (partial.pageSize !== undefined) editorSettings.value.pageSize = normalizeResultPageSize(partial.pageSize);
|
||||
if (partial.tableOpenPageSize !== undefined) editorSettings.value.tableOpenPageSize = normalizeResultPageSize(partial.tableOpenPageSize, DEFAULT_EDITOR_SETTINGS.tableOpenPageSize);
|
||||
if (partial.tableOpenSortMode !== undefined) editorSettings.value.tableOpenSortMode = partial.tableOpenSortMode === "database" || partial.tableOpenSortMode === "local" ? partial.tableOpenSortMode : "none";
|
||||
|
||||
Reference in new issue
Block a user