forked from taskcluster/taskcluster-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1441950 add ability to filter through the list of roles (taskclus…
…ter#481) * added search panel * code refactoring * use SearchForm component
- Loading branch information
1 parent
d0a61de
commit 3d1e718
Showing
3 changed files
with
81 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { PureComponent } from 'react'; | ||
import { func } from 'prop-types'; | ||
import { | ||
Glyphicon, | ||
FormGroup, | ||
InputGroup, | ||
FormControl, | ||
Form | ||
} from 'react-bootstrap'; | ||
import styles from './styles.module.css'; | ||
|
||
export default class SearchForm extends PureComponent { | ||
static propTypes = { | ||
onSearch: func.isRequired | ||
}; | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { value: '' }; | ||
} | ||
|
||
componentWillMount() { | ||
if (this.props.default) { | ||
this.setState({ value: this.props.default }); | ||
} | ||
} | ||
|
||
handleChange = e => this.setState({ value: e.target.value }); | ||
|
||
handleSearch = () => this.props.onSearch(this.state.value); | ||
|
||
handleSubmit = e => { | ||
e.preventDefault(); | ||
|
||
this.handleSearch(); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<Form onSubmit={this.handleSubmit} className={styles.typeInput}> | ||
<FormGroup> | ||
<InputGroup bsSize="sm"> | ||
<InputGroup.Addon>Role Id Containing</InputGroup.Addon> | ||
<FormControl | ||
onChange={this.handleChange} | ||
value={this.state.value} | ||
type="text" | ||
/> | ||
<InputGroup.Addon onClick={this.handleSearch} role="button"> | ||
<Glyphicon glyph="search" /> | ||
</InputGroup.Addon> | ||
</InputGroup> | ||
</FormGroup> | ||
</Form> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.typeInput { | ||
min-width: 300px; | ||
max-width: 600px; | ||
margin-top: 10px; | ||
} |