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