inputProps?: InputProps;
deletable?: boolean;
orderable?: boolean;
+ disabled?: boolean;
}
type CssRules = 'chips' | 'input' | 'inputContainer';
return <div className={classes.chips}>
<Chips
{...props}
+ clickable={!props.disabled}
values={value}
filler={<div ref={this.filler} />}
/>
{...InputProps}
value={this.state.text}
onChange={this.setText}
+ disabled={this.props.disabled}
onKeyDown={this.handleKeyPress}
inputProps={{
...(InputProps && InputProps.inputProps),
import * as React from 'react';
import { Chip, Grid, StyleRulesCallback, withStyles } from '@material-ui/core';
import { DragSource, DragSourceSpec, DragSourceCollector, ConnectDragSource, DropTarget, DropTargetSpec, DropTargetCollector, ConnectDropTarget } from 'react-dnd';
-import { compose, noop } from 'lodash/fp';
+import { compose } from 'lodash/fp';
import { WithStyles } from '@material-ui/core/styles';
interface ChipsProps<Value> {
values: Value[];
deletable?: boolean;
orderable?: boolean;
onChange: (value: Value[]) => void;
+ clickable?: boolean;
}
type CssRules = 'root';
onDelete={this.props.deletable
? this.deleteValue(value)
: undefined}
+ clickable={this.props.clickable}
label={this.props.getLabel ?
this.props.getLabel(value)
: typeof value === 'object'
doc?: string | string[];
default?: Value;
type?: Type | Array<Type | CWLType.NULL>;
+ value?: Value;
+ disabled?: boolean;
}
export type GenericArrayCommandInputParameter<Type, Value> = GenericCommandInputParameter<CommandInputArraySchema<Type>, Value[]>;
import { dialogActions } from '~/store/dialog/dialog-actions';
import { RootState } from '~/store/store';
import { Dispatch } from 'redux';
-import { getProcess } from '~/store/processes/process';
+import { getProcess, Process } from '~/store/processes/process';
export const PROCESS_INPUT_DIALOG_NAME = 'processInputDialog';
-export interface ProcessInputDialogData {
-}
-
export const openProcessInputDialog = (processUuid: string) =>
(dispatch: Dispatch<any>, getState: () => RootState) => {
const process = getProcess(processUuid)(getState().resources);
if (process) {
- const data: ProcessInputDialogData = { process };
+ const data: Process = process;
dispatch(dialogActions.OPEN_DIALOG({ id: PROCESS_INPUT_DIALOG_NAME, data }));
}
};
\ No newline at end of file
import { Dialog, DialogActions, Button, CardHeader, DialogContent } from '@material-ui/core';
import { WithDialogProps } from '~/store/dialog/with-dialog';
import { withDialog } from "~/store/dialog/with-dialog";
-import { PROCESS_INPUT_DIALOG_NAME, ProcessInputDialogData } from '~/store/processes/process-input-actions';
+import { PROCESS_INPUT_DIALOG_NAME } from '~/store/processes/process-input-actions';
+import { RunProcessInputsForm } from "~/views/run-process-panel/run-process-inputs-form";
export const ProcessInputDialog = withDialog(PROCESS_INPUT_DIALOG_NAME)(
- (props: WithDialogProps<ProcessInputDialogData>) =>
+ (props: WithDialogProps<any>) =>
<Dialog
open={props.open}
maxWidth={false}
<CardHeader
title="Inputs - Pipeline template that generates a config file from a template" />
<DialogContent>
- cos
+ <RunProcessInputsForm inputs={getInputs(props.data.containerRequest)} />
</DialogContent>
<DialogActions>
<Button
</Button>
</DialogActions>
</Dialog>
-);
\ No newline at end of file
+);
+
+const getInputs = (data: any) =>
+ data && data.mounts.varLibCwlWorkflowJson ? data.mounts.varLibCwlWorkflowJson.content.graph[1].inputs.map((it: any) => (
+ { type: it.type, id: it.id, label: it.label, value: getValue(it.id, data.mounts.varLibCwlCwlInputJson.content), disabled: true }
+ )) : [];
+
+const getValue = (id: string, data: any) => {
+ switch (id) {
+ case "#main/example_flag":
+ return data.exampleFlag;
+ case "#main/example_directory":
+ return data.exampleDirectory;
+ case "#main/example_double":
+ return data.exampleDouble;
+ case "#main/example_file":
+ return data.exampleFile;
+ case "#main/example_float":
+ return data.exampleFloat;
+ case "#main/example_int":
+ return data.exampleInt;
+ case "#main/example_long":
+ return data.exampleLong;
+ case "#main/example_null":
+ return data.exampleNull;
+ case "#main/example_string":
+ return data.exampleString;
+ case "#main/enum_type":
+ return data.enumType;
+ case "#main/multiple_collections":
+ return data.multipleCollections;
+ case "#main/example_string_array":
+ return data.exampleStringArray;
+ case "#main/example_int_array":
+ return data.exampleIntArray;
+ case "#main/example_float_array":
+ return data.exampleFloatArray;
+ case "#main/multiple_files":
+ return data.multipleFiles;
+ case "#main/collection":
+ return data.collection;
+ case "#main/optional_file_missing_label":
+ return data.optionalFileMissingLabel;
+ case "#main/optional_file":
+ return data.optionalFile;
+ case "#main/single_file":
+ return data.singleFile;
+ default:
+ return data.exampleString;
+ }
+};
\ No newline at end of file
export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps;
-export const ProcessPanelRoot = ({process, ...props}: ProcessPanelRootProps) =>
+export const ProcessPanelRoot = ({ process, ...props }: ProcessPanelRootProps) =>
process
? <Grid container spacing={16} alignItems="stretch">
<Grid item sm={12} md={7}>
<ProcessInformationCard
process={process}
- onContextMenu={event => props.onContextMenu(event, process)}
+ onContextMenu={event => props.onContextMenu(event, process)}
openProcessInputDialog={props.openProcessInputDialog} />
</Grid>
<Grid item sm={12} md={5}>
<Switch
color='primary'
checked={props.input.value}
- onChange={() => props.input.onChange(props.input.value)} />;
\ No newline at end of file
+ onChange={() => props.input.onChange(props.input.value)}
+ disabled={props.commandInput.disabled} />;
\ No newline at end of file
this.setState({ open: true });
}
-
closeDialog = () => {
this.setState({ open: false });
}
<ChipsInput
value={this.props.input.value}
onChange={noop}
+ disabled={this.props.commandInput.disabled}
createNewValue={identity}
getLabel={(data: FormattedDirectory) => data.name}
inputComponent={this.textInput} />
{...props}
error={this.props.meta.touched && !!this.props.meta.error}
readOnly
- onClick={this.openDialog}
- onKeyPress={this.openDialog}
- onBlur={this.props.input.onBlur} />
+ onClick={!this.props.commandInput.disabled ? this.openDialog : undefined}
+ onKeyPress={!this.props.commandInput.disabled ? this.openDialog : undefined}
+ onBlur={this.props.input.onBlur}
+ disabled={this.props.commandInput.disabled} />
dialog = () =>
<Dialog
fullWidth
value={props.input.value}
error={props.meta.touched && !!props.meta.error}
- onClick={this.openDialog}
- onKeyPress={this.openDialog} />}
+ disabled={props.commandInput.disabled}
+ onClick={!this.props.commandInput.disabled ? this.openDialog : undefined}
+ onKeyPress={!this.props.commandInput.disabled ? this.openDialog : undefined} />}
{...this.props} />;
}
const type = props.commandInput.type as CommandInputEnumSchema;
return <Select
value={props.input.value}
- onChange={props.input.onChange}>
+ onChange={props.input.onChange}
+ disabled={props.commandInput.disabled} >
{type.symbols.map(symbol =>
<MenuItem key={symbol} value={symbol.split('/').pop()}>
{symbol.split('/').pop()}
this.setState({ open: true });
}
-
closeDialog = () => {
this.setState({ open: false });
}
chipsInput = () =>
<ChipsInput
value={this.props.input.value}
+ disabled={this.props.commandInput.disabled}
onChange={noop}
createNewValue={identity}
getLabel={(file: CollectionFile) => file.name}
{...props}
error={this.props.meta.touched && !!this.props.meta.error}
readOnly
- onClick={this.openDialog}
- onKeyPress={this.openDialog}
+ disabled={this.props.commandInput.disabled}
+ onClick={!this.props.commandInput.disabled ? this.openDialog : undefined}
+ onKeyPress={!this.props.commandInput.disabled ? this.openDialog : undefined}
onBlur={this.props.input.onBlur} />
dialog = () =>
<Input
readOnly
fullWidth
+ disabled={props.commandInput.disabled}
value={props.input.value}
error={props.meta.touched && !!props.meta.error}
- onClick={this.openDialog}
- onKeyPress={this.openDialog} />}
+ onClick={!props.commandInput.disabled ? this.openDialog : undefined}
+ onKeyPress={!props.commandInput.disabled ? this.openDialog : undefined} />}
{...this.props} />;
}
import { ERROR_MESSAGE } from '~/validators/require';
import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input';
import { ChipsInput } from '~/components/chips-input/chips-input';
-import { identity } from 'lodash';
import { createSelector } from 'reselect';
import { FloatInput } from '~/components/float-input/float-input';
class InputComponent extends React.PureComponent<GenericInputProps>{
render() {
+ const { commandInput, input, meta } = this.props;
return <ChipsInput
- deletable
- orderable
- value={this.props.input.value}
+ deletable={!commandInput.disabled}
+ orderable={!commandInput.disabled}
+ disabled={commandInput.disabled}
+ value={input.value}
onChange={this.handleChange}
createNewValue={parseFloat}
inputComponent={FloatInput}
inputProps={{
- error: this.props.meta.error,
+ error: meta.error,
}} />;
}
component={InputComponent}
{...props} />;
-const InputComponent = ({ input, meta }: GenericInputProps) =>
- <FloatInputComponent fullWidth {...input} error={meta.touched && !!meta.error} />;
+const InputComponent = ({ input, meta, commandInput }: GenericInputProps) =>
+ <FloatInputComponent
+ fullWidth
+ error={meta.touched && !!meta.error}
+ disabled={commandInput.disabled}
+ {...input} />;
import * as React from 'react';
import { WrappedFieldProps } from 'redux-form';
-import { FormGroup, FormLabel, Input, FormHelperText, FormControl } from '@material-ui/core';
-import { GenericCommandInputParameter, getInputLabel, isRequiredInput } from '../../../models/workflow';
+import { FormGroup, FormLabel, FormHelperText } from '@material-ui/core';
+import { GenericCommandInputParameter, getInputLabel, isRequiredInput } from '~/models/workflow';
export type GenericInputProps = WrappedFieldProps & {
commandInput: GenericCommandInputParameter<any, any>;
import { ERROR_MESSAGE } from '~/validators/require';
import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input';
import { ChipsInput } from '~/components/chips-input/chips-input';
-import { identity } from 'lodash';
import { createSelector } from 'reselect';
import { IntInput } from '~/components/int-input/int-input';
class InputComponent extends React.PureComponent<GenericInputProps>{
render() {
+ const { commandInput, input, meta } = this.props;
return <ChipsInput
- deletable
- orderable
- value={this.props.input.value}
+ deletable={!commandInput.disabled}
+ orderable={!commandInput.disabled}
+ disabled={commandInput.disabled}
+ value={input.value}
onChange={this.handleChange}
createNewValue={value => parseInt(value, 10)}
inputComponent={IntInput}
inputProps={{
- error: this.props.meta.error,
+ error: meta.error,
}} />;
}
// SPDX-License-Identifier: AGPL-3.0
import * as React from 'react';
-import { IntCommandInputParameter, getInputLabel, isRequiredInput } from '~/models/workflow';
+import { IntCommandInputParameter, isRequiredInput } from '~/models/workflow';
import { Field } from 'redux-form';
import { isInteger } from '~/validators/is-integer';
import { GenericInputProps, GenericInput } from '~/views/run-process-panel/inputs/generic-input';
const Input = (props: GenericInputProps) =>
- <IntInputComponent fullWidth type='number' {...props.input} error={props.meta.touched && !!props.meta.error} />;
+ <IntInputComponent
+ fullWidth
+ type='number'
+ error={props.meta.touched && !!props.meta.error}
+ disabled={props.commandInput.disabled}
+ {...props.input} />;
class InputComponent extends React.PureComponent<GenericInputProps>{
render() {
+ const { commandInput, input, meta } = this.props;
return <ChipsInput
- deletable
- orderable
- value={this.props.input.value}
+ deletable={!commandInput.disabled}
+ orderable={!commandInput.disabled}
+ disabled={commandInput.disabled}
+ value={input.value}
onChange={this.handleChange}
createNewValue={identity}
inputComponent={Input}
inputProps={{
- error: this.props.meta.error,
+ error: meta.error
}} />;
}
{...props} />;
const Input = (props: GenericInputProps) =>
- <MaterialInput fullWidth {...props.input} error={props.meta.touched && !!props.meta.error} />;
\ No newline at end of file
+ <MaterialInput
+ fullWidth
+ error={props.meta.touched && !!props.meta.error}
+ disabled={props.commandInput.disabled}
+ {...props.input} />;
\ No newline at end of file
const initialValuesSelector = createSelector(
inputsSelector,
inputs => inputs.reduce(
- (values, input) => ({ ...values, [input.id]: input.default }),
+ (values, input) => ({ ...values, [input.id]: input.value || input.default }),
{}));
const propsSelector = createStructuredSelector({