diff --git a/README.md b/README.md index ed2d51757..1ae87eb19 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ ## Feature Log -- 2024-06-06: Search connections support(>=4) +- 2024-10-07: Hash field TTL support(Redis>=7.4) +- 2024-06-06: Search connections support - 2024-04-10: DB custom name support - 2024-02-21: Java/Pickle viewers support - 2024-02-15: Groups/Consumers in STREAM view diff --git a/README.zh-CN.md b/README.zh-CN.md index 5d06d2bfb..d6d503486 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -52,7 +52,8 @@ ## 里程碑 -- 2024-06-06: 搜索链接支持(>=4) +- 2024-10-07: Hash键值支持TTL(Redis>=7.4) +- 2024-06-06: 搜索链接支持 - 2024-04-10: DB自定义名称支持 - 2024-02-21: Java/Pickle解码视图支持 - 2024-02-15: STEAM支持查看群组和消费者 diff --git a/pack/electron/package.json b/pack/electron/package.json index 564f15bf1..ae1242592 100644 --- a/pack/electron/package.json +++ b/pack/electron/package.json @@ -1,6 +1,6 @@ { "name": "another-redis-desktop-manager", - "version": "1.6.7", + "version": "1.6.8", "description": "A faster, better and more stable redis desktop manager.", "author": "Another", "private": true, diff --git a/src/components/Status.vue b/src/components/Status.vue index bcfcf9726..0833ac044 100644 --- a/src/components/Status.vue +++ b/src/components/Status.vue @@ -114,7 +114,7 @@ - +
@@ -123,9 +123,10 @@
@@ -137,62 +138,20 @@ - - - - - - - -
-
-
- - - - - -
- - {{ $t('message.key_statistics') }} -
- - - - - @@ -246,17 +205,13 @@ export default { refreshTimer: null, refreshInterval: 2000, connectionStatus: {}, - statusConnection: null, allInfoFilter: '', - clusterKeysInfo: [], + DBKeys: [], }; }, props: ['client', 'hotKeyScope'], components: { ScrollToTop }, computed: { - DBKeys() { - return this.initDbKeys(this.connectionStatus); - }, AllRedisInfo() { const infos = []; const filter = this.allInfoFilter.toLowerCase(); @@ -278,12 +233,24 @@ export default { return infos; }, + isCluster() { + return this.connectionStatus['cluster_enabled'] == '1'; + }, }, methods: { initShow() { this.client.info().then((reply) => { this.connectionStatus = this.initStatus(reply); + // set global param this.client.ardmRedisVersion = this.connectionStatus['redis_version']; + + // init db keys info + if (this.isCluster) { + this.initClusterKeys(); + } + else { + this.DBKeys = this.initDbKeys(this.connectionStatus); + } }).catch((e) => { // info command may be disabled if (e.message.includes('unknown command')) { @@ -297,9 +264,6 @@ export default { this.$message.error(e.message); } }); - - // if cluster, init keys count in master nodes - this.initClusterKeys(); }, refreshInit() { this.refreshTimer && clearInterval(this.refreshTimer); @@ -346,15 +310,21 @@ export default { // fix #1101 unexpected db prefix // if (i.startsWith('db')) { if (/^db\d+/.test(i)) { - const item = status[i]; - const array = item.split(','); + const array = status[i].split(','); + + const keys = parseInt(array[0] ? array[0].split('=')[1]: NaN); + const expires = parseInt(array[1] ? array[1].split('=')[1] : NaN); + const avg_ttl = parseInt(array[2] ? array[2].split('=')[1] : NaN); - const keyCount = array[0] ? array[0].split('=')[1]: NaN; + // #1261 locale to the key count dbs.push({ db: i, - keys: isNaN(keyCount)? NaN: parseInt(keyCount).toLocaleString(), - expires: array[1] ? array[1].split('=')[1] : NaN, - avg_ttl: array[2] ? array[2].split('=')[1] : NaN, + keys, + expires, + avg_ttl, + keys_show: keys.toLocaleString(), + expires_show: expires.toLocaleString(), + avg_ttl_show: avg_ttl.toLocaleString(), name, }); } @@ -363,10 +333,10 @@ export default { return dbs; }, initClusterKeys() { + // const nodes = this.client.nodes('master'); const nodes = this.client.nodes ? this.client.nodes('master') : [this.client]; - // not in cluster mode - if (nodes.length < 2) { + if (!nodes || !nodes.length) { return; } @@ -391,13 +361,13 @@ export default { const keys = this.initDbKeys(this.initStatus(reply), name); // clear only when first reply, avoid jitter - if (this.clusterKeysInfo.length === nodes.length) { - this.clusterKeysInfo = []; + if (this.DBKeys.length === nodes.length) { + this.DBKeys = []; } - this.clusterKeysInfo = this.clusterKeysInfo.concat(keys); + this.DBKeys = this.DBKeys.concat(keys); // sort by node name - this.clusterKeysInfo.sort((a, b) => (a.name > b.name ? 1 : -1)); + this.DBKeys.sort((a, b) => (a.name > b.name ? 1 : -1)); }).catch((e) => { this.$message.error(e.message); });