2017-01-24 22:57:08 +00:00
|
|
|
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
|
2016-01-20 20:56:40 +00:00
|
|
|
|
2016-01-24 02:30:03 +00:00
|
|
|
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
|
|
|
|
{{-- of this software and associated documentation files (the "Software"), to deal --}}
|
|
|
|
{{-- in the Software without restriction, including without limitation the rights --}}
|
|
|
|
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
|
|
|
|
{{-- copies of the Software, and to permit persons to whom the Software is --}}
|
|
|
|
{{-- furnished to do so, subject to the following conditions: --}}
|
2016-01-20 20:56:40 +00:00
|
|
|
|
2016-01-24 02:30:03 +00:00
|
|
|
{{-- The above copyright notice and this permission notice shall be included in all --}}
|
|
|
|
{{-- copies or substantial portions of the Software. --}}
|
2016-01-20 20:56:40 +00:00
|
|
|
|
2016-01-24 02:30:03 +00:00
|
|
|
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
|
|
|
|
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
|
|
|
|
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
|
|
|
|
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
|
|
|
|
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
|
|
|
|
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
|
|
|
|
{{-- SOFTWARE. --}}
|
2015-12-07 05:47:19 +00:00
|
|
|
@extends('layouts.admin')
|
|
|
|
|
|
|
|
@section('title')
|
2016-01-02 23:04:18 +00:00
|
|
|
Create New Server
|
2015-12-07 05:47:19 +00:00
|
|
|
@endsection
|
|
|
|
|
2016-10-21 19:22:47 +00:00
|
|
|
@section('scripts')
|
|
|
|
@parent
|
|
|
|
{!! Theme::js('js/vendor/typeahead/typeahead.min.js') !!}
|
|
|
|
@endsection
|
|
|
|
|
2015-12-07 05:47:19 +00:00
|
|
|
@section('content')
|
2016-01-04 21:48:22 +00:00
|
|
|
<div class="col-md-12">
|
2015-12-07 05:47:19 +00:00
|
|
|
<ul class="breadcrumb">
|
2015-12-08 23:34:18 +00:00
|
|
|
<li><a href="/admin">Admin Control</a></li>
|
|
|
|
<li><a href="/admin/servers">Servers</a></li>
|
2015-12-07 05:47:19 +00:00
|
|
|
<li class="active">Create New Server</li>
|
2015-12-08 23:34:18 +00:00
|
|
|
</ul>
|
2015-12-07 05:47:19 +00:00
|
|
|
<h3>Create New Server</h3><hr />
|
2015-12-10 23:30:47 +00:00
|
|
|
<form action="/admin/servers/new" method="POST">
|
2015-12-07 05:47:19 +00:00
|
|
|
<div class="well">
|
|
|
|
<div class="row">
|
|
|
|
<div class="form-group col-md-6">
|
2015-12-11 04:13:32 +00:00
|
|
|
<label for="name" class="control-label">Server Name</label>
|
2015-12-07 05:47:19 +00:00
|
|
|
<div>
|
2015-12-15 20:08:41 +00:00
|
|
|
<input type="text" autocomplete="off" name="name" class="form-control" value="{{ old('name') }}" />
|
2016-12-30 20:46:10 +00:00
|
|
|
<p class="text-muted"><small><em>Character limits: <code>a-z A-Z 0-9 _ - .</code> and <code>[Space]</code> (max 200 characters).</em></small></p>
|
2015-12-07 05:47:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group col-md-6">
|
2015-12-11 04:13:32 +00:00
|
|
|
<label for="owner" class="control-label">Owner Email</label>
|
2015-12-07 05:47:19 +00:00
|
|
|
<div>
|
2016-10-21 19:22:47 +00:00
|
|
|
{{-- Hacky workaround to prevent Safari and Chrome from trying to suggest emails here --}}
|
2016-12-02 23:45:08 +00:00
|
|
|
<input id="fake_user_name" name="fake_user[name]" style="position:absolute; top:-10000px;" tabindex="5" type="text" value="Autofill Me">
|
2016-01-02 23:04:18 +00:00
|
|
|
<input type="text" autocomplete="off" name="owner" class="form-control" value="{{ old('owner', Input::get('email')) }}" />
|
2015-12-07 05:47:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="load_settings">
|
|
|
|
<div class="well">
|
|
|
|
<div class="row">
|
2015-12-08 23:34:18 +00:00
|
|
|
<div class="ajax_loading_box" style="display:none;"><i class="fa fa-refresh fa-spin ajax_loading_position"></i></div>
|
2015-12-07 05:47:19 +00:00
|
|
|
<div class="form-group col-md-6">
|
|
|
|
<label for="location" class="control-label">Server Location</label>
|
|
|
|
<div>
|
2017-02-11 01:26:38 +00:00
|
|
|
<select name="location_id" id="getLocation" class="form-control">
|
2015-12-15 20:08:41 +00:00
|
|
|
<option disabled selected> -- Select a Location</option>
|
2015-12-07 05:47:19 +00:00
|
|
|
@foreach($locations as $location)
|
|
|
|
<option value="{{ $location->id }}">{{ $location->long }} ({{ $location->short }})</option>
|
|
|
|
@endforeach
|
|
|
|
</select>
|
2015-12-08 23:34:18 +00:00
|
|
|
<p class="text-muted"><small>The location in which this server will be deployed.</small></p>
|
2015-12-07 05:47:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-28 01:01:46 +00:00
|
|
|
<div class="form-group col-md-6 hidden" id="allocationNode">
|
2015-12-10 23:30:47 +00:00
|
|
|
<label for="node" class="control-label">Server Node</label>
|
2015-12-07 05:47:19 +00:00
|
|
|
<div>
|
2017-02-11 01:26:38 +00:00
|
|
|
<select name="node_id" id="getNode" class="form-control">
|
2015-12-15 20:08:41 +00:00
|
|
|
<option disabled selected> -- Select a Node</option>
|
2015-12-07 05:47:19 +00:00
|
|
|
</select>
|
2015-12-08 23:34:18 +00:00
|
|
|
<p class="text-muted"><small>The node which this server will be deployed to.</small></p>
|
2015-12-07 05:47:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
2016-09-28 01:01:46 +00:00
|
|
|
<div class="form-group col-md-6 hidden" id="allocationIP">
|
2015-12-10 23:30:47 +00:00
|
|
|
<label for="ip" class="control-label">Server IP</label>
|
2015-12-07 05:47:19 +00:00
|
|
|
<div>
|
2015-12-10 23:30:47 +00:00
|
|
|
<select name="ip" id="getIP" class="form-control">
|
2015-12-15 20:08:41 +00:00
|
|
|
<option disabled selected> -- Select an IP</option>
|
2015-12-07 05:47:19 +00:00
|
|
|
</select>
|
2015-12-08 23:34:18 +00:00
|
|
|
<p class="text-muted"><small>Select the main IP that this server will be listening on. You can assign additional open IPs and ports below.</small></p>
|
2015-12-07 05:47:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-28 01:01:46 +00:00
|
|
|
<div class="form-group col-md-6 hidden" id="allocationPort">
|
2015-12-10 23:30:47 +00:00
|
|
|
<label for="port" class="control-label">Server Port</label>
|
2015-12-07 05:47:19 +00:00
|
|
|
<div>
|
2015-12-10 23:30:47 +00:00
|
|
|
<select name="port" id="getPort" class="form-control"></select>
|
2015-12-08 23:34:18 +00:00
|
|
|
<p class="text-muted"><small>Select the main port that this server will be listening on.</small></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-28 01:01:46 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 fuelux">
|
|
|
|
<hr style="margin-top: 10px;"/>
|
|
|
|
<div class="checkbox highlight" style="margin: 0;">
|
|
|
|
<label class="checkbox-custom highlight" data-initialize="checkbox">
|
|
|
|
<input class="sr-only" name="auto_deploy" type="checkbox" @if(isset($oldInput['auto_deploy']))checked="checked"@endif value="1"> <strong>Enable Automatic Deployment</strong>
|
|
|
|
<p class="text-muted"><small>Check this box if you want the panel to automatically select a node and allocation for this server in the given location.</small><p>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-12-08 23:34:18 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="well">
|
|
|
|
<div class="row">
|
2016-01-02 03:53:43 +00:00
|
|
|
<div class="form-group col-md-4 col-xs-4">
|
2015-12-08 23:34:18 +00:00
|
|
|
<label for="memory" class="control-label">Memory</label>
|
|
|
|
<div class="input-group">
|
2016-11-27 00:56:19 +00:00
|
|
|
<input type="text" name="memory" data-multiplicator="true" class="form-control" value="{{ old('memory') }}"/>
|
2015-12-08 23:34:18 +00:00
|
|
|
<span class="input-group-addon">MB</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-01-02 03:53:43 +00:00
|
|
|
<div class="form-group col-md-4 col-xs-4">
|
|
|
|
<label for="memory" class="control-label">Swap</label>
|
|
|
|
<div class="input-group">
|
2016-11-27 00:56:19 +00:00
|
|
|
<input type="text" name="swap" data-multiplicator="true" class="form-control" value="{{ old('swap', 0) }}"/>
|
2016-01-02 03:53:43 +00:00
|
|
|
<span class="input-group-addon">MB</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group col-md-4 col-xs-4">
|
|
|
|
<label for="memory" class="control-label">OOM Killer</label>
|
|
|
|
<div>
|
|
|
|
<span class="input-group-addon" style="height:36px;">
|
|
|
|
<input type="checkbox" name="oom_disabled"/>
|
|
|
|
</span>
|
|
|
|
<span class="input-group-addon" style="height:36px;">
|
|
|
|
Disable OOM Killer
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2016-02-13 05:06:23 +00:00
|
|
|
<p class="text-muted"><small>If you do not want to assign swap space to a server simply put <code>0</code> for the value, or <code>-1</code> to allow unlimited swap space. If you want to disable memory limiting on a server simply enter <code>0</code> into the memory field. We suggest leaving OOM Killer enabled unless you know what you are doing, disabling it could cause your server to hang unexpectedly.</small><p>
|
2016-01-02 03:53:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="form-group col-md-4 col-xs-4">
|
2015-12-08 23:34:18 +00:00
|
|
|
<label for="disk" class="control-label">Disk Space</label>
|
|
|
|
<div class="input-group">
|
2016-11-27 00:56:19 +00:00
|
|
|
<input type="text" name="disk" data-multiplicator="true" class="form-control" value="{{ old('disk') }}"/>
|
2015-12-08 23:34:18 +00:00
|
|
|
<span class="input-group-addon">MB</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-01-02 03:53:43 +00:00
|
|
|
<div class="form-group col-md-4 col-xs-4">
|
2015-12-08 23:34:18 +00:00
|
|
|
<label for="cpu" class="control-label">CPU Limit</label>
|
|
|
|
<div class="input-group">
|
2016-01-02 03:53:43 +00:00
|
|
|
<input type="text" name="cpu" class="form-control" value="{{ old('cpu', 0) }}"/>
|
2015-12-08 23:34:18 +00:00
|
|
|
<span class="input-group-addon">%</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-01-02 03:53:43 +00:00
|
|
|
<div class="form-group col-md-4 col-xs-4">
|
2015-12-08 23:34:18 +00:00
|
|
|
<label for="io" class="control-label">Block I/O</label>
|
|
|
|
<div class="input-group">
|
2016-01-02 03:53:43 +00:00
|
|
|
<input type="text" name="io" class="form-control" value="{{ old('io', 500) }}"/>
|
2015-12-08 23:34:18 +00:00
|
|
|
<span class="input-group-addon">I/O</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2016-12-30 20:46:26 +00:00
|
|
|
<p class="text-muted"><small>If you do not want to limit CPU usage set the value to <code>0</code>. To determine a value, take the number <em>physical</em> cores and multiply it by 100. For example, on a quad core system <code>(4 * 100 = 400)</code> there is <code>400%</code> available. To limit a server to using half of a single core, you would set the value to <code>50</code>. To allow a server to use up to two physical cores, set the value to <code>200</code>. BlockIO should be a value between <code>10</code> and <code>1000</code>. Please see <a href="https://docs.docker.com/engine/reference/run/#/block-io-bandwidth-blkio-constraint" target="_blank">this documentation</a> for more information about it.</small><p>
|
2015-12-08 23:34:18 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6" id="load_services">
|
|
|
|
<div class="well">
|
|
|
|
<div class="row">
|
|
|
|
<div class="ajax_loading_box" style="display:none;"><i class="fa fa-refresh fa-spin ajax_loading_position"></i></div>
|
|
|
|
<div class="form-group col-md-12">
|
2017-02-11 01:26:38 +00:00
|
|
|
<label for="service_id" class="control-label">Service Type</label>
|
2015-12-08 23:34:18 +00:00
|
|
|
<div>
|
2017-02-11 01:26:38 +00:00
|
|
|
<select name="service_id" id="getService" class="form-control">
|
2015-12-15 20:08:41 +00:00
|
|
|
<option disabled selected> -- Select a Service</option>
|
2015-12-08 23:34:18 +00:00
|
|
|
@foreach($services as $service)
|
|
|
|
<option value="{{ $service->id }}">{{ $service->name }}</option>
|
|
|
|
@endforeach
|
|
|
|
</select>
|
|
|
|
<p class="text-muted"><small>Select the type of service that this server will be running.</small></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group col-md-12 hidden">
|
2017-02-11 01:26:38 +00:00
|
|
|
<label for="option_id" class="control-label">Service Option</label>
|
2015-12-08 23:34:18 +00:00
|
|
|
<div>
|
2017-02-11 01:26:38 +00:00
|
|
|
<select name="option_id" id="getOption" class="form-control">
|
2015-12-15 20:08:41 +00:00
|
|
|
<option disabled selected> -- Select a Service Option</option>
|
2015-12-08 23:34:18 +00:00
|
|
|
</select>
|
|
|
|
<p class="text-muted"><small>Select the type of service that this server will be running.</small></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-11-27 19:30:44 +00:00
|
|
|
<div class="form-group col-md-12 hidden">
|
2017-02-11 01:26:38 +00:00
|
|
|
<label for="pack_id" class="control-label">Service Pack</label>
|
2016-11-27 19:30:44 +00:00
|
|
|
<div>
|
2017-02-11 01:26:38 +00:00
|
|
|
<select name="pack_id" id="getPack" class="form-control">
|
2016-11-27 19:30:44 +00:00
|
|
|
<option disabled selected> -- Select a Service Pack</option>
|
|
|
|
</select>
|
|
|
|
<p class="text-muted"><small>Select the service pack that should be used for this server. This option can be changed later.</small></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-12-08 23:34:18 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
|
|
<div class="well">
|
|
|
|
<div class="row">
|
|
|
|
<div class="form-group col-md-12">
|
|
|
|
<label for="use_custom_image" class="control-label">Use Custom Docker Image</label>
|
|
|
|
<div class="input-group">
|
|
|
|
<span class="input-group-addon">
|
2016-01-02 03:53:43 +00:00
|
|
|
<input @if(old('use_custom_image') === 'use_custom_image')checked="checked"@endif type="checkbox" name="use_custom_image"/>
|
2015-12-08 23:34:18 +00:00
|
|
|
</span>
|
2015-12-15 20:08:41 +00:00
|
|
|
<input type="text" class="form-control" name="custom_image_name" value="{{ old('custom_image_name') }}" disabled />
|
2015-12-08 23:34:18 +00:00
|
|
|
</div>
|
|
|
|
<p class="text-muted"><small>If you would like to use a custom docker image for this server please enter it here. Most users can ignore this option.</small></p>
|
2015-12-07 05:47:19 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-02-12 21:02:23 +00:00
|
|
|
<div class="well" id="ServiceOption" style="display:none;">
|
2015-12-10 23:30:47 +00:00
|
|
|
<div class="row">
|
2016-01-02 03:53:43 +00:00
|
|
|
<div class="form-group col-md-12">
|
|
|
|
<h3 class="nopad">Service Setup & Options</h3>
|
2015-12-10 23:30:47 +00:00
|
|
|
<hr />
|
2016-01-02 03:53:43 +00:00
|
|
|
<label for="startup" class="control-label">Startup Command</label>
|
|
|
|
<div class="input-group">
|
|
|
|
<span class="input-group-addon" id="startupExec"></span>
|
|
|
|
<input type="text" class="form-control" name="startup" value="{{ old('startup') }}" />
|
|
|
|
</div>
|
2016-01-03 23:10:28 +00:00
|
|
|
<p class="text-muted"><small>The following data replacers are avaliable for the startup command: <code>@{{SERVER_MEMORY}}</code>, <code>@{{SERVER_IP}}</code>, and <code>@{{SERVER_PORT}}</code>. They will be replaced with the allocated memory, server ip, and server port respectively.</small></p>
|
2016-01-02 03:53:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12">
|
2015-12-10 23:30:47 +00:00
|
|
|
<div class="alert alert-info">Some service options have additional environment variables that you can define for a given instance. They will show up below when you select a service option. If none show up, chances are that none were defined, and there is nothing to worry about.</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2016-01-03 23:10:28 +00:00
|
|
|
<div class="row" id="serverVariables"></div>
|
2015-12-10 23:30:47 +00:00
|
|
|
</div>
|
|
|
|
<div class="well">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-12 text-center">
|
|
|
|
{!! csrf_field() !!}
|
2015-12-11 04:13:32 +00:00
|
|
|
<input type="submit" class="btn btn-primary btn-sm" value="Create New Server" />
|
2015-12-10 23:30:47 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-12-07 05:47:19 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
$(document).ready(function () {
|
2015-12-08 23:34:18 +00:00
|
|
|
|
2015-12-10 23:30:47 +00:00
|
|
|
$('#sidebar_links').find("a[href='/admin/servers/new']").addClass('active');
|
|
|
|
|
2015-12-08 23:34:18 +00:00
|
|
|
$('input[name="use_custom_image"]').change(function () {
|
|
|
|
$('input[name="custom_image_name"]').val('').prop('disabled', !($(this).is(':checked')));
|
|
|
|
});
|
|
|
|
|
2016-10-21 19:22:47 +00:00
|
|
|
// Typeahead
|
|
|
|
$.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: '{{ route('admin.users.json') }}',
|
|
|
|
}).done(function (data) {
|
|
|
|
$('input[name="owner"]').typeahead({ fitToElement: true, source: data });
|
|
|
|
}).fail(function (jqXHR) {
|
|
|
|
alert('Could not initialize user email typeahead.')
|
|
|
|
console.log(jqXHR);
|
|
|
|
});
|
|
|
|
|
2015-12-07 05:47:19 +00:00
|
|
|
var nodeData = null;
|
|
|
|
var currentLocation = null;
|
|
|
|
var currentNode = null;
|
2015-12-08 23:34:18 +00:00
|
|
|
var currentService = null;
|
2015-12-07 05:47:19 +00:00
|
|
|
$('#getLocation').on('change', function (event) {
|
|
|
|
|
|
|
|
if ($('#getLocation').val() === '' || $('#getLocation').val() === currentLocation) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentLocation = $('#getLocation').val();
|
|
|
|
currentNode = null;
|
|
|
|
|
|
|
|
// Hide Existing, and Reset contents
|
2015-12-15 20:08:41 +00:00
|
|
|
$('#getNode').html('<option disabled selected> -- Select a Node</option>').parent().parent().addClass('hidden');
|
|
|
|
$('#getIP').html('<option disabled selected> -- Select an IP</option>').parent().parent().addClass('hidden');
|
2015-12-07 05:47:19 +00:00
|
|
|
$('#getPort').html('').parent().parent().addClass('hidden');
|
|
|
|
|
2015-12-08 23:34:18 +00:00
|
|
|
handleLoader('#load_settings', true);
|
2015-12-07 05:47:19 +00:00
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
method: 'POST',
|
2015-12-10 23:30:47 +00:00
|
|
|
url: '/admin/servers/new/get-nodes',
|
2015-12-07 05:47:19 +00:00
|
|
|
headers: {
|
|
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
location: $('#getLocation').val()
|
|
|
|
}
|
|
|
|
}).done(function (data) {
|
2015-12-08 23:34:18 +00:00
|
|
|
//var data = $.parseJSON(data);
|
2015-12-07 05:47:19 +00:00
|
|
|
$.each(data, function (i, item) {
|
|
|
|
var isPublic = (item.public !== 1) ? '(Private Node)' : '';
|
|
|
|
$('#getNode').append('<option value="' + item.id + '">' + item.name + ' ' + isPublic + '</option>');
|
|
|
|
});
|
|
|
|
$('#getNode').parent().parent().removeClass('hidden')
|
|
|
|
}).fail(function (jqXHR) {
|
|
|
|
alert('An error occured while attempting to load a list of nodes in this location.');
|
2015-12-08 23:34:18 +00:00
|
|
|
currentLocation = null;
|
2015-12-10 23:30:47 +00:00
|
|
|
console.error(jqXHR);
|
2015-12-07 05:47:19 +00:00
|
|
|
}).always(function () {
|
2015-12-08 23:34:18 +00:00
|
|
|
handleLoader('#load_settings');
|
2015-12-07 05:47:19 +00:00
|
|
|
})
|
|
|
|
});
|
|
|
|
$('#getNode').on('change', function (event) {
|
|
|
|
|
|
|
|
if ($('#getNode').val() === '' || $('#getNode').val() === currentNode) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentNode = $('#getNode').val();
|
|
|
|
|
|
|
|
// Hide Existing, and Reset contents
|
2015-12-15 20:08:41 +00:00
|
|
|
$('#getIP').html('<option disabled selected> -- Select an IP</option>').parent().parent().addClass('hidden');
|
2015-12-07 05:47:19 +00:00
|
|
|
$('#getPort').html('').parent().parent().addClass('hidden');
|
|
|
|
|
2015-12-08 23:34:18 +00:00
|
|
|
handleLoader('#load_settings', true);
|
2015-12-07 05:47:19 +00:00
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
method: 'POST',
|
2015-12-10 23:30:47 +00:00
|
|
|
url: '/admin/servers/new/get-ips',
|
2015-12-07 05:47:19 +00:00
|
|
|
headers: {
|
|
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
node: $('#getNode').val()
|
|
|
|
}
|
|
|
|
}).done(function (data) {
|
|
|
|
nodeData = data;
|
|
|
|
$.each(data, function (ip, ports) {
|
|
|
|
$('#getIP').append('<option value="' + ip + '">' + ip + '</option>');
|
|
|
|
});
|
|
|
|
$('#getIP').parent().parent().removeClass('hidden');
|
|
|
|
}).fail(function (jqXHR) {
|
2015-12-08 23:34:18 +00:00
|
|
|
alert('An error occured while attempting to get IPs and Ports avaliable on this node.');
|
|
|
|
currentNode = null;
|
2015-12-10 23:30:47 +00:00
|
|
|
console.error(jqXHR);
|
2015-12-07 05:47:19 +00:00
|
|
|
}).always(function () {
|
2015-12-08 23:34:18 +00:00
|
|
|
handleLoader('#load_settings');
|
2015-12-07 05:47:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
2015-12-08 23:34:18 +00:00
|
|
|
|
2015-12-07 05:47:19 +00:00
|
|
|
$('#getIP').on('change', function (event) {
|
|
|
|
|
|
|
|
if ($('#getIP').val() === '') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$('#getPort').html('');
|
|
|
|
|
|
|
|
$.each(nodeData[$('#getIP').val()], function (i, port) {
|
|
|
|
$('#getPort').append('<option value="' + port +'">' + port + '</option>');
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#getPort').parent().parent().removeClass('hidden');
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2016-09-28 01:01:46 +00:00
|
|
|
$('input[name="auto_deploy"]').change(function () {
|
|
|
|
if ($(this).is(':checked')) {
|
2016-10-07 17:47:14 +00:00
|
|
|
$('#allocationPort, #allocationIP, #allocationNode').hide();
|
2016-09-28 01:01:46 +00:00
|
|
|
} else {
|
|
|
|
currentLocation = null;
|
2016-10-07 17:47:14 +00:00
|
|
|
$('#allocationPort, #allocationIP, #allocationNode').show().addClass('hidden');
|
2016-09-28 01:01:46 +00:00
|
|
|
$('#getLocation').trigger('change', function (e) {
|
|
|
|
alert('triggered');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-12-08 23:34:18 +00:00
|
|
|
$('#getService').on('change', function (event) {
|
|
|
|
|
|
|
|
if ($('#getService').val() === '' || $('#getService').val() === currentService) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
currentService = $('#getService').val();
|
|
|
|
handleLoader('#load_services', true);
|
2017-02-12 21:02:23 +00:00
|
|
|
$('#ServiceOption').slideUp();
|
2016-01-02 03:53:43 +00:00
|
|
|
$('#getOption').html('<option disabled selected> -- Select a Service Option</option>');
|
2016-11-27 19:30:44 +00:00
|
|
|
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
|
2015-12-08 23:34:18 +00:00
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
method: 'POST',
|
2015-12-10 23:30:47 +00:00
|
|
|
url: '/admin/servers/new/service-options',
|
2015-12-08 23:34:18 +00:00
|
|
|
headers: {
|
|
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
service: $('#getService').val()
|
|
|
|
}
|
|
|
|
}).done(function (data) {
|
2016-02-13 22:29:52 +00:00
|
|
|
$.each(data, function (i, option) {
|
2015-12-10 23:30:47 +00:00
|
|
|
$('#getOption').append('<option value="' + option.id + '" data-image="' + option.docker_image + '">' + option.name + '</option>');
|
2015-12-08 23:34:18 +00:00
|
|
|
});
|
|
|
|
$('#getOption').parent().parent().removeClass('hidden');
|
|
|
|
}).fail(function (jqXHR) {
|
|
|
|
alert('An error occured while attempting to list options for this service.');
|
|
|
|
currentService = null;
|
2015-12-10 23:30:47 +00:00
|
|
|
console.error(jqXHR);
|
|
|
|
}).always(function () {
|
|
|
|
handleLoader('#load_services');
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$('#getOption').on('change', function (event) {
|
|
|
|
|
|
|
|
handleLoader('#load_services', true);
|
2017-02-12 21:02:23 +00:00
|
|
|
handleLoader('#ServiceOption', true);
|
2015-12-10 23:30:47 +00:00
|
|
|
$('#serverVariables').html('');
|
|
|
|
$('input[name="custom_image_name"]').val($(this).find(':selected').data('image'));
|
2016-11-27 19:30:44 +00:00
|
|
|
$('#getPack').html('<option disabled selected> -- Select a Service Pack</option>');
|
2015-12-10 23:30:47 +00:00
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
method: 'POST',
|
2016-11-27 19:30:44 +00:00
|
|
|
url: '/admin/servers/new/option-details',
|
2015-12-10 23:30:47 +00:00
|
|
|
headers: {
|
|
|
|
'X-CSRF-TOKEN': '{{ csrf_token() }}'
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
option: $('#getOption').val()
|
|
|
|
}
|
|
|
|
}).done(function (data) {
|
2016-02-13 22:29:52 +00:00
|
|
|
$('#startupExec').html(data.exec);
|
|
|
|
$('input[name="startup"]').val(data.startup);
|
2016-11-27 19:30:44 +00:00
|
|
|
|
|
|
|
$.each(data.packs, function (i, item) {
|
2016-11-27 19:57:23 +00:00
|
|
|
$('#getPack').append('<option value="' + item.id + '">' + item.name + ' (' + item.version + ')</option>');
|
2016-11-27 19:30:44 +00:00
|
|
|
});
|
2016-11-27 19:50:10 +00:00
|
|
|
$('#getPack').append('<option value="0">No Service Pack</option>').parent().parent().removeClass('hidden');
|
2016-11-27 19:30:44 +00:00
|
|
|
|
2016-02-13 22:29:52 +00:00
|
|
|
$.each(data.variables, function (i, item) {
|
2016-01-10 22:18:33 +00:00
|
|
|
var isRequired = (item.required === 1) ? '<span class="label label-primary">Required</span> ' : '';
|
2015-12-10 23:30:47 +00:00
|
|
|
var dataAppend = ' \
|
2016-01-04 04:16:03 +00:00
|
|
|
<div class="form-group col-md-12">\
|
2016-01-10 22:18:33 +00:00
|
|
|
<label for="var_ref_' + item.id + '" class="control-label">' + isRequired + item.name + '</label> \
|
2015-12-10 23:30:47 +00:00
|
|
|
<div>\
|
2015-12-11 04:13:32 +00:00
|
|
|
<input type="text" autocomplete="off" name="env_' + item.env_variable + '" class="form-control" value="' + item.default_value + '" />\
|
2015-12-10 23:30:47 +00:00
|
|
|
<p class="text-muted"><small>' + item.description + '</small></p>\
|
|
|
|
<p class="text-muted"><small>Regex Requirements for Input: <code>' + item.regex + '</code></small></p>\
|
2016-01-03 23:10:28 +00:00
|
|
|
<p class="text-muted"><small>Access in Startup: <code>@{{' + item.env_variable + '}}</code></small></p>\
|
2015-12-10 23:30:47 +00:00
|
|
|
</div>\
|
|
|
|
</div>\
|
|
|
|
';
|
|
|
|
$('#serverVariables').append(dataAppend);
|
|
|
|
});
|
2017-02-12 21:02:23 +00:00
|
|
|
$('#ServiceOption').slideDown();
|
2015-12-10 23:30:47 +00:00
|
|
|
}).fail(function (jqXHR) {
|
|
|
|
console.error(jqXHR);
|
2015-12-08 23:34:18 +00:00
|
|
|
}).always(function () {
|
|
|
|
handleLoader('#load_services');
|
2017-02-12 21:02:23 +00:00
|
|
|
handleLoader('#ServiceOption');
|
2015-12-08 23:34:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-12-07 05:47:19 +00:00
|
|
|
// Show Loading Animation
|
2015-12-08 23:34:18 +00:00
|
|
|
function handleLoader (element, show) {
|
|
|
|
|
|
|
|
var spinner = $(element).find('.ajax_loading_position');
|
|
|
|
var popover = $(element).find('.ajax_loading_box');
|
2015-12-07 05:47:19 +00:00
|
|
|
|
|
|
|
// Show Animation
|
2015-12-08 23:34:18 +00:00
|
|
|
if (typeof show !== 'undefined') {
|
|
|
|
var height = $(element).height();
|
|
|
|
var width = $(element).width();
|
2015-12-07 05:47:19 +00:00
|
|
|
var center_height = (height / 2) - 16;
|
|
|
|
var center_width = (width / 2) - 16;
|
2015-12-08 23:34:18 +00:00
|
|
|
spinner.css({
|
2015-12-07 05:47:19 +00:00
|
|
|
'top': center_height,
|
|
|
|
'left': center_width,
|
|
|
|
'font-size': '32px'
|
|
|
|
});
|
2015-12-08 23:34:18 +00:00
|
|
|
popover.css({
|
2015-12-07 05:47:19 +00:00
|
|
|
'height': height,
|
|
|
|
'margin': '-20px 0 0 -5px',
|
|
|
|
'width': width
|
|
|
|
}).fadeIn();
|
|
|
|
} else {
|
2015-12-08 23:34:18 +00:00
|
|
|
popover.hide();
|
2015-12-07 05:47:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@endsection
|