feat: check custom internal name through server's applications.

This commit is contained in:
Andras Bacsai
2024-07-25 11:30:31 +02:00
parent 69d8f706cf
commit 321c51f8ed

View File

@@ -96,6 +96,20 @@ class Advanced extends Component
} else {
$this->application->settings->custom_internal_name = null;
}
$customInternalName = $this->application->settings->custom_internal_name;
$server = $this->application->destination->server;
$allApplications = $server->applications();
$foundSameInternalName = $allApplications->filter(function ($application) {
return $application->id !== $this->application->id && $application->settings->custom_internal_name === $this->application->settings->custom_internal_name;
});
if ($foundSameInternalName->isNotEmpty()) {
$this->dispatch('error', 'This custom container name is already in use by another application on this server.');
$this->application->settings->custom_internal_name = $customInternalName;
$this->application->settings->refresh();
return;
}
$this->application->settings->save();
$this->dispatch('success', 'Custom name saved.');
}