fix: create key error
This commit is contained in:
parent
d66d7c9a49
commit
ed1b9d9b54
|
@ -685,6 +685,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||||
}
|
}
|
||||||
|
|
||||||
var data types.KeyDetail
|
var data types.KeyDetail
|
||||||
|
data.KeyType = strings.ToLower(keyType)
|
||||||
//var cursor uint64
|
//var cursor uint64
|
||||||
matchPattern := param.MatchPattern
|
matchPattern := param.MatchPattern
|
||||||
if len(matchPattern) <= 0 {
|
if len(matchPattern) <= 0 {
|
||||||
|
@ -728,7 +729,7 @@ func (b *browserService) GetKeyDetail(param types.KeyDetailParam) (resp types.JS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch strings.ToLower(keyType) {
|
switch data.KeyType {
|
||||||
case "string":
|
case "string":
|
||||||
var str string
|
var str string
|
||||||
str, err = client.Get(ctx, key).Result()
|
str, err = client.Get(ctx, key).Result()
|
||||||
|
|
|
@ -31,13 +31,14 @@ type KeyDetailParam struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type KeyDetail struct {
|
type KeyDetail struct {
|
||||||
Value any `json:"value"`
|
Value any `json:"value"`
|
||||||
Length int64 `json:"length,omitempty"`
|
KeyType string `json:"key_type"`
|
||||||
Format string `json:"format,omitempty"`
|
Length int64 `json:"length,omitempty"`
|
||||||
Decode string `json:"decode,omitempty"`
|
Format string `json:"format,omitempty"`
|
||||||
Match string `json:"match,omitempty"`
|
Decode string `json:"decode,omitempty"`
|
||||||
Reset bool `json:"reset"`
|
Match string `json:"match,omitempty"`
|
||||||
End bool `json:"end"`
|
Reset bool `json:"reset"`
|
||||||
|
End bool `json:"end"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetKeyParam struct {
|
type SetKeyParam struct {
|
||||||
|
|
|
@ -135,6 +135,7 @@ const onAdd = async () => {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value = defaultValue[type]
|
value = defaultValue[type]
|
||||||
}
|
}
|
||||||
|
// await browserStore.reloadKey({server, db, key: trim(key)})
|
||||||
const { success, msg, nodeKey } = await browserStore.setKey({
|
const { success, msg, nodeKey } = await browserStore.setKey({
|
||||||
server,
|
server,
|
||||||
db,
|
db,
|
||||||
|
@ -147,7 +148,7 @@ const onAdd = async () => {
|
||||||
// select current key
|
// select current key
|
||||||
await nextTick()
|
await nextTick()
|
||||||
tabStore.setSelectedKeys(server, nodeKey)
|
tabStore.setSelectedKeys(server, nodeKey)
|
||||||
browserStore.loadKeySummary({ server, db, key, clearValue: true })
|
browserStore.reloadKey({ server, db, key })
|
||||||
} else if (!isEmpty(msg)) {
|
} else if (!isEmpty(msg)) {
|
||||||
$message.error(msg)
|
$message.error(msg)
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ const checkedTip = computed(() => {
|
||||||
const onReload = async () => {
|
const onReload = async () => {
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
tabStore.setSelectedKeys(props.server)
|
// tabStore.setSelectedKeys(props.server)
|
||||||
const db = props.db
|
const db = props.db
|
||||||
browserStore.closeDatabase(props.server, db)
|
browserStore.closeDatabase(props.server, db)
|
||||||
|
|
||||||
|
|
|
@ -505,7 +505,15 @@ const useBrowserStore = defineStore('browser', {
|
||||||
lite: true,
|
lite: true,
|
||||||
})
|
})
|
||||||
if (success) {
|
if (success) {
|
||||||
const { value, decode: retDecode, format: retFormat, match: retMatch, reset: retReset, end } = data
|
const {
|
||||||
|
value,
|
||||||
|
keyType,
|
||||||
|
decode: retDecode,
|
||||||
|
format: retFormat,
|
||||||
|
match: retMatch,
|
||||||
|
reset: retReset,
|
||||||
|
end,
|
||||||
|
} = data
|
||||||
tab.updateValue({
|
tab.updateValue({
|
||||||
server,
|
server,
|
||||||
db,
|
db,
|
||||||
|
@ -758,10 +766,10 @@ const useBrowserStore = defineStore('browser', {
|
||||||
serverInst.updateDBKeyCount(db, newKey)
|
serverInst.updateDBKeyCount(db, newKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const tab = useTabStore()
|
// const tab = useTabStore()
|
||||||
tab.updateValue({ server, db, key, value })
|
// tab.updateValue({ server, db, key, value })
|
||||||
|
|
||||||
this.loadKeySummary({ server, db, key })
|
// this.loadKeySummary({ server, db, key })
|
||||||
return {
|
return {
|
||||||
success,
|
success,
|
||||||
nodeKey: `${server}/db${db}#${ConnectionType.RedisValue}/${key}`,
|
nodeKey: `${server}/db${db}#${ConnectionType.RedisValue}/${key}`,
|
||||||
|
|
Loading…
Reference in New Issue