Skip to content

Commit

Permalink
Remove LinkedStateMixin from InputDropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Edmundo Alvarez committed Dec 5, 2017
1 parent b4ec0fe commit 09ff634
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions graylog2-web-interface/src/components/inputs/InputDropdown.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import PropTypes from 'prop-types';
import React from 'react';
import LinkedStateMixin from 'react-addons-linked-state-mixin';
import { Button } from 'react-bootstrap';

import { Input } from 'components/bootstrap';
Expand All @@ -14,7 +13,6 @@ const InputDropdown = React.createClass({
onLoadMessage: PropTypes.func,
disabled: PropTypes.bool,
},
mixins: [LinkedStateMixin],
getInitialState() {
return {
selectedInput: this.props.preselectedInputId || this.PLACEHOLDER,
Expand All @@ -37,15 +35,19 @@ const InputDropdown = React.createClass({
</Input>
);
},
onSelectedInputChange(event) {
this.setState({ selectedInput: event.target.value });
},
render() {
const { selectedInput } = this.state;
// When an input is pre-selected, show a static dropdown
if (this.props.inputs && this.props.preselectedInputId) {
return (
<div>
{this._formatStaticInput(this.props.inputs.get(this.props.preselectedInputId))}

<Button bsStyle="info"
disabled={this.state.selectedInput === this.PLACEHOLDER}
disabled={selectedInput === this.PLACEHOLDER}
onClick={this._onLoadMessage}>
{this.props.title}
</Button>
Expand All @@ -60,14 +62,15 @@ const InputDropdown = React.createClass({
<Input id="placeholder-select"
type="select"
style={{ float: 'left', width: 400, marginRight: 10 }}
valueLink={this.linkState('selectedInput')}
value={selectedInput}
onChange={this.onSelectedInputChange}
placeholder={this.PLACEHOLDER}>
<option value={this.PLACEHOLDER}>Select an input</option>
{inputs.toArray()}
</Input>

<Button bsStyle="info"
disabled={this.props.disabled || this.state.selectedInput === this.PLACEHOLDER}
disabled={this.props.disabled || selectedInput === this.PLACEHOLDER}
onClick={this._onLoadMessage}>
{this.props.title}
</Button>
Expand Down

0 comments on commit 09ff634

Please sign in to comment.