Fix egg copy from, closes #995

This commit is contained in:
Dane Everitt 2018-03-06 23:07:00 -06:00
parent 4952a27903
commit 5839034e8f
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 36 additions and 7 deletions

View file

@ -7,6 +7,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
### Fixed ### Fixed
* Fixes a UI error when attempting to change the default Nest and Egg for an existing server. * Fixes a UI error when attempting to change the default Nest and Egg for an existing server.
* Correct permissions check in UI to allow subusers with permission to `view-allocations` the ability to actually see the sidebar link. * Correct permissions check in UI to allow subusers with permission to `view-allocations` the ability to actually see the sidebar link.
* Fixes improper behavior when marking an egg as copying the configuration from another.
### Changed ### Changed
* Panel now throws proper 504: Gateway Timeout errors on server listing when daemon is offline. * Panel now throws proper 504: Gateway Timeout errors on server listing when daemon is offline.

View file

@ -113,7 +113,11 @@ class Egg extends Model implements CleansAttributes, ValidableContract
*/ */
public function getCopyScriptInstallAttribute() public function getCopyScriptInstallAttribute()
{ {
return (is_null($this->copy_script_from)) ? $this->script_install : $this->scriptFrom->script_install; if (! is_null($this->script_install) || is_null($this->copy_script_from)) {
return $this->script_install;
}
return $this->scriptFrom->script_install;
} }
/** /**
@ -124,7 +128,11 @@ class Egg extends Model implements CleansAttributes, ValidableContract
*/ */
public function getCopyScriptEntryAttribute() public function getCopyScriptEntryAttribute()
{ {
return (is_null($this->copy_script_from)) ? $this->script_entry : $this->scriptFrom->script_entry; if (! is_null($this->script_entry) || is_null($this->copy_script_from)) {
return $this->script_entry;
}
return $this->scriptFrom->script_entry;
} }
/** /**
@ -135,7 +143,11 @@ class Egg extends Model implements CleansAttributes, ValidableContract
*/ */
public function getCopyScriptContainerAttribute() public function getCopyScriptContainerAttribute()
{ {
return (is_null($this->copy_script_from)) ? $this->script_container : $this->scriptFrom->script_container; if (! is_null($this->script_container) || is_null($this->copy_script_from)) {
return $this->script_container;
}
return $this->scriptFrom->script_container;
} }
/** /**
@ -145,7 +157,11 @@ class Egg extends Model implements CleansAttributes, ValidableContract
*/ */
public function getInheritConfigFilesAttribute() public function getInheritConfigFilesAttribute()
{ {
return is_null($this->config_from) ? $this->config_files : $this->configFrom->config_files; if (! is_null($this->config_files) || is_null($this->config_from)) {
return $this->config_files;
}
return $this->configFrom->config_files;
} }
/** /**
@ -155,7 +171,11 @@ class Egg extends Model implements CleansAttributes, ValidableContract
*/ */
public function getInheritConfigStartupAttribute() public function getInheritConfigStartupAttribute()
{ {
return is_null($this->config_from) ? $this->config_startup : $this->configFrom->config_startup; if (! is_null($this->config_startup) || is_null($this->config_from)) {
return $this->config_startup;
}
return $this->configFrom->config_startup;
} }
/** /**
@ -165,7 +185,11 @@ class Egg extends Model implements CleansAttributes, ValidableContract
*/ */
public function getInheritConfigLogsAttribute() public function getInheritConfigLogsAttribute()
{ {
return is_null($this->config_from) ? $this->config_logs : $this->configFrom->config_logs; if (! is_null($this->config_logs) || is_null($this->config_from)) {
return $this->config_logs;
}
return $this->configFrom->config_logs;
} }
/** /**
@ -175,7 +199,11 @@ class Egg extends Model implements CleansAttributes, ValidableContract
*/ */
public function getInheritConfigStopAttribute() public function getInheritConfigStopAttribute()
{ {
return is_null($this->config_from) ? $this->config_stop : $this->configFrom->config_stop; if (! is_null($this->config_stop) || is_null($this->config_from)) {
return $this->config_stop;
}
return $this->configFrom->config_stop;
} }
/** /**