diff --git a/app/Http/Livewire/Destination/New/StandaloneDocker.php b/app/Http/Livewire/Destination/New/StandaloneDocker.php index d9d556510..efe68e241 100644 --- a/app/Http/Livewire/Destination/New/StandaloneDocker.php +++ b/app/Http/Livewire/Destination/New/StandaloneDocker.php @@ -38,24 +38,29 @@ public function mount() public function submit() { + $this->validate(); - $found = ModelsStandaloneDocker::where('server_id', $this->server_id)->where('network', $this->network)->first(); - if ($found) { - $this->addError('network', 'Network already added to this server.'); - return; + try { + $found = ModelsStandaloneDocker::where('server_id', $this->server_id)->where('network', $this->network)->first(); + if ($found) { + $this->addError('network', 'Network already added to this server.'); + return; + } + $server = Server::find($this->server_id); + + instant_remote_process(['docker network create --attachable ' . $this->network], $server); + + instant_remote_process(["docker network connect $this->network coolify-proxy"], $server); + + $docker = ModelsStandaloneDocker::create([ + 'name' => $this->name, + 'network' => $this->network, + 'server_id' => $this->server_id, + 'team_id' => session('currentTeam')->id + ]); + return redirect()->route('destination.show', $docker->uuid); + } catch (\Exception $e) { + return general_error_handler(err: $e); } - $server = Server::find($this->server_id); - instant_remote_process(['docker network create --attachable ' . $this->network], $server, throwError: false); - instant_remote_process(["docker network connect $this->network coolify-proxy"], $server, throwError: false); - - $docker = ModelsStandaloneDocker::create([ - 'name' => $this->name, - 'network' => $this->network, - 'server_id' => $this->server_id, - 'team_id' => session('currentTeam')->id - ]); - - - return redirect()->route('destination.show', $docker->uuid); } } diff --git a/app/Models/Server.php b/app/Models/Server.php index bde034a86..ac9e1c30c 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -33,7 +33,12 @@ public function scopeWithExtraAttributes(): Builder { return $this->extra_attributes->modelScope(); } - + public function destinations() + { + $standalone_docker = $this->hasMany(StandaloneDocker::class)->get(); + $swarm_docker = $this->hasMany(SwarmDocker::class)->get(); + return $standalone_docker->concat($swarm_docker); + } public function standaloneDockers() { return $this->hasMany(StandaloneDocker::class); diff --git a/resources/css/app.css b/resources/css/app.css index e6639945b..e26a62460 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -38,7 +38,7 @@ textarea { @apply textarea placeholder:text-neutral-700 text-white rounded scrollbar; } select { - @apply select select-sm text-sm disabled:bg-coolgray-200 border-none disabled:opacity-50 font-normal placeholder:text-neutral-700 text-white rounded; + @apply h-7 select select-sm text-sm disabled:bg-coolgray-200 border-none disabled:opacity-50 font-normal placeholder:text-neutral-700 text-white rounded; } .loading { @apply w-4 text-warning; @@ -67,7 +67,7 @@ a { } .main-navbar { - @apply fixed h-full overflow-hidden pt-14; + @apply fixed h-full overflow-hidden pt-16; } .kbd-custom { @apply px-2 text-xs border border-dashed rounded border-neutral-700 text-warning; diff --git a/resources/js/components/MagicBar.vue b/resources/js/components/MagicBar.vue index 1821dd4b7..b7b5594df 100644 --- a/resources/js/components/MagicBar.vue +++ b/resources/js/components/MagicBar.vue @@ -1,7 +1,7 @@