[ARVADOS-WORKBENCH2] updated: 1.2.0-805-gbde866a
Git user
git at public.curoverse.com
Thu Nov 8 08:33:47 EST 2018
Summary of changes:
src/components/chips-input/chips-input.tsx | 3 ++
src/components/chips/chips.tsx | 4 +-
src/models/workflow.ts | 2 +
src/store/processes/process-input-actions.ts | 7 +--
.../process-input-dialog/process-input-dialog.tsx | 59 ++++++++++++++++++++--
src/views/process-panel/process-panel-root.tsx | 4 +-
.../run-process-panel/inputs/boolean-input.tsx | 3 +-
.../inputs/directory-array-input.tsx | 9 ++--
.../run-process-panel/inputs/directory-input.tsx | 5 +-
src/views/run-process-panel/inputs/enum-input.tsx | 3 +-
.../run-process-panel/inputs/file-array-input.tsx | 7 +--
src/views/run-process-panel/inputs/file-input.tsx | 5 +-
.../run-process-panel/inputs/float-array-input.tsx | 11 ++--
src/views/run-process-panel/inputs/float-input.tsx | 8 ++-
.../run-process-panel/inputs/generic-input.tsx | 4 +-
.../run-process-panel/inputs/int-array-input.tsx | 11 ++--
src/views/run-process-panel/inputs/int-input.tsx | 9 +++-
.../inputs/string-array-input.tsx | 10 ++--
.../run-process-panel/inputs/string-input.tsx | 6 ++-
.../run-process-panel/run-process-inputs-form.tsx | 2 +-
20 files changed, 125 insertions(+), 47 deletions(-)
via bde866ac574bdf34e17c1d8124f2dc36e854ad3c (commit)
from 95563e85e95cae6a4ef6d2c2137fe1a3533ef8db (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit bde866ac574bdf34e17c1d8124f2dc36e854ad3c
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Thu Nov 8 14:33:32 2018 +0100
disabled-inputs-modal-and-filled-with-proper-values
Feature #14129
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/components/chips-input/chips-input.tsx b/src/components/chips-input/chips-input.tsx
index fc5fda0..1369966 100644
--- a/src/components/chips-input/chips-input.tsx
+++ b/src/components/chips-input/chips-input.tsx
@@ -17,6 +17,7 @@ interface ChipsInputProps<Value> {
inputProps?: InputProps;
deletable?: boolean;
orderable?: boolean;
+ disabled?: boolean;
}
type CssRules = 'chips' | 'input' | 'inputContainer';
@@ -106,6 +107,7 @@ export const ChipsInput = withStyles(styles)(
return <div className={classes.chips}>
<Chips
{...props}
+ clickable={!props.disabled}
values={value}
filler={<div ref={this.filler} />}
/>
@@ -118,6 +120,7 @@ export const ChipsInput = withStyles(styles)(
{...InputProps}
value={this.state.text}
onChange={this.setText}
+ disabled={this.props.disabled}
onKeyDown={this.handleKeyPress}
inputProps={{
...(InputProps && InputProps.inputProps),
diff --git a/src/components/chips/chips.tsx b/src/components/chips/chips.tsx
index 36cf241..75ae00f 100644
--- a/src/components/chips/chips.tsx
+++ b/src/components/chips/chips.tsx
@@ -5,7 +5,7 @@
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[];
@@ -14,6 +14,7 @@ interface ChipsProps<Value> {
deletable?: boolean;
orderable?: boolean;
onChange: (value: Value[]) => void;
+ clickable?: boolean;
}
type CssRules = 'root';
@@ -90,6 +91,7 @@ export const Chips = withStyles(styles)(
onDelete={this.props.deletable
? this.deleteValue(value)
: undefined}
+ clickable={this.props.clickable}
label={this.props.getLabel ?
this.props.getLabel(value)
: typeof value === 'object'
diff --git a/src/models/workflow.ts b/src/models/workflow.ts
index a342dbb..3a38348 100644
--- a/src/models/workflow.ts
+++ b/src/models/workflow.ts
@@ -92,6 +92,8 @@ export interface GenericCommandInputParameter<Type, Value> {
doc?: string | string[];
default?: Value;
type?: Type | Array<Type | CWLType.NULL>;
+ value?: Value;
+ disabled?: boolean;
}
export type GenericArrayCommandInputParameter<Type, Value> = GenericCommandInputParameter<CommandInputArraySchema<Type>, Value[]>;
diff --git a/src/store/processes/process-input-actions.ts b/src/store/processes/process-input-actions.ts
index 7b0ae4c..b67622d 100644
--- a/src/store/processes/process-input-actions.ts
+++ b/src/store/processes/process-input-actions.ts
@@ -5,18 +5,15 @@
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
diff --git a/src/views-components/process-input-dialog/process-input-dialog.tsx b/src/views-components/process-input-dialog/process-input-dialog.tsx
index 96eab1c..a639fa8 100644
--- a/src/views-components/process-input-dialog/process-input-dialog.tsx
+++ b/src/views-components/process-input-dialog/process-input-dialog.tsx
@@ -6,10 +6,11 @@ import * as React from "react";
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}
@@ -17,7 +18,7 @@ export const ProcessInputDialog = withDialog(PROCESS_INPUT_DIALOG_NAME)(
<CardHeader
title="Inputs - Pipeline template that generates a config file from a template" />
<DialogContent>
- cos
+ <RunProcessInputsForm inputs={getInputs(props.data.containerRequest)} />
</DialogContent>
<DialogActions>
<Button
@@ -28,4 +29,54 @@ export const ProcessInputDialog = withDialog(PROCESS_INPUT_DIALOG_NAME)(
</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
diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx
index df0f7a6..52c0f45 100644
--- a/src/views/process-panel/process-panel-root.tsx
+++ b/src/views/process-panel/process-panel-root.tsx
@@ -27,13 +27,13 @@ export interface ProcessPanelRootActionProps {
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}>
diff --git a/src/views/run-process-panel/inputs/boolean-input.tsx b/src/views/run-process-panel/inputs/boolean-input.tsx
index e66ec3d..5da5474 100644
--- a/src/views/run-process-panel/inputs/boolean-input.tsx
+++ b/src/views/run-process-panel/inputs/boolean-input.tsx
@@ -28,4 +28,5 @@ const Input = (props: GenericInputProps) =>
<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
diff --git a/src/views/run-process-panel/inputs/directory-array-input.tsx b/src/views/run-process-panel/inputs/directory-array-input.tsx
index d4f4cb6..6da3210 100644
--- a/src/views/run-process-panel/inputs/directory-array-input.tsx
+++ b/src/views/run-process-panel/inputs/directory-array-input.tsx
@@ -119,7 +119,6 @@ const DirectoryArrayInputComponent = connect(mapStateToProps)(
this.setState({ open: true });
}
-
closeDialog = () => {
this.setState({ open: false });
}
@@ -214,6 +213,7 @@ const DirectoryArrayInputComponent = connect(mapStateToProps)(
<ChipsInput
value={this.props.input.value}
onChange={noop}
+ disabled={this.props.commandInput.disabled}
createNewValue={identity}
getLabel={(data: FormattedDirectory) => data.name}
inputComponent={this.textInput} />
@@ -223,9 +223,10 @@ const DirectoryArrayInputComponent = connect(mapStateToProps)(
{...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
diff --git a/src/views/run-process-panel/inputs/directory-input.tsx b/src/views/run-process-panel/inputs/directory-input.tsx
index b85c24f..aa25fef 100644
--- a/src/views/run-process-panel/inputs/directory-input.tsx
+++ b/src/views/run-process-panel/inputs/directory-input.tsx
@@ -94,8 +94,9 @@ const DirectoryInputComponent = connect()(
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} />;
}
diff --git a/src/views/run-process-panel/inputs/enum-input.tsx b/src/views/run-process-panel/inputs/enum-input.tsx
index 967d8fc..86ff6fb 100644
--- a/src/views/run-process-panel/inputs/enum-input.tsx
+++ b/src/views/run-process-panel/inputs/enum-input.tsx
@@ -27,7 +27,8 @@ const Input = (props: GenericInputProps) => {
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()}
diff --git a/src/views/run-process-panel/inputs/file-array-input.tsx b/src/views/run-process-panel/inputs/file-array-input.tsx
index 48fc42d..bb85825 100644
--- a/src/views/run-process-panel/inputs/file-array-input.tsx
+++ b/src/views/run-process-panel/inputs/file-array-input.tsx
@@ -117,7 +117,6 @@ const FileArrayInputComponent = connect(mapStateToProps)(
this.setState({ open: true });
}
-
closeDialog = () => {
this.setState({ open: false });
}
@@ -195,6 +194,7 @@ const FileArrayInputComponent = connect(mapStateToProps)(
chipsInput = () =>
<ChipsInput
value={this.props.input.value}
+ disabled={this.props.commandInput.disabled}
onChange={noop}
createNewValue={identity}
getLabel={(file: CollectionFile) => file.name}
@@ -205,8 +205,9 @@ const FileArrayInputComponent = connect(mapStateToProps)(
{...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 = () =>
diff --git a/src/views/run-process-panel/inputs/file-input.tsx b/src/views/run-process-panel/inputs/file-input.tsx
index f5d3d93..7e0925e 100644
--- a/src/views/run-process-panel/inputs/file-input.tsx
+++ b/src/views/run-process-panel/inputs/file-input.tsx
@@ -91,10 +91,11 @@ const FileInputComponent = connect()(
<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} />;
}
diff --git a/src/views/run-process-panel/inputs/float-array-input.tsx b/src/views/run-process-panel/inputs/float-array-input.tsx
index 6e546ec..225a772 100644
--- a/src/views/run-process-panel/inputs/float-array-input.tsx
+++ b/src/views/run-process-panel/inputs/float-array-input.tsx
@@ -8,7 +8,6 @@ import { Field } from 'redux-form';
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';
@@ -42,15 +41,17 @@ const FloatArrayInputComponent = (props: GenericInputProps) =>
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,
}} />;
}
diff --git a/src/views/run-process-panel/inputs/float-input.tsx b/src/views/run-process-panel/inputs/float-input.tsx
index 9558fd8..56a5801 100644
--- a/src/views/run-process-panel/inputs/float-input.tsx
+++ b/src/views/run-process-panel/inputs/float-input.tsx
@@ -28,6 +28,10 @@ const Input = (props: GenericInputProps) =>
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} />;
diff --git a/src/views/run-process-panel/inputs/generic-input.tsx b/src/views/run-process-panel/inputs/generic-input.tsx
index a449c65..066bf2b 100644
--- a/src/views/run-process-panel/inputs/generic-input.tsx
+++ b/src/views/run-process-panel/inputs/generic-input.tsx
@@ -4,8 +4,8 @@
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>;
diff --git a/src/views/run-process-panel/inputs/int-array-input.tsx b/src/views/run-process-panel/inputs/int-array-input.tsx
index d1c0273..22c069b 100644
--- a/src/views/run-process-panel/inputs/int-array-input.tsx
+++ b/src/views/run-process-panel/inputs/int-array-input.tsx
@@ -8,7 +8,6 @@ import { Field } from 'redux-form';
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';
@@ -42,15 +41,17 @@ const IntArrayInputComponent = (props: GenericInputProps) =>
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,
}} />;
}
diff --git a/src/views/run-process-panel/inputs/int-input.tsx b/src/views/run-process-panel/inputs/int-input.tsx
index 410d2df..413ee49 100644
--- a/src/views/run-process-panel/inputs/int-input.tsx
+++ b/src/views/run-process-panel/inputs/int-input.tsx
@@ -3,7 +3,7 @@
// 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';
@@ -32,5 +32,10 @@ const InputComponent = (props: GenericInputProps) =>
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} />;
diff --git a/src/views/run-process-panel/inputs/string-array-input.tsx b/src/views/run-process-panel/inputs/string-array-input.tsx
index da03f29..e560b33 100644
--- a/src/views/run-process-panel/inputs/string-array-input.tsx
+++ b/src/views/run-process-panel/inputs/string-array-input.tsx
@@ -42,15 +42,17 @@ const StringArrayInputComponent = (props: GenericInputProps) =>
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
}} />;
}
diff --git a/src/views/run-process-panel/inputs/string-input.tsx b/src/views/run-process-panel/inputs/string-input.tsx
index 7f02e1d..f6b50a7 100644
--- a/src/views/run-process-panel/inputs/string-input.tsx
+++ b/src/views/run-process-panel/inputs/string-input.tsx
@@ -29,4 +29,8 @@ const StringInputComponent = (props: GenericInputProps) =>
{...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
diff --git a/src/views/run-process-panel/run-process-inputs-form.tsx b/src/views/run-process-panel/run-process-inputs-form.tsx
index 37349a6..9b3379a 100644
--- a/src/views/run-process-panel/run-process-inputs-form.tsx
+++ b/src/views/run-process-panel/run-process-inputs-form.tsx
@@ -35,7 +35,7 @@ const inputsSelector = (props: RunProcessInputFormProps) =>
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({
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list