File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
src/components/databrowser/components/display Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -65,14 +65,24 @@ const ListEditForm = ({
65
65
< form onSubmit = { onSubmit } className = "flex flex-col gap-2" >
66
66
< div className = "flex grow flex-col gap-2" >
67
67
{ type !== "list" && (
68
- < FormItem name = "key" height = { type === "set" ? 250 : 100 } label = { keyLabel } />
68
+ < FormItem
69
+ readOnly = { type === "stream" }
70
+ name = "key"
71
+ height = { type === "set" ? 250 : 100 }
72
+ label = { keyLabel }
73
+ />
69
74
) }
70
75
71
76
{ type === "zset" ? (
72
77
< NumberFormItem name = "value" label = { valueLabel } />
73
78
) : (
74
79
type !== "set" && (
75
- < FormItem name = "value" height = { type === "list" ? 250 : 100 } label = { valueLabel } />
80
+ < FormItem
81
+ readOnly = { type === "stream" }
82
+ name = "value"
83
+ height = { type === "list" ? 250 : 100 }
84
+ label = { valueLabel }
85
+ />
76
86
)
77
87
) }
78
88
</ div >
@@ -131,18 +141,21 @@ const FormItem = ({
131
141
name,
132
142
label,
133
143
height,
144
+ readOnly,
134
145
} : {
135
146
name : string
136
147
label : string
137
148
isNumber ?: boolean
138
149
height ?: number
150
+ readOnly ?: boolean
139
151
} ) => {
140
152
const form = useFormContext ( )
141
153
const { editor, selector } = useField ( {
142
154
name,
143
155
form,
144
156
height : height ,
145
157
showCopyButton : true ,
158
+ readOnly,
146
159
} )
147
160
148
161
return (
Original file line number Diff line number Diff line change @@ -10,12 +10,14 @@ export const CustomEditor = ({
10
10
onChange,
11
11
height,
12
12
showCopyButton,
13
+ readOnly,
13
14
} : {
14
15
language : string
15
16
value : string
16
17
onChange : ( value : string ) => void
17
18
height ?: number
18
19
showCopyButton ?: boolean
20
+ readOnly ?: boolean
19
21
} ) => {
20
22
const monaco = useMonaco ( )
21
23
const editorRef = useRef ( )
@@ -48,6 +50,7 @@ export const CustomEditor = ({
48
50
} }
49
51
defaultLanguage = { language }
50
52
options = { {
53
+ readOnly : readOnly ,
51
54
wordWrap : "on" ,
52
55
overviewRulerBorder : false ,
53
56
overviewRulerLanes : 0 ,
Original file line number Diff line number Diff line change @@ -9,11 +9,13 @@ export const useField = ({
9
9
form,
10
10
height,
11
11
showCopyButton,
12
+ readOnly,
12
13
} : {
13
14
name : string
14
15
form : UseFormReturn < any >
15
16
height ?: number
16
17
showCopyButton ?: boolean
18
+ readOnly ?: boolean
17
19
} ) => {
18
20
const { field, fieldState } = useController < Record < string , string > > ( {
19
21
name,
@@ -60,6 +62,7 @@ export const useField = ({
60
62
onChange = { field . onChange }
61
63
height = { height }
62
64
showCopyButton = { showCopyButton }
65
+ readOnly = { readOnly }
63
66
/>
64
67
</ >
65
68
) ,
You can’t perform that action at this time.
0 commit comments