Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Static param value not editable for Text/Number #3369

Merged
merged 1 commit into from
Jan 30, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions client/app/components/ParameterValueInput.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { isNull, isUndefined } from 'lodash';
import React from 'react';
import PropTypes from 'prop-types';
import { react2angular } from 'react2angular';
import Select from 'antd/lib/select';
import Input from 'antd/lib/input';
import InputNumber from 'antd/lib/input-number';
import { DateInput } from './DateInput';
import { DateRangeInput } from './DateRangeInput';
import { DateTimeInput } from './DateTimeInput';
Expand Down Expand Up @@ -127,14 +128,24 @@ export class ParameterValueInput extends React.Component {
);
}

renderNumberInput() {
const { value, onSelect, className } = this.props;
return (
<InputNumber
className={'form-control ' + className}
defaultValue={!isNaN(value) && value || 0}
onChange={onSelect}
/>
);
}

renderTextInput() {
const { value, onSelect, type } = this.props;
const { value, onSelect, className } = this.props;
return (
<input
type={type}
className={'form-control ' + this.props.className}
value={isNull(value) || isUndefined(value) ? '' : value}
onChange={event => onSelect(event.target.value)}
<Input
className={'form-control ' + className}
defaultValue={value || ''}
onChange={onSelect}
/>
);
}
Expand All @@ -150,6 +161,7 @@ export class ParameterValueInput extends React.Component {
case 'date-range': return this.renderDateRangeInput();
case 'enum': return this.renderEnumInput();
case 'query': return this.renderQueryBasedInput();
case 'number': return this.renderNumberInput();
default: return this.renderTextInput();
}
}
Expand Down