This commit is contained in:
Andras Bacsai 2023-06-15 09:15:41 +02:00
parent 384ab2dd18
commit f79b3841c7
40 changed files with 119 additions and 197 deletions

View File

@ -46,7 +46,7 @@ public function deployments()
public function deployment() public function deployment()
{ {
$deployment_uuid = request()->route('deployment_uuid'); $deploymentUuid = request()->route('deployment_uuid');
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first(); $project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
if (!$project) { if (!$project) {
@ -60,7 +60,7 @@ public function deployment()
if (!$application) { if (!$application) {
return redirect()->route('dashboard'); return redirect()->route('dashboard');
} }
$activity = Activity::where('properties->type_uuid', '=', $deployment_uuid)->first(); $activity = Activity::where('properties->type_uuid', '=', $deploymentUuid)->first();
if (!$activity) { if (!$activity) {
return redirect()->route('project.application.deployments', [ return redirect()->route('project.application.deployments', [
'project_uuid' => $project->uuid, 'project_uuid' => $project->uuid,
@ -68,7 +68,7 @@ public function deployment()
'application_uuid' => $application->uuid, 'application_uuid' => $application->uuid,
]); ]);
} }
$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $deployment_uuid)->first(); $deployment = ApplicationDeploymentQueue::where('deployment_uuid', $deploymentUuid)->first();
if (!$deployment) { if (!$deployment) {
return redirect()->route('project.application.deployments', [ return redirect()->route('project.application.deployments', [
'project_uuid' => $project->uuid, 'project_uuid' => $project->uuid,
@ -80,7 +80,7 @@ public function deployment()
'application' => $application, 'application' => $application,
'activity' => $activity, 'activity' => $activity,
'deployment' => $deployment, 'deployment' => $deployment,
'deployment_uuid' => $deployment_uuid, 'deployment_uuid' => $deploymentUuid,
]); ]);
} }
} }

View File

@ -64,7 +64,7 @@ public function team()
'invitations' => $invitations, 'invitations' => $invitations,
]); ]);
} }
public function accept_invitation() public function acceptInvitation()
{ {
try { try {
$invitation = TeamInvitation::whereUuid(request()->route('uuid'))->firstOrFail(); $invitation = TeamInvitation::whereUuid(request()->route('uuid'))->firstOrFail();
@ -76,8 +76,8 @@ public function accept_invitation()
abort(401); abort(401);
} }
$created_at = $invitation->created_at; $createdAt = $invitation->created_at;
$diff = $created_at->diffInMinutes(now()); $diff = $createdAt->diffInMinutes(now());
if ($diff <= config('constants.invitation.link.expiration')) { if ($diff <= config('constants.invitation.link.expiration')) {
$user->teams()->attach($invitation->team->id, ['role' => $invitation->role]); $user->teams()->attach($invitation->team->id, ['role' => $invitation->role]);
$invitation->delete(); $invitation->delete();
@ -90,7 +90,7 @@ public function accept_invitation()
throw $th; throw $th;
} }
} }
public function revoke_invitation() public function revokeInvitation()
{ {
try { try {
$invitation = TeamInvitation::whereUuid(request()->route('uuid'))->firstOrFail(); $invitation = TeamInvitation::whereUuid(request()->route('uuid'))->firstOrFail();

View File

@ -33,7 +33,7 @@ public function environments()
'environments' => Project::ownedByCurrentTeam()->whereUuid(request()->query('project_uuid'))->first()->environments 'environments' => Project::ownedByCurrentTeam()->whereUuid(request()->query('project_uuid'))->first()->environments
]); ]);
} }
public function new_project() public function newProject()
{ {
$project = Project::firstOrCreate( $project = Project::firstOrCreate(
['name' => request()->query('name') ?? generate_random_name()], ['name' => request()->query('name') ?? generate_random_name()],
@ -43,7 +43,7 @@ public function new_project()
'project_uuid' => $project->uuid 'project_uuid' => $project->uuid
]); ]);
} }
public function new_environment() public function newEnvironment()
{ {
$environment = Environment::firstOrCreate( $environment = Environment::firstOrCreate(
['name' => request()->query('name') ?? generate_random_name()], ['name' => request()->query('name') ?? generate_random_name()],

View File

@ -8,18 +8,18 @@ class ProjectController extends Controller
{ {
public function all() public function all()
{ {
$team_id = session('currentTeam')->id; $teamId = session('currentTeam')->id;
$projects = Project::where('team_id', $team_id)->get(); $projects = Project::where('team_id', $teamId)->get();
return view('projects', ['projects' => $projects]); return view('projects', ['projects' => $projects]);
} }
public function show() public function show()
{ {
$project_uuid = request()->route('project_uuid'); $projectUuid = request()->route('project_uuid');
$team_id = session('currentTeam')->id; $teamId = session('currentTeam')->id;
$project = Project::where('team_id', $team_id)->where('uuid', $project_uuid)->first(); $project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();
if (!$project) { if (!$project) {
return redirect()->route('dashboard'); return redirect()->route('dashboard');
} }

View File

@ -1,34 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\PrivateKey;
use App\Models\Server;
class ServerController extends Controller
{
public function all()
{
return view('server.all', [
'servers' => Server::ownedByCurrentTeam()->get()
]);
}
public function create()
{
return view('server.create', [
'private_keys' => PrivateKey::ownedByCurrentTeam()->get(),
]);
}
public function show()
{
return view('server.show', [
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
]);
}
public function proxy()
{
return view('server.proxy', [
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
]);
}
}

View File

@ -12,7 +12,7 @@ class Danger extends Component
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
} }
public function delete() public function delete()
{ {

View File

@ -3,7 +3,6 @@
namespace App\Http\Livewire\Project\Application; namespace App\Http\Livewire\Project\Application;
use App\Jobs\ApplicationContainerStatusJob; use App\Jobs\ApplicationContainerStatusJob;
use App\Jobs\ContainerStopJob;
use App\Models\Application; use App\Models\Application;
use Livewire\Component; use Livewire\Component;
use Visus\Cuid2\Cuid2; use Visus\Cuid2\Cuid2;
@ -17,7 +16,7 @@ class Deploy extends Component
public $destination; public $destination;
public array $parameters; public array $parameters;
protected string $deployment_uuid; protected string $deploymentUuid;
protected array $command = []; protected array $command = [];
protected $source; protected $source;
@ -27,7 +26,7 @@ class Deploy extends Component
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
$this->application = Application::where('id', $this->applicationId)->first(); $this->application = Application::where('id', $this->applicationId)->first();
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first(); $this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
} }
@ -35,10 +34,9 @@ public function applicationStatusChanged()
{ {
$this->application->refresh(); $this->application->refresh();
} }
protected function set_deployment_uuid() protected function setDeploymentUuid()
{ {
// Create Deployment ID $this->deploymentUuid = new Cuid2(7);
$this->deployment_uuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deployment_uuid; $this->parameters['deployment_uuid'] = $this->deployment_uuid;
} }
public function deploy(bool $force = false, bool|null $debug = null) public function deploy(bool $force = false, bool|null $debug = null)
@ -47,7 +45,7 @@ public function deploy(bool $force = false, bool|null $debug = null)
$this->application->settings->is_debug_enabled = true; $this->application->settings->is_debug_enabled = true;
$this->application->settings->save(); $this->application->settings->save();
} }
$this->set_deployment_uuid(); $this->setDeploymentUuid();
queue_application_deployment( queue_application_deployment(
application_id: $this->application->id, application_id: $this->application->id,
@ -65,7 +63,7 @@ public function deploy(bool $force = false, bool|null $debug = null)
public function stop() public function stop()
{ {
instant_remote_process(["docker rm -f {$this->application->uuid}"], $this->application->destination->server); instant_remote_process(["docker rm -f {$this->application->uuid}"], $this->application->destination->server);
$this->application->status = get_container_status(server: $this->application->destination->server, container_id: $this->application->uuid); $this->application->status = 'stopped';
$this->application->save(); $this->application->save();
$this->emit('applicationStatusChanged'); $this->emit('applicationStatusChanged');
} }

View File

@ -20,7 +20,7 @@ class Add extends Component
]; ];
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
} }
public function submit() public function submit()
{ {

View File

@ -17,7 +17,7 @@ class Show extends Component
]; ];
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
} }
public function submit() public function submit()
{ {

View File

@ -20,7 +20,7 @@ class Previews extends Component
public function mount() public function mount()
{ {
$this->pull_requests = collect(); $this->pull_requests = collect();
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
} }
public function loadStatus($pull_request_id) public function loadStatus($pull_request_id)
{ {
@ -30,7 +30,7 @@ public function loadStatus($pull_request_id)
pull_request_id: $pull_request_id pull_request_id: $pull_request_id
)); ));
} }
protected function set_deployment_uuid() protected function setDeploymentUuid()
{ {
$this->deployment_uuid = new Cuid2(7); $this->deployment_uuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deployment_uuid; $this->parameters['deployment_uuid'] = $this->deployment_uuid;
@ -49,7 +49,7 @@ public function load_prs()
public function deploy(int $pull_request_id, string|null $pull_request_html_url = null) public function deploy(int $pull_request_id, string|null $pull_request_html_url = null)
{ {
try { try {
$this->set_deployment_uuid(); $this->setDeploymentUuid();
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first(); $found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
if (!$found && !is_null($pull_request_html_url)) { if (!$found && !is_null($pull_request_html_url)) {
ApplicationPreview::create([ ApplicationPreview::create([

View File

@ -16,7 +16,7 @@ class Rollback extends Component
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
} }
public function rollbackImage($commit) public function rollbackImage($commit)
{ {

View File

@ -2,10 +2,6 @@
namespace App\Http\Livewire\Project\Application\Storages; namespace App\Http\Livewire\Project\Application\Storages;
use App\Models\Application;
use App\Models\LocalPersistentVolume;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Route;
use Livewire\Component; use Livewire\Component;
class Add extends Component class Add extends Component
@ -23,7 +19,7 @@ class Add extends Component
]; ];
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
} }
public function submit() public function submit()
{ {

View File

@ -14,7 +14,7 @@ class DeleteEnvironment extends Component
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
} }
public function delete() public function delete()
{ {

View File

@ -13,7 +13,7 @@ class DeleteProject extends Component
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
} }
public function delete() public function delete()
{ {

View File

@ -44,7 +44,7 @@ class GithubPrivateRepository extends Component
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
$this->query = request()->query(); $this->query = request()->query();
$this->repositories = $this->branches = collect(); $this->repositories = $this->branches = collect();
$this->github_apps = GithubApp::private(); $this->github_apps = GithubApp::private();

View File

@ -53,7 +53,7 @@ public function mount()
if (config('app.env') === 'local') { if (config('app.env') === 'local') {
$this->repository_url = 'https://github.com/coollabsio/coolify-examples'; $this->repository_url = 'https://github.com/coollabsio/coolify-examples';
} }
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
$this->query = request()->query(); $this->query = request()->query();
$this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->get(); $this->private_keys = PrivateKey::where('team_id', session('currentTeam')->id)->get();
} }

View File

@ -43,7 +43,7 @@ public function mount()
$this->repository_url = 'https://github.com/coollabsio/coolify-examples'; $this->repository_url = 'https://github.com/coollabsio/coolify-examples';
$this->port = 3000; $this->port = 3000;
} }
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
$this->query = request()->query(); $this->query = request()->query();
} }

View File

@ -23,7 +23,7 @@ public function setPrivateKey($private_key_id)
} }
public function mount() public function mount()
{ {
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
$this->private_keys = ModelsPrivateKey::where('team_id', session('currentTeam')->id)->get(); $this->private_keys = ModelsPrivateKey::where('team_id', session('currentTeam')->id)->get();
} }
} }

View File

@ -38,7 +38,7 @@ class Change extends Component
public function mount() public function mount()
{ {
$this->webhook_endpoint = $this->ipv4; $this->webhook_endpoint = $this->ipv4;
$this->parameters = get_parameters(); $this->parameters = getRouteParameters();
$this->is_system_wide = $this->github_app->is_system_wide; $this->is_system_wide = $this->github_app->is_system_wide;
} }
public function submit() public function submit()

View File

@ -1,13 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Git extends Model
{
public function applications()
{
return $this->morphMany(Application::class, 'source');
}
}

View File

@ -2,7 +2,9 @@
namespace App\Models; namespace App\Models;
class ProjectSetting extends BaseModel use Illuminate\Database\Eloquent\Model;
class ProjectSetting extends Model
{ {
protected $fillable = [ protected $fillable = [
'project_id' 'project_id'

View File

@ -2,7 +2,9 @@
namespace App\Models; namespace App\Models;
class ServerSetting extends BaseModel use Illuminate\Database\Eloquent\Model;
class ServerSetting extends Model
{ {
protected $fillable = [ protected $fillable = [
'server_id' 'server_id'

View File

@ -5,10 +5,11 @@
use App\Notifications\Channels\SendsEmail; use App\Notifications\Channels\SendsEmail;
use App\Notifications\Channels\SendsDiscord; use App\Notifications\Channels\SendsDiscord;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
use Spatie\SchemalessAttributes\Casts\SchemalessAttributes; use Spatie\SchemalessAttributes\Casts\SchemalessAttributes;
class Team extends BaseModel implements SendsDiscord, SendsEmail class Team extends Model implements SendsDiscord, SendsEmail
{ {
use Notifiable; use Notifiable;

View File

@ -31,9 +31,6 @@ protected static function boot()
{ {
parent::boot(); parent::boot();
static::creating(function (Model $model) {
$model->uuid = (string) new Cuid2(7);
});
static::created(function (User $user) { static::created(function (User $user) {
$team = [ $team = [
'name' => $user->name . "'s Team", 'name' => $user->name . "'s Team",

View File

@ -37,7 +37,7 @@ function general_error_handler(\Throwable|null $err = null, $that = null, $isJso
} }
} }
function get_parameters() function getRouteParameters()
{ {
return Route::current()->parameters(); return Route::current()->parameters();
} }

View File

@ -13,7 +13,6 @@ public function up(): void
{ {
Schema::create('teams', function (Blueprint $table) { Schema::create('teams', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('uuid')->unique();
$table->string('name'); $table->string('name');
$table->boolean('personal_team')->default(false); $table->boolean('personal_team')->default(false);
$table->schemalessAttributes('extra_attributes'); $table->schemalessAttributes('extra_attributes');

View File

@ -13,13 +13,10 @@ public function up(): void
{ {
Schema::create('server_settings', function (Blueprint $table) { Schema::create('server_settings', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('uuid')->unique();
$table->boolean('is_part_of_swarm')->default(false); $table->boolean('is_part_of_swarm')->default(false);
$table->boolean('is_jump_server')->default(false); $table->boolean('is_jump_server')->default(false);
$table->boolean('is_build_server')->default(false); $table->boolean('is_build_server')->default(false);
$table->boolean('is_validated')->default(false); $table->boolean('is_validated')->default(false);
$table->foreignId('server_id'); $table->foreignId('server_id');
$table->timestamps(); $table->timestamps();
}); });

View File

@ -13,11 +13,8 @@ public function up(): void
{ {
Schema::create('project_settings', function (Blueprint $table) { Schema::create('project_settings', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('uuid')->unique();
$table->string('wildcard_domain')->nullable(); $table->string('wildcard_domain')->nullable();
$table->foreignId('project_id'); $table->foreignId('project_id');
$table->timestamps(); $table->timestamps();
}); });
} }

View File

@ -1,38 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('gits', function (Blueprint $table) {
$table->id();
$table->enum('type', ['github', 'gitlab', 'bitbucket', 'custom']);
$table->string('api_url');
$table->string('html_url');
$table->integer('custom_port')->default(22);
$table->string('custom_user')->default('git');
$table->longText('webhook_secret')->nullable();
$table->foreignId('private_key_id')->nullable();
$table->foreignId('project_id');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('gits');
}
};

View File

@ -13,7 +13,6 @@ public function up(): void
{ {
Schema::create('local_persistent_volumes', function (Blueprint $table) { Schema::create('local_persistent_volumes', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('uuid')->unique();
$table->string('name'); $table->string('name');
$table->string('mount_path'); $table->string('mount_path');
$table->string('host_path')->nullable(); $table->string('host_path')->nullable();

View File

@ -0,0 +1,16 @@
@props([
'helper' => $attributes->has('helper'),
])
<div class="group">
<div class="cursor-pointer text-warning">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="w-4 h-4 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
</div>
<div class="absolute hidden text-xs group-hover:block border-coolgray-400 bg-coolgray-500">
<div class="p-4 card-body">
{!! $helper !!}
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
<div class="flex items-center gap-2" wire:poll.10000ms="pollStatus"> <div class="flex items-center gap-2" wire:poll.10000ms="pollStatus" x-init="$wire.pollStatus">
<div class="group"> <div class="group">
<label tabindex="0" class="flex items-center gap-2 cursor-pointer hover:text-white"> Actions <label tabindex="0" class="flex items-center gap-2 cursor-pointer hover:text-white"> Actions
<x-chevron-down /> <x-chevron-down />

View File

@ -1,10 +1,8 @@
<form wire:submit.prevent='submit' class="flex flex-col max-w-fit"> <form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row"">
<div class="flex items-end justify-center gap-2"> <x-forms.input placeholder="NODE_ENV" noDirty id="key" label="Name" required />
<x-forms.input placeholder="NODE_ENV" noDirty id="key" label="Name" required /> <x-forms.input placeholder="production" noDirty id="value" label="Value" required />
<x-forms.input placeholder="production" noDirty id="value" label="Value" required /> <x-forms.checkbox noDirty id="is_build_time" label="Build Variable?" />
<x-forms.checkbox noDirty class="flex-col text-center w-96" id="is_build_time" label="Build Variable?" /> <x-forms.button type="submit">
<x-forms.button type="submit"> Add New Variable
Add New Variable </x-forms.button>
</x-forms.button>
</div>
</form> </form>

View File

@ -8,7 +8,7 @@
:env="$env" /> :env="$env" />
@endforeach @endforeach
<div class="pt-2 pb-8"> <div class="pt-2 pb-8">
<livewire:project.application.environment-variable.add /> <livewire:project.application.environment-varia /ble.add />
</div> </div>
<div> <div>
<h3>Preview Deployments</h3> <h3>Preview Deployments</h3>

View File

@ -1,17 +1,15 @@
<div x-data="{ deleteEnvironment: false }"> <div x-data="{ deleteEnvironment: false }">
<form wire:submit.prevent='submit' class="flex flex-col max-w-fit"> <form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
<div class="flex items-end gap-2"> <x-forms.input label="Name" id="env.key" />
<x-forms.input label="Name" id="env.key" /> <x-forms.input label="Value" id="env.value" />
<x-forms.input label="Value" id="env.value" /> <x-forms.checkbox disabled id="env.is_build_time" label="Build Variable?" />
<x-forms.checkbox disabled class="flex-col text-center w-96" id="env.is_build_time" label="Build Variable?" /> <div class="flex gap-2">
<div class="flex gap-2"> <x-forms.button type="submit">
<x-forms.button type="submit"> Update
Update </x-forms.button>
</x-forms.button> <x-forms.button x-on:click.prevent="deleteEnvironment = true">
<x-forms.button x-on:click.prevent="deleteEnvironment = true"> Delete
Delete </x-forms.button>
</x-forms.button>
</div>
</div> </div>
</form> </form>
<x-naked-modal show="deleteEnvironment" message="Are you sure you want to delete {{ $env->key }}?" /> <x-naked-modal show="deleteEnvironment" message="Are you sure you want to delete {{ $env->key }}?" />

View File

@ -21,7 +21,7 @@
<div class="text-sm">Code source of your application.</div> <div class="text-sm">Code source of your application.</div>
<x-forms.input placeholder="coollabsio/coolify-example" id="application.git_repository" label="Repository" /> <x-forms.input placeholder="coollabsio/coolify-example" id="application.git_repository" label="Repository" />
<x-forms.input placeholder="main" id="application.git_branch" label="Branch" /> <x-forms.input placeholder="main" id="application.git_branch" label="Branch" />
<div class="flex items-end gap-2"> <div class="flex items-end gap-2 w-96">
<x-forms.input placeholder="HEAD" id="application.git_commit_sha" placeholder="HEAD" label="Commit SHA" /> <x-forms.input placeholder="HEAD" id="application.git_commit_sha" placeholder="HEAD" label="Commit SHA" />
<a target="_blank" class="flex hover:no-underline" href="{{ $application?->gitCommits }}"> <a target="_blank" class="flex hover:no-underline" href="{{ $application?->gitCommits }}">
<x-forms.button><svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24" <x-forms.button><svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"

View File

@ -1,10 +1,8 @@
<form wire:submit.prevent='submit' class="flex flex-col w-full px-2"> <form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
<div class="flex items-end gap-2"> <x-forms.input placeholder="pv-name" noDirty id="name" label="Name" required />
<x-forms.input placeholder="pv-name" noDirty id="name" label="Name" required /> <x-forms.input placeholder="/root" noDirty id="host_path" label="Source Path" />
<x-forms.input placeholder="/root" noDirty id="host_path" label="Source Path" /> <x-forms.input placeholder="/tmp/root" noDirty id="mount_path" label="Destination Path" required />
<x-forms.input placeholder="/tmp/root" noDirty id="mount_path" label="Destination Path" required /> <x-forms.button type="submit">
<x-forms.button type="submit"> Add New Volume
Add New Volume </x-forms.button>
</x-forms.button>
</div>
</form> </form>

View File

@ -1,17 +1,18 @@
<div> <div>
<div> <div>
<h2>Storages</h2> <div class="flex items-center gap-2">
<div class="text-sm">Persistent storage to preserve data between deployments.</div> <h2>Storages </h2>
<div class="text-sm">Preview Deployments has a <span class='text-helper'>-pr-#PRNumber</span> in their <x-helper
helper="For Preview Deployments, storage has a <span class='text-helper'>-pr-#PRNumber</span> in their
volume volume
name, example: <span class='text-helper'>-pr-1</span>.</div> name, example: <span class='text-helper'>-pr-1</span>" />
</div>
<div class="text-sm">Persistent storage to preserve data between deployments.</div>
</div> </div>
<div class="flex flex-col gap-2 py-4"> <div class="flex flex-col gap-2 py-4">
@forelse ($application->persistentStorages as $storage) @foreach ($application->persistentStorages as $storage)
<livewire:project.application.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" /> <livewire:project.application.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" />
@empty @endforeach
<p>There are no persistent storages attached for this application.</p>
@endforelse
</div> </div>
<livewire:project.application.storages.add /> <livewire:project.application.storages.add />
</div> </div>

View File

@ -1,9 +1,9 @@
<div x-data="{ deleteStorage: false }"> <div x-data="{ deleteStorage: false }">
<form wire:submit.prevent='submit' class="flex flex-col px-2"> <form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
<div class="flex items-end gap-2"> <x-forms.input id="storage.name" label="Name" required />
<x-forms.input id="storage.name" label="Name" required /> <x-forms.input id="storage.host_path" label="Source Path" />
<x-forms.input id="storage.host_path" label="Source Path" /> <x-forms.input id="storage.mount_path" label="Destination Path" required />
<x-forms.input id="storage.mount_path" label="Destination Path" required /> <div class="flex gap-2">
<x-forms.button type="submit"> <x-forms.button type="submit">
Update Update
</x-forms.button> </x-forms.button>

View File

@ -43,8 +43,8 @@
Route::get('/destinations', [MagicController::class, 'destinations']); Route::get('/destinations', [MagicController::class, 'destinations']);
Route::get('/projects', [MagicController::class, 'projects']); Route::get('/projects', [MagicController::class, 'projects']);
Route::get('/environments', [MagicController::class, 'environments']); Route::get('/environments', [MagicController::class, 'environments']);
Route::get('/project/new', [MagicController::class, 'new_project']); Route::get('/project/new', [MagicController::class, 'newProject']);
Route::get('/environment/new', [MagicController::class, 'new_environment']); Route::get('/environment/new', [MagicController::class, 'newEnvironment']);
}); });
Route::middleware(['auth'])->group(function () { Route::middleware(['auth'])->group(function () {
@ -63,10 +63,18 @@
}); });
Route::middleware(['auth'])->group(function () { Route::middleware(['auth'])->group(function () {
Route::get('/servers', [ServerController::class, 'all'])->name('server.all'); Route::get('/servers', fn () => view('server.all', [
Route::get('/server/new', [ServerController::class, 'create'])->name('server.create'); 'servers' => Server::ownedByCurrentTeam()->get()
Route::get('/server/{server_uuid}', [ServerController::class, 'show'])->name('server.show'); ]))->name('server.all');
Route::get('/server/{server_uuid}/proxy', [ServerController::class, 'proxy'])->name('server.proxy'); Route::get('/servers/new', fn () => view('server.create', [
'private_keys' => PrivateKey::ownedByCurrentTeam()->get(),
]))->name('server.create');
Route::get('/servers/{server_uuid}', fn () => view('server.show', [
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
]))->name('server.show');
Route::get('/servers/{server_uuid}/proxy', fn () => view('server.proxy', [
'server' => Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->firstOrFail(),
]))->name('server.proxy');
Route::get('/server/{server_uuid}/private-key', fn () => view('server.private-key'))->name('server.private-key'); Route::get('/server/{server_uuid}/private-key', fn () => view('server.private-key'))->name('server.private-key');
}); });
@ -79,8 +87,8 @@
Route::get('/profile/team', [Controller::class, 'team'])->name('team.show'); Route::get('/profile/team', [Controller::class, 'team'])->name('team.show');
Route::get('/profile/team/notifications', fn () => view('team.notifications'))->name('team.notifications'); Route::get('/profile/team/notifications', fn () => view('team.notifications'))->name('team.notifications');
Route::get('/command-center', fn () => view('command-center', ['servers' => Server::validated()->get()]))->name('command-center'); Route::get('/command-center', fn () => view('command-center', ['servers' => Server::validated()->get()]))->name('command-center');
Route::get('/invitations/{uuid}', [Controller::class, 'accept_invitation'])->name('team.invitation.accept'); Route::get('/invitations/{uuid}', [Controller::class, 'acceptInvitation'])->name('team.invitation.accept');
Route::get('/invitations/{uuid}/revoke', [Controller::class, 'revoke_invitation'])->name('team.invitation.revoke'); Route::get('/invitations/{uuid}/revoke', [Controller::class, 'revokeInvitation'])->name('team.invitation.revoke');
}); });
Route::middleware(['auth'])->group(function () { Route::middleware(['auth'])->group(function () {