perf: remove unused parameter in content-slog

This commit is contained in:
Lykin 2024-01-17 15:48:23 +08:00
parent 7fecbc2b53
commit ffed68ae4c
4 changed files with 17 additions and 18 deletions

View File

@ -2456,8 +2456,8 @@ func (b *browserService) CleanCmdHistory() (resp types.JSResp) {
} }
// GetSlowLogs get slow log list // GetSlowLogs get slow log list
func (b *browserService) GetSlowLogs(server string, db int, num int64) (resp types.JSResp) { func (b *browserService) GetSlowLogs(server string, num int64) (resp types.JSResp) {
item, err := b.getRedisClient(server, db) item, err := b.getRedisClient(server, -1)
if err != nil { if err != nil {
resp.Msg = err.Error() resp.Msg = err.Error()
return return

View File

@ -17,6 +17,7 @@ import ContentSlog from '@/components/content_value/ContentSlog.vue'
import { decodeTypes, formatTypes } from '@/consts/value_view_type.js' import { decodeTypes, formatTypes } from '@/consts/value_view_type.js'
import ContentMonitor from '@/components/content_value/ContentMonitor.vue' import ContentMonitor from '@/components/content_value/ContentMonitor.vue'
import { decodeRedisKey } from '@/utils/key_convert.js' import { decodeRedisKey } from '@/utils/key_convert.js'
import ContentPubsub from '@/components/content_value/ContentPubsub.vue'
const themeVars = useThemeVars() const themeVars = useThemeVars()
@ -159,7 +160,7 @@ watch(
</n-tab-pane> </n-tab-pane>
<!-- slow log pane --> <!-- slow log pane -->
<n-tab-pane :name="BrowserTabType.SlowLog.toString()" display-directive="if"> <n-tab-pane :name="BrowserTabType.SlowLog.toString()" display-directive="show:lazy">
<template #tab> <template #tab>
<n-space :size="5" :wrap-item="false" align="center" inline justify="center"> <n-space :size="5" :wrap-item="false" align="center" inline justify="center">
<n-icon size="16"> <n-icon size="16">
@ -171,7 +172,7 @@ watch(
<span>{{ $t('interface.sub_tab.slow_log') }}</span> <span>{{ $t('interface.sub_tab.slow_log') }}</span>
</n-space> </n-space>
</template> </template>
<content-slog :db="tabContent.db" :server="props.server" /> <content-slog :server="props.server" />
</n-tab-pane> </n-tab-pane>
<!-- command monitor pane --> <!-- command monitor pane -->
@ -191,7 +192,7 @@ watch(
</n-tab-pane> </n-tab-pane>
<!-- pub/sub message pane --> <!-- pub/sub message pane -->
<n-tab-pane :disabled="true" :name="BrowserTabType.PubMessage.toString()"> <n-tab-pane :name="BrowserTabType.PubMessage.toString()" display-directive="show:lazy">
<template #tab> <template #tab>
<n-space :size="5" :wrap-item="false" align="center" inline justify="center"> <n-space :size="5" :wrap-item="false" align="center" inline justify="center">
<n-icon size="16"> <n-icon size="16">
@ -203,6 +204,7 @@ watch(
<span>{{ $t('interface.sub_tab.pub_message') }}</span> <span>{{ $t('interface.sub_tab.pub_message') }}</span>
</n-space> </n-space>
</template> </template>
<content-pubsub :server="props.server" />
</n-tab-pane> </n-tab-pane>
</n-tabs> </n-tabs>
</div> </div>

View File

@ -3,7 +3,7 @@ import { computed, h, nextTick, onMounted, onUnmounted, reactive, ref } from 'vu
import Refresh from '@/components/icons/Refresh.vue' import Refresh from '@/components/icons/Refresh.vue'
import { debounce, isEmpty, map, size, split } from 'lodash' import { debounce, isEmpty, map, size, split } from 'lodash'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useThemeVars } from 'naive-ui' import { NIcon, useThemeVars } from 'naive-ui'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import useBrowserStore from 'stores/browser.js' import useBrowserStore from 'stores/browser.js'
import { timeout } from '@/utils/promise.js' import { timeout } from '@/utils/promise.js'
@ -17,10 +17,6 @@ const props = defineProps({
server: { server: {
type: String, type: String,
}, },
db: {
type: Number,
default: 0,
},
}) })
const autoRefresh = reactive({ const autoRefresh = reactive({
@ -127,7 +123,7 @@ const columns = computed(() => [
const _loadSlowLog = () => { const _loadSlowLog = () => {
data.loading = true data.loading = true
browserStore browserStore
.getSlowLog(props.server, props.db, data.listLimit) .getSlowLog(props.server, data.listLimit)
.then((list) => { .then((list) => {
data.list = list || [] data.list = list || []
}) })
@ -194,10 +190,12 @@ const onListLimitChanged = (limit) => {
<template #trigger> <template #trigger>
<n-button :loading="data.loading" circle size="small" tertiary @click="_loadSlowLog"> <n-button :loading="data.loading" circle size="small" tertiary @click="_loadSlowLog">
<template #icon> <template #icon>
<n-icon :size="props.size">
<refresh <refresh
:class="{ 'auto-rotate': autoRefresh.on }" :class="{ 'auto-rotate': autoRefresh.on }"
:color="autoRefresh.on ? themeVars.primaryColor : undefined" :color="autoRefresh.on ? themeVars.primaryColor : undefined"
:stroke-width="autoRefresh.on ? 6 : 3" /> :stroke-width="autoRefresh.on ? 6 : 3" />
</n-icon>
</template> </template>
</n-button> </n-button>
</template> </template>

View File

@ -1884,13 +1884,12 @@ const useBrowserStore = defineStore('browser', {
/** /**
* get slow log list * get slow log list
* @param {string} server * @param {string} server
* @param {number} db
* @param {number} num * @param {number} num
* @return {Promise<[]>} * @return {Promise<[]>}
*/ */
async getSlowLog(server, db, num) { async getSlowLog(server, num) {
try { try {
const { success, data = { list: [] } } = await GetSlowLogs(server, db, num) const { success, data = { list: [] } } = await GetSlowLogs(server, num)
const { list } = data const { list } = data
return list return list
} catch { } catch {