File tree 1 file changed +5
-20
lines changed
web/src/pages/app/storages/mods/CreateBucketModal
1 file changed +5
-20
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ function CreateBucketModal(props: { storage?: TBucket; children: React.ReactElem
41
41
storage : parseInt ( storage ?. spec . storage || "" , 10 ) ,
42
42
} ;
43
43
44
+ const maxStorage = store . maxStorage + ( defaultValues . storage || 0 ) ;
44
45
const { register, handleSubmit, reset, setFocus } = useForm < {
45
46
shortName : string ;
46
47
policy : string ;
@@ -116,29 +117,17 @@ function CreateBucketModal(props: { storage?: TBucket; children: React.ReactElem
116
117
</ FormControl >
117
118
118
119
< FormControl isRequired >
119
- < FormLabel htmlFor = "storage" >
120
- 容量(最大容量
121
- { defaultValues . storage
122
- ? store . maxStorage + defaultValues . storage
123
- : store . maxStorage }
124
- GB)
125
- </ FormLabel >
120
+ < FormLabel htmlFor = "storage" > 容量(最大容量{ maxStorage } GB)</ FormLabel >
126
121
< InputGroup >
127
122
< Input
128
123
{ ...register ( "storage" , {
129
124
required : true ,
130
- max : defaultValues . storage
131
- ? store . maxStorage + defaultValues . storage
132
- : store . maxStorage ,
125
+ max : maxStorage ,
133
126
min : 0 ,
134
127
} ) }
135
128
type = "number"
136
129
min = "0"
137
- max = {
138
- defaultValues . storage
139
- ? store . maxStorage + defaultValues . storage
140
- : store . maxStorage
141
- }
130
+ max = { maxStorage }
142
131
variant = "filled"
143
132
className = "w-1"
144
133
/>
@@ -153,11 +142,7 @@ function CreateBucketModal(props: { storage?: TBucket; children: React.ReactElem
153
142
{ t ( "Common.Dialog.Cancel" ) }
154
143
</ Button >
155
144
< Button
156
- disabled = {
157
- ( defaultValues . storage
158
- ? store . maxStorage + defaultValues . storage
159
- : store . maxStorage ) === 0
160
- }
145
+ disabled = { maxStorage === 0 }
161
146
colorScheme = "blue"
162
147
type = "submit"
163
148
onClick = { handleSubmit ( onSubmit ) }
You can’t perform that action at this time.
0 commit comments