Skip to content

Commit 6048674

Browse files
committed
fix: disable Generate button when required fields are not filled
1 parent 11a3936 commit 6048674

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

packages/ui/src/views/docstore/DocStoreInputHandler.jsx

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,20 @@ const DocStoreInputHandler = ({ inputParam, data, disabled = false, onNodeDataCh
4141

4242
const handleDataChange = ({ inputParam, newValue }) => {
4343
data.inputs[inputParam.name] = newValue
44-
const allowedShowHideInputTypes = ['boolean', 'asyncOptions', 'asyncMultiOptions', 'options', 'multiOptions']
44+
const allowedShowHideInputTypes = [
45+
'boolean',
46+
'asyncOptions',
47+
'asyncMultiOptions',
48+
'options',
49+
'multiOptions',
50+
'string',
51+
'password',
52+
'number',
53+
'code',
54+
'json',
55+
'datagrid',
56+
'array'
57+
]
4558
if (allowedShowHideInputTypes.includes(inputParam.type) && nodeDataChangeHandler) {
4659
nodeDataChangeHandler({ nodeId: data.id, inputParam, newValue })
4760
}
@@ -157,7 +170,7 @@ const DocStoreInputHandler = ({ inputParam, data, disabled = false, onNodeDataCh
157170
<File
158171
disabled={disabled}
159172
fileType={inputParam.fileType || '*'}
160-
onChange={(newValue) => (data.inputs[inputParam.name] = newValue)}
173+
onChange={(newValue) => handleDataChange({ inputParam, newValue })}
161174
value={data.inputs[inputParam.name] ?? inputParam.default ?? 'Choose a file to upload'}
162175
/>
163176
)}
@@ -174,7 +187,7 @@ const DocStoreInputHandler = ({ inputParam, data, disabled = false, onNodeDataCh
174187
columns={inputParam.datagrid}
175188
hideFooter={true}
176189
rows={data.inputs[inputParam.name] ?? JSON.stringify(inputParam.default) ?? []}
177-
onChange={(newValue) => (data.inputs[inputParam.name] = newValue)}
190+
onChange={(newValue) => handleDataChange({ inputParam, newValue })}
178191
/>
179192
)}
180193
{inputParam.type === 'code' && (
@@ -199,15 +212,15 @@ const DocStoreInputHandler = ({ inputParam, data, disabled = false, onNodeDataCh
199212
key={data.inputs[inputParam.name]}
200213
disabled={disabled}
201214
inputParam={inputParam}
202-
onChange={(newValue) => (data.inputs[inputParam.name] = newValue)}
215+
onChange={(newValue) => handleDataChange({ inputParam, newValue })}
203216
value={data.inputs[inputParam.name] ?? inputParam.default ?? ''}
204217
nodeId={data.id}
205218
/>
206219
)}
207220
{inputParam.type === 'json' && (
208221
<JsonEditorInput
209222
disabled={disabled}
210-
onChange={(newValue) => (data.inputs[inputParam.name] = newValue)}
223+
onChange={(newValue) => handleDataChange({ inputParam, newValue })}
211224
value={data.inputs[inputParam.name] ?? inputParam.default ?? ''}
212225
isDarkMode={customization.isDarkMode}
213226
/>

0 commit comments

Comments
 (0)