]);
export const formatInputData = (inputs: CommandInputParameter[], auth: AuthState): ProcessIOParameter[] => {
- return inputs.map(input => {
- return {
- id: getIOParamId(input),
- label: input.label || "",
- value: getIOParamDisplayValue(auth, input),
- };
+ return inputs.flatMap((input): ProcessIOParameter[] => {
+ const processValues = getIOParamDisplayValue(auth, input);
+ return processValues.map((thisValue, i) => ({
+ id: i === 0 ? getIOParamId(input) : "",
+ label: i === 0 ? input.label || "" : "",
+ value: thisValue,
+ }));
});
};
pdh: string | undefined,
auth: AuthState
): ProcessIOParameter[] => {
- return definitions.map(output => {
- return {
- id: getIOParamId(output),
- label: output.label || "",
- value: getIOParamDisplayValue(auth, Object.assign(output, { value: values[getIOParamId(output)] || [] }), pdh),
- };
+ return definitions.flatMap((output): ProcessIOParameter[] => {
+ const processValues = getIOParamDisplayValue(auth, Object.assign(output, { value: values[getIOParamId(output)] || [] }), pdh);
+ return processValues.map((thisValue, i) => ({
+ id: i === 0 ? getIOParamId(output) : "",
+ label: i === 0 ? output.label || "" : "",
+ value: thisValue,
+ }));
});
};
</Grid>
)}
{/* Once loaded, either raw or params may still be empty
- * Raw when all params are empty
- * Params when raw is provided by containerRequest properties but workflow mount is absent for preview
- */}
+ * Raw when all params are empty
+ * Params when raw is provided by containerRequest properties but workflow mount is absent for preview
+ */}
{!loading && (hasRaw || hasParams) && (
<>
<Tabs
export type ProcessIOParameter = {
id: string;
label: string;
- value: ProcessIOValue[];
+ value: ProcessIOValue;
};
interface ProcessIOPreviewDataProps {
</TableRow>
</TableHead>
<TableBody>
- {data.map((param: ProcessIOParameter) => {
- const firstVal = param.value.length > 0 ? param.value[0] : undefined;
- const rest = param.value.slice(1);
- const mainRowClasses = {
- [classes.noBorderRow]: rest.length > 0,
- [classes.primaryRow]: true
- };
-
- return (
- <React.Fragment key={param.id}>
- <TableRow
- className={classNames(mainRowClasses)}
- data-cy="process-io-param"
- >
- <TableCell>{param.id}</TableCell>
- {showLabel && <TableCell>{param.label}</TableCell>}
- <TableCell>
- {firstVal && (
- <ProcessValuePreview
- value={firstVal}
- showImagePreview={showImagePreview}
- />
- )}
- </TableCell>
- <TableCell className={firstVal?.imageUrl ? classes.rowWithPreview : undefined}>
- <Typography className={classes.paramValue}>{firstVal?.collection}</Typography>
- </TableCell>
- </TableRow>
- {rest.map((val, i) => {
- const rowClasses = {
- [classes.noBorderRow]: i < rest.length - 1,
- [classes.secondaryRow]: val.secondary,
- [classes.primaryRow]: !val.secondary,
- };
- return (
- <TableRow
- className={classNames(rowClasses)}
- key={i}
- >
- <TableCell />
- {showLabel && <TableCell />}
- <TableCell>
- <ProcessValuePreview
- value={val}
- showImagePreview={showImagePreview}
- />
- </TableCell>
- <TableCell className={firstVal?.imageUrl ? classes.rowWithPreview : undefined}>
- <Typography className={classes.paramValue}>{val.collection}</Typography>
- </TableCell>
- </TableRow>
- );
- })}
- </React.Fragment>
- );
- })}
</TableBody>
</Table>
);