fix: async service loads

This commit is contained in:
Andras Bacsai 2024-03-27 14:50:56 +01:00
parent 3fca169096
commit a777db1234
2 changed files with 65 additions and 66 deletions

View File

@ -49,7 +49,6 @@ class Select extends Component
}
public function render()
{
$this->loadServices();
return view('livewire.project.new.select');
}
@ -74,6 +73,7 @@ class Select extends Component
public function loadServices(bool $force = false)
{
try {
$this->loadingServices = true;
if (count($this->allServices) > 0 && !$force) {
if (!$this->search) {
$this->services = $this->allServices;

View File

@ -1,4 +1,4 @@
<div x-data x-init="$wire.loadServers">
<div x-data x-init="$wire.loadServers" x-init="$wire.loadServices">
<div class="flex flex-col gap-4 lg:flex-row ">
<h1>New Resource</h1>
<div class="w-full pb-4 lg:w-96 lg:pb-0">
@ -383,10 +383,10 @@
<div class="pb-4 text-xs">Trademarks Policy: The respective trademarks mentioned here are owned by the
respective
companies, and use of them does not imply any affiliation or endorsement.</div>
<div class="grid justify-start grid-cols-1 gap-4 text-left xl:grid-cols-2">
@if ($loadingServices)
<span class="loading loading-xs loading-spinner"></span>
<x-loading text="Loading services..." />
@else
<div class="grid justify-start grid-cols-1 gap-4 text-left xl:grid-cols-2">
@forelse ($services as $serviceName => $service)
@if (data_get($service, 'minversion') && version_compare(config('version'), data_get($service, 'minversion'), '<'))
<x-resource-view wire="setType('one-click-service-{{ $serviceName }}')">
@ -477,8 +477,7 @@
</div>
@empty
<div>
<div>No validated & reachable servers found. <a class="underline dark:text-white"
href="/servers">
<div>No validated & reachable servers found. <a class="underline dark:text-white" href="/servers">
Go to servers page
</a></div>
</div>