server forms
This commit is contained in:
parent
50316c9cf6
commit
18a2d0bd90
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function show()
|
||||
{
|
||||
$projects = session('currentTeam')->load(['projects'])->projects;
|
||||
$servers = session('currentTeam')->load(['servers'])->servers;
|
||||
|
||||
return view('home', [
|
||||
'servers' => $servers,
|
||||
'projects' => $projects
|
||||
]);
|
||||
}
|
||||
}
|
@ -68,6 +68,7 @@ public function mount()
|
||||
}
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
$this->application->save();
|
||||
}
|
||||
}
|
||||
|
41
app/Http/Livewire/Server/Form.php
Normal file
41
app/Http/Livewire/Server/Form.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Server;
|
||||
|
||||
use App\Models\Server;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Livewire\Component;
|
||||
|
||||
class Form extends Component
|
||||
{
|
||||
public $server_id;
|
||||
public Server $server;
|
||||
|
||||
protected $rules = [
|
||||
'server.name' => 'required|min:6',
|
||||
'server.description' => 'nullable',
|
||||
'server.ip' => 'required',
|
||||
'server.user' => 'required',
|
||||
'server.port' => 'required',
|
||||
];
|
||||
public function mount()
|
||||
{
|
||||
$this->server = Server::find($this->server_id);
|
||||
}
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
// $validation = Validator::make($this->server->toArray(), [
|
||||
// 'ip' => [
|
||||
// 'ip'
|
||||
// ],
|
||||
// ]);
|
||||
// if ($validation->fails()) {
|
||||
// foreach ($validation->errors()->getMessages() as $key => $value) {
|
||||
// $this->addError("server.{$key}", $value[0]);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
$this->server->save();
|
||||
}
|
||||
}
|
@ -1,11 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
namespace App\Http\Livewire\Settings;
|
||||
|
||||
use App\Models\InstanceSettings as ModelsInstanceSettings;
|
||||
use Livewire\Component;
|
||||
|
||||
class InstanceSettings extends Component
|
||||
class Form extends Component
|
||||
{
|
||||
public ModelsInstanceSettings $settings;
|
||||
public $do_not_track;
|
||||
@ -41,6 +41,7 @@ public function submit()
|
||||
$this->addError('settings.public_port_min', 'The minimum port must be lower than the maximum port.');
|
||||
return;
|
||||
}
|
||||
$this->validate();
|
||||
$this->settings->save();
|
||||
}
|
||||
}
|
@ -395,7 +395,6 @@ private function gitImport()
|
||||
if ($this->source->is_public) {
|
||||
$git_clone_command = "{$git_clone_command} {$this->source->html_url}/{$this->application->git_repository}.git {$this->workdir}";
|
||||
$git_clone_command = $this->setGitImportSettings($git_clone_command);
|
||||
dump($git_clone_command);
|
||||
return [
|
||||
$this->execute_in_builder($git_clone_command)
|
||||
];
|
||||
|
@ -14,7 +14,6 @@ public function run(): void
|
||||
{
|
||||
InstanceSettings::create([
|
||||
'id' => 0,
|
||||
'wildcard_domain' => 'coolify.io',
|
||||
'is_https_forced' => false,
|
||||
'is_registration_enabled' => true,
|
||||
]);
|
||||
|
@ -10,7 +10,7 @@ class ProjectSettingSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
$first_project = Project::find(1);
|
||||
$first_project->settings->wildcard_domain = 'wildcard.example.com';
|
||||
// $first_project->settings->wildcard_domain = 'wildcard.example.com';
|
||||
$first_project->settings->save();
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
<x-layout>
|
||||
<h1>Servers</h1>
|
||||
@forelse ($servers as $server)
|
||||
<a href="{{ route('project.environments', [$server->uuid]) }}">{{ data_get($server, 'name') }}</a>
|
||||
@empty
|
||||
<p>No servers found.</p>
|
||||
@endforelse
|
||||
<h1>Projects</h1>
|
||||
@forelse ($projects as $project)
|
||||
<a href="{{ route('project.environments', [$project->uuid]) }}">{{ data_get($project, 'name') }}</a>
|
||||
@empty
|
||||
<p>No projects found.</p>
|
||||
@endforelse
|
||||
<h1>Servers</h1>
|
||||
@forelse ($servers as $server)
|
||||
<a href="{{ route('server.dashboard', [$server->uuid]) }}">{{ data_get($server, 'name') }}</a>
|
||||
@empty
|
||||
<p>No servers found.</p>
|
||||
@endforelse
|
||||
</x-layout>
|
||||
|
18
resources/views/livewire/server/form.blade.php
Normal file
18
resources/views/livewire/server/form.blade.php
Normal file
@ -0,0 +1,18 @@
|
||||
<div>
|
||||
<form wire:submit.prevent='submit' class="flex flex-col">
|
||||
<div class="flex flex-col gap-2 xl:flex-row">
|
||||
<div class="flex flex-col w-96">
|
||||
<x-input name="server.name" label="Name" required />
|
||||
<x-input name="server.description" label="Description" />
|
||||
</div>
|
||||
<div class="flex flex-col w-96">
|
||||
<x-input name="server.ip" label="IP Address" required />
|
||||
<x-input name="server.user" label="User" required />
|
||||
<x-input type="number" name="server.port" label="Port" required />
|
||||
</div>
|
||||
</div>
|
||||
<button class="w-16 mt-4" type="submit">
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
@ -10,7 +10,7 @@
|
||||
<x-input type="number" name="settings.public_port_max" label="Public Port Max" />
|
||||
</div>
|
||||
</div>
|
||||
<button class="flex mx-auto mt-4" type="submit">
|
||||
<button class="w-16 mt-4" type="submit">
|
||||
Submit
|
||||
</button>
|
||||
</form>
|
4
resources/views/server/dashboard.blade.php
Normal file
4
resources/views/server/dashboard.blade.php
Normal file
@ -0,0 +1,4 @@
|
||||
<x-layout>
|
||||
<h1>Server</h1>
|
||||
<livewire:server.form :server_id="$server_id" />
|
||||
</x-layout>
|
@ -1,4 +1,4 @@
|
||||
<x-layout>
|
||||
<h1>Settings</h1>
|
||||
<livewire:instance-settings :settings="$settings" />
|
||||
<livewire:settings.form :settings="$settings" />
|
||||
</x-layout>
|
||||
|
@ -24,8 +24,8 @@
|
||||
$projects = session('currentTeam')->load(['projects'])->projects;
|
||||
$servers = session('currentTeam')->load(['servers'])->servers;
|
||||
return view('home', [
|
||||
'servers' => $servers,
|
||||
'projects' => $projects
|
||||
'servers' => $servers->sortBy('name'),
|
||||
'projects' => $projects->sortBy('name')
|
||||
]);
|
||||
})->name('home');
|
||||
|
||||
@ -54,6 +54,18 @@
|
||||
})->name('demo');
|
||||
});
|
||||
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
Route::get('/server/{server_uuid}', function () {
|
||||
$server = session('currentTeam')->load(['servers'])->servers->firstWhere('uuid', request()->server_uuid);
|
||||
if (!$server) {
|
||||
abort(404);
|
||||
}
|
||||
return view('server.dashboard', [
|
||||
'server_id' => $server->id,
|
||||
]);
|
||||
})->name('server.dashboard');
|
||||
});
|
||||
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
Route::get(
|
||||
'/project/{project_uuid}',
|
||||
|
Loading…
Reference in New Issue
Block a user