fix(application): add option to suppress toast notifications when loading compose file

This commit is contained in:
Andras Bacsai
2025-07-18 23:22:24 +02:00
parent 039aa86321
commit 5ddaf3a61f

View File

@@ -215,25 +215,21 @@ class General extends Component
} }
public function loadComposeFile($isInit = false) public function loadComposeFile($isInit = false, $showToast = true)
{ {
try { try {
if ($isInit && $this->application->docker_compose_raw) { if ($isInit && $this->application->docker_compose_raw) {
return; return;
} }
// Must reload the application to get the latest database changes
// Why? Not sure, but it works.
// $this->application->refresh();
['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation] = $this->application->loadComposeFile($isInit); ['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation] = $this->application->loadComposeFile($isInit);
if (is_null($this->parsedServices)) { if (is_null($this->parsedServices)) {
$this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.'); $showToast && $this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.');
return; return;
} }
$this->application->parse(); $this->application->parse();
$this->dispatch('success', 'Docker compose file loaded.'); $showToast && $this->dispatch('success', 'Docker compose file loaded.');
$this->dispatch('compose_loaded'); $this->dispatch('compose_loaded');
$this->dispatch('refreshStorages'); $this->dispatch('refreshStorages');
$this->dispatch('refreshEnvs'); $this->dispatch('refreshEnvs');
@@ -275,7 +271,7 @@ class General extends Component
$this->dispatch('success', 'Domain generated.'); $this->dispatch('success', 'Domain generated.');
if ($this->application->build_pack === 'dockercompose') { if ($this->application->build_pack === 'dockercompose') {
$this->updateServiceEnvironmentVariables(); $this->updateServiceEnvironmentVariables();
$this->loadComposeFile(); $this->loadComposeFile(showToast: false);
} }
return $domain; return $domain;