Compare commits

..

No commits in common. "3057012710d4686a05a69a45d4cc3898249985c1" and "30835ac46953beb87f18421063885bf796558db9" have entirely different histories.

12 changed files with 28 additions and 95 deletions

View File

@ -2,7 +2,6 @@ package types
const FORMAT_RAW = "Raw"
const FORMAT_JSON = "JSON"
const FORMAT_UNICODE_JSON = "Unicode JSON"
const FORMAT_YAML = "YAML"
const FORMAT_XML = "XML"
const FORMAT_HEX = "Hex"

View File

@ -15,7 +15,6 @@ type DataConvert interface {
var (
jsonConv JsonConvert
uniJsonConv UnicodeJsonConvert
yamlConv YamlConvert
xmlConv XmlConvert
base64Conv Base64Convert
@ -31,12 +30,11 @@ var (
)
var BuildInFormatters = map[string]DataConvert{
types.FORMAT_JSON: jsonConv,
types.FORMAT_UNICODE_JSON: uniJsonConv,
types.FORMAT_YAML: yamlConv,
types.FORMAT_XML: xmlConv,
types.FORMAT_HEX: hexConv,
types.FORMAT_BINARY: binaryConv,
types.FORMAT_JSON: jsonConv,
types.FORMAT_YAML: yamlConv,
types.FORMAT_XML: xmlConv,
types.FORMAT_HEX: hexConv,
types.FORMAT_BINARY: binaryConv,
}
var BuildInDecoders = map[string]DataConvert{

View File

@ -1,43 +0,0 @@
package convutil
import (
"bytes"
"encoding/json"
"strings"
)
type UnicodeJsonConvert struct{}
func (UnicodeJsonConvert) Enable() bool {
return true
}
func (UnicodeJsonConvert) Decode(str string) (string, bool) {
trimedStr := strings.TrimSpace(str)
if strings.HasPrefix(trimedStr, "{") && strings.HasSuffix(trimedStr, "}") {
var obj map[string]any
if err := json.Unmarshal([]byte(trimedStr), &obj); err == nil {
var out []byte
if out, err = json.MarshalIndent(obj, "", " "); err == nil {
return string(out), true
}
}
} else if strings.HasPrefix(trimedStr, "[") && strings.HasSuffix(trimedStr, "]") {
var arr []any
if err := json.Unmarshal([]byte(trimedStr), &arr); err == nil {
var out []byte
if out, err = json.MarshalIndent(arr, "", " "); err == nil {
return string(out), true
}
}
}
return str, false
}
func (UnicodeJsonConvert) Encode(str string) (string, bool) {
var dst bytes.Buffer
if err := json.Compact(&dst, []byte(str)); err != nil {
return str, false
}
return dst.String(), true
}

View File

@ -94,7 +94,6 @@ const enableSave = computed(() => {
const viewLanguage = computed(() => {
switch (viewAs.format) {
case formatTypes.JSON:
case formatTypes.UNICODE_JSON:
return 'json'
case formatTypes.YAML:
return 'yaml'

View File

@ -107,17 +107,17 @@ const fieldColumn = computed(() => ({
},
}))
const isCode = computed(() => {
return props.format === formatTypes.JSON || props.format === formatTypes.UNICODE_JSON
const displayCode = computed(() => {
return props.format === formatTypes.JSON
})
// const valueFilterOption = ref(null)
const valueColumn = computed(() => ({
key: 'value',
title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : 'center',
align: displayCode.value ? 'left' : 'center',
titleAlign: 'center',
resizable: true,
ellipsis: isCode.value
ellipsis: displayCode.value
? false
: {
tooltip: {
@ -137,7 +137,7 @@ const valueColumn = computed(() => ({
// return !!~row.v.indexOf(value.toString())
// },
render: (row) => {
if (isCode.value) {
if (displayCode.value) {
return h('pre', {}, row.dv || row.v)
}
return row.dv || row.v

View File

@ -77,16 +77,16 @@ const inEdit = computed(() => {
})
const fullEdit = ref(false)
const isCode = computed(() => {
return props.format === formatTypes.JSON || props.format === formatTypes.UNICODE_JSON
const displayCode = computed(() => {
return props.format === formatTypes.JSON
})
const valueFilterOption = ref(null)
const valueColumn = computed(() => ({
key: 'value',
title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : 'center',
align: displayCode.value ? 'left' : 'center',
titleAlign: 'center',
ellipsis: isCode.value
ellipsis: displayCode.value
? false
: {
tooltip: {
@ -106,7 +106,7 @@ const valueColumn = computed(() => ({
return !!~row.v.indexOf(value.toString())
},
render: (row) => {
if (isCode.value) {
if (displayCode.value) {
return h('pre', {}, row.dv || row.v)
}
return row.dv || row.v

View File

@ -76,16 +76,16 @@ const inEdit = computed(() => {
})
const fullEdit = ref(false)
const isCode = computed(() => {
return props.format === formatTypes.JSON || props.format === formatTypes.UNICODE_JSON
const displayCode = computed(() => {
return props.format === formatTypes.JSON
})
const valueFilterOption = ref(null)
const valueColumn = computed(() => ({
key: 'value',
title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : 'center',
align: displayCode.value ? 'left' : 'center',
titleAlign: 'center',
ellipsis: isCode.value
ellipsis: displayCode.value
? false
: {
tooltip: {
@ -105,7 +105,7 @@ const valueColumn = computed(() => ({
return !!~row.v.indexOf(value.toString())
},
render: (row) => {
if (isCode.value) {
if (displayCode.value) {
return h('pre', {}, row.dv || row.v)
}
return row.dv || row.v

View File

@ -47,7 +47,6 @@ const keyType = redisTypes.STRING
const viewLanguage = computed(() => {
switch (viewAs.format) {
case formatTypes.JSON:
case formatTypes.UNICODE_JSON:
return 'json'
case formatTypes.YAML:
return 'yaml'

View File

@ -124,17 +124,17 @@ const scoreColumn = computed(() => ({
},
}))
const isCode = computed(() => {
return props.format === formatTypes.JSON || props.format === formatTypes.UNICODE_JSON
const displayCode = computed(() => {
return props.format === formatTypes.JSON
})
const valueFilterOption = ref(null)
const valueColumn = computed(() => ({
key: 'value',
title: () => i18n.t('common.value'),
align: isCode.value ? 'left' : 'center',
align: displayCode.value ? 'left' : 'center',
titleAlign: 'center',
resizable: true,
ellipsis: isCode.value
ellipsis: displayCode.value
? false
: {
tooltip: {
@ -155,7 +155,7 @@ const valueColumn = computed(() => ({
},
// sorter: (row1, row2) => row1.value - row2.value,
render: (row) => {
if (isCode.value) {
if (displayCode.value) {
return h('pre', {}, row.dv || row.v)
}
return row.dv || row.v

View File

@ -1,18 +0,0 @@
<script setup>
const props = defineProps({
strokeWidth: {
type: [Number, String],
default: 3,
},
})
</script>
<template>
<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
:stroke-width="props.strokeWidth"
d="M8 2H1L9.26086 13.0145L1.44995 21.9999H4.09998L10.4883 14.651L16 22H23L14.3917 10.5223L21.8001 2H19.1501L13.1643 8.88578L8 2ZM17 20L5 4H7L19 20H17Z"></path>
</svg>
</template>
<style lang="scss" scoped></style>

View File

@ -16,7 +16,6 @@ import useBrowserStore from 'stores/browser.js'
import { useRender } from '@/utils/render.js'
import wechatUrl from '@/assets/images/wechat_official.png'
import QRCode from '@/components/icons/QRCode.vue'
import Twitter from '@/components/icons/Twitter.vue'
const themeVars = useThemeVars()
const render = useRender()
@ -174,12 +173,13 @@ const exThemeVars = computed(() => {
@click="openWechatOfficial" />
<icon-button
v-else
:icon="Twitter"
:border="false"
:size="iconSize"
class="nav-menu-button"
t-tooltip="ribbon.follow_x"
@click="openX" />
@click="openX">
<span style="font-weight: bold; font-size: 24px">𝕏</span>
</icon-button>
<icon-button
:icon="Github"
:size="iconSize"

View File

@ -5,7 +5,6 @@
export const formatTypes = {
RAW: 'Raw',
JSON: 'JSON',
UNICODE_JSON: 'Unicode JSON',
YAML: 'YAML',
XML: 'XML',
HEX: 'Hex',