Path: blob/1.0-develop/resources/views/admin/servers/view/startup.blade.php
7461 views
@extends('layouts.admin')12@section('title')3Server — {{ $server->name }}: Startup4@endsection56@section('content-header')7<h1>{{ $server->name }}<small>Control startup command as well as variables.</small></h1>8<ol class="breadcrumb">9<li><a href="{{ route('admin.index') }}">Admin</a></li>10<li><a href="{{ route('admin.servers') }}">Servers</a></li>11<li><a href="{{ route('admin.servers.view', $server->id) }}">{{ $server->name }}</a></li>12<li class="active">Startup</li>13</ol>14@endsection1516@section('content')17@include('admin.servers.partials.navigation')18<form action="{{ route('admin.servers.view.startup', $server->id) }}" method="POST">19<div class="row">20<div class="col-xs-12">21<div class="box box-primary">22<div class="box-header with-border">23<h3 class="box-title">Startup Command Modification</h3>24</div>25<div class="box-body">26<label for="pStartup" class="form-label">Startup Command</label>27<input id="pStartup" name="startup" class="form-control" type="text" value="{{ old('startup', $server->startup) }}" />28<p class="small text-muted">Edit your server's startup command here. The following variables are available by default: <code>@{{SERVER_MEMORY}}</code>, <code>@{{SERVER_IP}}</code>, and <code>@{{SERVER_PORT}}</code>.</p>29</div>30<div class="box-body">31<label for="pDefaultStartupCommand" class="form-label">Default Service Start Command</label>32<input id="pDefaultStartupCommand" class="form-control" type="text" readonly />33</div>34<div class="box-footer">35{!! csrf_field() !!}36<button type="submit" class="btn btn-primary btn-sm pull-right">Save Modifications</button>37</div>38</div>39</div>40</div>41<div class="row">42<div class="col-md-6">43<div class="box">44<div class="box-header with-border">45<h3 class="box-title">Service Configuration</h3>46</div>47<div class="box-body row">48<div class="col-xs-12">49<p class="small text-danger">50Changing any of the below values will result in the server processing a re-install command. The server will be stopped and will then proceed.51If you would like the service scripts to not run, ensure the box is checked at the bottom.52</p>53<p class="small text-danger">54<strong>This is a destructive operation in many cases. This server will be stopped immediately in order for this action to proceed.</strong>55</p>56</div>57<div class="form-group col-xs-12">58<label for="pNestId">Nest</label>59<select name="nest_id" id="pNestId" class="form-control">60@foreach($nests as $nest)61<option value="{{ $nest->id }}"62@if($nest->id === $server->nest_id)63selected64@endif65>{{ $nest->name }}</option>66@endforeach67</select>68<p class="small text-muted no-margin">Select the Nest that this server will be grouped into.</p>69</div>70<div class="form-group col-xs-12">71<label for="pEggId">Egg</label>72<select name="egg_id" id="pEggId" class="form-control"></select>73<p class="small text-muted no-margin">Select the Egg that will provide processing data for this server.</p>74</div>75<div class="form-group col-xs-12">76<div class="checkbox checkbox-primary no-margin-bottom">77<input id="pSkipScripting" name="skip_scripts" type="checkbox" value="1" @if($server->skip_scripts) checked @endif />78<label for="pSkipScripting" class="strong">Skip Egg Install Script</label>79</div>80<p class="small text-muted no-margin">If the selected Egg has an install script attached to it, the script will run during install. If you would like to skip this step, check this box.</p>81</div>82</div>83</div>84<div class="box">85<div class="box-header with-border">86<h3 class="box-title">Docker Image Configuration</h3>87</div>88<div class="box-body">89<div class="form-group">90<label for="pDockerImage">Image</label>91<select id="pDockerImage" name="docker_image" class="form-control"></select>92<input id="pDockerImageCustom" name="custom_docker_image" value="{{ old('custom_docker_image') }}" class="form-control" placeholder="Or enter a custom image..." style="margin-top:1rem"/>93<p class="small text-muted no-margin">This is the Docker image that will be used to run this server. Select an image from the dropdown or enter a custom image in the text field above.</p>94</div>95</div>96</div>97</div>98<div class="col-md-6">99<div class="row" id="appendVariablesTo"></div>100</div>101</div>102</form>103@endsection104105@section('footer-scripts')106@parent107{!! Theme::js('vendor/lodash/lodash.js') !!}108<script>109function escapeHtml(str) {110var div = document.createElement('div');111div.appendChild(document.createTextNode(str));112return div.innerHTML;113}114115$(document).ready(function () {116$('#pEggId').select2({placeholder: 'Select a Nest Egg'}).on('change', function () {117var selectedEgg = _.isNull($(this).val()) ? $(this).find('option').first().val() : $(this).val();118var parentChain = _.get(Pterodactyl.nests, $("#pNestId").val());119var objectChain = _.get(parentChain, 'eggs.' + selectedEgg);120121const images = _.get(objectChain, 'docker_images', [])122$('#pDockerImage').html('');123const keys = Object.keys(images);124for (let i = 0; i < keys.length; i++) {125let opt = document.createElement('option');126opt.value = images[keys[i]];127opt.innerText = keys[i] + " (" + images[keys[i]] + ")";128if (objectChain.id === parseInt(Pterodactyl.server.egg_id) && Pterodactyl.server.image == opt.value) {129opt.selected = true130}131$('#pDockerImage').append(opt);132}133$('#pDockerImage').on('change', function () {134$('#pDockerImageCustom').val('');135})136137if (objectChain.id === parseInt(Pterodactyl.server.egg_id)) {138if ($('#pDockerImage').val() != Pterodactyl.server.image) {139$('#pDockerImageCustom').val(Pterodactyl.server.image);140}141}142143if (!_.get(objectChain, 'startup', false)) {144$('#pDefaultStartupCommand').val(_.get(parentChain, 'startup', 'ERROR: Startup Not Defined!'));145} else {146$('#pDefaultStartupCommand').val(_.get(objectChain, 'startup'));147}148149$('#appendVariablesTo').html('');150$.each(_.get(objectChain, 'variables', []), function (i, item) {151var setValue = _.get(Pterodactyl.server_variables, item.env_variable, item.default_value);152var isRequired = (item.required === 1) ? '<span class="label label-danger">Required</span> ' : '';153var dataAppend = ' \154<div class="col-xs-12"> \155<div class="box"> \156<div class="box-header with-border"> \157<h3 class="box-title">' + isRequired + escapeHtml(item.name) + '</h3> \158</div> \159<div class="box-body"> \160<input name="environment[' + escapeHtml(item.env_variable) + ']" class="form-control" type="text" id="egg_variable_' + escapeHtml(item.env_variable) + '" /> \161<p class="no-margin small text-muted">' + escapeHtml(item.description) + '</p> \162</div> \163<div class="box-footer"> \164<p class="no-margin text-muted small"><strong>Startup Command Variable:</strong> <code>' + escapeHtml(item.env_variable) + '</code></p> \165<p class="no-margin text-muted small"><strong>Input Rules:</strong> <code>' + escapeHtml(item.rules) + '</code></p> \166</div> \167</div> \168</div>';169$('#appendVariablesTo').append(dataAppend).find('#egg_variable_' + item.env_variable).val(setValue);170});171});172173$('#pNestId').select2({placeholder: 'Select a Nest'}).on('change', function () {174$('#pEggId').html('').select2({175data: $.map(_.get(Pterodactyl.nests, $(this).val() + '.eggs', []), function (item) {176return {177id: item.id,178text: item.name,179};180}),181});182183if (_.isObject(_.get(Pterodactyl.nests, $(this).val() + '.eggs.' + Pterodactyl.server.egg_id))) {184$('#pEggId').val(Pterodactyl.server.egg_id);185}186187$('#pEggId').change();188}).change();189});190</script>191@endsection192193194