Skip to content

Commit 5ddf711

Browse files
committed
[GPhL] Add possibility to handle textarea
fix default nested ternary rendering Fix textarea typo
1 parent 591b03b commit 5ddf711

File tree

1 file changed

+57
-17
lines changed

1 file changed

+57
-17
lines changed

ui/src/containers/GphlWorkflowParametersDialog.jsx

+57-17
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,44 @@ function GphlWorkflowParametersDialog(props) {
251251
} mb-5`}
252252
>
253253
<div className={`${styles.title} p-2`}>
254-
{ui_schema[rowKey]['ui:title'] ||
255-
schema.properties.indexing_solution?.title ||
256-
null}
254+
{rowKey === 'reffiles'
255+
? schema.properties.reffiles?.title
256+
: rowKey === 'indexing_solution'
257+
? schema.properties.indexing_solution?.title
258+
: ui_schema[rowKey]['ui:title']}
257259
</div>
258260
<Row>
259-
{ui_schema[rowKey]['ui:order'] ? (
260-
ui_schema[rowKey]['ui:order'].map((ColKey) => (
261+
{rowKey === 'indexing_solution' ? (
262+
ui_schema[rowKey]['ui:widget']?.includes('table') &&
263+
renderIndexingTable(
264+
ui_schema[rowKey][uiOptions],
265+
selected,
266+
onSelectRow,
267+
)
268+
) : rowKey === 'reffiles' ? (
269+
// Specific textarea for "reffiles"
270+
schema.properties.reffiles.type === 'textarea' && (
271+
<Form.Control
272+
name="reffiles"
273+
id="reffiles"
274+
onChange={(e) => handleChange(e)}
275+
data-highlight={
276+
schema.properties.reffiles.highlight || undefined
277+
}
278+
type={schema.properties.reffiles.type}
279+
as="textarea"
280+
required
281+
defaultValue={formState.reffiles}
282+
readOnly={schema.properties.reffiles.readOnly}
283+
disabled={schema.properties.reffiles.readOnly}
284+
/>
285+
)
286+
) : rowKey === '_info' ? (
287+
<pre className="p-2">
288+
{schema.properties[rowKey].default}
289+
</pre>
290+
) : (
291+
ui_schema[rowKey]['ui:order']?.map((ColKey) => (
261292
<Col key={ColKey} sm>
262293
{ui_schema[rowKey][ColKey]['ui:order'].map(
263294
(fieldKey) => (
@@ -301,6 +332,27 @@ function GphlWorkflowParametersDialog(props) {
301332
),
302333
)}
303334
</Form.Select>
335+
) : // Generic any other textarea
336+
schema.properties[fieldKey].type ===
337+
'textarea' ? (
338+
<Form.Control
339+
name={fieldKey}
340+
id={fieldKey}
341+
onChange={(e) => handleChange(e)}
342+
data-highlight={
343+
schema.properties[fieldKey].highlight ||
344+
undefined
345+
}
346+
type={schema.properties[fieldKey].type}
347+
as="textarea"
348+
defaultValue={formState[fieldKey]}
349+
readOnly={
350+
schema.properties[fieldKey].readOnly
351+
}
352+
disabled={
353+
schema.properties[fieldKey].readOnly
354+
}
355+
/>
304356
) : (
305357
<Form.Control
306358
name={fieldKey}
@@ -339,18 +391,6 @@ function GphlWorkflowParametersDialog(props) {
339391
)}
340392
</Col>
341393
))
342-
) : ui_schema[rowKey]['ui:widget'] ? (
343-
ui_schema[rowKey]['ui:widget'].includes('table') ? (
344-
renderIndexingTable(
345-
ui_schema[rowKey][uiOptions],
346-
selected,
347-
onSelectRow,
348-
)
349-
) : null
350-
) : (
351-
<pre className="p-2">
352-
{schema.properties[rowKey].default}
353-
</pre>
354394
)}
355395
</Row>
356396
</div>

0 commit comments

Comments
 (0)