Skip to content

Commit f59aa75

Browse files
author
fuyoo
committed
update
1 parent 43eb2fb commit f59aa75

File tree

13 files changed

+164
-42
lines changed

13 files changed

+164
-42
lines changed

src-tauri/src/api/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ struct KeyParam {
7070
// here,we provide a query function,to do all query from frontend.
7171
async fn do_query(connection_info: ConnectionImpl, data: &str) -> Result<Response<String>> {
7272
let param = extract::<Vec<String>>(data)?;
73+
// just print log in debug environment
74+
if cfg!(debug_assertions) {
75+
println!("cmd param: {:#?}", param);
76+
}
7377
let mut cmd_ = cmd(param.get(0).unwrap());
7478
for (_, v) in param.iter().skip(1).enumerate() {
7579
cmd_.arg(v);

src-tauri/src/api/rdb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ pub fn convert_to_string(ori: Value) -> Result<String> {
7777
}
7878
s
7979
}
80-
Value::Status(_) => "".to_string(),
81-
Value::Okay => "".to_string(),
80+
Value::Status(s) => s.to_string(),
81+
Value::Okay => "okey".to_string(),
8282
};
8383
Ok(v)
8484
}

src/pages/host/components/CoDatabase/CoInfomation/index.vue

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/pages/host/components/CoDatabase/CoDbs.vue renamed to src/pages/host/components/CoDatabase/components/CoDatabase/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { useReqStore } from "@/stores/req";
2+
import { useReqStore } from "@/stores/req.ts";
33
import { ElDropdown, ElDropdownMenu, ElDropdownItem, ElButton } from "element-plus"
44
import { ref } from "vue";
55
import { useRoute, useRouter } from "vue-router";
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script setup lang="ts">
2+
3+
</script>
4+
5+
<template>
6+
7+
</template>
8+
9+
<style scoped lang="scss">
10+
11+
</style>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<script setup lang="ts">
2+
import { useReqStore } from '@/stores/req.ts'
3+
import { reactive, ref, watch } from 'vue'
4+
5+
const prop = defineProps<{ value?: string }>()
6+
const vModel = defineModel()
7+
const vSizeModel = defineModel('size')
8+
const reqStore = useReqStore()
9+
const baseInfo = reactive({
10+
type: '',
11+
memory: '',
12+
pttl: '',
13+
})
14+
const fetchInfo = async () => {
15+
const t = await reqStore.reqWithHost<string>({
16+
path: '/cmd',
17+
data: ['type', prop.value],
18+
})
19+
baseInfo.type = t.data
20+
vModel.value = t.data
21+
const mem = await reqStore.reqWithHost<string>({
22+
path: '/cmd',
23+
data: ['memory','usage',prop.value]
24+
})
25+
baseInfo.memory = mem.data
26+
vSizeModel.value = mem.data
27+
const pttl = await reqStore.reqWithHost<string>({
28+
path: '/cmd',
29+
data: ['pttl', prop.value]
30+
})
31+
baseInfo.pttl = pttl.data
32+
}
33+
fetchInfo()
34+
watch(() => prop.value, () => {
35+
fetchInfo()
36+
})
37+
</script>
38+
39+
<template>
40+
<div class="b-b b-b-dashed b-b-#eee p-4 gap-2 flex">
41+
<b>{{ value }}</b>
42+
<q-badge><i class="i-iconamoon:type-bold mr-1"></i> {{baseInfo.type.toUpperCase()}}</q-badge>
43+
<q-badge> <i class="i-material-symbols:memory-alt mr-1"></i> {{baseInfo.memory}}bytes</q-badge>
44+
<q-badge>
45+
<i class="i-material-symbols:nest-clock-farsight-analog-outline"></i>TTL
46+
{{baseInfo.pttl+'ms'}}
47+
</q-badge>
48+
</div>
49+
</template>
50+
51+
<style scoped lang="scss">
52+
53+
</style>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<script setup lang="ts">
2+
import { computed, defineAsyncComponent, ref } from 'vue'
3+
4+
defineProps<{ value?: string }>()
5+
import CoInfoHeader from "@/pages/host/components/CoDatabase/components/CoInfoHeader/index.vue"
6+
import type { RedisKeyType } from '@/types.ts'
7+
import { ElEmpty } from 'element-plus'
8+
const keyType = ref<RedisKeyType>("")
9+
const typeView = computed(() => {
10+
switch (keyType.value) {
11+
case "string":
12+
return defineAsyncComponent(() => import("@/pages/host/components/CoDatabase/components/CoString/index.vue"))
13+
case "hash":
14+
return defineAsyncComponent(() => import("@/pages/host/components/CoDatabase/components/CoHash/index.vue"))
15+
case "list":
16+
return defineAsyncComponent(() => import("@/pages/host/components/CoDatabase/components/CoList/index.vue"))
17+
case "set":
18+
return defineAsyncComponent(() => import("@/pages/host/components/CoDatabase/components/CoSet/index.vue"))
19+
case "zset": return ElEmpty
20+
default:
21+
return ElEmpty
22+
}
23+
})
24+
const size = ref<string>()
25+
</script>
26+
27+
<template>
28+
<div class="w-full h-full">
29+
<co-info-header :value="value" v-model="keyType" v-model:size="size"/>
30+
<component :is="typeView" :value="value" :size="size"/>
31+
</div>
32+
</template>
33+
34+
<style scoped lang="scss"></style>

src/pages/host/components/CoDatabase/CoKeys.vue renamed to src/pages/host/components/CoDatabase/components/CoKeys/index.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { useReqStore } from '@/stores/req'
2+
import { useReqStore } from '@/stores/req.ts'
33
import { onMounted, reactive, ref, shallowRef } from 'vue'
44
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
55
import { ElTreeV2, type TreeNode,ElButton } from 'element-plus'
@@ -144,8 +144,8 @@ const loadMoreFn = () => {
144144
}
145145
</script>
146146
<template>
147-
<div class="_mc flex flex-col flex-1 justify-start items-start">
148-
<div class="p-2 flex justify-center items-start flex-row">
147+
<div class="_mc w-full flex flex-col flex-1 justify-start items-start">
148+
<div class="p-2 flex justify-center items-start flex-row w-full">
149149
<input type="text" class="flex-1 outline-none" v-model="search.match" />
150150
</div>
151151
<div class="flex-1 w-full" ref="treeBoxRef">
@@ -156,6 +156,7 @@ const loadMoreFn = () => {
156156
v-if="nameSpaceEnable"
157157
ref="elTreeV2Ref"
158158
:data="noSearchKeyData"
159+
class="w-full"
159160
:props="{
160161
value: 'id',
161162
label: 'label',
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script setup lang="ts">
2+
3+
</script>
4+
5+
<template>
6+
7+
</template>
8+
9+
<style scoped lang="scss">
10+
11+
</style>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<script setup lang="ts">
2+
3+
</script>
4+
5+
<template>
6+
7+
</template>
8+
9+
<style scoped lang="scss">
10+
11+
</style>

0 commit comments

Comments
 (0)