Skip to content

Commit 8c55fe0

Browse files
committed
[pull/692] - fix tests, fix json display value
1 parent 661697a commit 8c55fe0

File tree

5 files changed

+166
-168
lines changed

5 files changed

+166
-168
lines changed

redisinsight/ui/src/pages/browser/components/rejson-details/JSONScalar/JSONScalar.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ const JSONScalar = (props: Props) => {
5858
path = keyName.includes('"') ? `${parentPath}['${keyName}']` : `${parentPath}["${keyName}"]`
5959
}
6060

61-
let changedValue = value
61+
let val = value
6262
if (value === null) {
63-
changedValue = JSON.stringify(value)
63+
val = JSON.stringify(value)
6464
}
6565
if (typeof value === 'string') {
66-
changedValue = `"${value}"`
66+
val = `"${value}"`
6767
}
6868

69-
setChangedValue(changedValue)
69+
setChangedValue(val)
7070
setPath(path)
71-
}, [parentPath, keyName])
71+
}, [parentPath, keyName, value])
7272

7373
const validateJSONValue = (value: JSONScalarValue) => {
7474
let error: string = ''
@@ -208,7 +208,7 @@ const JSONScalar = (props: Props) => {
208208
updateLoading={false}
209209
showPopover={(item) => setDeleting(`${item}scalar`)}
210210
handleDeleteItem={() => handleSubmitRemoveKey(path, keyName.toString())}
211-
/>
211+
/>
212212
</div>
213213
</div>
214214
</div>

redisinsight/ui/src/pages/browser/components/rejson-details/RejsonDetailsWrapper.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ const RejsonDetailsWrapper = () => {
6868

6969
return (
7070
<div className={`${[styles.container].join(' ')}`}>
71-
{loading ? (
71+
{loading && (
7272
<EuiProgress
7373
color="primary"
7474
size="xs"
7575
position="absolute"
7676
data-testid="progress-key-json"
7777
/>
78-
) : (
78+
)}
79+
{!(loading && data === undefined) && (
7980
<RejsonDetails
8081
selectedKey={selectedKey}
8182
dbNumber={0}

redisinsight/ui/src/slices/browser/rejson.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
2-
import { cloneDeep } from 'lodash'
32
import axios, { CancelTokenSource } from 'axios'
43
import * as jsonpath from 'jsonpath'
54

@@ -20,8 +19,8 @@ import {
2019
RemoveRejsonRlResponse,
2120
} from 'apiSrc/modules/browser/dto/rejson-rl.dto'
2221

23-
import { InitialStateRejson } from '../interfaces'
2422
import { refreshKeyInfoAction } from './keys'
23+
import { InitialStateRejson } from '../interfaces'
2524
import { addErrorNotification, addMessageNotification } from '../app/notifications'
2625
import { AppDispatch, RootState } from '../store'
2726

@@ -30,7 +29,7 @@ export const initialState: InitialStateRejson = {
3029
error: '',
3130
data: {
3231
downloaded: false,
33-
data: null,
32+
data: undefined,
3433
type: '',
3534
},
3635
}

0 commit comments

Comments
 (0)