perf: add mark color to the border of icon in connection pane
This commit is contained in:
parent
94bcbdfe13
commit
96a11bdb9c
|
@ -62,6 +62,9 @@ const data = computed(() => {
|
||||||
|
|
||||||
const backgroundColor = computed(() => {
|
const backgroundColor = computed(() => {
|
||||||
const { markColor: hex = '' } = connectionStore.serverProfile[props.server] || {}
|
const { markColor: hex = '' } = connectionStore.serverProfile[props.server] || {}
|
||||||
|
if (isEmpty(hex)) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
const { r, g, b } = parseHexColor(hex)
|
const { r, g, b } = parseHexColor(hex)
|
||||||
return `rgba(${r}, ${g}, ${b}, 0.2)`
|
return `rgba(${r}, ${g}, ${b}, 0.2)`
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,10 +14,6 @@ const themeVars = useThemeVars()
|
||||||
const dialogStore = useDialogStore()
|
const dialogStore = useDialogStore()
|
||||||
const connectionStore = useConnectionStore()
|
const connectionStore = useConnectionStore()
|
||||||
const filterPattern = ref('')
|
const filterPattern = ref('')
|
||||||
|
|
||||||
const onDisconnectAll = () => {
|
|
||||||
connectionStore.closeAllConnection()
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -38,13 +34,6 @@ const onDisconnectAll = () => {
|
||||||
stroke-width="4"
|
stroke-width="4"
|
||||||
t-tooltip="new_group"
|
t-tooltip="new_group"
|
||||||
@click="dialogStore.openNewGroupDialog()" />
|
@click="dialogStore.openNewGroupDialog()" />
|
||||||
<icon-button
|
|
||||||
:disabled="!connectionStore.anyConnectionOpened"
|
|
||||||
:icon="Unlink"
|
|
||||||
size="20"
|
|
||||||
stroke-width="4"
|
|
||||||
t-tooltip="disconnect_all"
|
|
||||||
@click="onDisconnectAll" />
|
|
||||||
<n-input v-model:value="filterPattern" :placeholder="$t('filter')" clearable>
|
<n-input v-model:value="filterPattern" :placeholder="$t('filter')" clearable>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<n-icon :component="Filter" size="20" />
|
<n-icon :component="Filter" size="20" />
|
||||||
|
|
|
@ -117,18 +117,29 @@ const menuOptions = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const renderLabel = ({ option }) => {
|
/**
|
||||||
if (option.type === ConnectionType.Server) {
|
* get mark color of server saved in preferences
|
||||||
const { markColor = '' } = connectionStore.serverProfile[option.name] || {}
|
* @param name
|
||||||
|
* @return {null|string}
|
||||||
|
*/
|
||||||
|
const getServerMarkColor = (name) => {
|
||||||
|
const { markColor = '' } = connectionStore.serverProfile[name] || {}
|
||||||
if (!isEmpty(markColor)) {
|
if (!isEmpty(markColor)) {
|
||||||
const rgb = parseHexColor(markColor)
|
const rgb = parseHexColor(markColor)
|
||||||
const rgb2 = hexGammaCorrection(rgb, 0.75)
|
const rgb2 = hexGammaCorrection(rgb, 0.75)
|
||||||
|
return toHexColor(rgb2)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
const renderLabel = ({ option }) => {
|
||||||
|
if (option.type === ConnectionType.Server) {
|
||||||
|
const color = getServerMarkColor(option.name)
|
||||||
|
if (color != null) {
|
||||||
return h(
|
return h(
|
||||||
NText,
|
NText,
|
||||||
{
|
{
|
||||||
style: {
|
style: { color },
|
||||||
color: toHexColor(rgb2),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
() => option.label,
|
() => option.label,
|
||||||
)
|
)
|
||||||
|
@ -166,9 +177,10 @@ const renderPrefix = ({ option }) => {
|
||||||
)
|
)
|
||||||
case ConnectionType.Server:
|
case ConnectionType.Server:
|
||||||
const connected = connectionStore.isConnected(option.name)
|
const connected = connectionStore.isConnected(option.name)
|
||||||
|
const color = getServerMarkColor(option.name)
|
||||||
return h(
|
return h(
|
||||||
NIcon,
|
NIcon,
|
||||||
{ size: 20 },
|
{ size: 20, color },
|
||||||
{
|
{
|
||||||
default: () => h(ToggleServer, { modelValue: !!connected }),
|
default: () => h(ToggleServer, { modelValue: !!connected }),
|
||||||
},
|
},
|
||||||
|
@ -362,9 +374,11 @@ const handleSelectContextMenu = (key) => {
|
||||||
removeConnection(name)
|
removeConnection(name)
|
||||||
break
|
break
|
||||||
case 'server_close':
|
case 'server_close':
|
||||||
if (!isEmpty(group)) {
|
connectionStore.closeConnection(name).then((closed) => {
|
||||||
connectionStore.closeConnection(name)
|
if (closed) {
|
||||||
|
$message.success(i18n.t('handle_succ'))
|
||||||
}
|
}
|
||||||
|
})
|
||||||
break
|
break
|
||||||
case 'group_rename':
|
case 'group_rename':
|
||||||
if (!isEmpty(group)) {
|
if (!isEmpty(group)) {
|
||||||
|
@ -372,7 +386,9 @@ const handleSelectContextMenu = (key) => {
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'group_delete':
|
case 'group_delete':
|
||||||
|
if (!isEmpty(group)) {
|
||||||
removeGroup(group)
|
removeGroup(group)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
console.warn('TODO: handle context menu:' + key)
|
console.warn('TODO: handle context menu:' + key)
|
||||||
|
|
2
main.go
2
main.go
|
@ -67,7 +67,7 @@ func main() {
|
||||||
},
|
},
|
||||||
About: &mac.AboutInfo{
|
About: &mac.AboutInfo{
|
||||||
Title: "Tiny RDM",
|
Title: "Tiny RDM",
|
||||||
Message: "A modern lightweight cross-platform Redis desktop client\nCopyright © 2023",
|
Message: "A modern lightweight cross-platform Redis desktop client.\n\nCopyright © 2023",
|
||||||
Icon: icon,
|
Icon: icon,
|
||||||
},
|
},
|
||||||
//WebviewIsTransparent: true,
|
//WebviewIsTransparent: true,
|
||||||
|
|
Loading…
Reference in New Issue