Compare commits

..

No commits in common. "cc696f9642ec6e058e2d761956bff4976deb1692" and "d99a397ae34093a03e766ada44f15863925691d0" have entirely different histories.

11 changed files with 23 additions and 64 deletions

View File

@ -44,7 +44,6 @@ const browserStore = useBrowserStore()
const connectionStore = useConnectionStore() const connectionStore = useConnectionStore()
const render = useRender() const render = useRender()
const browserTreeRef = ref(null) const browserTreeRef = ref(null)
const filterInputRef = ref(null)
const loading = ref(false) const loading = ref(false)
const fullyLoaded = ref(false) const fullyLoaded = ref(false)
const inCheckState = ref(false) const inCheckState = ref(false)
@ -208,7 +207,6 @@ const handleSelectDB = async (db) => {
loading.value = true loading.value = true
browserStore.setKeyFilter(props.server, {}) browserStore.setKeyFilter(props.server, {})
browserStore.closeDatabase(props.server, props.db) browserStore.closeDatabase(props.server, props.db)
filterInputRef.value?.reset()
await browserStore.openDatabase(props.server, db) await browserStore.openDatabase(props.server, db)
await nextTick() await nextTick()
await connectionStore.saveLastDB(props.server, db) await connectionStore.saveLastDB(props.server, db)
@ -293,7 +291,6 @@ watch(
<!-- top function bar --> <!-- top function bar -->
<div class="flex-box-h nav-pane-func" style="height: 36px"> <div class="flex-box-h nav-pane-func" style="height: 36px">
<content-search-input <content-search-input
ref="filterInputRef"
:debounce-wait="1000" :debounce-wait="1000"
:full-search-icon="Search" :full-search-icon="Search"
small small

View File

@ -456,7 +456,7 @@
"copy_log": "Copy Log", "copy_log": "Copy Log",
"save_log": "Save Log", "save_log": "Save Log",
"clean_log": "Clean Log", "clean_log": "Clean Log",
"always_show_last": "Auto Scroll to Latest" "always_show_last": "Always Show Latest"
}, },
"pubsub": { "pubsub": {
"title": "Pub/Sub", "title": "Pub/Sub",
@ -469,6 +469,6 @@
"channel": "Channel", "channel": "Channel",
"message": "Message", "message": "Message",
"receive_message": "Received {total} messages", "receive_message": "Received {total} messages",
"always_show_last": "Auto Scroll to Latest" "always_show_last": "Always Show Latest"
} }
} }

View File

@ -456,7 +456,7 @@
"copy_log": "Copiar registro", "copy_log": "Copiar registro",
"save_log": "Guardar registro", "save_log": "Guardar registro",
"clean_log": "Limpiar registro", "clean_log": "Limpiar registro",
"always_show_last": "Desplazamiento automático al último" "always_show_last": "Siempre mostrar el último"
}, },
"pubsub": { "pubsub": {
"title": "Pub/Sub", "title": "Pub/Sub",
@ -469,6 +469,6 @@
"channel": "Canal", "channel": "Canal",
"message": "Mensaje", "message": "Mensaje",
"receive_message": "Recibidos {total} mensajes", "receive_message": "Recibidos {total} mensajes",
"always_show_last": "Desplazamiento automático al último" "always_show_last": "Siempre mostrar el último"
} }
} }

View File

@ -456,7 +456,7 @@
"copy_log": "Copier le journal", "copy_log": "Copier le journal",
"save_log": "Enregistrer le journal", "save_log": "Enregistrer le journal",
"clean_log": "Nettoyer le journal", "clean_log": "Nettoyer le journal",
"always_show_last": "Défilement automatique vers le dernier message" "always_show_last": "Toujours afficher les dernières"
}, },
"pubsub": { "pubsub": {
"title": "Pub/Sub", "title": "Pub/Sub",
@ -469,6 +469,6 @@
"channel": "Canal", "channel": "Canal",
"message": "Message", "message": "Message",
"receive_message": "{total} messages reçus", "receive_message": "{total} messages reçus",
"always_show_last": "Défilement automatique vers le dernier message" "always_show_last": "Toujours afficher les derniers"
} }
} }

View File

@ -456,7 +456,7 @@
"copy_log": "ログをコピー", "copy_log": "ログをコピー",
"save_log": "ログを保存", "save_log": "ログを保存",
"clean_log": "ログをクリア", "clean_log": "ログをクリア",
"always_show_last": "最新に自動スクロール" "always_show_last": "最新を常に表示"
}, },
"pubsub": { "pubsub": {
"title": "パブ/サブ", "title": "パブ/サブ",
@ -469,6 +469,6 @@
"channel": "チャンネル", "channel": "チャンネル",
"message": "メッセージ", "message": "メッセージ",
"receive_message": "{total}件のメッセージを受信しました", "receive_message": "{total}件のメッセージを受信しました",
"always_show_last": "最新に自動スクロール" "always_show_last": "最新を常に表示"
} }
} }

View File

@ -456,7 +456,7 @@
"copy_log": "로그 복사", "copy_log": "로그 복사",
"save_log": "로그 저장", "save_log": "로그 저장",
"clean_log": "로그 지우기", "clean_log": "로그 지우기",
"always_show_last": "최신 내용으로 자동 스크롤" "always_show_last": "최신 항목 계속 표시"
}, },
"pubsub": { "pubsub": {
"title": "Pub/Sub", "title": "Pub/Sub",
@ -469,6 +469,6 @@
"channel": "채널", "channel": "채널",
"message": "메시지", "message": "메시지",
"receive_message": "{total}개의 메시지를 받았습니다", "receive_message": "{total}개의 메시지를 받았습니다",
"always_show_last": "최신 내용으로 자동 스크롤" "always_show_last": "최신 항목 계속 표시"
} }
} }

View File

@ -456,7 +456,7 @@
"copy_log": "Copiar Log", "copy_log": "Copiar Log",
"save_log": "Salvar Log", "save_log": "Salvar Log",
"clean_log": "Limpar Log", "clean_log": "Limpar Log",
"always_show_last": "Rolar automaticamente para o mais recente" "always_show_last": "Sempre Mostrar o Mais Recente"
}, },
"pubsub": { "pubsub": {
"title": "Pub/Sub", "title": "Pub/Sub",
@ -469,6 +469,6 @@
"channel": "Canal", "channel": "Canal",
"message": "Mensagem", "message": "Mensagem",
"receive_message": "Recebidas {total} mensagens", "receive_message": "Recebidas {total} mensagens",
"always_show_last": "Rolar automaticamente para o mais recente" "always_show_last": "Sempre Mostrar o Mais Recente"
} }
} }

View File

@ -456,7 +456,7 @@
"copy_log": "Копировать журнал", "copy_log": "Копировать журнал",
"save_log": "Сохранить журнал", "save_log": "Сохранить журнал",
"clean_log": "Очистить журнал", "clean_log": "Очистить журнал",
"always_show_last": "Автоматическая прокрутка к последнему" "always_show_last": "Всегда показывать последние"
}, },
"pubsub": { "pubsub": {
"title": "Публикация/Подписка", "title": "Публикация/Подписка",
@ -469,6 +469,6 @@
"channel": "Канал", "channel": "Канал",
"message": "Сообщение", "message": "Сообщение",
"receive_message": "Получено сообщений: {total}", "receive_message": "Получено сообщений: {total}",
"always_show_last": "Автоматическая прокрутка к последнему" "always_show_last": "Всегда показывать последние"
} }
} }

View File

@ -456,7 +456,7 @@
"copy_log": "复制日志", "copy_log": "复制日志",
"save_log": "保存日志", "save_log": "保存日志",
"clean_log": "清空日志", "clean_log": "清空日志",
"always_show_last": "自动滚到最新" "always_show_last": "总是显示最新"
}, },
"pubsub": { "pubsub": {
"title": "发布订阅", "title": "发布订阅",
@ -469,6 +469,6 @@
"channel": "频道", "channel": "频道",
"message": "消息", "message": "消息",
"receive_message": "已接收消息 {total} 条", "receive_message": "已接收消息 {total} 条",
"always_show_last": "自动滚到最新" "always_show_last": "总是显示最新"
} }
} }

View File

@ -456,7 +456,7 @@
"copy_log": "複製日誌", "copy_log": "複製日誌",
"save_log": "儲存日誌", "save_log": "儲存日誌",
"clean_log": "清空日誌", "clean_log": "清空日誌",
"always_show_last": "自動捲動到最新" "always_show_last": "總是顯示最新"
}, },
"pubsub": { "pubsub": {
"title": "發佈訂閱", "title": "發佈訂閱",
@ -469,6 +469,6 @@
"channel": "頻道", "channel": "頻道",
"message": "訊息", "message": "訊息",
"receive_message": "已接收訊息 {total} 條", "receive_message": "已接收訊息 {total} 條",
"always_show_last": "自動捲動到最新" "always_show_last": "總是顯示最新"
} }
} }

View File

@ -1,4 +1,4 @@
import { isEmpty, remove, size, sumBy } from 'lodash' import { isEmpty, remove, size, sortedIndexBy, sumBy } from 'lodash'
import { ConnectionType } from '@/consts/connection_type.js' import { ConnectionType } from '@/consts/connection_type.js'
/** /**
@ -68,46 +68,6 @@ export class RedisNodeItem {
}) })
} }
/**
* compare two items to determine the sort order
* @param {*} a
* @param {*} b
* @return {number}
*/
_sortingCompare(a, b) {
if (a.type !== b.type) {
return a.type - b.type
}
const isANum = isNaN(a.label)
const isBNum = isNaN(b.label)
if (!isANum && !isBNum) {
return parseInt(a.label, 10) - parseInt(b.label, 10)
} else if (!isANum) {
return -1
} else if (!isBNum) {
return 1
}
return a.label.localeCompare(b.label)
}
/**
* calculate insert sorted index
* @param {[]} arr
* @param {*} item
* @return {number}
*/
_sortedIndex(arr, item) {
for (let i = 0; i < arr.length; i++) {
const cmpResult = this._sortingCompare(arr[i], item)
if (cmpResult > 0) {
return i
} else if (cmpResult === 0) {
return i + 1
}
}
return arr.length
}
/** /**
* sort all node item's children and calculate keys count * sort all node item's children and calculate keys count
* @param skipSort skip sorting children * @param skipSort skip sorting children
@ -138,7 +98,9 @@ export class RedisNodeItem {
} }
sortChildren() { sortChildren() {
this.children.sort(this._sortingCompare) this.children.sort((a, b) => {
return a.key > b.key ? 1 : -1
})
} }
/** /**
@ -150,7 +112,7 @@ export class RedisNodeItem {
if (!!!sorted) { if (!!!sorted) {
this.children.push(child) this.children.push(child)
} else { } else {
const idx = this._sortedIndex(this.children, child) const idx = sortedIndexBy(this.children, child, 'key')
this.children.splice(idx, 0, child) this.children.splice(idx, 0, child)
} }
} }