Refactor custom labels handling in General.php and update Docker Compose Content label in general.blade.php

This commit is contained in:
Andras Bacsai
2024-01-02 17:14:52 +01:00
parent a8ca57d095
commit 83d96c8d11
2 changed files with 11 additions and 6 deletions

View File

@@ -117,7 +117,9 @@ class General extends Component
$this->isConfigurationChanged = $this->application->isConfigurationChanged();
$this->customLabels = $this->application->parseContainerLabels();
if (!$this->customLabels) {
$this->resetDefaultLabels(false);
$this->customLabels = str(implode(",", generateLabelsApplication($this->application)))->replace(',', "\n");
$this->application->custom_labels = base64_encode($this->customLabels);
$this->application->save();
}
$this->initialDockerComposeLocation = $this->application->docker_compose_location;
$this->checkLabelUpdates();
@@ -204,7 +206,12 @@ class General extends Component
public function submit($showToaster = true)
{
try {
ray($this->initialDockerComposeLocation, $this->application->docker_compose_location);
if (!$this->customLabels) {
$this->customLabels = str(implode(",", generateLabelsApplication($this->application)))->replace(',', "\n");
$this->application->custom_labels = base64_encode($this->customLabels);
$this->application->save();
}
if ($this->application->build_pack === 'dockercompose' && $this->initialDockerComposeLocation !== $this->application->docker_compose_location) {
$this->loadComposeFile();
}
@@ -212,9 +219,7 @@ class General extends Component
if ($this->ports_exposes !== $this->application->ports_exposes) {
$this->resetDefaultLabels(false);
}
if (!$this->customLabels) {
$this->resetDefaultLabels(false);
}
if (data_get($this->application, 'build_pack') === 'dockerimage') {
$this->validate([
'application.docker_registry_image_name' => 'required',