From a7dab697115713ee45728a36296b31edf5d31fc8 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Sat, 11 Apr 2020 14:46:30 -0600 Subject: [PATCH] Persist service variables --- .../themes/pterodactyl/js/admin/new-server.js | 7 +++ resources/views/admin/servers/new.blade.php | 48 +++++++++++++------ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/public/themes/pterodactyl/js/admin/new-server.js b/public/themes/pterodactyl/js/admin/new-server.js index d52502f33..3e0718a46 100644 --- a/public/themes/pterodactyl/js/admin/new-server.js +++ b/public/themes/pterodactyl/js/admin/new-server.js @@ -101,8 +101,11 @@ $('#pEggId').on('change', function (event) { ), }); + const variableIds = {}; $('#appendVariablesTo').html(''); $.each(_.get(objectChain, 'variables', []), function (i, item) { + variableIds[item.env_variable] = 'var_ref_' + item.id; + let isRequired = (item.required === 1) ? 'Required ' : ''; let dataAppend = ' \
\ @@ -115,6 +118,10 @@ $('#pEggId').on('change', function (event) { '; $('#appendVariablesTo').append(dataAppend); }); + + // If you receive a warning on this line, it should be fine to ignore. this function is + // defined in "resources/views/admin/servers/new.blade.php" near the bottom of the file. + serviceVariablesUpdated($('#pEggId').val(), variableIds); }); $('#pAllocation').on('change', function () { diff --git a/resources/views/admin/servers/new.blade.php b/resources/views/admin/servers/new.blade.php index b3418347e..1d61f1a50 100644 --- a/resources/views/admin/servers/new.blade.php +++ b/resources/views/admin/servers/new.blade.php @@ -309,11 +309,31 @@ @section('footer-scripts') @parent {!! Theme::js('vendor/lodash/lodash.js') !!} + + + {!! Theme::js('js/admin/new-server.js') !!} @endsection