From 8791d681bcf9e3d6ac82e36fcafef9904523f0ee Mon Sep 17 00:00:00 2001 From: DaneEveritt Date: Fri, 13 May 2022 22:09:20 -0400 Subject: [PATCH] Fix server image selection not... existing --- public/themes/pterodactyl/js/admin/new-server.js | 9 +++++---- resources/views/admin/servers/view/startup.blade.php | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/public/themes/pterodactyl/js/admin/new-server.js b/public/themes/pterodactyl/js/admin/new-server.js index 39818963d..db138cbde 100644 --- a/public/themes/pterodactyl/js/admin/new-server.js +++ b/public/themes/pterodactyl/js/admin/new-server.js @@ -82,12 +82,13 @@ $('#pEggId').on('change', function (event) { let parentChain = _.get(Pterodactyl.nests, $('#pNestId').val(), null); let objectChain = _.get(parentChain, 'eggs.' + $(this).val(), null); - const images = _.get(objectChain, 'docker_images', []) + const images = _.get(objectChain, 'docker_images', {}) $('#pDefaultContainer').html(''); - for (let i = 0; i < images.length; i++) { + const keys = Object.keys(images); + for (let i = 0; i < keys.length; i++) { let opt = document.createElement('option'); - opt.value = images[i]; - opt.innerHTML = images[i]; + opt.value = images[keys[i]]; + opt.innerHTML = keys[i] + " (" + images[keys[i]] + ")"; $('#pDefaultContainer').append(opt); } diff --git a/resources/views/admin/servers/view/startup.blade.php b/resources/views/admin/servers/view/startup.blade.php index 389f8fc06..3dccdfda2 100644 --- a/resources/views/admin/servers/view/startup.blade.php +++ b/resources/views/admin/servers/view/startup.blade.php @@ -118,15 +118,15 @@ var parentChain = _.get(Pterodactyl.nests, $("#pNestId").val()); var objectChain = _.get(parentChain, 'eggs.' + selectedEgg); - $('#setDefaultImage').html(_.get(objectChain, 'docker_images.0', 'undefined')); const images = _.get(objectChain, 'docker_images', []) $('#pDockerImage').html(''); - for (let i = 0; i < images.length; i++) { + const keys = Object.keys(images); + for (let i = 0; i < keys.length; i++) { let opt = document.createElement('option'); - opt.value = images[i]; - opt.innerHTML = images[i]; + opt.value = images[keys[i]]; + opt.innerHTML = keys[i] + " (" + images[keys[i]] + ")"; if (objectChain.id === parseInt(Pterodactyl.server.egg_id) && Pterodactyl.server.image == opt.value) { - opt.checked = true + opt.selected = true } $('#pDockerImage').append(opt); }