From 52490cb304e75d94eb5ad8380222dfef2d58d86c Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Sat, 2 Dec 2023 02:43:37 +0800 Subject: [PATCH] feat: add loaded progress for list/hash/set/zset/stream --- .../components/content_value/ContentValueHash.vue | 15 +++++++++++++++ .../components/content_value/ContentValueList.vue | 15 +++++++++++++++ .../components/content_value/ContentValueSet.vue | 15 +++++++++++++++ .../content_value/ContentValueStream.vue | 15 +++++++++++++++ .../components/content_value/ContentValueZSet.vue | 15 +++++++++++++++ frontend/src/components/sidebar/BrowserPane.vue | 2 +- 6 files changed, 76 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/content_value/ContentValueHash.vue b/frontend/src/components/content_value/ContentValueHash.vue index bd8b242..8f71b81 100644 --- a/frontend/src/components/content_value/ContentValueHash.vue +++ b/frontend/src/components/content_value/ContentValueHash.vue @@ -280,6 +280,11 @@ const entries = computed(() => { return `${len} / ${Math.max(len, props.length)}` }) +const loadProgress = computed(() => { + const len = size(props.value) + return (len * 100) / Math.max(len, props.length) +}) + const onAddRow = () => { dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, props.keyCode, types.HASH) } @@ -355,6 +360,16 @@ defineExpose({ {{ $t('interface.add_row') }} + +
{ return `${len} / ${Math.max(len, props.length)}` }) +const loadProgress = computed(() => { + const len = size(props.value) + return (len * 100) / Math.max(len, props.length) +}) + const onAddValue = (value) => { dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, props.keyCode, types.LIST) } @@ -332,6 +337,16 @@ defineExpose({ {{ $t('interface.add_row') }}
+ +
{ return `${len} / ${Math.max(len, props.length)}` }) +const loadProgress = computed(() => { + const len = size(props.value) + return (len * 100) / Math.max(len, props.length) +}) + const onAddValue = (value) => { dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, props.keyCode, types.SET) } @@ -329,6 +334,16 @@ defineExpose({ {{ $t('interface.add_row') }}
+ +
{ return `${len} / ${Math.max(len, props.length)}` }) +const loadProgress = computed(() => { + const len = size(props.value) + return (len * 100) / Math.max(len, props.length) +}) + const onAddRow = () => { dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, props.keyCode, types.STREAM) } @@ -215,6 +220,16 @@ defineExpose({ {{ $t('interface.add_row') }}
+ +
{ return `${len} / ${Math.max(len, props.length)}` }) +const loadProgress = computed(() => { + const len = size(props.value) + return (len * 100) / Math.max(len, props.length) +}) + const onAddRow = () => { dialogStore.openAddFieldsDialog(props.name, props.db, props.keyPath, props.keyCode, types.ZSET) } @@ -366,6 +371,16 @@ defineExpose({ {{ $t('interface.add_row') }}
+ +
{ if (db.maxKeys <= 0) { return 100 } - return (db.keys * 100) / db.maxKeys + return (db.keys * 100) / Math.max(db.keys, db.maxKeys) }) const onReload = async () => {