2020-08-23 22:43:28 +00:00
|
|
|
{% extends ../base.html %}
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
{% block title %}Crafty Controller - {{ translate('serverWizard', 'newServer') }}{% end %}
|
2020-08-23 22:43:28 +00:00
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
|
|
|
|
<div class="content-wrapper">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-6 grid-margin stretch-card">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
<h4>{{ translate('serverWizard', 'newServer') }}</h4>
|
2020-08-23 22:43:28 +00:00
|
|
|
<br />
|
|
|
|
<p class="card-description">
|
|
|
|
|
2021-04-17 20:24:34 +00:00
|
|
|
<form method="post" class="server-wizard">
|
2020-08-23 22:43:28 +00:00
|
|
|
{% raw xsrf_form_html() %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
2021-03-26 13:57:50 +00:00
|
|
|
<h4 class="card-title" style="margin-bottom:20px;">{{ translate('serverWizard', 'serverType') }}</h4>
|
2020-08-23 22:43:28 +00:00
|
|
|
|
|
|
|
<select class="form-control form-control-lg select-css" id="server" name="server">
|
|
|
|
{% for s in data['server_types'] %}
|
|
|
|
{% for v in data['server_types'][s] %}
|
|
|
|
<option value="{{ s }}|{{ v }}">{{ s.capitalize() }} - {{ v }}</option>
|
|
|
|
{% end %}
|
|
|
|
{% end %}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
2021-03-26 13:57:50 +00:00
|
|
|
<label for="server_name">{{ translate('serverWizard', 'serverName') }}</label>
|
|
|
|
<input type="text" class="form-control" id="server_name" name="server_name" placeholder="{{ translate('serverWizard', 'myNewServer') }}">
|
2020-08-23 22:43:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<br />
|
2021-03-26 13:57:50 +00:00
|
|
|
<h4 class="card-title">{{ translate('serverWizard', 'quickSettings') }} <small style="text-transform: none;"> - {{ translate('serverWizard', 'quickSettingsDescription') }}</small></h4>
|
2020-08-23 22:43:28 +00:00
|
|
|
<hr>
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="min_memory1">{{ translate('serverWizard', 'minMem') }} <small> - {{ translate('serverWizard', 'sizeInGB') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="min_memory1" name="min_memory" value="1" step="0.5" min="0.5">
|
2020-08-23 22:43:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-3 offset-1">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="max_memory1">{{ translate('serverWizard', 'maxMem') }} <small> - {{ translate('serverWizard', 'sizeInGB') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="max_memory1" name="max_memory" value="2" step="0.5" min="0.5">
|
2020-08-23 22:43:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-3 offset-1">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="port1">{{ translate('serverWizard', 'serverPort') }} <small> - {{ translate('serverWizard', 'defaultPort') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="port1" name="port" value="25565" step="1" min="1">
|
2020-08-23 22:43:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
2021-03-26 13:57:50 +00:00
|
|
|
<button type="submit" class="btn btn-primary mr-2" onclick="wait_msg()">{{ translate('serverWizard', 'buildServer') }}</button>
|
|
|
|
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm') }}</button>
|
2020-08-23 22:43:28 +00:00
|
|
|
|
|
|
|
</form>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-14 20:01:38 +00:00
|
|
|
|
|
|
|
<div class="col-sm-6 grid-margin stretch-card">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
<h4>{{ translate('serverWizard', 'importServer') }}</h4>
|
2020-09-14 20:01:38 +00:00
|
|
|
<br />
|
|
|
|
<p class="card-description">
|
|
|
|
|
2021-04-17 20:24:34 +00:00
|
|
|
<form method="post" class="server-wizard">
|
2020-09-14 20:01:38 +00:00
|
|
|
{% raw xsrf_form_html() %}
|
|
|
|
<input type="hidden" value="import_jar" name="create_type">
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
2021-03-26 13:57:50 +00:00
|
|
|
<label for="server_name">{{ translate('serverWizard', 'serverName') }}</label>
|
|
|
|
<input type="text" class="form-control" id="server_name" name="server_name" value="" placeholder="{{ translate('serverWizard', 'myNewServer') }}">
|
2020-09-14 20:01:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
2021-03-26 13:57:50 +00:00
|
|
|
<label for="server">{{ translate('serverWizard', 'serverPath') }} <small>{{ translate('serverWizard', 'absoluteServerPath') }}</small></label>
|
2020-09-14 20:01:38 +00:00
|
|
|
<input type="text" class="form-control" id="server_path" name="server_path" placeholder="/var/opt/server">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
2021-03-26 13:57:50 +00:00
|
|
|
<label for="server_jar">{{ translate('serverWizard', 'serverJar') }}</label>
|
2020-09-14 20:01:38 +00:00
|
|
|
<input type="text" class="form-control" id="server_jar" name="server_jar" value="" placeholder="paper.jar">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<br />
|
2021-03-26 13:57:50 +00:00
|
|
|
<h4 class="card-title">{{ translate('serverWizard', 'quickSettings') }} <small style="text-transform: none;"> - {{ translate('serverWizard', 'quickSettingsDescription') }}</small></h4>
|
2020-09-14 20:01:38 +00:00
|
|
|
<hr>
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-3">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="min_memory2">{{ translate('serverWizard', 'minMem') }} <small> - {{ translate('serverWizard', 'sizeInGB') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="min_memory2" name="min_memory" value="1" step="0.5" min="0.5">
|
2020-09-14 20:01:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-3 offset-1">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="max_memory2">{{ translate('serverWizard', 'maxMem') }} <small> - {{ translate('serverWizard', 'sizeInGB') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="max_memory2" name="max_memory" value="2" step="0.5" min="0.5">
|
2020-09-14 20:01:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-3 offset-1">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="port2">{{ translate('serverWizard', 'serverPort') }} <small> - {{ translate('serverWizard', 'defaultPort') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="port2" name="port" value="25565" step="1" min="1">
|
2020-09-14 20:01:38 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
2021-03-26 13:57:50 +00:00
|
|
|
<button type="submit" class="btn btn-primary mr-2" onclick="wait_msg(true)">{{ translate('serverWizard', 'importServerButton') }}</button>
|
|
|
|
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm') }}</button>
|
2020-09-14 20:01:38 +00:00
|
|
|
|
|
|
|
</form>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-23 22:43:28 +00:00
|
|
|
</div>
|
2020-12-12 17:54:10 +00:00
|
|
|
<div class="col-sm-13 grid-margin stretch-card">
|
|
|
|
<div class="card">
|
|
|
|
<div class="card-body">
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
<h4>{{ translate('serverWizard', 'importZip') }}</h4>
|
2020-12-12 17:54:10 +00:00
|
|
|
<br />
|
|
|
|
<p class="card-description">
|
|
|
|
|
2021-04-17 20:24:34 +00:00
|
|
|
<form method="post" class="server-wizard">
|
2020-12-12 17:54:10 +00:00
|
|
|
{% raw xsrf_form_html() %}
|
|
|
|
<input type="hidden" value="import_zip" name="create_type">
|
|
|
|
|
|
|
|
<div class="row">
|
2021-03-26 13:57:50 +00:00
|
|
|
<div class="col-sm-9">
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="server_name">{{ translate('serverWizard', 'serverName') }}</label>
|
|
|
|
<input type="text" class="form-control" id="server_name" name="server_name" value="" placeholder="{{ translate('serverWizard', 'myNewServer') }}">
|
|
|
|
</div>
|
2020-12-12 17:54:10 +00:00
|
|
|
</div>
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="server">{{ translate('serverWizard', 'zipPath') }} <small>{{ translate('serverWizard', 'absoluteZipPath') }}</small></label>
|
|
|
|
<input type="text" class="form-control" id="server_path" name="server_path" placeholder="/var/opt/server.zip">
|
|
|
|
</div>
|
2020-12-12 17:54:10 +00:00
|
|
|
</div>
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="server_jar">{{ translate('serverWizard', 'serverJar') }}</label>
|
|
|
|
<input type="text" class="form-control" id="server_jar" name="server_jar" value="" placeholder="paper.jar">
|
|
|
|
</div>
|
2020-12-12 17:54:10 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-03-26 13:57:50 +00:00
|
|
|
<div class="col-sm-3">
|
|
|
|
<h4 class="card-title">{{ translate('serverWizard', 'quickSettings') }} <small style="text-transform: none;"> - {{ translate('serverWizard', 'quickSettingsDescription') }}</small></h4>
|
|
|
|
<hr>
|
|
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="min_memory3">{{ translate('serverWizard', 'minMem') }} <small> - {{ translate('serverWizard', 'sizeInGB') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="min_memory3" name="min_memory" value="1" step="0.5" min="0.5">
|
2021-03-26 13:57:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="max_memory3">{{ translate('serverWizard', 'maxMem') }} <small> - {{ translate('serverWizard', 'sizeInGB') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="max_memory3" name="max_memory" value="2" step="0.5" min="0.5">
|
2021-03-26 13:57:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="col-sm-12">
|
|
|
|
<div class="form-group">
|
2021-04-17 20:24:34 +00:00
|
|
|
<label for="port3">{{ translate('serverWizard', 'serverPort') }} <small> - {{ translate('serverWizard', 'defaultPort') }}</small></label>
|
|
|
|
<input type="number" class="form-control" id="port3" name="port" value="25565" step="1" min="1">
|
2021-03-26 13:57:50 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-12-12 17:54:10 +00:00
|
|
|
|
|
|
|
</div>
|
2021-03-26 13:57:50 +00:00
|
|
|
<button type="submit" class="btn btn-primary mr-2" onclick="wait_msg(true)">{{ translate('serverWizard', 'importServerButton') }}</button>
|
|
|
|
<button type="reset" class="btn btn-danger mr-2">{{ translate('serverWizard', 'resetForm') }}</button>
|
2020-12-12 17:54:10 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-23 22:43:28 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
{% end %}
|
|
|
|
|
|
|
|
{% block js%}
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$( document ).ready(function() {
|
2021-04-17 20:24:34 +00:00
|
|
|
console.log('ready');
|
|
|
|
var forms = $('form.server-wizard');
|
|
|
|
forms.each(function(i, formEl) {
|
|
|
|
var form = $(formEl);
|
|
|
|
var min = form.find('[name=min_memory]');
|
|
|
|
var max = form.find('[name=max_memory]');
|
|
|
|
console.log(form, min, max)
|
|
|
|
min.change(function(){
|
|
|
|
check_sizes(max, min, 'min');
|
|
|
|
});
|
|
|
|
max.change(function(){
|
|
|
|
check_sizes(max, min, 'max');
|
|
|
|
});
|
2020-08-23 22:43:28 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-03-05 09:10:13 +00:00
|
|
|
function wait_msg(importing){
|
2020-08-27 22:30:56 +00:00
|
|
|
bootbox.alert({
|
2021-03-26 13:57:50 +00:00
|
|
|
title: importing ? '{% raw translate("serverWizard", "importing") %}' : '{% raw translate("serverWizard", "downloading") %}',
|
|
|
|
message: '<i class="fas fa-cloud-download"></i> {% raw translate("serverWizard", "bePatient") %}'
|
2020-08-27 22:30:56 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-04-17 20:24:34 +00:00
|
|
|
function check_sizes(a, b, changed){
|
|
|
|
max_mem = parseFloat(a.val());
|
|
|
|
min_mem = parseFloat(b.val());
|
2021-03-26 13:57:50 +00:00
|
|
|
if (max_mem < min_mem && changed === 'min'){
|
2021-04-17 20:24:34 +00:00
|
|
|
a.val(min_mem)
|
2021-03-26 13:57:50 +00:00
|
|
|
}
|
|
|
|
if (max_mem < min_mem && changed === 'max'){
|
2021-04-17 20:24:34 +00:00
|
|
|
b.val(max_mem)
|
2020-08-23 22:43:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
{% end %}
|