From 36ab91214cbf5d196f825c666e7018eb9122e5c6 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Mon, 27 Jan 2020 18:38:24 -0300 Subject: [PATCH] 16086: Enhances readability by using plural on Array var's name. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/components/chips-input/chips-input.tsx | 13 ++++++------- .../inputs/directory-array-input.tsx | 2 +- .../run-process-panel/inputs/file-array-input.tsx | 2 +- .../run-process-panel/inputs/float-array-input.tsx | 2 +- .../run-process-panel/inputs/int-array-input.tsx | 2 +- .../run-process-panel/inputs/string-array-input.tsx | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/chips-input/chips-input.tsx b/src/components/chips-input/chips-input.tsx index 13699660..790d49eb 100644 --- a/src/components/chips-input/chips-input.tsx +++ b/src/components/chips-input/chips-input.tsx @@ -9,7 +9,7 @@ import { StyleRulesCallback } from '@material-ui/core/styles'; import { InputProps } from '@material-ui/core/Input'; interface ChipsInputProps { - 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
} />
; @@ -132,7 +131,7 @@ export const ChipsInput = withStyles(styles)( } componentDidUpdate(prevProps: ChipsInputProps) { - if (prevProps.value !== this.props.value) { + if (prevProps.values !== this.props.values) { this.updateCursorPosition(); } } 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 7b238832..8b03a123 100644 --- a/src/views/run-process-panel/inputs/directory-array-input.tsx +++ b/src/views/run-process-panel/inputs/directory-array-input.tsx @@ -211,7 +211,7 @@ const DirectoryArrayInputComponent = connect(mapStateToProps)( chipsInput = () => { deletable={!commandInput.disabled} orderable={!commandInput.disabled} disabled={commandInput.disabled} - value={input.value} + values={input.value} onChange={this.handleChange} createNewValue={parseFloat} inputComponent={FloatInput} 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 22c069b5..c625f955 100644 --- a/src/views/run-process-panel/inputs/int-array-input.tsx +++ b/src/views/run-process-panel/inputs/int-array-input.tsx @@ -46,7 +46,7 @@ class InputComponent extends React.PureComponent{ 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} 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 c73b39bf..39dbe0af 100644 --- a/src/views/run-process-panel/inputs/string-array-input.tsx +++ b/src/views/run-process-panel/inputs/string-array-input.tsx @@ -47,7 +47,7 @@ class InputComponent extends React.PureComponent{ deletable={!commandInput.disabled} orderable={!commandInput.disabled} disabled={commandInput.disabled} - value={input.value} + values={input.value} onChange={this.handleChange} createNewValue={identity} inputComponent={Input} -- 2.30.2