Merge pull request #30 from Dahlgren/feature/auto-start

Auto Start selected servers when Manager launches
This commit is contained in:
Björn Dahlgren 2017-02-21 19:31:07 +01:00 committed by GitHub
commit b8dca85609
5 changed files with 21 additions and 0 deletions

View File

@ -81,6 +81,12 @@ Manager.prototype.load = (function () {
} catch(e) {
console.error("Manager load error: " + e);
}
self.getServers().map(function (server) {
if (server.auto_start) {
server.start();
}
});
});
});
@ -96,6 +102,7 @@ Manager.prototype.save = (function () {
this.serversArr.forEach(function (server) {
data.push({
admin_password: server.admin_password,
auto_start: server.auto_start,
battle_eye: server.battle_eye,
headless: server.headless,
max_players: server.max_players,

View File

@ -41,6 +41,7 @@ Server.prototype = new events.EventEmitter();
Server.prototype.update = function (options) {
this.admin_password = options.admin_password;
this.auto_start = options.auto_start;
this.battle_eye = options.battle_eye;
this.headless = options.headless;
this.max_players = options.max_players;
@ -227,6 +228,7 @@ Server.prototype.stop = function(cb) {
Server.prototype.toJSON = function () {
return {
admin_password: this.admin_password,
auto_start: this.auto_start,
battle_eye: this.battle_eye,
headless: this.headless,
id: this.id,

View File

@ -9,6 +9,7 @@ define(function (require) {
return Backbone.Model.extend({
defaults: {
admin_password: '',
auto_start: false,
battle_eye: false,
headless: false,
max_players: null,

View File

@ -20,6 +20,7 @@ define(function (require) {
serialize : function() {
return {
admin_password: this.$("form .admin-password").val(),
auto_start: this.$("form .auto-start").prop("checked"),
battle_eye: this.$("form .battle-eye").prop("checked"),
headless: this.$("form .headless").prop("checked"),
max_players: this.$("form .max-players").val(),

View File

@ -35,6 +35,16 @@
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" class="auto-start" <% if (auto_start) { %>checked="checked"<% } %>> Auto Start when manager launches
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">