Refactor custom labels handling in General.php and update Docker Compose Content label in general.blade.php
This commit is contained in:
		@@ -117,7 +117,9 @@ class General extends Component
 | 
				
			|||||||
        $this->isConfigurationChanged = $this->application->isConfigurationChanged();
 | 
					        $this->isConfigurationChanged = $this->application->isConfigurationChanged();
 | 
				
			||||||
        $this->customLabels = $this->application->parseContainerLabels();
 | 
					        $this->customLabels = $this->application->parseContainerLabels();
 | 
				
			||||||
        if (!$this->customLabels) {
 | 
					        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->initialDockerComposeLocation = $this->application->docker_compose_location;
 | 
				
			||||||
        $this->checkLabelUpdates();
 | 
					        $this->checkLabelUpdates();
 | 
				
			||||||
@@ -204,7 +206,12 @@ class General extends Component
 | 
				
			|||||||
    public function submit($showToaster = true)
 | 
					    public function submit($showToaster = true)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        try {
 | 
					        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) {
 | 
					            if ($this->application->build_pack === 'dockercompose' && $this->initialDockerComposeLocation !== $this->application->docker_compose_location) {
 | 
				
			||||||
                $this->loadComposeFile();
 | 
					                $this->loadComposeFile();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -212,9 +219,7 @@ class General extends Component
 | 
				
			|||||||
            if ($this->ports_exposes !== $this->application->ports_exposes) {
 | 
					            if ($this->ports_exposes !== $this->application->ports_exposes) {
 | 
				
			||||||
                $this->resetDefaultLabels(false);
 | 
					                $this->resetDefaultLabels(false);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (!$this->customLabels) {
 | 
					
 | 
				
			||||||
                $this->resetDefaultLabels(false);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            if (data_get($this->application, 'build_pack') === 'dockerimage') {
 | 
					            if (data_get($this->application, 'build_pack') === 'dockerimage') {
 | 
				
			||||||
                $this->validate([
 | 
					                $this->validate([
 | 
				
			||||||
                    'application.docker_registry_image_name' => 'required',
 | 
					                    'application.docker_registry_image_name' => 'required',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -189,7 +189,7 @@
 | 
				
			|||||||
                <x-forms.button wire:click="loadComposeFile">Reload Compose File</x-forms.button>
 | 
					                <x-forms.button wire:click="loadComposeFile">Reload Compose File</x-forms.button>
 | 
				
			||||||
                @if ($application->settings->is_raw_compose_deployment_enabled)
 | 
					                @if ($application->settings->is_raw_compose_deployment_enabled)
 | 
				
			||||||
                    <x-forms.textarea rows="10" readonly id="application.docker_compose_raw"
 | 
					                    <x-forms.textarea rows="10" readonly id="application.docker_compose_raw"
 | 
				
			||||||
                        label="Docker Compose Content" helper="You need to modify the docker compose file." />
 | 
					                        label="Docker Compose Content (applicationId: {{$application->id}})" helper="You need to modify the docker compose file." />
 | 
				
			||||||
                @else
 | 
					                @else
 | 
				
			||||||
                    <x-forms.textarea rows="10" readonly id="application.docker_compose"
 | 
					                    <x-forms.textarea rows="10" readonly id="application.docker_compose"
 | 
				
			||||||
                        label="Docker Compose Content" helper="You need to modify the docker compose file." />
 | 
					                        label="Docker Compose Content" helper="You need to modify the docker compose file." />
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user