Skip to content

Commit f6859ce

Browse files
author
fuyoo
committed
optimize
1 parent a46bfef commit f6859ce

File tree

6 files changed

+53
-22
lines changed

6 files changed

+53
-22
lines changed

src/pages/host/components/CoKeys/actions.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ const template = {
2323
maskClosable: false,
2424
}
2525
export const addStringKey = (dialog: DialogApiInjection) => {
26-
console.log(dialog)
2726
dialog.create({
2827
...template,
2928
title: "New",
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
<script setup lang="ts">
2-
2+
import { ref } from 'vue'
3+
import CoInfoHeader from '@/pages/host/components/CoInfoHeader/index.vue'
4+
const size = ref('')
35
</script>
46

57
<template>
6-
<div>
7-
8+
<div class="w-full h-full">
9+
<co-info-header v-model:size="size" type="hash">
10+
<n-space>
11+
<n-button type="primary" size="tiny">
12+
<template #icon><i class="i-material-symbols:edit-square-rounded"></i></template>
13+
{{ $t('actions[3]') }}
14+
</n-button>
15+
</n-space>
16+
</co-info-header>
817
</div>
918
</template>
1019

11-
<style scoped lang="scss">
12-
13-
</style>
20+
<style scoped lang="scss"></style>

src/pages/host/key-types/co-list/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const { height } = useResize()
9191
:data="records"
9292
:loading="reqStore.reqLoading"
9393
:pagination="pager"
94-
:style="{ height: `${height - 200}px` }"
94+
:style="{ height: `${height - 140}px` }"
9595
flex-height
9696
/>
9797
</div>
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<script setup lang="ts">
2-
2+
import { ref } from 'vue'
3+
import CoInfoHeader from '@/pages/host/components/CoInfoHeader/index.vue'
4+
const size = ref('')
35
</script>
46

57
<template>
6-
<div></div>
8+
<div class="w-full h-full">
9+
<co-info-header v-model:size="size" type="set">
10+
<n-space>
11+
<n-button type="primary" size="tiny">
12+
<template #icon><i class="i-material-symbols:edit-square-rounded"></i></template>
13+
{{ $t('actions[3]') }}
14+
</n-button>
15+
</n-space>
16+
</co-info-header>
17+
</div>
718
</template>
819

9-
<style scoped lang="scss">
10-
11-
</style>
20+
<style scoped lang="scss"></style>
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<script setup lang="ts">
2-
2+
import { ref } from 'vue'
3+
import CoInfoHeader from '@/pages/host/components/CoInfoHeader/index.vue'
4+
const size = ref('')
35
</script>
46

57
<template>
6-
<div></div>
8+
<div class="w-full h-full">
9+
<co-info-header v-model:size="size" type="zset">
10+
<n-space>
11+
<n-button type="primary" size="tiny">
12+
<template #icon><i class="i-material-symbols:edit-square-rounded"></i></template>
13+
{{ $t('actions[3]') }}
14+
</n-button>
15+
</n-space>
16+
</co-info-header>
17+
</div>
718
</template>
819

9-
<style scoped lang="scss">
10-
11-
</style>
20+
<style scoped lang="scss"></style>

src/pages/host/layout.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { computed, ref, shallowRef } from 'vue'
33
import { useRoute, useRouter } from 'vue-router'
44
import { useReqStore } from '@/stores/req.ts'
55
import { useI18n } from 'vue-i18n'
6-
6+
import { db, type ConnectionHost } from '@/db'
77
const router = useRouter()
88
const route = useRoute()
99
const reqStore = useReqStore()
@@ -23,8 +23,16 @@ const tab = computed(() => {
2323
return 'info'
2424
}
2525
})
26+
const selectedDb = ref(Number((route.query.db as string) || -1))
2627
const dbs = shallowRef<Record<string, any>[]>([])
2728
const fetchDbs = async () => {
29+
if (selectedDb.value < 0) {
30+
// fetch host info
31+
const inf = await db.hosts.get<ConnectionHost>(parseInt(route.params.id as string))
32+
// set default db
33+
selectedDb.value = Number(inf?.node?.[0].db || 0)
34+
}
35+
2836
const resp = await reqStore.reqWithHost<string>({
2937
path: '/cmd',
3038
data: ['config', 'get', 'databases']
@@ -35,10 +43,9 @@ const fetchDbs = async () => {
3543
value: i
3644
}))
3745
}
38-
const selectedDb = ref(Number((route.query.db as string) || 0))
3946
fetchDbs()
4047
const reload = async (v: number) => {
41-
if (v == Number(route.query.db || 0)) {
48+
if (v == Number(route.query.db || selectedDb.value)) {
4249
return
4350
}
4451
await router.replace({
@@ -82,7 +89,7 @@ const reload = async (v: number) => {
8289
trigger="click"
8390
>
8491
<span>
85-
<span></span>{{ t('normal.0') }}.{{ route.query.db || 0 }}
92+
<span></span>{{ t('normal.0') }}.{{ route.query.db || selectedDb }}
8693
<i class="i-material-symbols:arrow-drop-down-rounded"></i>
8794
</span>
8895
</n-popselect>

0 commit comments

Comments
 (0)