style: adjusted style in dark mode
feat: add server status entrance button at the bottom of browser pane
This commit is contained in:
parent
0de32407c7
commit
e15bf3ab2f
|
@ -0,0 +1,44 @@
|
||||||
|
<script setup>
|
||||||
|
const props = defineProps({
|
||||||
|
strokeWidth: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: 3,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<svg viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect
|
||||||
|
x="4"
|
||||||
|
y="6"
|
||||||
|
width="40"
|
||||||
|
height="36"
|
||||||
|
rx="2"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
:stroke-width="props.strokeWidth"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round" />
|
||||||
|
<path
|
||||||
|
d="M32 25V32"
|
||||||
|
stroke="currentColor"
|
||||||
|
:stroke-width="props.strokeWidth"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round" />
|
||||||
|
<path
|
||||||
|
d="M24 16V32"
|
||||||
|
stroke="currentColor"
|
||||||
|
:stroke-width="props.strokeWidth"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round" />
|
||||||
|
<path
|
||||||
|
d="M16 20V32"
|
||||||
|
stroke="currentColor"
|
||||||
|
:stroke-width="props.strokeWidth"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round" />
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
|
@ -13,6 +13,7 @@ import useConnectionStore from 'stores/connections.js'
|
||||||
import { types } from '@/consts/support_redis_type.js'
|
import { types } from '@/consts/support_redis_type.js'
|
||||||
import Search from '@/components/icons/Search.vue'
|
import Search from '@/components/icons/Search.vue'
|
||||||
import Unlink from '@/components/icons/Unlink.vue'
|
import Unlink from '@/components/icons/Unlink.vue'
|
||||||
|
import Status from '@/components/icons/Status.vue'
|
||||||
|
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
const dialogStore = useDialogStore()
|
const dialogStore = useDialogStore()
|
||||||
|
@ -28,9 +29,8 @@ const currentSelect = computed(() => {
|
||||||
return { server, db, key }
|
return { server, db, key }
|
||||||
})
|
})
|
||||||
|
|
||||||
const onNewKey = () => {
|
const onInfo = () => {
|
||||||
const { server, key, db = 0 } = currentSelect.value
|
browserTreeRef.value?.handleSelectContextMenu('server_info')
|
||||||
dialogStore.openNewKeyDialog(key, server, db)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
|
@ -74,7 +74,7 @@ const filterTypeOptions = computed(() => {
|
||||||
:options="filterTypeOptions"
|
:options="filterTypeOptions"
|
||||||
style="width: 120px" />
|
style="width: 120px" />
|
||||||
<n-input clearable placeholder="" />
|
<n-input clearable placeholder="" />
|
||||||
<n-button ghost>
|
<n-button ghost :focusable="false">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<n-icon :component="Search" />
|
<n-icon :component="Search" />
|
||||||
</template>
|
</template>
|
||||||
|
@ -83,15 +83,8 @@ const filterTypeOptions = computed(() => {
|
||||||
</div>
|
</div>
|
||||||
<!-- bottom function bar -->
|
<!-- bottom function bar -->
|
||||||
<div class="nav-pane-bottom flex-box-h">
|
<div class="nav-pane-bottom flex-box-h">
|
||||||
<icon-button :icon="AddLink" size="20" stroke-width="4" t-tooltip="new_key" @click="onNewKey" />
|
<icon-button :icon="Status" size="20" stroke-width="4" t-tooltip="status" @click="onInfo" />
|
||||||
<icon-button :icon="Refresh" size="20" stroke-width="4" t-tooltip="reload" @click="onRefresh" />
|
<icon-button :icon="Refresh" size="20" stroke-width="4" t-tooltip="reload" @click="onRefresh" />
|
||||||
<!-- <icon-button-->
|
|
||||||
<!-- :icon="Filter"-->
|
|
||||||
<!-- size="20"-->
|
|
||||||
<!-- stroke-width="4"-->
|
|
||||||
<!-- t-tooltip="filter_key"-->
|
|
||||||
<!-- @click="filterForm.showFilter = !filterForm.showFilter"-->
|
|
||||||
<!-- />-->
|
|
||||||
<div class="flex-item-expand"></div>
|
<div class="flex-item-expand"></div>
|
||||||
<icon-button :icon="Unlink" size="20" stroke-width="4" t-tooltip="disconnect" @click="onDisconnect" />
|
<icon-button :icon="Unlink" size="20" stroke-width="4" t-tooltip="disconnect" @click="onDisconnect" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -225,6 +225,10 @@ const handleSelectContextMenu = (key) => {
|
||||||
const node = connectionStore.getNode(selectedKey)
|
const node = connectionStore.getNode(selectedKey)
|
||||||
const { db, key: nodeKey, redisKey } = node || {}
|
const { db, key: nodeKey, redisKey } = node || {}
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
case 'server_info':
|
||||||
|
tabStore.setSelectedKeys(props.server)
|
||||||
|
onUpdateSelectedKeys()
|
||||||
|
break
|
||||||
case 'server_reload':
|
case 'server_reload':
|
||||||
expandedKeys.value = [props.server]
|
expandedKeys.value = [props.server]
|
||||||
tabStore.setSelectedKeys(props.server)
|
tabStore.setSelectedKeys(props.server)
|
||||||
|
@ -320,10 +324,9 @@ const onUpdateSelectedKeys = (keys, options) => {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// default is load blank key to display server status
|
|
||||||
connectionStore.loadKeyValue(props.server, 0)
|
|
||||||
}
|
}
|
||||||
|
// default is load blank key to display server status
|
||||||
|
connectionStore.loadKeyValue(props.server, 0)
|
||||||
} finally {
|
} finally {
|
||||||
tabStore.setSelectedKeys(props.server, keys)
|
tabStore.setSelectedKeys(props.server, keys)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,14 @@ import useTabStore from 'stores/tab.js'
|
||||||
import Edit from '@/components/icons/Edit.vue'
|
import Edit from '@/components/icons/Edit.vue'
|
||||||
import { hexGammaCorrection, parseHexColor, toHexColor } from '@/utils/rgb.js'
|
import { hexGammaCorrection, parseHexColor, toHexColor } from '@/utils/rgb.js'
|
||||||
import IconButton from '@/components/common/IconButton.vue'
|
import IconButton from '@/components/common/IconButton.vue'
|
||||||
|
import usePreferencesStore from 'stores/preferences.js'
|
||||||
|
|
||||||
const themeVars = useThemeVars()
|
const themeVars = useThemeVars()
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
const openingConnection = ref(false)
|
const openingConnection = ref(false)
|
||||||
const connectionStore = useConnectionStore()
|
const connectionStore = useConnectionStore()
|
||||||
const tabStore = useTabStore()
|
const tabStore = useTabStore()
|
||||||
|
const prefStore = usePreferencesStore()
|
||||||
const dialogStore = useDialogStore()
|
const dialogStore = useDialogStore()
|
||||||
|
|
||||||
const expandedKeys = ref([])
|
const expandedKeys = ref([])
|
||||||
|
@ -168,6 +170,7 @@ const renderIconMenu = (items) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderPrefix = ({ option }) => {
|
const renderPrefix = ({ option }) => {
|
||||||
|
const iconTransparency = prefStore.isDark ? 0.75 : 1
|
||||||
switch (option.type) {
|
switch (option.type) {
|
||||||
case ConnectionType.Group:
|
case ConnectionType.Group:
|
||||||
const opened = indexOf(expandedKeys.value, option.key) !== -1
|
const opened = indexOf(expandedKeys.value, option.key) !== -1
|
||||||
|
@ -175,7 +178,11 @@ const renderPrefix = ({ option }) => {
|
||||||
NIcon,
|
NIcon,
|
||||||
{ size: 20 },
|
{ size: 20 },
|
||||||
{
|
{
|
||||||
default: () => h(ToggleFolder, { modelValue: opened }),
|
default: () =>
|
||||||
|
h(ToggleFolder, {
|
||||||
|
modelValue: opened,
|
||||||
|
fillColor: `rgba(255,206,120,${iconTransparency})`,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
case ConnectionType.Server:
|
case ConnectionType.Server:
|
||||||
|
@ -183,9 +190,13 @@ const renderPrefix = ({ option }) => {
|
||||||
const color = getServerMarkColor(option.name)
|
const color = getServerMarkColor(option.name)
|
||||||
return h(
|
return h(
|
||||||
NIcon,
|
NIcon,
|
||||||
{ size: 20, color },
|
{ size: 20, color: !!!connected ? color : undefined },
|
||||||
{
|
{
|
||||||
default: () => h(ToggleServer, { modelValue: !!connected }),
|
default: () =>
|
||||||
|
h(ToggleServer, {
|
||||||
|
modelValue: !!connected,
|
||||||
|
fillColor: `rgba(220,66,60,${iconTransparency})`,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"new_group": "Add New Group",
|
"new_group": "Add New Group",
|
||||||
"rename_group": "Rename Group",
|
"rename_group": "Rename Group",
|
||||||
"disconnect_all": "Disconnect all",
|
"disconnect_all": "Disconnect all",
|
||||||
|
"status": "Status",
|
||||||
"filter": "Filter",
|
"filter": "Filter",
|
||||||
"sort_conn": "Sort Connections",
|
"sort_conn": "Sort Connections",
|
||||||
"close_confirm": "Confirm close this tab and connection",
|
"close_confirm": "Confirm close this tab and connection",
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"new_group": "添加新分组",
|
"new_group": "添加新分组",
|
||||||
"rename_group": "重命名分组",
|
"rename_group": "重命名分组",
|
||||||
"disconnect_all": "断开所有连接",
|
"disconnect_all": "断开所有连接",
|
||||||
|
"status": "状态",
|
||||||
"filter": "筛选",
|
"filter": "筛选",
|
||||||
"sort_conn": "调整连接顺序",
|
"sort_conn": "调整连接顺序",
|
||||||
"close_confirm": "是否关闭当前连接",
|
"close_confirm": "是否关闭当前连接",
|
||||||
|
|
|
@ -24,12 +24,15 @@ async function setupApp() {
|
||||||
await setupDiscreteApi()
|
await setupDiscreteApi()
|
||||||
app.config.errorHandler = (err, instance, info) => {
|
app.config.errorHandler = (err, instance, info) => {
|
||||||
// TODO: add "send error message to author" later
|
// TODO: add "send error message to author" later
|
||||||
$notification.error({
|
try {
|
||||||
title: i18n.global.t('error'),
|
const content = err.toString()
|
||||||
content: err.toString(),
|
$notification.error({
|
||||||
// meta: err.stack,
|
title: i18n.global.t('error'),
|
||||||
})
|
content,
|
||||||
console.error(err)
|
// meta: err.stack,
|
||||||
|
})
|
||||||
|
console.error(err)
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
app.config.warnHandler = (message) => {
|
app.config.warnHandler = (message) => {
|
||||||
console.warn(message)
|
console.warn(message)
|
||||||
|
|
Loading…
Reference in New Issue