mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-01-24 05:17:24 +02:00
workaround for bug #91
This commit is contained in:
parent
783696ad8e
commit
ebc11ba91a
@ -4,7 +4,8 @@ import ModFoundOverview from './ModFoundOverview.jsx';
|
|||||||
class ModSearch extends React.Component {
|
class ModSearch extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
if(this.props.loggedIn) {
|
if(this.props.loggedIn) {
|
||||||
return (
|
//TODO switch back to currently commented out code, when the mod-portal-api is back with all features!!
|
||||||
|
/*return (
|
||||||
<div className="box-body">
|
<div className="box-body">
|
||||||
<form onSubmit={this.props.submitSearchMod}>
|
<form onSubmit={this.props.submitSearchMod}>
|
||||||
<div className="input-group col-lg-5">
|
<div className="input-group col-lg-5">
|
||||||
@ -19,6 +20,18 @@ class ModSearch extends React.Component {
|
|||||||
{...this.props}
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
)*/
|
||||||
|
return (
|
||||||
|
<div className="box-body">
|
||||||
|
<form onSubmit={this.props.loadDownloadList}>
|
||||||
|
<div className="input-group col-lg-5">
|
||||||
|
<input type="text" className="form-control" placeholder="Download mod by ID" name="modId" />
|
||||||
|
<span className="input-group-btn">
|
||||||
|
<input className="btn btn-default" type="submit" value="Go!"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
@ -44,7 +57,8 @@ class ModSearch extends React.Component {
|
|||||||
ModSearch.propTypes = {
|
ModSearch.propTypes = {
|
||||||
submitSearchMod: React.PropTypes.func.isRequired,
|
submitSearchMod: React.PropTypes.func.isRequired,
|
||||||
loggedIn: React.PropTypes.bool.isRequired,
|
loggedIn: React.PropTypes.bool.isRequired,
|
||||||
submitFactorioLogin: React.PropTypes.func.isRequired
|
submitFactorioLogin: React.PropTypes.func.isRequired,
|
||||||
|
loadDownloadList: React.PropTypes.func.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ModSearch;
|
export default ModSearch;
|
@ -156,12 +156,15 @@ class ModsContent extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO remove modIdInput, when the factorio-mod-portal-api is fixed
|
||||||
|
// all outcommented needs to be reimplemented, when it will work again
|
||||||
loadDownloadList(e) {
|
loadDownloadList(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let $button = $(e.target);
|
// let $button = $(e.target);
|
||||||
let $loader = $("<div class='loader'></div>");
|
// let $loader = $("<div class='loader'></div>");
|
||||||
$button.prepend($loader);
|
// $button.prepend($loader);
|
||||||
let modId = $button.data("modId");
|
let modId = $(e.target).find("input[name=modId]").val();
|
||||||
|
// let modId = $button.data("modId");
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@ -171,7 +174,7 @@ class ModsContent extends React.Component {
|
|||||||
},
|
},
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: (data) => {
|
success: (data) => {
|
||||||
$loader.remove();
|
// $loader.remove();
|
||||||
|
|
||||||
let correctData = JSON.parse(data.data);
|
let correctData = JSON.parse(data.data);
|
||||||
|
|
||||||
@ -244,7 +247,7 @@ class ModsContent extends React.Component {
|
|||||||
},
|
},
|
||||||
error: (xhr, status, err) => {
|
error: (xhr, status, err) => {
|
||||||
console.log('api/mods/details', status, err.toString());
|
console.log('api/mods/details', status, err.toString());
|
||||||
$loader.remove();
|
// $loader.remove();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user