Compare commits

...

2 Commits

Author SHA1 Message Date
Lykin b0dfe348bd Merge remote-tracking branch 'origin/main' 2024-10-18 16:37:56 +08:00
Lykin a3a1a17af3 fix: force switch to key detail tab when `Auto Refresh` on 2024-10-18 16:37:03 +08:00
2 changed files with 7 additions and 4 deletions

View File

@ -386,9 +386,10 @@ const useBrowserStore = defineStore('browser', {
* @param {number} db * @param {number} db
* @param {string|number[]} [key] null or blank indicate that update tab to display normal content (blank content or server status) * @param {string|number[]} [key] null or blank indicate that update tab to display normal content (blank content or server status)
* @param {boolean} [clearValue] * @param {boolean} [clearValue]
* @param {boolean} [redirect] redirect to key detail tab
* @return {Promise<void>} * @return {Promise<void>}
*/ */
async loadKeySummary({ server, db, key, clearValue }) { async loadKeySummary({ server, db, key, clearValue, redirect = true }) {
try { try {
const tab = useTabStore() const tab = useTabStore()
if (!isEmpty(key)) { if (!isEmpty(key)) {
@ -402,7 +403,7 @@ const useBrowserStore = defineStore('browser', {
const k = nativeRedisKey(key) const k = nativeRedisKey(key)
const binaryKey = k !== key const binaryKey = k !== key
tab.upsertTab({ tab.upsertTab({
subTab: BrowserTabType.KeyDetail, subTab: redirect === false ? null : BrowserTabType.KeyDetail,
server, server,
db, db,
type, type,
@ -492,7 +493,7 @@ const useBrowserStore = defineStore('browser', {
if (showLoading) { if (showLoading) {
tab.updateLoading({ server, db, loading: true }) tab.updateLoading({ server, db, loading: true })
} }
await this.loadKeySummary({ server, db, key, clearValue: true }) await this.loadKeySummary({ server, db, key, clearValue: true, redirect: false })
await this.loadKeyDetail({ await this.loadKeyDetail({
server, server,
db, db,

View File

@ -3,6 +3,7 @@ import { defineStore } from 'pinia'
import { TabItem } from '@/objects/tabItem.js' import { TabItem } from '@/objects/tabItem.js'
import useBrowserStore from 'stores/browser.js' import useBrowserStore from 'stores/browser.js'
import { i18nGlobal } from '@/utils/i18n.js' import { i18nGlobal } from '@/utils/i18n.js'
import { BrowserTabType } from '@/consts/browser_tab_type.js'
const useTabStore = defineStore('tab', { const useTabStore = defineStore('tab', {
/** /**
@ -179,6 +180,7 @@ const useTabStore = defineStore('tab', {
}) { }) {
let tabIndex = findIndex(this.tabList, { name: server }) let tabIndex = findIndex(this.tabList, { name: server })
if (tabIndex === -1) { if (tabIndex === -1) {
subTab = subTab || BrowserTabType.KeyDetail
const tabItem = new TabItem({ const tabItem = new TabItem({
name: server, name: server,
title: server, title: server,
@ -202,7 +204,7 @@ const useTabStore = defineStore('tab', {
} else { } else {
const tab = this.tabList[tabIndex] const tab = this.tabList[tabIndex]
tab.blank = false tab.blank = false
tab.subTab = subTab tab.subTab = subTab || tab.subTab
// tab.title = db !== undefined ? `${server}/db${db}` : `${server}` // tab.title = db !== undefined ? `${server}/db${db}` : `${server}`
tab.title = server tab.title = server
tab.server = server tab.server = server