1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-26 02:52:30 +01:00

Fix UI error changing a server's service, closes #1019

This commit is contained in:
Dane Everitt 2018-03-06 21:53:05 -06:00
parent 36837df0a6
commit c9e874d3ae
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
2 changed files with 20 additions and 14 deletions

View File

@ -3,6 +3,10 @@ This file is a running track of new features and fixes to each version of the pa
This project follows [Semantic Versioning](http://semver.org) guidelines. This project follows [Semantic Versioning](http://semver.org) guidelines.
## v0.7.6 (Derelict Dermodactylus)
### Fixed
* Fixes a UI error when attempting to change the default Nest and Egg for an existing server.
## v0.7.5 (Derelict Dermodactylus) ## v0.7.5 (Derelict Dermodactylus)
### Fixed ### Fixed
* Fixes application API keys being created as a client API key. * Fixes application API keys being created as a client API key.

View File

@ -134,13 +134,8 @@
{!! Theme::js('vendor/lodash/lodash.js') !!} {!! Theme::js('vendor/lodash/lodash.js') !!}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#pNestId').select2({placeholder: 'Select a Nest'}).change();
$('#pEggId').select2({placeholder: 'Select a Nest Egg'});
$('#pPackId').select2({placeholder: 'Select a Service Pack'}); $('#pPackId').select2({placeholder: 'Select a Service Pack'});
}); $('#pNestId').select2({placeholder: 'Select a Nest'}).on('change', function () {
</script>
<script>
$('#pNestId').on('change', function (event) {
$('#pEggId').html('').select2({ $('#pEggId').html('').select2({
data: $.map(_.get(Pterodactyl.nests, $(this).val() + '.eggs', []), function (item) { data: $.map(_.get(Pterodactyl.nests, $(this).val() + '.eggs', []), function (item) {
return { return {
@ -148,12 +143,19 @@
text: item.name, text: item.name,
}; };
}), }),
}).val(Pterodactyl.server.egg_id).change(); });
});
$('#pEggId').on('change', function (event) { if (_.isObject(_.get(Pterodactyl.nests, $(this).val() + '.eggs.' + Pterodactyl.server.egg_id))) {
var parentChain = _.get(Pterodactyl.nests, $('#pNestId').val(), null); $('#pEggId').val(Pterodactyl.server.egg_id);
var objectChain = _.get(parentChain, 'eggs.' + $(this).val(), null); }
$('#pEggId').change();
}).change();
$('#pEggId').select2({placeholder: 'Select a Nest Egg'}).on('change', function () {
var selectedEgg = _.isNull($(this).val()) ? $(this).find('option').first().val() : $(this).val();
var parentChain = _.get(Pterodactyl.nests, $("#pNestId").val());
var objectChain = _.get(parentChain, 'eggs.' + selectedEgg);
$('#setDefaultImage').html(_.get(objectChain, 'docker_image', 'undefined')); $('#setDefaultImage').html(_.get(objectChain, 'docker_image', 'undefined'));
$('#pDockerImage').val(_.get(objectChain, 'docker_image', 'undefined')); $('#pDockerImage').val(_.get(objectChain, 'docker_image', 'undefined'));
@ -168,7 +170,7 @@
} }
$('#pPackId').html('').select2({ $('#pPackId').html('').select2({
data: [{ id: '0', text: 'No Service Pack' }].concat( data: [{id: '0', text: 'No Service Pack'}].concat(
$.map(_.get(objectChain, 'packs', []), function (item, i) { $.map(_.get(objectChain, 'packs', []), function (item, i) {
return { return {
id: item.id, id: item.id,
@ -202,9 +204,9 @@
</div> \ </div> \
</div> \ </div> \
</div>'; </div>';
$('#appendVariablesTo').append(dataAppend); $('#appendVariablesTo').append(dataAppend).find('#egg_variable_' + item.env_variable).val(setValue);
$('#appendVariablesTo').find('#egg_variable_' + item.env_variable).val(setValue);
}); });
}); });
});
</script> </script>
@endsection @endsection