wip: ui for services
This commit is contained in:
parent
4ae7e46e81
commit
53d1fa0331
@ -18,6 +18,7 @@ public function handle(Service $service)
|
||||
$docker_compose_base64 = base64_encode($service->docker_compose);
|
||||
$commands[] = "echo $docker_compose_base64 | base64 -d > docker-compose.yml";
|
||||
$envs = $service->environment_variables()->get();
|
||||
$commands[] = "rm -f .env || true";
|
||||
foreach ($envs as $env) {
|
||||
$commands[] = "echo '{$env->key}={$env->value}' >> .env";
|
||||
}
|
||||
|
30
app/Http/Livewire/Project/Service/Application.php
Normal file
30
app/Http/Livewire/Project/Service/Application.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Project\Service;
|
||||
|
||||
use App\Models\ServiceApplication;
|
||||
use Livewire\Component;
|
||||
|
||||
class Application extends Component
|
||||
{
|
||||
public ServiceApplication $application;
|
||||
protected $rules = [
|
||||
'application.human_name' => 'nullable',
|
||||
'application.fqdn' => 'nullable',
|
||||
];
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.application');
|
||||
}
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
$this->validate();
|
||||
$this->application->save();
|
||||
} catch (\Throwable $e) {
|
||||
ray($e);
|
||||
} finally {
|
||||
$this->emit('generateDockerCompose');
|
||||
}
|
||||
}
|
||||
}
|
30
app/Http/Livewire/Project/Service/Database.php
Normal file
30
app/Http/Livewire/Project/Service/Database.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Project\Service;
|
||||
|
||||
use App\Models\ServiceApplication;
|
||||
use App\Models\ServiceDatabase;
|
||||
use Livewire\Component;
|
||||
|
||||
class Database extends Component
|
||||
{
|
||||
public ServiceDatabase $database;
|
||||
protected $rules = [
|
||||
'database.human_name' => 'nullable',
|
||||
];
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.database');
|
||||
}
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
$this->validate();
|
||||
$this->database->save();
|
||||
} catch (\Throwable $e) {
|
||||
ray($e);
|
||||
} finally {
|
||||
$this->emit('generateDockerCompose');
|
||||
}
|
||||
}
|
||||
}
|
@ -15,73 +15,25 @@ class Index extends Component
|
||||
|
||||
public array $parameters;
|
||||
public array $query;
|
||||
public Collection $services;
|
||||
protected $listeners = ['serviceStatusUpdated'];
|
||||
protected $rules = [
|
||||
'services.*.fqdn' => 'nullable',
|
||||
'service.docker_compose_raw' => 'required',
|
||||
'service.docker_compose' => 'required',
|
||||
];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->services = collect([]);
|
||||
$this->parameters = get_route_parameters();
|
||||
$this->query = request()->query();
|
||||
$this->service = Service::whereUuid($this->parameters['service_uuid'])->firstOrFail();
|
||||
foreach ($this->service->applications as $application) {
|
||||
$this->services->put($application->name, [
|
||||
'fqdn' => $application->fqdn,
|
||||
]);
|
||||
}
|
||||
// foreach ($this->service->databases as $database) {
|
||||
// $this->services->put($database->name, $database->fqdn);
|
||||
// }
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.index')->layout('layouts.app');
|
||||
return view('livewire.project.service.index');
|
||||
}
|
||||
public function serviceStatusUpdated() {
|
||||
ray('serviceStatusUpdated');
|
||||
$this->check_status();
|
||||
}
|
||||
public function check_status()
|
||||
{
|
||||
dispatch_sync(new ContainerStatusJob($this->service->server));
|
||||
$this->service->refresh();
|
||||
}
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
if ($this->services->count() === 0) {
|
||||
return;
|
||||
}
|
||||
foreach ($this->services as $name => $value) {
|
||||
$foundService = $this->service->applications()->whereName($name)->first();
|
||||
if ($foundService) {
|
||||
$foundService->fqdn = data_get($value, 'fqdn');
|
||||
$foundService->save();
|
||||
return;
|
||||
}
|
||||
$foundService = $this->service->databases()->whereName($name)->first();
|
||||
if ($foundService) {
|
||||
// $foundService->save();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
ray($e);
|
||||
} finally {
|
||||
$this->service->parse();
|
||||
}
|
||||
}
|
||||
public function deploy()
|
||||
{
|
||||
public function save() {
|
||||
$this->service->save();
|
||||
$this->service->parse();
|
||||
$activity = StartService::run($this->service);
|
||||
$this->emit('newMonitorActivity', $activity->id);
|
||||
}
|
||||
public function stop() {
|
||||
StopService::run($this->service);
|
||||
$this->service->refresh();
|
||||
$this->emit('refreshEnvs');
|
||||
}
|
||||
|
||||
}
|
||||
|
43
app/Http/Livewire/Project/Service/Navbar.php
Normal file
43
app/Http/Livewire/Project/Service/Navbar.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Project\Service;
|
||||
|
||||
use App\Actions\Service\StartService;
|
||||
use App\Actions\Service\StopService;
|
||||
use App\Jobs\ContainerStatusJob;
|
||||
use App\Models\Service;
|
||||
use Livewire\Component;
|
||||
|
||||
class Navbar extends Component
|
||||
{
|
||||
public Service $service;
|
||||
public array $parameters;
|
||||
public array $query;
|
||||
protected $listeners = ['serviceStatusUpdated'];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.navbar');
|
||||
}
|
||||
public function serviceStatusUpdated()
|
||||
{
|
||||
ray('serviceStatusUpdated');
|
||||
$this->check_status();
|
||||
}
|
||||
public function check_status()
|
||||
{
|
||||
dispatch_sync(new ContainerStatusJob($this->service->server));
|
||||
$this->service->refresh();
|
||||
}
|
||||
public function deploy()
|
||||
{
|
||||
$this->service->parse();
|
||||
$activity = StartService::run($this->service);
|
||||
$this->emit('newMonitorActivity', $activity->id);
|
||||
}
|
||||
public function stop()
|
||||
{
|
||||
StopService::run($this->service);
|
||||
$this->service->refresh();
|
||||
}
|
||||
}
|
42
app/Http/Livewire/Project/Service/Show.php
Normal file
42
app/Http/Livewire/Project/Service/Show.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire\Project\Service;
|
||||
|
||||
use App\Models\Service;
|
||||
use App\Models\ServiceApplication;
|
||||
use App\Models\ServiceDatabase;
|
||||
use Illuminate\Support\Collection;
|
||||
use Livewire\Component;
|
||||
|
||||
class Show extends Component
|
||||
{
|
||||
public Service $service;
|
||||
public ServiceApplication $serviceApplication;
|
||||
public ServiceDatabase $serviceDatabase;
|
||||
public array $parameters;
|
||||
public array $query;
|
||||
public Collection $services;
|
||||
protected $listeners = ['generateDockerCompose'];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->services = collect([]);
|
||||
$this->parameters = get_route_parameters();
|
||||
$this->query = request()->query();
|
||||
$this->service = Service::whereUuid($this->parameters['service_uuid'])->firstOrFail();
|
||||
$service = $this->service->applications()->whereName($this->parameters['service_name'])->first();
|
||||
if ($service) {
|
||||
$this->serviceApplication = $service;
|
||||
} else {
|
||||
$this->serviceDatabase = $this->service->databases()->whereName($this->parameters['service_name'])->first();
|
||||
}
|
||||
}
|
||||
public function generateDockerCompose()
|
||||
{
|
||||
$this->service->parse();
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.show');
|
||||
}
|
||||
}
|
@ -19,13 +19,24 @@ public function mount()
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$destination = $this->resource->destination->getMorphClass()::where('id', $this->resource->destination->id)->first();
|
||||
|
||||
instant_remote_process(["docker rm -f {$this->resource->uuid}"], $destination->server);
|
||||
$this->resource->delete();
|
||||
return redirect()->route('project.resources', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'environment_name' => $this->parameters['environment_name']
|
||||
]);
|
||||
try {
|
||||
if ($this->resource->type() === 'service') {
|
||||
$server = $this->resource->server;
|
||||
} else {
|
||||
$destination = data_get($this->resource, 'destination');
|
||||
if ($destination) {
|
||||
$destination = $this->resource->destination->getMorphClass()::where('id', $this->resource->destination->id)->first();
|
||||
$server = $destination->server;
|
||||
}
|
||||
}
|
||||
instant_remote_process(["docker rm -f {$this->resource->uuid}"], $server);
|
||||
$this->resource->delete();
|
||||
return redirect()->route('project.resources', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'environment_name' => $this->parameters['environment_name']
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ public function mount()
|
||||
|
||||
public function submit()
|
||||
{
|
||||
ray('submitting');
|
||||
$this->validate();
|
||||
$this->emitUp('submit', [
|
||||
'key' => $this->key,
|
||||
|
@ -53,6 +53,7 @@ public function saveVariables($isPreview)
|
||||
$this->resource->environment_variables_preview()->delete();
|
||||
} else {
|
||||
$variables = parseEnvFormatToArray($this->variables);
|
||||
ray($variables);
|
||||
$existingVariables = $this->resource->environment_variables();
|
||||
$this->resource->environment_variables()->delete();
|
||||
}
|
||||
@ -68,11 +69,16 @@ public function saveVariables($isPreview)
|
||||
$environment->value = $variable;
|
||||
$environment->is_build_time = false;
|
||||
$environment->is_preview = $isPreview ? true : false;
|
||||
if ($this->resource->type() === 'application') {
|
||||
$environment->application_id = $this->resource->id;
|
||||
}
|
||||
if ($this->resource->type() === 'standalone-postgresql') {
|
||||
$environment->standalone_postgresql_id = $this->resource->id;
|
||||
switch ($this->resource->type()) {
|
||||
case 'application':
|
||||
$environment->application_id = $this->resource->id;
|
||||
break;
|
||||
case 'standalone-postgresql':
|
||||
$environment->standalone_postgresql_id = $this->resource->id;
|
||||
break;
|
||||
case 'service':
|
||||
$environment->service_id = $this->resource->id;
|
||||
break;
|
||||
}
|
||||
$environment->save();
|
||||
}
|
||||
|
@ -10,7 +10,9 @@ class Show extends Component
|
||||
{
|
||||
public $parameters;
|
||||
public ModelsEnvironmentVariable $env;
|
||||
public string|null $modalId = null;
|
||||
public ?string $modalId = null;
|
||||
public string $type;
|
||||
|
||||
protected $rules = [
|
||||
'env.key' => 'required|string',
|
||||
'env.value' => 'required|string',
|
||||
@ -37,6 +39,7 @@ public function submit()
|
||||
$this->validate();
|
||||
$this->env->save();
|
||||
$this->emit('success', 'Environment variable updated successfully.');
|
||||
$this->emit('refreshEnvs');
|
||||
}
|
||||
|
||||
public function delete()
|
||||
|
@ -2,13 +2,16 @@
|
||||
|
||||
namespace App\Http\Livewire\Project\Shared\Storages;
|
||||
|
||||
use App\Models\LocalPersistentVolume;
|
||||
use Livewire\Component;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
class Show extends Component
|
||||
{
|
||||
public $storage;
|
||||
public string|null $modalId = null;
|
||||
public LocalPersistentVolume $storage;
|
||||
public bool $isReadOnly = false;
|
||||
public ?string $modalId = null;
|
||||
|
||||
protected $rules = [
|
||||
'storage.name' => 'required|string',
|
||||
'storage.mount_path' => 'required|string',
|
||||
|
@ -170,40 +170,32 @@ public function handle(): void
|
||||
if (in_array("$service->id-$app->name", $foundServices)) {
|
||||
continue;
|
||||
} else {
|
||||
$exitedServices->push($service);
|
||||
$app->update(['status' => 'exited']);
|
||||
$exitedServices->push($app);
|
||||
}
|
||||
}
|
||||
foreach ($dbs as $db) {
|
||||
if (in_array("$service->id-$db->name", $foundServices)) {
|
||||
continue;
|
||||
} else {
|
||||
$exitedServices->push($service);
|
||||
$db->update(['status' => 'exited']);
|
||||
$exitedServices->push($db);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$exitedServices = $exitedServices->unique('id');
|
||||
ray($exitedServices);
|
||||
// ray($exitedServices);
|
||||
// foreach ($serviceIds as $serviceId) {
|
||||
// $service = $services->where('id', $serviceId)->first();
|
||||
// if ($service->status === 'exited') {
|
||||
// continue;
|
||||
// }
|
||||
foreach ($exitedServices as $exitedService) {
|
||||
if ($exitedService->status === 'exited') {
|
||||
continue;
|
||||
}
|
||||
$name = data_get($exitedService, 'name');
|
||||
$fqdn = data_get($exitedService, 'fqdn');
|
||||
$containerName = $name ? "$name ($fqdn)" : $fqdn;
|
||||
$project = data_get($service, 'environment.project');
|
||||
$environment = data_get($service, 'environment');
|
||||
|
||||
// $name = data_get($service, 'name');
|
||||
// $fqdn = data_get($service, 'fqdn');
|
||||
|
||||
// $containerName = $name ? "$name ($fqdn)" : $fqdn;
|
||||
|
||||
// $project = data_get($service, 'environment.project');
|
||||
// $environment = data_get($service, 'environment');
|
||||
|
||||
// $url = base_url() . '/project/' . $project->uuid . "/" . $environment->name . "/service/" . $service->uuid;
|
||||
|
||||
// $this->server->team->notify(new ContainerStopped($containerName, $this->server, $url));
|
||||
// }
|
||||
$url = base_url() . '/project/' . $project->uuid . "/" . $environment->name . "/service/" . $service->uuid;
|
||||
$this->server->team->notify(new ContainerStopped($containerName, $this->server, $url));
|
||||
$exitedService->update(['status' => 'exited']);
|
||||
}
|
||||
|
||||
$notRunningApplications = $applications->pluck('id')->diff($foundApplications);
|
||||
foreach ($notRunningApplications as $applicationId) {
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\ProxyTypes;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Collection;
|
||||
@ -14,27 +13,26 @@ class Service extends BaseModel
|
||||
{
|
||||
use HasFactory;
|
||||
protected $guarded = [];
|
||||
public function persistentStorages()
|
||||
{
|
||||
return $this->morphMany(LocalPersistentVolume::class, 'resource');
|
||||
}
|
||||
public function portsMappingsArray(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => is_null($this->ports_mappings)
|
||||
? []
|
||||
: explode(',', $this->ports_mappings),
|
||||
|
||||
);
|
||||
}
|
||||
public function portsExposesArray(): Attribute
|
||||
protected static function booted()
|
||||
{
|
||||
return Attribute::make(
|
||||
get: fn () => is_null($this->ports_exposes)
|
||||
? []
|
||||
: explode(',', $this->ports_exposes)
|
||||
);
|
||||
static::deleted(function ($service) {
|
||||
foreach($service->applications()->get() as $application) {
|
||||
$application->persistentStorages()->delete();
|
||||
}
|
||||
foreach($service->databases()->get() as $database) {
|
||||
$database->persistentStorages()->delete();
|
||||
}
|
||||
$service->environment_variables()->delete();
|
||||
$service->applications()->delete();
|
||||
$service->databases()->delete();
|
||||
});
|
||||
}
|
||||
public function type()
|
||||
{
|
||||
return 'service';
|
||||
}
|
||||
|
||||
public function applications()
|
||||
{
|
||||
return $this->hasMany(ServiceApplication::class);
|
||||
@ -47,10 +45,10 @@ public function environment()
|
||||
{
|
||||
return $this->belongsTo(Environment::class);
|
||||
}
|
||||
public function server() {
|
||||
public function server()
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
}
|
||||
|
||||
public function byName(string $name)
|
||||
{
|
||||
$app = $this->applications()->whereName($name)->first();
|
||||
@ -70,7 +68,6 @@ public function environment_variables(): HasMany
|
||||
public function parse(bool $isNew = false): Collection
|
||||
{
|
||||
// ray()->clearAll();
|
||||
ray('Service parse');
|
||||
if ($this->docker_compose_raw) {
|
||||
$yaml = Yaml::parse($this->docker_compose_raw);
|
||||
|
||||
@ -138,8 +135,8 @@ public function parse(bool $isNew = false): Collection
|
||||
}
|
||||
}
|
||||
}
|
||||
$savedService->ports_exposes = $ports->implode(',');
|
||||
$savedService->save();
|
||||
// $savedService->ports_exposes = $ports->implode(',');
|
||||
// $savedService->save();
|
||||
}
|
||||
// Collect volumes
|
||||
$serviceVolumes = collect(data_get($service, 'volumes', []));
|
||||
@ -158,17 +155,38 @@ public function parse(bool $isNew = false): Collection
|
||||
return $key == $volumeName;
|
||||
});
|
||||
if (!$volumeExists) {
|
||||
if (!Str::startsWith($volumeName, '/')) {
|
||||
if (Str::startsWith($volumeName, '/')) {
|
||||
$volumes->put($volumeName, $volumePath);
|
||||
LocalPersistentVolume::updateOrCreate(
|
||||
[
|
||||
'mount_path' => $volumePath,
|
||||
'resource_id' => $savedService->id,
|
||||
'resource_type' => get_class($savedService)
|
||||
],
|
||||
[
|
||||
'name' => Str::slug($volumeName, '-'),
|
||||
'mount_path' => $volumePath,
|
||||
'host_path' => $volumeName,
|
||||
'resource_id' => $savedService->id,
|
||||
'resource_type' => get_class($savedService)
|
||||
]
|
||||
);
|
||||
} else {
|
||||
$composeVolumes->put($volumeName, null);
|
||||
}
|
||||
$volumes->put($volumeName, $volumePath);
|
||||
if ($isNew) {
|
||||
LocalPersistentVolume::create([
|
||||
'name' => $volumeName,
|
||||
'mount_path' => $volumePath,
|
||||
'resource_id' => $savedService->id,
|
||||
'resource_type' => get_class($savedService)
|
||||
]);
|
||||
LocalPersistentVolume::updateOrCreate(
|
||||
[
|
||||
'mount_path' => $volumePath,
|
||||
'resource_id' => $savedService->id,
|
||||
'resource_type' => get_class($savedService)
|
||||
],
|
||||
[
|
||||
'name' => $volumeName,
|
||||
'mount_path' => $volumePath,
|
||||
'host_path' => null,
|
||||
'resource_id' => $savedService->id,
|
||||
'resource_type' => get_class($savedService)
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -229,25 +247,26 @@ public function parse(bool $isNew = false): Collection
|
||||
}
|
||||
if (!$envs->has($nakedName->value())) {
|
||||
$envs->put($nakedName->value(), $nakedValue->value());
|
||||
if ($isNew) {
|
||||
EnvironmentVariable::create([
|
||||
'key' => $nakedName->value(),
|
||||
'value' => $nakedValue->value(),
|
||||
'is_build_time' => false,
|
||||
'service_id' => $this->id,
|
||||
'is_preview' => false,
|
||||
]);
|
||||
}
|
||||
EnvironmentVariable::updateOrCreate([
|
||||
'key' => $nakedName->value(),
|
||||
'service_id' => $this->id,
|
||||
], [
|
||||
'value' => $nakedValue->value(),
|
||||
'is_build_time' => false,
|
||||
'service_id' => $this->id,
|
||||
'is_preview' => false,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if (!$envs->has($nakedName->value())) {
|
||||
$envs->put($nakedName->value(), null);
|
||||
if ($isNew) {
|
||||
$envExists = EnvironmentVariable::where('service_id', $this->id)->where('key', $nakedName->value())->exists();
|
||||
if (!$envExists) {
|
||||
EnvironmentVariable::create([
|
||||
'key' => $nakedName->value(),
|
||||
'value' => null,
|
||||
'is_build_time' => false,
|
||||
'service_id' => $this->id,
|
||||
'is_build_time' => false,
|
||||
'is_preview' => false,
|
||||
]);
|
||||
}
|
||||
@ -259,31 +278,31 @@ public function parse(bool $isNew = false): Collection
|
||||
$generatedValue = null;
|
||||
if ($variableName->startsWith('SERVICE_USER')) {
|
||||
$generatedValue = Str::random(10);
|
||||
if ($isNew) {
|
||||
if (!$envs->has($variableName->value())) {
|
||||
$envs->put($variableName->value(), $generatedValue);
|
||||
EnvironmentVariable::create([
|
||||
'key' => $variableName->value(),
|
||||
'value' => $generatedValue,
|
||||
'is_build_time' => false,
|
||||
'service_id' => $this->id,
|
||||
'is_preview' => false,
|
||||
]);
|
||||
}
|
||||
if (!$envs->has($variableName->value())) {
|
||||
$envs->put($variableName->value(), $generatedValue);
|
||||
EnvironmentVariable::updateOrCreate([
|
||||
'key' => $variableName->value(),
|
||||
'service_id' => $this->id,
|
||||
], [
|
||||
'value' => $generatedValue,
|
||||
'is_build_time' => false,
|
||||
'service_id' => $this->id,
|
||||
'is_preview' => false,
|
||||
]);
|
||||
}
|
||||
} else if ($variableName->startsWith('SERVICE_PASSWORD')) {
|
||||
$generatedValue = Str::password(symbols: false);
|
||||
if ($isNew) {
|
||||
if (!$envs->has($variableName->value())) {
|
||||
$envs->put($variableName->value(), $generatedValue);
|
||||
EnvironmentVariable::create([
|
||||
'key' => $variableName->value(),
|
||||
'value' => $generatedValue,
|
||||
'is_build_time' => false,
|
||||
'service_id' => $this->id,
|
||||
'is_preview' => false,
|
||||
]);
|
||||
}
|
||||
if (!$envs->has($variableName->value())) {
|
||||
$envs->put($variableName->value(), $generatedValue);
|
||||
EnvironmentVariable::updateOrCreate([
|
||||
'key' => $variableName->value(),
|
||||
'service_id' => $this->id,
|
||||
], [
|
||||
'value' => $generatedValue,
|
||||
'is_build_time' => false,
|
||||
'service_id' => $this->id,
|
||||
'is_preview' => false,
|
||||
]);
|
||||
}
|
||||
} else if ($variableName->startsWith('SERVICE_FQDN')) {
|
||||
if ($fqdn) {
|
||||
@ -324,20 +343,6 @@ public function parse(bool $isNew = false): Collection
|
||||
data_forget($service, 'documentation');
|
||||
return $service;
|
||||
});
|
||||
// $services = $services->map(function ($service, $serviceName) {
|
||||
// $dependsOn = collect(data_get($service, 'depends_on', []));
|
||||
// $dependsOn = $dependsOn->map(function ($value) {
|
||||
// return "$value-{$this->uuid}";
|
||||
// });
|
||||
// data_set($service, 'depends_on', $dependsOn->toArray());
|
||||
// return $service;
|
||||
// });
|
||||
// $renamedServices = collect([]);
|
||||
// collect($services)->map(function ($service, $serviceName) use ($renamedServices) {
|
||||
// $newServiceName = "$serviceName-$this->uuid";
|
||||
// $renamedServices->put($newServiceName, $service);
|
||||
// });
|
||||
|
||||
$finalServices = [
|
||||
'version' => $dockerComposeVersion,
|
||||
'services' => $services->toArray(),
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class ServiceApplication extends BaseModel
|
||||
@ -9,4 +10,12 @@ class ServiceApplication extends BaseModel
|
||||
use HasFactory;
|
||||
protected $guarded = [];
|
||||
|
||||
public function type()
|
||||
{
|
||||
return 'service';
|
||||
}
|
||||
public function persistentStorages()
|
||||
{
|
||||
return $this->morphMany(LocalPersistentVolume::class, 'resource');
|
||||
}
|
||||
}
|
||||
|
@ -9,4 +9,12 @@ class ServiceDatabase extends BaseModel
|
||||
use HasFactory;
|
||||
protected $guarded = [];
|
||||
|
||||
public function type()
|
||||
{
|
||||
return 'service';
|
||||
}
|
||||
public function persistentStorages()
|
||||
{
|
||||
return $this->morphMany(LocalPersistentVolume::class, 'resource');
|
||||
}
|
||||
}
|
||||
|
29
app/View/Components/Services/Links.php
Normal file
29
app/View/Components/Services/Links.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components\Services;
|
||||
|
||||
use App\Models\Service;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class Links extends Component
|
||||
{
|
||||
public Collection $links;
|
||||
public function __construct(public Service $service)
|
||||
{
|
||||
$this->links = collect([]);
|
||||
$service->applications()->get()->map(function ($application) {
|
||||
$this->links->push($application->fqdn);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.services.links');
|
||||
}
|
||||
}
|
@ -132,7 +132,6 @@ function get_port_from_dockerfile($dockerfile): int
|
||||
|
||||
function defaultLabels($id, $name, $pull_request_id = 0, string $type = 'application')
|
||||
{
|
||||
ray($type);
|
||||
$labels = collect([]);
|
||||
$labels->push('coolify.managed=true');
|
||||
$labels->push('coolify.version=' . config('version'));
|
||||
|
@ -15,12 +15,10 @@ public function up(): void
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->string('name');
|
||||
$table->string('human_name')->nullable();
|
||||
|
||||
$table->string('status')->default('exited');
|
||||
|
||||
$table->string('ports_exposes')->nullable();
|
||||
$table->string('ports_mappings')->nullable();
|
||||
|
||||
$table->foreignId('service_id');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
@ -15,24 +15,10 @@ public function up(): void
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->string('name');
|
||||
$table->string('human_name')->nullable();
|
||||
|
||||
$table->string('fqdn')->unique()->nullable();
|
||||
|
||||
$table->string('ports_exposes')->nullable();
|
||||
$table->string('ports_mappings')->nullable();
|
||||
|
||||
$table->string('health_check_path')->default('/');
|
||||
$table->string('health_check_port')->nullable();
|
||||
$table->string('health_check_host')->default('localhost');
|
||||
$table->string('health_check_method')->default('GET');
|
||||
$table->integer('health_check_return_code')->default(200);
|
||||
$table->string('health_check_scheme')->default('http');
|
||||
$table->string('health_check_response_text')->nullable();
|
||||
$table->integer('health_check_interval')->default(5);
|
||||
$table->integer('health_check_timeout')->default(5);
|
||||
$table->integer('health_check_retries')->default(10);
|
||||
$table->integer('health_check_start_period')->default(5);
|
||||
|
||||
$table->string('status')->default('exited');
|
||||
|
||||
$table->foreignId('service_id');
|
||||
|
@ -1,18 +1,20 @@
|
||||
<div class="group">
|
||||
<label tabindex="0" class="flex items-center gap-2 cursor-pointer hover:text-white"> Links
|
||||
<label tabindex="0" class="flex items-center gap-2 cursor-pointer hover:text-white"> Open Application
|
||||
<x-chevron-down />
|
||||
</label>
|
||||
|
||||
<div class="absolute hidden group-hover:block">
|
||||
<ul tabindex="0" class="relative -ml-24 text-xs text-white normal-case rounded min-w-max menu bg-coolgray-200">
|
||||
<li>
|
||||
<a target="_blank"
|
||||
class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
|
||||
href="{{ $application->gitBranchLocation }}">
|
||||
<x-git-icon git="{{ $application->source?->getMorphClass() }}" />
|
||||
Git Repository
|
||||
</a>
|
||||
</li>
|
||||
@if (data_get($application, 'gitBrancLocation'))
|
||||
<li>
|
||||
<a target="_blank"
|
||||
class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
|
||||
href="{{ $application->gitBranchLocation }}">
|
||||
<x-git-icon git="{{ $application->source?->getMorphClass() }}" />
|
||||
Git Repository
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@if (data_get($application, 'fqdn'))
|
||||
@foreach (Str::of(data_get($application, 'fqdn'))->explode(',') as $fqdn)
|
||||
<li>
|
||||
@ -31,7 +33,7 @@ class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hove
|
||||
</li>
|
||||
@endforeach
|
||||
@endif
|
||||
@if (data_get($application, 'previews')->count() > 0)
|
||||
@if (data_get($application, 'previews', collect([]))->count() > 0)
|
||||
@foreach (data_get($application, 'previews') as $preview)
|
||||
@if (data_get($preview, 'fqdn'))
|
||||
<li>
|
||||
|
28
resources/views/components/services/links.blade.php
Normal file
28
resources/views/components/services/links.blade.php
Normal file
@ -0,0 +1,28 @@
|
||||
<div class="group">
|
||||
<label tabindex="0" class="flex items-center gap-2 cursor-pointer hover:text-white"> Open Application
|
||||
<x-chevron-down />
|
||||
</label>
|
||||
|
||||
<div class="absolute hidden group-hover:block">
|
||||
<ul tabindex="0" class="relative -ml-24 text-xs text-white normal-case rounded min-w-max menu bg-coolgray-200">
|
||||
@if ($links->count() > 0)
|
||||
@foreach ($links as $link)
|
||||
<li>
|
||||
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
|
||||
target="_blank" href="{{ $link }}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"
|
||||
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||
stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||
<path d="M9 15l6 -6" />
|
||||
<path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464" />
|
||||
<path
|
||||
d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463" />
|
||||
</svg>{{ $link }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
@ -1,13 +1,11 @@
|
||||
<div class="navbar-main">
|
||||
<a class="{{ request()->routeIs('project.service') ? 'text-white' : '' }}"
|
||||
href="{{ route('project.service', $parameters) }}">
|
||||
<button>Configuration</button>
|
||||
href="{{ route('project.service', [...$parameters, 'service_name' => null]) }}">
|
||||
<button>Service</button>
|
||||
</a>
|
||||
<x-services.links :service="$service" />
|
||||
<div class="flex-1"></div>
|
||||
{{-- <x-applications.links :application="$application" />
|
||||
|
||||
<x-applications.advanced :application="$application" /> --}}
|
||||
@if (serviceStatus($service) !== 'exited')
|
||||
@if (serviceStatus($service) === 'running')
|
||||
<button wire:click='stop' class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2"
|
||||
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
@ -17,7 +15,7 @@
|
||||
</svg>
|
||||
Stop
|
||||
</button>
|
||||
@else
|
||||
@elseif(serviceStatus($service) === 'exited')
|
||||
<button wire:click='deploy' onclick="startService.showModal()"
|
||||
class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-warning" viewBox="0 0 24 24" stroke-width="1.5"
|
||||
@ -27,5 +25,25 @@ class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400"
|
||||
</svg>
|
||||
Deploy
|
||||
</button>
|
||||
@elseif (serviceStatus($service) === 'degraded')
|
||||
<button wire:click='deploy' onclick="startService.showModal()"
|
||||
class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
|
||||
<svg class="w-5 h-5 text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
|
||||
<path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
|
||||
<path d="M20 4v5h-5" />
|
||||
</g>
|
||||
</svg>
|
||||
Restart Degraded Services
|
||||
</button>
|
||||
<button wire:click='stop' class="flex items-center gap-2 cursor-pointer hover:text-white text-neutral-400">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2"
|
||||
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
||||
<path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"></path>
|
||||
<path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z"></path>
|
||||
</svg>
|
||||
Stop
|
||||
</button>
|
||||
@endif
|
||||
</div>
|
||||
|
@ -0,0 +1,14 @@
|
||||
<form wire:submit.prevent='submit'>
|
||||
<div class="flex gap-2 pb-4">
|
||||
@if ($application->human_name)
|
||||
<h2>{{ Str::headline($application->human_name) }}</h2>
|
||||
@else
|
||||
<h2>{{ Str::headline($application->name) }}</h2>
|
||||
@endif
|
||||
<x-forms.button type="submit">Save</x-forms.button>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input label="Name" id="application.human_name" placeholder="Name"></x-forms.input>
|
||||
<x-forms.input label="FQDN" required id="application.fqdn"></x-forms.input>
|
||||
</div>
|
||||
</form>
|
13
resources/views/livewire/project/service/database.blade.php
Normal file
13
resources/views/livewire/project/service/database.blade.php
Normal file
@ -0,0 +1,13 @@
|
||||
<form wire:submit.prevent='submit'>
|
||||
<div class="flex gap-2 pb-4">
|
||||
@if ($database->human_name)
|
||||
<h2>{{ Str::headline($database->human_name) }}</h2>
|
||||
@else
|
||||
<h2>{{ Str::headline($database->name) }}</h2>
|
||||
@endif
|
||||
<x-forms.button type="submit">Save</x-forms.button>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<x-forms.input label="Name" id="database.human_name" placeholder="Name"></x-forms.input>
|
||||
</div>
|
||||
</form>
|
@ -1,25 +1,79 @@
|
||||
<div x-init="$wire.check_status">
|
||||
<livewire:project.service.modal />
|
||||
<h1>Configuration</h1>
|
||||
<x-resources.breadcrumbs :resource="$service" :parameters="$parameters" />
|
||||
<x-services.navbar :service="$service" :parameters="$parameters" />
|
||||
<h3>Applications</h3>
|
||||
@foreach ($service->applications as $application)
|
||||
<form class="box" wire:submit.prevent='submit'>
|
||||
<p>{{ $application->name }}</p>
|
||||
<x-forms.input id="services.{{ $application->name }}.fqdn"></x-forms.input>
|
||||
<x-forms.button type="submit">Save</x-forms.button>
|
||||
</form>
|
||||
@endforeach
|
||||
@if ($service->databases->count() > 0)
|
||||
<h3>Databases</h3>
|
||||
@endif
|
||||
@foreach ($service->databases as $database)
|
||||
<p>{{ $database->name }}</p>
|
||||
<p>{{ $database->status }}</p>
|
||||
@endforeach
|
||||
<h3>Variables</h3>
|
||||
@foreach ($service->environment_variables as $variable)
|
||||
<p>{{ $variable->key }}={{ $variable->value }}</p>
|
||||
@endforeach
|
||||
</div>
|
||||
<div x-data="{ raw: true, activeTab: window.location.hash ? window.location.hash.substring(1) : 'service-stack' }">
|
||||
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
||||
<div class="flex h-full pt-6">
|
||||
<div class="flex flex-col gap-4 min-w-fit">
|
||||
<a :class="activeTab === 'service-stack' && 'text-white'"
|
||||
@click.prevent="activeTab = 'service-stack'; window.location.hash = 'service-stack'" href="#">Service Stack</a>
|
||||
<a :class="activeTab === 'compose' && 'text-white'"
|
||||
@click.prevent="activeTab = 'compose'; window.location.hash = 'compose'" href="#">Compose File</a>
|
||||
<a :class="activeTab === 'environment-variables' && 'text-white'"
|
||||
@click.prevent="activeTab = 'environment-variables'; window.location.hash = 'environment-variables'"
|
||||
href="#">Environment
|
||||
Variables</a>
|
||||
<a :class="activeTab === 'danger' && 'text-white'"
|
||||
@click.prevent="activeTab = 'danger'; window.location.hash = 'danger'" href="#">Danger Zone
|
||||
</a>
|
||||
</div>
|
||||
<div class="w-full pl-8">
|
||||
<div x-cloak x-show="activeTab === 'service-stack'">
|
||||
<h2 class="pb-4"> Service Stack </h2>
|
||||
<div class="grid grid-cols-1 gap-2">
|
||||
@foreach ($service->applications as $application)
|
||||
<a class="flex flex-col justify-center box"
|
||||
href="{{ route('project.service.show', [...$parameters, 'service_name' => $application->name]) }}">
|
||||
@if ($application->human_name)
|
||||
{{ Str::headline($application->human_name) }}
|
||||
@else
|
||||
{{ Str::headline($application->name) }}
|
||||
@endif
|
||||
@if ($application->fqdn)
|
||||
<span class="text-xs">{{ $application->fqdn }}</span>
|
||||
@endif
|
||||
</a>
|
||||
@endforeach
|
||||
@foreach ($service->databases as $database)
|
||||
<a class="justify-center box"
|
||||
href="{{ route('project.service.show', [...$parameters, 'service_name' => $database->name]) }}">
|
||||
@if ($database->human_name)
|
||||
{{ Str::headline($database->human_name) }}
|
||||
@else
|
||||
{{ Str::headline($database->name) }}
|
||||
@endif
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div x-cloak x-show="activeTab === 'compose'">
|
||||
<div x-cloak x-show="activeTab === 'compose'">
|
||||
<div class="flex gap-2 pb-4">
|
||||
<h2>Docker Compose</h2>
|
||||
<div x-cloak x-show="raw">
|
||||
<x-forms.button class="w-64" @click.prevent="raw = !raw">Show Deployable</x-forms.button>
|
||||
<x-forms.button wire:click='save'>Save</x-forms.button>
|
||||
</div>
|
||||
<div x-cloak x-show="raw === false">
|
||||
<x-forms.button class="w-64" @click.prevent="raw = !raw">Show Source</x-forms.button>
|
||||
<x-forms.button disabled wire:click='save'>Save</x-forms.button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div x-cloak x-show="raw">
|
||||
<x-forms.textarea rows="20" id="service.docker_compose_raw">
|
||||
</x-forms.textarea>
|
||||
</div>
|
||||
<div x-cloak x-show="raw === false">
|
||||
<x-forms.textarea readonly rows="20" id="service.docker_compose">
|
||||
</x-forms.textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div x-cloak x-show="activeTab === 'environment-variables'">
|
||||
<div x-cloak x-show="activeTab === 'environment-variables'">
|
||||
<livewire:project.shared.environment-variable.all :resource="$service" />
|
||||
</div>
|
||||
</div>
|
||||
<div x-cloak x-show="activeTab === 'danger'">
|
||||
<livewire:project.shared.danger :resource="$service" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -0,0 +1,6 @@
|
||||
<div x-init="$wire.check_status">
|
||||
<livewire:project.service.modal />
|
||||
<h1>Configuration</h1>
|
||||
<x-resources.breadcrumbs :resource="$service" :parameters="$parameters" />
|
||||
<x-services.navbar :service="$service" :parameters="$parameters" />
|
||||
</div>
|
30
resources/views/livewire/project/service/show.blade.php
Normal file
30
resources/views/livewire/project/service/show.blade.php
Normal file
@ -0,0 +1,30 @@
|
||||
<div x-data="{ activeTab: window.location.hash ? window.location.hash.substring(1) : 'general' }">
|
||||
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
||||
<div class="flex h-full pt-6">
|
||||
<div class="flex flex-col gap-4 min-w-fit">
|
||||
<a :class="activeTab === 'general' && 'text-white'"
|
||||
@click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a>
|
||||
<a :class="activeTab === 'storages' && 'text-white'"
|
||||
@click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storages
|
||||
</a>
|
||||
</div>
|
||||
<div class="w-full pl-8">
|
||||
@isset($serviceApplication)
|
||||
<div x-cloak x-show="activeTab === 'general'" class="h-full">
|
||||
<livewire:project.service.application :application="$serviceApplication" />
|
||||
</div>
|
||||
<div x-cloak x-show="activeTab === 'storages'">
|
||||
<livewire:project.shared.storages.all :resource="$serviceApplication" />
|
||||
</div>
|
||||
@endisset
|
||||
@isset($serviceDatabase)
|
||||
<div x-cloak x-show="activeTab === 'general'" class="h-full">
|
||||
<livewire:project.service.database :database="$serviceDatabase" />
|
||||
</div>
|
||||
<div x-cloak x-show="activeTab === 'storages'">
|
||||
<livewire:project.shared.storages.all :resource="$serviceDatabase" />
|
||||
</div>
|
||||
@endisset
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -12,7 +12,7 @@
|
||||
@if ($view === 'normal')
|
||||
@forelse ($resource->environment_variables as $env)
|
||||
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
|
||||
:env="$env" />
|
||||
:env="$env" :type="$resource->type()" />
|
||||
@empty
|
||||
<div class="text-neutral-500">No environment variables found.</div>
|
||||
@endforelse
|
||||
@ -23,12 +23,12 @@
|
||||
</div>
|
||||
@foreach ($resource->environment_variables_preview as $env)
|
||||
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
|
||||
:env="$env" />
|
||||
:env="$env" :type="$resource->type()" />
|
||||
@endforeach
|
||||
@endif
|
||||
@else
|
||||
<form wire:submit.prevent='saveVariables(false)' class="flex flex-col gap-2">
|
||||
<x-forms.textarea rows=5 class="whitespace-pre-wrap" label="Environment Variables"
|
||||
<x-forms.textarea rows=5 class="whitespace-pre-wrap"
|
||||
id="variables"></x-forms.textarea>
|
||||
<x-forms.button type="submit" class="btn btn-primary">Save</x-forms.button>
|
||||
</form>
|
||||
|
@ -8,7 +8,9 @@ class="font-bold text-warning">({{ $env->key }})</span>?</p>
|
||||
<form wire:submit.prevent='submit' class="flex flex-col items-center gap-2 xl:flex-row">
|
||||
<x-forms.input id="env.key" />
|
||||
<x-forms.input type="password" id="env.value" />
|
||||
<x-forms.checkbox instantSave id="env.is_build_time" label="Build Variable?" />
|
||||
@if ($type !== 'service')
|
||||
<x-forms.checkbox instantSave id="env.is_build_time" label="Build Variable?" />
|
||||
@endif
|
||||
<div class="flex gap-2">
|
||||
<x-forms.button type="submit">
|
||||
Update
|
||||
|
@ -2,18 +2,25 @@
|
||||
<div>
|
||||
<div class="flex items-center gap-2">
|
||||
<h2>Storages</h2>
|
||||
<x-helper
|
||||
helper="For Preview Deployments, storage has a <span class='text-helper'>-pr-#PRNumber</span> in their
|
||||
@if ($resource->type() !== 'service')
|
||||
<x-helper
|
||||
helper="For Preview Deployments, storage has a <span class='text-helper'>-pr-#PRNumber</span> in their
|
||||
volume
|
||||
name, example: <span class='text-helper'>-pr-1</span>" />
|
||||
<x-forms.button class="btn" onclick="newStorage.showModal()">+ Add</x-forms.button>
|
||||
<livewire:project.shared.storages.add />
|
||||
<x-forms.button class="btn" onclick="newStorage.showModal()">+ Add</x-forms.button>
|
||||
<livewire:project.shared.storages.add />
|
||||
@endif
|
||||
</div>
|
||||
<div>Persistent storage to preserve data between deployments.</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 py-4">
|
||||
@forelse ($resource->persistentStorages as $storage)
|
||||
<livewire:project.shared.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" />
|
||||
@if ($resource->type() === 'service')
|
||||
<livewire:project.shared.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage"
|
||||
isReadOnly='true' />
|
||||
@else
|
||||
<livewire:project.shared.storages.show wire:key="storage-{{ $storage->id }}" :storage="$storage" />
|
||||
@endif
|
||||
@empty
|
||||
<div class="text-neutral-500">No storages found.</div>
|
||||
@endforelse
|
||||
|
@ -6,8 +6,11 @@
|
||||
reversible. <br>Please think again.</p>
|
||||
</x-slot:modalBody>
|
||||
</x-modal>
|
||||
<form wire:submit.prevent='submit' class="flex flex-col gap-2 xl:items-end xl:flex-row">
|
||||
@if ($storage->is_readonly)
|
||||
@if ($isReadOnly)
|
||||
<span class="text-warning">Please modify storage layout in your Compose file.</span>
|
||||
@endif
|
||||
<form wire:submit.prevent='submit' class="flex flex-col gap-2 pt-4 xl:items-end xl:flex-row">
|
||||
@if ($isReadOnly)
|
||||
<x-forms.input id="storage.name" label="Name" required readonly />
|
||||
<x-forms.input id="storage.host_path" label="Source Path" readonly />
|
||||
<x-forms.input id="storage.mount_path" label="Destination Path" required readonly />
|
||||
@ -15,7 +18,7 @@
|
||||
<x-forms.button type="submit" disabled>
|
||||
Update
|
||||
</x-forms.button>
|
||||
<x-forms.button isError isModal modalId="{{ $modalId }}" disabled>
|
||||
<x-forms.button isError isModal modalId="{{ $modalId }}">
|
||||
Delete
|
||||
</x-forms.button>
|
||||
</div>
|
||||
|
@ -8,6 +8,7 @@
|
||||
use App\Http\Controllers\ServerController;
|
||||
use App\Http\Livewire\Boarding\Index as BoardingIndex;
|
||||
use App\Http\Livewire\Project\Service\Index as ServiceIndex;
|
||||
use App\Http\Livewire\Project\Service\Show as ServiceShow;
|
||||
use App\Http\Livewire\Dashboard;
|
||||
use App\Http\Livewire\Server\All;
|
||||
use App\Http\Livewire\Server\Show;
|
||||
@ -86,6 +87,7 @@
|
||||
|
||||
// Services
|
||||
Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}', ServiceIndex::class)->name('project.service');
|
||||
Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}/{service_name}', ServiceShow::class)->name('project.service.show');
|
||||
});
|
||||
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
|
Loading…
Reference in New Issue
Block a user