Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchengbin committed Apr 9, 2020
1 parent 3a1d784 commit 0950f4c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,4 @@ redis管理客户端, 基于GO语言+Electron开发, 支持常见的数据结
## TODO ##
- [ ] ~~键搜索, tree组件无法提供, 暂时不添加功能~~
- [ ] 替换类库为(https://github.com/zserge/lorca), 精简文件大小与依赖
- [ ] 切换连接清空cli的输入内容(暴露全局命令行对象)
- [ ] zset list hash set 数据切换时内容未清空. hash读取内容发现出现[object jobect]内容

42 changes: 31 additions & 11 deletions src/RedisManager/pages/MainPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<Content :style="{ height: '100%', background: '#fff', borderLeft: '1px solid #ccc'}">
<div v-if="currentConnectionId && currentDbIndex > -1 && typeof tabs[getTabsKey()] !== 'undefined' && !isEmptyObj(tabs[getTabsKey()]['keys'])" :style="{height: '100%' }">
<Tabs @on-tab-remove="handleTabRemove" type="card" :value="currentKey" :animated="false" :style="{ background: '#fff', height: '100%' }">
<TabPane v-for="(data, key) in tabs[getTabsKey()]['keys']" closable :name="key" :key="key" :label="currentConnection + '::DB' + currentDbIndex + '::' + key" >
<TabPane v-for="(data, key) in tabs[getTabsKey()]['keys']" closable :name="key" :key="key" :label="key" >
<Row type="flex">
<Col span="12">
<Input v-model="key" readonly>
Expand Down Expand Up @@ -332,7 +332,7 @@
</Modal>

<Modal v-model="showJsonModal" fullscreen footer-hide :title="getTerminalTitle()" :on-visible-change="showJsonModalOkClick">
<VueTerminal v-bind:id="currentConnectionId"
<VueTerminal ref="child" v-bind:id="currentConnectionId"
@command="onCliCommand"
console-sign="redis-cli $" style="height: 100%; font-size:14px"></VueTerminal>
</Modal>
Expand Down Expand Up @@ -668,10 +668,12 @@
}
},
getRowData (data, index) {
console.log('getRowData', data, index)
let fullValue = typeof data.fullValue === 'object' ? data.fullValue.value : data.fullValue
this.currentSelectRowData = {
value: data.fullValue,
value: fullValue,
key: data.key,
oldValue: data.fullValue,
oldValue: fullValue,
index: index
}
},
Expand Down Expand Up @@ -734,7 +736,6 @@
if (!type) {
type = data.data.type
}
console.log(data, key, data)
let rowIndex = null
let newRowValue = data.newRowValue
let newRowKey = data.newRowKey
Expand All @@ -761,7 +762,13 @@
rowIndex = this.currentSelectRowData.index
newRowKey = this.currentSelectRowData.key
newRowValue = this.currentSelectRowData.value
this.$set(data.data, this.currentSelectRowData.index, type === 'zset' ? {
console.log('this.currentSelectRowData', this.currentSelectRowData)
if (!newRowValue) {
this.$Message.error('请设置要操作Key / Value')
return
}
this.$set(data.data, type === 'hash' ? this.currentSelectRowData.key : this.currentSelectRowData.index, type === 'zset' ? {
'score': newRowKey,
'value': newRowValue
} : newRowValue)
Expand Down Expand Up @@ -789,10 +796,13 @@
this.ttlModal = false
this.$Message.success(res.msg)
if (action === 'addrow') {
data.data.data.push(type === 'zset' ? {
'score': newRowKey,
'value': data.newRowValue
} : data.newRowValue)
if (type === 'hash') {
data.data.data[newRowKey] = data.newRowValue
} else if (type === 'zset') {
data.data.data.push({'score': newRowKey, 'value': data.newRowValue})
} else {
data.data.data.push(data.newRowValue)
}
}
}
})
Expand Down Expand Up @@ -908,6 +918,8 @@
} else {
this.currentKey = key
}
// 清空输入框数据
this.currentSelectRowData = {}
},
formatItem (type, data) {
let res = []
Expand Down Expand Up @@ -976,7 +988,7 @@
},
{
title: '',
width: 160,
width: 400,
key: 'value'
},
{
Expand Down Expand Up @@ -1591,6 +1603,14 @@
])
])
}
},
watch: {
currentConnectionId: (newVal) => {
window.document.querySelector('#terminal .content').innerHTML = ''
},
currentDbIndex: (newVal) => {
window.document.querySelector('#terminal .content').innerHTML = ''
}
}
}
</script>
Expand Down
3 changes: 3 additions & 0 deletions src/vue-terminal-ui/src/VueTerminal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export default {
methods: {
toggleWaiting () {
this.waiting = !this.waiting
},
clear () {
this.$ptty.run_command('clear', false)
}
},
mounted () {
Expand Down

0 comments on commit 0950f4c

Please sign in to comment.