rector: arrrrr

This commit is contained in:
Andras Bacsai
2025-01-07 14:52:08 +01:00
parent c702ebff6d
commit 16c0cd10d8
349 changed files with 4204 additions and 3712 deletions

View File

@@ -5,9 +5,11 @@ namespace App\Livewire\Destination\New;
use App\Models\Server;
use App\Models\StandaloneDocker;
use App\Models\SwarmDocker;
use Exception;
use Livewire\Attributes\Locked;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Throwable;
use Visus\Cuid2\Cuid2;
class Docker extends Component
@@ -63,31 +65,31 @@ class Docker extends Component
if ($this->isSwarm) {
$found = $this->selectedServer->swarmDockers()->where('network', $this->network)->first();
if ($found) {
throw new \Exception('Network already added to this server.');
} else {
$docker = SwarmDocker::create([
'name' => $this->name,
'network' => $this->network,
'server_id' => $this->selectedServer->id,
]);
throw new Exception('Network already added to this server.');
}
$docker = SwarmDocker::query()->create([
'name' => $this->name,
'network' => $this->network,
'server_id' => $this->selectedServer->id,
]);
} else {
$found = $this->selectedServer->standaloneDockers()->where('network', $this->network)->first();
if ($found) {
throw new \Exception('Network already added to this server.');
} else {
$docker = StandaloneDocker::create([
'name' => $this->name,
'network' => $this->network,
'server_id' => $this->selectedServer->id,
]);
throw new Exception('Network already added to this server.');
}
$docker = StandaloneDocker::query()->create([
'name' => $this->name,
'network' => $this->network,
'server_id' => $this->selectedServer->id,
]);
}
$connectProxyToDockerNetworks = connectProxyToNetworks($this->selectedServer);
instant_remote_process($connectProxyToDockerNetworks, $this->selectedServer, false);
$this->dispatch('reloadWindow');
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
}

View File

@@ -8,6 +8,7 @@ use App\Models\SwarmDocker;
use Livewire\Attributes\Locked;
use Livewire\Attributes\Validate;
use Livewire\Component;
use Throwable;
class Show extends Component
{
@@ -40,9 +41,11 @@ class Show extends Component
}
$this->destination = $destination;
$this->syncData();
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function syncData(bool $toModel = false)
@@ -65,15 +68,17 @@ class Show extends Component
try {
$this->syncData(true);
$this->dispatch('success', 'Destination saved.');
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function delete()
{
try {
if ($this->destination->getMorphClass() === \App\Models\StandaloneDocker::class) {
if ($this->destination->getMorphClass() === StandaloneDocker::class) {
if ($this->destination->attachedTo()) {
return $this->dispatch('error', 'You must delete all resources before deleting this destination.');
}
@@ -83,7 +88,7 @@ class Show extends Component
$this->destination->delete();
return redirect()->route('destination.index');
} catch (\Throwable $e) {
} catch (Throwable $e) {
return handleError($e, $this);
}
}