Merge pull request #3766 from djsisson/fix-windmill-template
fix windmill template
This commit is contained in:
		| @@ -49,11 +49,8 @@ class Select extends Component | |||||||
| 
 | 
 | ||||||
|     public ?string $existingPostgresqlUrl = null; |     public ?string $existingPostgresqlUrl = null; | ||||||
| 
 | 
 | ||||||
|     public ?string $search = null; |  | ||||||
| 
 |  | ||||||
|     protected $queryString = [ |     protected $queryString = [ | ||||||
|         'server_id', |         'server_id', | ||||||
|         'search', |  | ||||||
|     ]; |     ]; | ||||||
| 
 | 
 | ||||||
|     public function mount() |     public function mount() | ||||||
| @@ -90,13 +87,13 @@ class Select extends Component | |||||||
|     //     }
 |     //     }
 | ||||||
|     // }
 |     // }
 | ||||||
| 
 | 
 | ||||||
|     public function loadServices2() |     public function loadServices() | ||||||
|     { |     { | ||||||
|         $services = get_service_templates(true); |         $services = get_service_templates(true); | ||||||
|         $services = collect($services)->map(function ($service, $key) { |         $services = collect($services)->map(function ($service, $key) { | ||||||
|             return [ |             return [ | ||||||
|                 'name' => str($key)->headline(), |                 'name' => str($key)->headline(), | ||||||
|                 'logo' => asset(data_get($service, 'logo', 'svgs/unknown.svg')), |                 'logo' => asset(data_get($service, 'logo', 'svgs/coolify.png')), | ||||||
|             ] + (array) $service; |             ] + (array) $service; | ||||||
|         })->all(); |         })->all(); | ||||||
|         $gitBasedApplications = [ |         $gitBasedApplications = [ | ||||||
| @@ -205,42 +202,6 @@ class Select extends Component | |||||||
|         ]; |         ]; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public function updatedSearch() |  | ||||||
|     { |  | ||||||
|         $this->loadServices(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public function loadServices(bool $force = false) |  | ||||||
|     { |  | ||||||
|         try { |  | ||||||
|             $this->loadingServices = true; |  | ||||||
|             if (count($this->allServices) > 0 && ! $force) { |  | ||||||
|                 if (! $this->search) { |  | ||||||
|                     $this->services = $this->allServices; |  | ||||||
| 
 |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
|                 $this->services = $this->allServices->filter(function ($service, $key) { |  | ||||||
|                     $tags = collect(data_get($service, 'tags', [])); |  | ||||||
| 
 |  | ||||||
|                     return str_contains(strtolower($key), strtolower($this->search)) || $tags->contains(function ($tag) { |  | ||||||
|                         return str_contains(strtolower($tag), strtolower($this->search)); |  | ||||||
|                     }); |  | ||||||
|                 }); |  | ||||||
|             } else { |  | ||||||
|                 $this->search = null; |  | ||||||
|                 $this->allServices = get_service_templates($force); |  | ||||||
|                 $this->services = $this->allServices->filter(function ($service, $key) { |  | ||||||
|                     return str_contains(strtolower($key), strtolower($this->search)); |  | ||||||
|                 }); |  | ||||||
|             } |  | ||||||
|         } catch (\Throwable $e) { |  | ||||||
|             return handleError($e, $this); |  | ||||||
|         } finally { |  | ||||||
|             $this->loadingServices = false; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     public function instantSave() |     public function instantSave() | ||||||
|     { |     { | ||||||
|         if ($this->includeSwarm) { |         if ($this->includeSwarm) { | ||||||
|   | |||||||
| @@ -10,13 +10,14 @@ | |||||||
|         </div> |         </div> | ||||||
|     </div> |     </div> | ||||||
|     <div class="pb-4">Deploy resources, like Applications, Databases, Services...</div> |     <div class="pb-4">Deploy resources, like Applications, Databases, Services...</div> | ||||||
|     <div class="flex flex-col gap-4 py-4" x-data="searchResources()"> |     <div x-data="searchResources()"> | ||||||
|         @if ($current_step === 'type') |         @if ($current_step === 'type') | ||||||
|             <div class="sticky top-0 z-50 py-2"> |             <div class="sticky top-0 z-50 py-2"> | ||||||
|                 <input autocomplete="off" x-ref="searchInput" class="input w-full" x-model="search" |                 <input autocomplete="off" x-ref="searchInput" class="input w-full" x-model="search" | ||||||
|                     placeholder="Type / to search..." @keydown.window.slash.prevent="$refs.searchInput.focus()"> |                     placeholder="Type / to search..." @keydown.window.slash.prevent="$refs.searchInput.focus()"> | ||||||
|             </div> |             </div> | ||||||
|             <div x-show="loading">Loading...</div> |             <div x-show="loading">Loading...</div> | ||||||
|  |             <div x-show="!loading" class="flex flex-col gap-4 py-4"> | ||||||
|                 <h2 x-show="filteredGitBasedApplications.length > 0">Applications</h2> |                 <h2 x-show="filteredGitBasedApplications.length > 0">Applications</h2> | ||||||
|                 <h4 x-show="filteredGitBasedApplications.length > 0">Git Based</h4> |                 <h4 x-show="filteredGitBasedApplications.length > 0">Git Based</h4> | ||||||
|                 <div x-show="filteredGitBasedApplications.length > 0" |                 <div x-show="filteredGitBasedApplications.length > 0" | ||||||
| @@ -75,11 +76,13 @@ | |||||||
|                         <h2>Services</h2> |                         <h2>Services</h2> | ||||||
|                         <x-forms.button x-on:click="loadResources">Reload List</x-forms.button> |                         <x-forms.button x-on:click="loadResources">Reload List</x-forms.button> | ||||||
|                     </div> |                     </div> | ||||||
|                 <div class="pb-4 text-xs">Trademarks Policy: The respective trademarks mentioned here are owned by the |                     <div class="pb-4 text-xs">Trademarks Policy: The respective trademarks mentioned here are owned by | ||||||
|  |                         the | ||||||
|                         respective |                         respective | ||||||
|                     companies, and use of them does not imply any affiliation or endorsement.<br>Find more services <a |                         companies, and use of them does not imply any affiliation or endorsement.<br>Find more services | ||||||
|                         class="dark:text-white underline" target="_blank" |                         <a class="dark:text-white underline" target="_blank" | ||||||
|                         href="https://coolify.io/docs/services">here</a>.</div> |                             href="https://coolify.io/docs/services">here</a>. | ||||||
|  |                     </div> | ||||||
| 
 | 
 | ||||||
|                     <div class="grid justify-start grid-cols-1 gap-4 text-left xl:grid-cols-2"> |                     <div class="grid justify-start grid-cols-1 gap-4 text-left xl:grid-cols-2"> | ||||||
|                         <template x-for="service in filteredServices" :key="service.name"> |                         <template x-for="service in filteredServices" :key="service.name"> | ||||||
| @@ -121,6 +124,7 @@ | |||||||
|                     x-show="filteredGitBasedApplications.length === 0 && filteredDockerBasedApplications.length === 0 && filteredDatabases.length === 0 && filteredServices.length === 0 && loading === false"> |                     x-show="filteredGitBasedApplications.length === 0 && filteredDockerBasedApplications.length === 0 && filteredDatabases.length === 0 && filteredServices.length === 0 && loading === false"> | ||||||
|                     <div>No resources found.</div> |                     <div>No resources found.</div> | ||||||
|                 </div> |                 </div> | ||||||
|  |             </div> | ||||||
|             <script> |             <script> | ||||||
|                 function sortFn(a, b) { |                 function sortFn(a, b) { | ||||||
|                     return a.name.localeCompare(b.name) |                     return a.name.localeCompare(b.name) | ||||||
| @@ -144,7 +148,7 @@ | |||||||
|                                 gitBasedApplications, |                                 gitBasedApplications, | ||||||
|                                 dockerBasedApplications, |                                 dockerBasedApplications, | ||||||
|                                 databases |                                 databases | ||||||
|                             } = await this.$wire.loadServices2(); |                             } = await this.$wire.loadServices(); | ||||||
|                             this.services = services; |                             this.services = services; | ||||||
|                             this.gitBasedApplications = gitBasedApplications; |                             this.gitBasedApplications = gitBasedApplications; | ||||||
|                             this.dockerBasedApplications = dockerBasedApplications; |                             this.dockerBasedApplications = dockerBasedApplications; | ||||||
|   | |||||||
| @@ -15,7 +15,7 @@ services: | |||||||
|     volumes: |     volumes: | ||||||
|       - db_data:/var/lib/postgresql/data |       - db_data:/var/lib/postgresql/data | ||||||
|     environment: |     environment: | ||||||
|       POSTGRES_PASSWORD: $SERVICE_PASSWORD_WINDMILL_POSTGRES |       POSTGRES_PASSWORD: $SERVICE_PASSWORD_POSTGRES | ||||||
|       POSTGRES_DB: windmill |       POSTGRES_DB: windmill | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: ["CMD-SHELL", "pg_isready -U postgres"] |       test: ["CMD-SHELL", "pg_isready -U postgres"] | ||||||
| @@ -26,8 +26,8 @@ services: | |||||||
|   windmill_server: |   windmill_server: | ||||||
|     image: ghcr.io/windmill-labs/windmill:main |     image: ghcr.io/windmill-labs/windmill:main | ||||||
|     environment: |     environment: | ||||||
|       - SERVICE_FQDN_WINDMILL |       - SERVICE_FQDN_WINDMILL_8000 | ||||||
|       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_WINDMILL_POSTGRES@db/windmill |       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@db/windmill | ||||||
|       - MODE=server |       - MODE=server | ||||||
|       - BASE_URL=$SERVICE_FQDN_WINDMILL |       - BASE_URL=$SERVICE_FQDN_WINDMILL | ||||||
|     depends_on: |     depends_on: | ||||||
| @@ -39,7 +39,7 @@ services: | |||||||
|   windmill_worker_1: |   windmill_worker_1: | ||||||
|     image: ghcr.io/windmill-labs/windmill:main |     image: ghcr.io/windmill-labs/windmill:main | ||||||
|     environment: |     environment: | ||||||
|       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_WINDMILL_POSTGRES@db/windmill |       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@db/windmill | ||||||
|       - MODE=worker |       - MODE=worker | ||||||
|       - WORKER_GROUP=default |       - WORKER_GROUP=default | ||||||
|     depends_on: |     depends_on: | ||||||
| @@ -53,7 +53,7 @@ services: | |||||||
|   windmill_worker_2: |   windmill_worker_2: | ||||||
|     image: ghcr.io/windmill-labs/windmill:main |     image: ghcr.io/windmill-labs/windmill:main | ||||||
|     environment: |     environment: | ||||||
|       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_WINDMILL_POSTGRES@db/windmill |       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@db/windmill | ||||||
|       - MODE=worker |       - MODE=worker | ||||||
|       - WORKER_GROUP=default |       - WORKER_GROUP=default | ||||||
|     depends_on: |     depends_on: | ||||||
| @@ -67,7 +67,7 @@ services: | |||||||
|   windmill_worker_3: |   windmill_worker_3: | ||||||
|     image: ghcr.io/windmill-labs/windmill:main |     image: ghcr.io/windmill-labs/windmill:main | ||||||
|     environment: |     environment: | ||||||
|       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_WINDMILL_POSTGRES@db/windmill |       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@db/windmill | ||||||
|       - MODE=worker |       - MODE=worker | ||||||
|       - WORKER_GROUP=default |       - WORKER_GROUP=default | ||||||
|     depends_on: |     depends_on: | ||||||
| @@ -81,7 +81,7 @@ services: | |||||||
|   windmill_worker_native: |   windmill_worker_native: | ||||||
|     image: ghcr.io/windmill-labs/windmill:main |     image: ghcr.io/windmill-labs/windmill:main | ||||||
|     environment: |     environment: | ||||||
|       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_WINDMILL_POSTGRES@db/windmill |       - DATABASE_URL=postgres://postgres:$SERVICE_PASSWORD_POSTGRES@db/windmill | ||||||
|       - MODE=worker |       - MODE=worker | ||||||
|       - WORKER_GROUP=native |       - WORKER_GROUP=native | ||||||
|       - NUM_WORKERS=8 |       - NUM_WORKERS=8 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 🏔️ Peak
					🏔️ Peak