fix: port exposes change, shoud regenerate label

This commit is contained in:
Andras Bacsai 2023-10-20 12:34:25 +02:00
parent 51ef24e1fb
commit 266b99bc25

View File

@ -19,6 +19,7 @@ class General extends Component
public string $git_branch;
public ?string $git_commit_sha = null;
public string $build_pack;
public ?string $ports_exposes = null;
public $customLabels;
public bool $labelsChanged = false;
@ -80,6 +81,7 @@ class General extends Component
public function mount()
{
$this->ports_exposes = $this->application->ports_exposes;
if (str($this->application->status)->startsWith('running') && is_null($this->application->config_hash)) {
$this->application->isConfigurationChanged(true);
}
@ -156,6 +158,7 @@ public function getWildcardDomain()
public function resetDefaultLabels($showToaster = true)
{
$this->customLabels = str(implode(",", generateLabelsApplication($this->application)))->replace(',', "\n");
$this->ports_exposes = $this->application->ports_exposes;
$this->submit($showToaster);
}
@ -168,6 +171,9 @@ public function submit($showToaster = true)
{
try {
$this->validate();
if ($this->ports_exposes !== $this->application->ports_exposes) {
$this->resetDefaultLabels(false);
}
if (data_get($this->application, 'build_pack') === 'dockerimage') {
$this->validate([
'application.docker_registry_image_name' => 'required',