refactor: move DB selector from TitleBar/StatusBar to MainArea tab bar
- Remove DbSelector from StatusBar.vue - Remove DbSelector from TitleBar.vue - Add DbSelector to MainArea tab bar (left of tab buttons, after connection switcher) - Only visible when connected (connStore.isConnected) - Separated by dividers from connection switcher and tabs
This commit is contained in:
@@ -9,6 +9,7 @@ import CliView from './CliView.vue'
|
|||||||
import SlowLogView from './SlowLogView.vue'
|
import SlowLogView from './SlowLogView.vue'
|
||||||
import MemoryAnalysis from './MemoryAnalysis.vue'
|
import MemoryAnalysis from './MemoryAnalysis.vue'
|
||||||
import SettingsView from './SettingsView.vue'
|
import SettingsView from './SettingsView.vue'
|
||||||
|
import DbSelector from './DbSelector.vue'
|
||||||
|
|
||||||
const connStore = useConnectionStore()
|
const connStore = useConnectionStore()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -228,6 +229,9 @@ onUnmounted(() => {
|
|||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<div class="tab-divider" v-if="connectedConnections.length > 0" />
|
<div class="tab-divider" v-if="connectedConnections.length > 0" />
|
||||||
|
<!-- DB Selector -->
|
||||||
|
<DbSelector v-if="connStore.isConnected" class="tab-db-selector" />
|
||||||
|
<div class="tab-divider" v-if="connStore.isConnected" />
|
||||||
<!-- Tabs -->
|
<!-- Tabs -->
|
||||||
<div
|
<div
|
||||||
v-for="tab in tabs"
|
v-for="tab in tabs"
|
||||||
@@ -359,6 +363,13 @@ onUnmounted(() => {
|
|||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tab-db-selector {
|
||||||
|
flex-shrink: 0;
|
||||||
|
padding: 0 4px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-divider {
|
.tab-divider {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useConnectionStore } from '@renderer/stores/connection'
|
import { useConnectionStore } from '@renderer/stores/connection'
|
||||||
import { useI18n } from '@renderer/i18n'
|
import { useI18n } from '@renderer/i18n'
|
||||||
import DbSelector from './DbSelector.vue'
|
|
||||||
|
|
||||||
const connStore = useConnectionStore()
|
const connStore = useConnectionStore()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
@@ -32,9 +31,6 @@ const statusClass = computed(() => {
|
|||||||
<span class="status-dot" :class="statusClass" />
|
<span class="status-dot" :class="statusClass" />
|
||||||
{{ statusText }}
|
{{ statusText }}
|
||||||
</span>
|
</span>
|
||||||
<span class="statusbar-center">
|
|
||||||
<DbSelector v-if="connStore.isConnected" />
|
|
||||||
</span>
|
|
||||||
<span class="statusbar-right">JRedisDesktop v2.0</span>
|
<span class="statusbar-right">JRedisDesktop v2.0</span>
|
||||||
</footer>
|
</footer>
|
||||||
</template>
|
</template>
|
||||||
@@ -60,12 +56,6 @@ const statusClass = computed(() => {
|
|||||||
gap: 6px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.statusbar-center {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-dot {
|
.status-dot {
|
||||||
width: 7px;
|
width: 7px;
|
||||||
height: 7px;
|
height: 7px;
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// src/components/TitleBar.vue
|
// src/components/TitleBar.vue
|
||||||
import { useAppStore } from '@renderer/stores/app'
|
import { useAppStore } from '@renderer/stores/app'
|
||||||
import { useConnectionStore } from '@renderer/stores/connection'
|
|
||||||
import { useI18n } from '@renderer/i18n'
|
import { useI18n } from '@renderer/i18n'
|
||||||
import DbSelector from './DbSelector.vue'
|
|
||||||
|
|
||||||
const appStore = useAppStore()
|
const appStore = useAppStore()
|
||||||
const connStore = useConnectionStore()
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const props = defineProps<{ showSettings: boolean }>()
|
const props = defineProps<{ showSettings: boolean }>()
|
||||||
@@ -28,7 +25,6 @@ function openSettings() {
|
|||||||
<div class="titlebar-drag">
|
<div class="titlebar-drag">
|
||||||
<span class="titlebar-logo">JRD</span>
|
<span class="titlebar-logo">JRD</span>
|
||||||
<span class="titlebar-title">JRedisDesktop</span>
|
<span class="titlebar-title">JRedisDesktop</span>
|
||||||
<DbSelector v-if="connStore.isConnected" class="titlebar-db" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="titlebar-actions">
|
<div class="titlebar-actions">
|
||||||
<button class="titlebar-btn" :title="t('settings.title')" @click="openSettings">
|
<button class="titlebar-btn" :title="t('settings.title')" @click="openSettings">
|
||||||
@@ -84,10 +80,6 @@ function openSettings() {
|
|||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.titlebar-db {
|
|
||||||
-webkit-app-region: no-drag;
|
|
||||||
}
|
|
||||||
|
|
||||||
.titlebar-actions {
|
.titlebar-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
-webkit-app-region: no-drag;
|
-webkit-app-region: no-drag;
|
||||||
|
|||||||
Reference in New Issue
Block a user