43 lines
1019 B
JavaScript
43 lines
1019 B
JavaScript
import React from "react";
|
|
|
|
// Inline search bar with direct UUID linking,
|
|
// Changes URL and populates the form at /migrations/ with the information from the request
|
|
|
|
class InLineSearch extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = { data: "" };
|
|
|
|
this.onChange = this.onChange.bind(this);
|
|
}
|
|
onChange(e) {
|
|
this.setState({ data: e.target.value });
|
|
}
|
|
onKeyPressed = (e) => {
|
|
// This is so we can access the state within the function
|
|
if (e.keyCode === 13) {
|
|
window.location.href =
|
|
"https://devui.benjamyn.love/migrations/" + this.state.data;
|
|
}
|
|
};
|
|
render() {
|
|
return (
|
|
<span>
|
|
<input
|
|
className="right"
|
|
name="uuidIn"
|
|
value={this.state.data}
|
|
onChange={this.onChange}
|
|
onKeyDown={this.onKeyPressed}
|
|
placeholder="Enter Migration UUID"
|
|
id="search"
|
|
type="search"
|
|
required
|
|
/>
|
|
</span>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default InLineSearch;
|