mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-02-09 13:47:17 +02:00
added buttons to ui for downloading and deleting modpacks
This commit is contained in:
parent
9547653999
commit
9fec285cea
@ -5,6 +5,32 @@ class ModPacks extends React.Component {
|
||||
super(props)
|
||||
}
|
||||
|
||||
removeModPack(modpack, e) {
|
||||
var self = this;
|
||||
swal({
|
||||
title: "Are you sure?",
|
||||
text: "Modpack: " + modpack + " will be deleted",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "Yes, delete it!",
|
||||
closeOnConfirm: false
|
||||
},
|
||||
() => {
|
||||
$.ajax({
|
||||
url: "/api/mods/packs/rm/" + modpack,
|
||||
dataType: "json",
|
||||
success: (resp) => {
|
||||
if (resp.success === true) {
|
||||
swal("Deleted!", resp.data, "success");
|
||||
self.props.loadModPackList();
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
render() {
|
||||
return(
|
||||
<div className="box">
|
||||
@ -23,9 +49,20 @@ class ModPacks extends React.Component {
|
||||
</thead>
|
||||
<tbody>
|
||||
{this.props.modPacks.map( (mod, i) => {
|
||||
console.log(mod)
|
||||
let dlURL = "/api/mods/packs/dl/" + mod
|
||||
return(
|
||||
<tr key={i}>
|
||||
<td>{mod}</td>
|
||||
<td><a className="btn btn-default" href={dlURL}></a></td>
|
||||
<td>
|
||||
<button
|
||||
className="btn btn-danger"
|
||||
ref="modpack"
|
||||
type="button"
|
||||
onClick={this.removeModPack.bind(this, mod)}>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
)
|
||||
})}
|
||||
@ -39,6 +76,7 @@ class ModPacks extends React.Component {
|
||||
|
||||
ModPacks.propTypes = {
|
||||
modPacks: React.PropTypes.array.isRequired,
|
||||
loadModPackList: React.PropTypes.func.isRequired,
|
||||
}
|
||||
|
||||
export default ModPacks
|
||||
|
@ -109,6 +109,7 @@ class ModsContent extends React.Component {
|
||||
/>
|
||||
<ModPacks
|
||||
{...this.state}
|
||||
loadModPackList={this.loadModPackList}
|
||||
/>
|
||||
|
||||
</section>
|
||||
|
Loading…
x
Reference in New Issue
Block a user