Skip to content

Commit cd5b364

Browse files
committed
#RIVS-202 - No TREE_VIEW_KEY_DETAILS_REFRESH_CLICKED event
1 parent 03089c4 commit cd5b364

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

redisinsight/ui/src/pages/browser/modules/key-details/components/rejson-details/rejson-details/RejsonDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const RejsonDetails = (props: BaseProps) => {
4040
}
4141

4242
const handleSetRejsonDataAction = (keyName: RedisResponseBuffer, path: string, data: string) => {
43-
dispatch(setReJSONDataAction(keyName, path, data, length))
43+
dispatch(setReJSONDataAction(keyName, path, data, false, length))
4444
}
4545

4646
const handleFormSubmit = ({ key, value }: { key?: string, value: string }) => {

redisinsight/ui/src/pages/browser/modules/key-details/components/rejson-details/rejson-scalar/RejsonScalar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const RejsonScalar = (props: JSONScalarProps) => {
5050
return
5151
}
5252

53-
dispatch<any>(setReJSONDataAction(selectedKey, path, String(value), () => setEditing(false)))
53+
dispatch<any>(setReJSONDataAction(selectedKey, path, String(value), true, undefined, () => setEditing(false)))
5454
}
5555

5656
return (

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
22
import axios, { AxiosError, CancelTokenSource } from 'axios'
3-
import * as jsonpath from 'jsonpath'
43

54
import { isNumber } from 'lodash'
65
import { ApiEndpoints } from 'uiSrc/constants'
@@ -176,6 +175,7 @@ export function setReJSONDataAction(
176175
key: RedisResponseBuffer,
177176
path: string,
178177
data: string,
178+
isEditMode: boolean,
179179
length?: number,
180180
onSuccessAction?: () => void,
181181
onFailAction?: () => void
@@ -199,7 +199,6 @@ export function setReJSONDataAction(
199199

200200
if (isStatusSuccessful(status)) {
201201
try {
202-
const isEditMode = jsonpath.query(state.browser.rejson?.data?.data, `$..${path}`).length > 0
203202
sendEventTelemetry({
204203
event: getBasedOnViewTypeEvent(
205204
state.browser.keys?.viewType,

redisinsight/ui/src/telemetry/telemetryUtils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55
import isGlob from 'is-glob'
66
import { cloneDeep } from 'lodash'
7-
import * as jsonpath from 'jsonpath'
7+
import jsonpath from 'jsonpath'
88
import { isRedisearchAvailable } from 'uiSrc/utils'
99
import { ApiEndpoints, KeyTypes } from 'uiSrc/constants'
1010
import { KeyViewType } from 'uiSrc/slices/interfaces/keys'
@@ -66,10 +66,10 @@ const getJsonPathLevel = (path: string): string => {
6666
return 'root'
6767
}
6868
const levelsLength = jsonpath.parse(
69-
`$${path.startsWith('.') ? '' : '..'}${path}`,
69+
`$${path.startsWith('.') ? '.' : '..'}${path}`,
7070
).length
7171

72-
return levelsLength === 1 ? 'root' : `${levelsLength - 2}`
72+
return levelsLength === 2 ? 'root' : `${levelsLength - 2}`
7373
} catch (e) {
7474
return 'root'
7575
}

0 commit comments

Comments
 (0)