Skip to content

Commit 620e770

Browse files
author
xiusin
committed
add paginator for list,set...
1 parent 418e18a commit 620e770

11 files changed

Lines changed: 64 additions & 161 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ node_modules
2626
frontend/dist
2727
vbuild
2828
rdm
29+
dump.rdb
2930

.idea/codeStyles/Project.xml

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

.idea/codeStyles/codeStyleConfig.xml

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

.idea/inspectionProfiles/Project_Default.xml

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

.idea/modules.xml

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

.idea/vcs.xml

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

.idea/workspace.xml

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

.vscode/settings.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"cSpell.words": [
3-
"slowlog"
3+
"addrow",
4+
"childs",
5+
"dblist",
6+
"HGETALL",
7+
"llen",
8+
"removekey",
9+
"rowkey",
10+
"SCARD",
11+
"slowlog",
12+
"WITHSCORES",
13+
"ZCARD",
14+
"ZRANGEBYSCORE",
15+
"zset"
416
]
517
}

TODO.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
- [ ] 连接服务器时需要校验是否需要auth信息
66
- [ ] list / set / stream等数据优化
77
- [ ] list / hash / zset编辑
8+
- [ ] list / set / stream查询请求后端

frontend/src/RedisManager/pages/MainPage.vue

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
</Content>
9393
<Layout>
9494
<Content
95-
:style="!isQtWebView() ? { height: '100%', background: '#fff', borderLeft: '1px solid #ccc' } : { height: '100%', background: '#fff' }">
95+
:style="!isQtWebView() ? { height: '100%', minWidth: '800px', background: '#fff', borderLeft: '1px solid #ccc' } : { height: '100%', background: '#fff' }">
9696
<Spin size="large" fix v-if="keyLoading && isQtWebView()">
9797
<span style="color: firebrick; font-size: 16px;">正在读取: {{ currentLoadingKey }}</span>
9898
</Spin>
@@ -134,26 +134,24 @@
134134
</div>
135135
<div v-else style="margin-top: 4px; height: 100%">
136136
<Row type="flex">
137-
<Col span="16">
137+
<Col span="18">
138138
<Table :highlightRow="true" @on-row-click="getRowData" ref="currentRowTable"
139-
border height="370" :columns="getColumns(data.type)"
140-
:data="formatItem(data.type, data.data)" />
139+
border height="470" :columns="getColumns(data.type)"
140+
:data="formatItem(data.type, data.data, data.current, data.size)" />
141141
</Col>
142-
<Col span="8">
143-
<Card style="height:370px;border-left: none;" dis-hover>
142+
<Col span="6">
143+
<Card style="height:470px;border-left: none;" dis-hover>
144144
<p slot="title">
145145
操作
146146
</p>
147-
<ButtonGroup style="width: 100%;">
148-
<Button style="width: 33%">
149-
<Icon type="chevron-left"></Icon>
150-
上一页
151-
</Button>
152-
<Button style="float:right;width: 33%">
153-
下一页
154-
<Icon type="chevron-right"></Icon>
155-
</Button>
156-
</ButtonGroup>
147+
<div style="text-align: center;">
148+
<Alert v-if="data.count > data.size" type="warning">共有{{ data.count
149+
}}条,本次仅返回{{ data.size }}条</Alert>
150+
<Page :current="data.current" :page-size="data.size" :total="data.count"
151+
:transfer="true" @on-change="(page) => changePage(page, data)"
152+
simple>
153+
</Page>
154+
</div>
157155
<br />
158156
<br />
159157
<Button long @click="addRow(key, data)">插入行</Button>
@@ -590,6 +588,9 @@ export default {
590588
}
591589
},
592590
methods: {
591+
changePage(page, data) {
592+
data.current = page
593+
},
593594
showMoveKeyModal(key) {
594595
this.moveKey.modal = true
595596
this.moveKey.key = key
@@ -943,7 +944,6 @@ export default {
943944
rowIndex = this.currentSelectRowData.index
944945
newRowKey = this.currentSelectRowData.key
945946
newRowValue = this.currentSelectRowData.value
946-
// console.log('this.currentSelectRowData', this.currentSelectRowData)
947947
if (!newRowValue) {
948948
this.$Message.error('请设置要操作Key / Value')
949949
return
@@ -1072,7 +1072,6 @@ export default {
10721072
let node = nodes[0]
10731073
10741074
const childs = this.$refs[node.title].at(0).$el.parentElement.childNodes
1075-
console.log(childs)
10761075
for (let i in childs) {
10771076
try {
10781077
childs[i].style.backgroundColor = '#fff'
@@ -1127,7 +1126,10 @@ export default {
11271126
this.currentKey = key
11281127
this.currentSelectRowData = {}
11291128
},
1130-
formatItem(type, data) {
1129+
formatItem(type, data, page) {
1130+
if (!page) page = 1
1131+
const size = 50
1132+
const offset = (page - 1) * size
11311133
let res = []
11321134
const strlen = 80
11331135
switch (type) {
@@ -1176,7 +1178,7 @@ export default {
11761178
}
11771179
}
11781180
}
1179-
return res.slice(0, 200)
1181+
return res.slice(offset, offset + size)
11801182
},
11811183
getColumns(type) {
11821184
let cols = []
@@ -1194,7 +1196,7 @@ export default {
11941196
key: 'key'
11951197
},
11961198
{
1197-
title: ' (性能考虑,默认显示200条,请使用查询)',
1199+
title: '',
11981200
key: 'value'
11991201
}
12001202
]
@@ -1225,7 +1227,7 @@ export default {
12251227
align: 'center'
12261228
},
12271229
{
1228-
title: ' (性能考虑,默认显示200条,请使用查询)',
1230+
title: '',
12291231
width: 400,
12301232
key: 'value'
12311233
},
@@ -1245,7 +1247,7 @@ export default {
12451247
align: 'center'
12461248
},
12471249
{
1248-
title: ' (性能考虑,默认显示200条,请使用查询)',
1250+
title: '',
12491251
key: 'value'
12501252
}
12511253
]

0 commit comments

Comments
 (0)