16086: Enhances readability by using plural on Array var's name.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 27 Jan 2020 21:38:24 +0000 (18:38 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 27 Jan 2020 21:38:24 +0000 (18:38 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

src/components/chips-input/chips-input.tsx
src/views/run-process-panel/inputs/directory-array-input.tsx
src/views/run-process-panel/inputs/file-array-input.tsx
src/views/run-process-panel/inputs/float-array-input.tsx
src/views/run-process-panel/inputs/int-array-input.tsx
src/views/run-process-panel/inputs/string-array-input.tsx

index 13699660053824a8f205efc1f8a556ba43d8b106..790d49ebd6e306e202bb691d553bba8f57ccf2b1 100644 (file)
@@ -9,7 +9,7 @@ import { StyleRulesCallback } from '@material-ui/core/styles';
 import { InputProps } from '@material-ui/core/Input';
 
 interface ChipsInputProps<Value> {
-    value: Value[];
+    values: Value[];
     getLabel?: (value: Value) => string;
     onChange: (value: Value[]) => void;
     createNewValue: (value: string) => Value;
@@ -64,13 +64,13 @@ export const ChipsInput = withStyles(styles)(
             if (this.state.text) {
                 const newValue = this.props.createNewValue(this.state.text);
                 this.setState({ text: '' });
-                this.props.onChange([...this.props.value, newValue]);
+                this.props.onChange([...this.props.values, newValue]);
             }
         }
 
         deleteLastValue = () => {
-            if (this.state.text.length === 0 && this.props.value.length > 0) {
-                this.props.onChange(this.props.value.slice(0, -1));
+            if (this.state.text.length === 0 && this.props.values.length > 0) {
+                this.props.onChange(this.props.values.slice(0, -1));
             }
         }
 
@@ -103,12 +103,11 @@ export const ChipsInput = withStyles(styles)(
         }
 
         renderChips() {
-            const { classes, value, ...props } = this.props;
+            const { classes, ...props } = this.props;
             return <div className={classes.chips}>
                 <Chips
                     {...props}
                     clickable={!props.disabled}
-                    values={value}
                     filler={<div ref={this.filler} />}
                 />
             </div>;
@@ -132,7 +131,7 @@ export const ChipsInput = withStyles(styles)(
         }
 
         componentDidUpdate(prevProps: ChipsInputProps<Value>) {
-            if (prevProps.value !== this.props.value) {
+            if (prevProps.values !== this.props.values) {
                 this.updateCursorPosition();
             }
         }
index 7b238832b09139152d500f00a2671a6d602f85b1..8b03a12340386a370efd1ada6653ceea1fb62fe8 100644 (file)
@@ -211,7 +211,7 @@ const DirectoryArrayInputComponent = connect(mapStateToProps)(
 
         chipsInput = () =>
             <ChipsInput
-                value={this.props.input.value}
+                values={this.props.input.value}
                 onChange={noop}
                 disabled={this.props.commandInput.disabled}
                 createNewValue={identity}
index 88f8a00c1c496a534cc91c38fcd4e2fb83637b36..14d16824966cfaa6fcd4e4d8ee67753e5e4619d3 100644 (file)
@@ -193,7 +193,7 @@ const FileArrayInputComponent = connect(mapStateToProps)(
 
         chipsInput = () =>
             <ChipsInput
-                value={this.props.input.value}
+                values={this.props.input.value}
                 disabled={this.props.commandInput.disabled}
                 onChange={noop}
                 createNewValue={identity}
index 225a772749cc466b597d94224b62b3a0a02bf742..818a0518defb8f11d07181d5dbe71c0ea83f89fc 100644 (file)
@@ -46,7 +46,7 @@ class InputComponent extends React.PureComponent<GenericInputProps>{
             deletable={!commandInput.disabled}
             orderable={!commandInput.disabled}
             disabled={commandInput.disabled}
-            value={input.value}
+            values={input.value}
             onChange={this.handleChange}
             createNewValue={parseFloat}
             inputComponent={FloatInput}
index 22c069b548fe18c6dd7d9c89e5012a19370017d1..c625f95592dc0a682ccb1f2c14bd94a78007715e 100644 (file)
@@ -46,7 +46,7 @@ class InputComponent extends React.PureComponent<GenericInputProps>{
             deletable={!commandInput.disabled}
             orderable={!commandInput.disabled}
             disabled={commandInput.disabled}
-            value={input.value}
+            values={input.value}
             onChange={this.handleChange}
             createNewValue={value => parseInt(value, 10)}
             inputComponent={IntInput}
index c73b39bfb43ea718f64fdc10ba2113dbf2525e6b..39dbe0afdaa67bcd083a437ad3c0cd5f6bf6f7ef 100644 (file)
@@ -47,7 +47,7 @@ class InputComponent extends React.PureComponent<GenericInputProps>{
             deletable={!commandInput.disabled}
             orderable={!commandInput.disabled}
             disabled={commandInput.disabled}
-            value={input.value}
+            values={input.value}
             onChange={this.handleChange}
             createNewValue={identity}
             inputComponent={Input}