Merge pull request #1548 from coollabsio/next
fix: compose domains & links
This commit is contained in:
		| @@ -146,7 +146,6 @@ class General extends Component | |||||||
|             $this->parsedServiceDomains[$serviceName]['domain'] = $domain; |             $this->parsedServiceDomains[$serviceName]['domain'] = $domain; | ||||||
|             $this->application->docker_compose_domains = json_encode($this->parsedServiceDomains); |             $this->application->docker_compose_domains = json_encode($this->parsedServiceDomains); | ||||||
|             $this->application->save(); |             $this->application->save(); | ||||||
|             $this->dispatch('success', 'Domain generated.'); |  | ||||||
|         } |         } | ||||||
|         return $domain; |         return $domain; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -966,8 +966,6 @@ class Application extends BaseModel | |||||||
|     function loadComposeFile($isInit = false) |     function loadComposeFile($isInit = false) | ||||||
|     { |     { | ||||||
|         $initialDockerComposeLocation = $this->docker_compose_location; |         $initialDockerComposeLocation = $this->docker_compose_location; | ||||||
|         // $initialDockerComposePrLocation = $this->docker_compose_pr_location;
 |  | ||||||
|         if ($this->build_pack === 'dockercompose') { |  | ||||||
|         if ($isInit && $this->docker_compose_raw) { |         if ($isInit && $this->docker_compose_raw) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @@ -1020,13 +1018,28 @@ class Application extends BaseModel | |||||||
|             "rm -rf /tmp/{$uuid}", |             "rm -rf /tmp/{$uuid}", | ||||||
|         ]); |         ]); | ||||||
|         instant_remote_process($commands, $this->destination->server, false); |         instant_remote_process($commands, $this->destination->server, false); | ||||||
|  |         $parsedServices = $this->parseCompose(); | ||||||
|  |         if ($this->docker_compose_domains) { | ||||||
|  |             $json = collect(json_decode($this->docker_compose_domains)); | ||||||
|  |             $names = collect(data_get($parsedServices, 'services'))->keys()->toArray(); | ||||||
|  |             $jsonNames = $json->keys()->toArray(); | ||||||
|  |             $diff = array_diff($jsonNames, $names); | ||||||
|  |             $json = $json->filter(function ($value, $key) use ($diff) { | ||||||
|  |                 return !in_array($key, $diff); | ||||||
|  |             }); | ||||||
|  |             if ($json) { | ||||||
|  |                 $this->docker_compose_domains = json_encode($json); | ||||||
|  |             } else { | ||||||
|  |                 $this->docker_compose_domains = null; | ||||||
|  |             } | ||||||
|  |             $this->save(); | ||||||
|  |         } | ||||||
|         return [ |         return [ | ||||||
|                 'parsedServices' => $this->parseCompose(), |             'parsedServices' => $parsedServices, | ||||||
|             'initialDockerComposeLocation' => $this->docker_compose_location, |             'initialDockerComposeLocation' => $this->docker_compose_location, | ||||||
|             'initialDockerComposePrLocation' => $this->docker_compose_pr_location, |             'initialDockerComposePrLocation' => $this->docker_compose_pr_location, | ||||||
|         ]; |         ]; | ||||||
|     } |     } | ||||||
|     } |  | ||||||
|     function parseContainerLabels(?ApplicationPreview $preview = null) |     function parseContainerLabels(?ApplicationPreview $preview = null) | ||||||
|     { |     { | ||||||
|         $customLabels = data_get($this, 'custom_labels'); |         $customLabels = data_get($this, 'custom_labels'); | ||||||
|   | |||||||
| @@ -23,9 +23,10 @@ | |||||||
|                 @if (data_get($application, 'build_pack') === 'dockercompose') |                 @if (data_get($application, 'build_pack') === 'dockercompose') | ||||||
|                     @foreach (collect(json_decode($this->application->docker_compose_domains)) as $fqdn) |                     @foreach (collect(json_decode($this->application->docker_compose_domains)) as $fqdn) | ||||||
|                         @if (data_get($fqdn, 'domain')) |                         @if (data_get($fqdn, 'domain')) | ||||||
|  |                             @foreach (explode(',', data_get($fqdn, 'domain')) as $domain) | ||||||
|                                 <li> |                                 <li> | ||||||
|                                     <a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white" |                                     <a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white" | ||||||
|                                     target="_blank" href="{{ getFqdnWithoutPort(data_get($fqdn, 'domain')) }}"> |                                         target="_blank" href="{{ getFqdnWithoutPort($domain) }}"> | ||||||
|                                         <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" |                                         <svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" | ||||||
|                                             stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" |                                             stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" | ||||||
|                                             stroke-linejoin="round"> |                                             stroke-linejoin="round"> | ||||||
| @@ -34,9 +35,10 @@ | |||||||
|                                             <path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464" /> |                                             <path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464" /> | ||||||
|                                             <path |                                             <path | ||||||
|                                                 d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463" /> |                                                 d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463" /> | ||||||
|                                     </svg>{{ getFqdnWithoutPort(data_get($fqdn, 'domain')) }} |                                         </svg>{{ getFqdnWithoutPort($domain) }} | ||||||
|                                     </a> |                                     </a> | ||||||
|                                 </li> |                                 </li> | ||||||
|  |                             @endforeach | ||||||
|                         @endif |                         @endif | ||||||
|                     @endforeach |                     @endforeach | ||||||
|                 @endif |                 @endif | ||||||
|   | |||||||
| @@ -230,14 +230,7 @@ | |||||||
|                 <li class="step step-secondary">Select a Server</li> |                 <li class="step step-secondary">Select a Server</li> | ||||||
|                 <li class="step step-secondary">Select a Destination</li> |                 <li class="step step-secondary">Select a Destination</li> | ||||||
|             </ul> |             </ul> | ||||||
|             <a wire:navigate href="{{ route('destination.new', ['server_id' => $server_id]) }}" | 
 | ||||||
|                 class="items-center justify-center pb-10 text-center box-without-bg group bg-coollabs hover:bg-coollabs-100"> |  | ||||||
|                 <div class="flex flex-col mx-6 "> |  | ||||||
|                     <div class="font-bold text-white"> |  | ||||||
|                         + Add New |  | ||||||
|                     </div> |  | ||||||
|                 </div> |  | ||||||
|             </a> |  | ||||||
|             <div class="flex flex-col justify-center gap-2 text-left xl:flex-row xl:flex-wrap"> |             <div class="flex flex-col justify-center gap-2 text-left xl:flex-row xl:flex-wrap"> | ||||||
| 
 | 
 | ||||||
|                 @foreach ($standaloneDockers as $standaloneDocker) |                 @foreach ($standaloneDockers as $standaloneDocker) | ||||||
| @@ -260,6 +253,14 @@ | |||||||
|                         </div> |                         </div> | ||||||
|                     </div> |                     </div> | ||||||
|                 @endforeach |                 @endforeach | ||||||
|  |                 <a wire:navigate href="{{ route('destination.new', ['server_id' => $server_id]) }}" | ||||||
|  |                     class="items-center justify-center pb-10 text-center box-without-bg group bg-coollabs hover:bg-coollabs-100"> | ||||||
|  |                     <div class="flex flex-col mx-6 "> | ||||||
|  |                         <div class="font-bold text-white"> | ||||||
|  |                             + Add New | ||||||
|  |                         </div> | ||||||
|  |                     </div> | ||||||
|  |                 </a> | ||||||
|             </div> |             </div> | ||||||
|         @endif |         @endif | ||||||
|         @if ($current_step === 'existing-postgresql') |         @if ($current_step === 'existing-postgresql') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Andras Bacsai
					Andras Bacsai