Skip to content

Commit

Permalink
Merge pull request #440 from qishibo/formatviewer
Browse files Browse the repository at this point in the history
msgpack viewer support
  • Loading branch information
qishibo authored Feb 3, 2021
2 parents eb3e726 + 66365c8 commit 38e21d3
Show file tree
Hide file tree
Showing 14 changed files with 70 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Download latest [AppImage](https://github.com/qishibo/AnotherRedisDesktopManager

## Feature Log

- 2021-02-03: Multiple Select\Delete && Msgpack Viewer Support
- 2020-12-30: Tree View Support!!!
- 2020-11-03: Binary View Support && SSH Passparse\Timeout Support
- 2020-09-04: SSH Cluster Support && Extension Commands Support
Expand Down
2 changes: 1 addition & 1 deletion pack/electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "another-redis-desktop-manager",
"version": "1.4.0",
"version": "1.4.1",
"description": "A faster, better and more stable redis desktop manager.",
"author": "qii404.me",
"private": true,
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"sign": "cd pack/mas; bash sign.sh"
},
"dependencies": {
"@msgpack/msgpack": "^2.3.0",
"@ztree/ztree_v3": "^3.5.46",
"element-ui": "^2.4.11",
"font-awesome": "^4.7.0",
Expand Down
4 changes: 3 additions & 1 deletion src/components/FormatViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import ViewerText from '@/components/ViewerText';
import ViewerJson from '@/components/ViewerJson';
import ViewerBinary from '@/components/ViewerBinary';
import ViewerUnserialize from '@/components/ViewerUnserialize';
import ViewerMsgpack from '@/components/ViewerMsgpack';

export default {
data() {
Expand All @@ -38,14 +39,15 @@ export default {
{ value: 'ViewerText', text: 'Text' },
{ value: 'ViewerJson', text: 'Json' },
{ value: 'ViewerBinary', text: 'Binary' },
{ value: 'ViewerMsgpack', text: 'Msgpack' },
{ value: 'ViewerUnserialize', text: 'Unserialize' },
],
selectStyle: {
float: this.float,
},
};
},
components: {ViewerText, ViewerJson, ViewerBinary, ViewerUnserialize},
components: {ViewerText, ViewerJson, ViewerBinary, ViewerUnserialize, ViewerMsgpack},
props: {
float: {default: 'right'},
content: {default: () => Buffer.from('')},
Expand Down
51 changes: 51 additions & 0 deletions src/components/ViewerMsgpack.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<template>
<div class="text-formated-container">
<div class="collapse-container">
<el-button class="collapse-btn" type="text" @click="toggleCollapse">{{ $t('message.' + collapseText) }}</el-button>
</div>
<JsonViewer
v-if='show'
:value="newContent"
:expand-depth="previousDeep"
>
</JsonViewer>
</div>
</template>

<script type="text/javascript">
import JsonViewer from 'vue-json-viewer'
import {decode} from "@msgpack/msgpack";

export default {
data() {
return {
show: true,
previousDeep: 3,
collapseText: 'collapse_all',
};
},
components: {JsonViewer},
props: ['content'],
computed: {
newContent() {
try {
return decode(this.content);
} catch (e) {
return this.$t('message.msgpack_format_failed');
}
},
},
methods: {
toggleCollapse() {
this.previousDeep = this.previousDeep ? 0 : Infinity;
this.collapseText = this.previousDeep ? 'collapse_all' : 'expand_all';

// reload json tree
this.show = false;
this.$nextTick(() => {
this.show = true;
});
},
},
}
</script>
1 change: 1 addition & 0 deletions src/i18n/langs/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const cn = {
collapse_all: '全部折叠',
expand_all: '全部展开',
json_format_failed: 'Json 格式化失败',
msgpack_format_failed: 'Msgpack 格式化失败',
php_unserialize_format_failed: 'PHP Unserialize 格式化失败',
clean_up: '清空',
redis_console: 'Redis 控制台',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const de = {
collapse_all: 'Alle einklappen',
expand_all: 'Alle ausklappen',
json_format_failed: 'Json parsen fehlgeschlagen',
msgpack_format_failed: 'Msgpack parsen fehlgeschlagen',
php_unserialize_format_failed: 'PHP Unserialisieren fehlgeschlagen',
clean_up: 'Bereinigen',
redis_console: 'Redis Konsole',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const en = {
collapse_all: 'Collapse All',
expand_all: 'Expand All',
json_format_failed: 'Json Parse Failed',
msgpack_format_failed: 'Msgpack Parse Failed',
php_unserialize_format_failed: 'PHP Unserialize Failed',
clean_up: 'Clean Up',
redis_console: 'Redis Console',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const fr = {
collapse_all: 'Tout fermer',
expand_all: 'Tout étendre',
json_format_failed: 'Échec de l\'analyse du JSON',
msgpack_format_failed: 'Échec de l\'analyse du Msgpack',
php_unserialize_format_failed: 'Échec de la désérialisation PHP',
clean_up: 'Nettoyer',
redis_console: 'Console Redis',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/pt.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const pt = {
collapse_all: 'Recolher todos',
expand_all: 'Expandir todos',
json_format_failed: 'Falha na análise do JSON',
msgpack_format_failed: 'Falha na análise do Msgpack',
php_unserialize_format_failed: 'Falha na desserialização do PHP',
clean_up: 'Limpar',
redis_console: 'Console do Redis',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const ru = {
collapse_all: 'Свернуть все',
expand_all: 'Развернуть все',
json_format_failed: 'Не удалось форматировать в JSON',
msgpack_format_failed: 'Не удалось форматировать в Msgpack',
php_unserialize_format_failed: 'PHP Unserialize форматирование не удалось',
clean_up: 'Очистить',
redis_console: 'Redis console',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const tr = {
collapse_all: 'Hepsini Daralt',
expand_all: 'Hepsini Genişlet',
json_format_failed: 'Json Ayrıştırma Başarısız Oldu',
msgpack_format_failed: 'Msgpack Ayrıştırma Başarısız Oldu',
php_unserialize_format_failed: 'PHP Serileştirmesi Başarısız Oldu',
clean_up: 'Pırıl Pırıl Yap',
redis_console: 'Redis Konsolu',
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const tw = {
collapse_all: '全部摺疊',
expand_all: '全部展開',
json_format_failed: 'JSON 格式化失敗',
msgpack_format_failed: 'Msgpack 格式化失敗',
php_unserialize_format_failed: 'PHP Unserialize 格式化失敗',
clean_up: '清空',
redis_console: 'Redis 控制台',
Expand Down

0 comments on commit 38e21d3

Please sign in to comment.