Refactor application submit method to handle dockercompose build pack

This commit is contained in:
Andras Bacsai 2023-11-28 11:10:48 +01:00
parent 0eda49b104
commit 7f5d7e0eb0

View File

@ -199,7 +199,7 @@ public function updatedApplicationFqdn()
public function submit($showToaster = true)
{
try {
if ($this->initialDockerComposeLocation !== $this->application->docker_compose_location || $this->initialDockerComposePrLocation !== $this->application->docker_compose_pr_location) {
if ($this->application->build_pack === 'dockercompose' && ($this->initialDockerComposeLocation !== $this->application->docker_compose_location || $this->initialDockerComposePrLocation !== $this->application->docker_compose_pr_location)) {
$this->loadComposeFile();
}
$this->validate();
@ -234,10 +234,12 @@ public function submit($showToaster = true)
$this->customLabels = str($this->customLabels)->replace(',', "\n");
}
$this->application->custom_labels = $this->customLabels->explode("\n")->implode(',');
$this->application->docker_compose_domains = json_encode($this->parsedServiceDomains);
if ($this->application->build_pack === 'dockercompose') {
$this->application->docker_compose_domains = json_encode($this->parsedServiceDomains);
$this->parsedServices = $this->application->parseCompose();
}
$this->application->save();
$showToaster && $this->emit('success', 'Application settings updated!');
$this->parsedServices = $this->application->parseCompose();
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {