Fix server startup dropdown for egg being incorrect, fixes #778

This commit is contained in:
Dane Everitt 2017-11-25 12:27:08 -06:00
parent 34db4102b9
commit 0bb44a4972
4 changed files with 12 additions and 10 deletions

View file

@ -6,6 +6,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
## v0.7.0-beta.3 (Derelict Dermodactylus) ## v0.7.0-beta.3 (Derelict Dermodactylus)
### Fixed ### Fixed
* `[beta.2]` — Fixes a bug that would cause an endless exception message stream in the console when attemping to setup environment settings in certain instances. * `[beta.2]` — Fixes a bug that would cause an endless exception message stream in the console when attemping to setup environment settings in certain instances.
* `[beta.2]` — Fixes a bug causing the dropdown menu for a server's egg to display the wrong selected value.
## v0.7.0-beta.2 (Derelict Dermodactylus) ## v0.7.0-beta.2 (Derelict Dermodactylus)
### Fixed ### Fixed

View file

@ -319,14 +319,14 @@ class ServersController extends Controller
/** /**
* Display startup configuration page for a server. * Display startup configuration page for a server.
* *
* @param int $server * @param \Pterodactyl\Models\Server $server
* @return \Illuminate\View\View * @return \Illuminate\View\View
* *
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/ */
public function viewStartup($server) public function viewStartup(Server $server)
{ {
$parameters = $this->repository->getVariablesWithValues($server, true); $parameters = $this->repository->getVariablesWithValues($server->id, true);
if (! $parameters->server->installed) { if (! $parameters->server->installed) {
abort(404); abort(404);
} }
@ -334,6 +334,7 @@ class ServersController extends Controller
$nests = $this->nestRepository->getWithEggs(); $nests = $this->nestRepository->getWithEggs();
Javascript::put([ Javascript::put([
'server' => $server,
'nests' => $nests->map(function ($item) { 'nests' => $nests->map(function ($item) {
return array_merge($item->toArray(), [ return array_merge($item->toArray(), [
'eggs' => $item->eggs->keyBy('id')->toArray(), 'eggs' => $item->eggs->keyBy('id')->toArray(),

View file

@ -16,7 +16,7 @@ return [
'default_allocation_not_found' => 'The requested default allocation was not found in this server\'s allocations.', 'default_allocation_not_found' => 'The requested default allocation was not found in this server\'s allocations.',
], ],
'alerts' => [ 'alerts' => [
'startup_changed' => 'The startup configuration for this server has been updated. If this server\'s service or option was changed a reinstall will be occuring now.', 'startup_changed' => 'The startup configuration for this server has been updated. If this server\'s nest or egg was changed a reinstall will be occuring now.',
'server_deleted' => 'Server has successfully been deleted from the system.', 'server_deleted' => 'Server has successfully been deleted from the system.',
'server_created' => 'Server was successfully created on the panel. Please allow the daemon a few minutes to completely install this server.', 'server_created' => 'Server was successfully created on the panel. Please allow the daemon a few minutes to completely install this server.',
'build_updated' => 'The build details for this server have been updated. Some changes may require a restart to take effect.', 'build_updated' => 'The build details for this server have been updated. Some changes may require a restart to take effect.',

View file

@ -148,7 +148,7 @@
text: item.name, text: item.name,
}; };
}), }),
}).change(); }).val(Pterodactyl.server.egg_id).change();
}); });
$('#pEggId').on('change', function (event) { $('#pEggId').on('change', function (event) {
@ -157,8 +157,8 @@
$('#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'));
if (objectChain.id === parseInt('{{ $server->egg_id }}')) { if (objectChain.id === parseInt(Pterodactyl.server.egg_id)) {
$('#pDockerImage').val('{{ $server->image }}'); $('#pDockerImage').val(Pterodactyl.server.image);
} }
if (!_.get(objectChain, 'startup', false)) { if (!_.get(objectChain, 'startup', false)) {
@ -178,9 +178,9 @@
), ),
}); });
@if(! is_null($server->pack_id)) if (Pterodactyl.server.pack_id !== null) {
$('#pPackId').val({{ $server->pack_id }}); $('#pPackId').val(Pterodactyl.server.pack_id);
@endif }
$('#appendVariablesTo').html(''); $('#appendVariablesTo').html('');
$.each(_.get(objectChain, 'variables', []), function (i, item) { $.each(_.get(objectChain, 'variables', []), function (i, item) {