Fix styling
This commit is contained in:
committed by
github-actions[bot]
parent
41fb6a1fc9
commit
d86274cc37
@@ -9,34 +9,43 @@ use Livewire\Component;
|
||||
class Configuration extends Component
|
||||
{
|
||||
public ?Service $service = null;
|
||||
|
||||
public $applications;
|
||||
|
||||
public $databases;
|
||||
|
||||
public array $parameters;
|
||||
|
||||
public array $query;
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
$userId = auth()->user()->id;
|
||||
|
||||
return [
|
||||
"echo-private:user.{$userId},ServiceStatusChanged" => 'check_status',
|
||||
"check_status",
|
||||
"refresh" => '$refresh',
|
||||
'check_status',
|
||||
'refresh' => '$refresh',
|
||||
];
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.configuration');
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->parameters = get_route_parameters();
|
||||
$this->query = request()->query();
|
||||
$this->service = Service::whereUuid($this->parameters['service_uuid'])->first();
|
||||
if (!$this->service) {
|
||||
if (! $this->service) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$this->applications = $this->service->applications->sort();
|
||||
$this->databases = $this->service->databases->sort();
|
||||
}
|
||||
|
||||
public function restartApplication($id)
|
||||
{
|
||||
try {
|
||||
@@ -49,6 +58,7 @@ class Configuration extends Component
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function restartDatabase($id)
|
||||
{
|
||||
try {
|
||||
@@ -61,6 +71,7 @@ class Configuration extends Component
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function check_status()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -10,10 +10,13 @@ use Livewire\Component;
|
||||
class Database extends Component
|
||||
{
|
||||
public ServiceDatabase $database;
|
||||
|
||||
public ?string $db_url_public = null;
|
||||
|
||||
public $fileStorages;
|
||||
|
||||
protected $listeners = ["refreshFileStorages"];
|
||||
protected $listeners = ['refreshFileStorages'];
|
||||
|
||||
protected $rules = [
|
||||
'database.human_name' => 'nullable',
|
||||
'database.description' => 'nullable',
|
||||
@@ -23,10 +26,12 @@ class Database extends Component
|
||||
'database.is_public' => 'required|boolean',
|
||||
'database.is_log_drain_enabled' => 'required|boolean',
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.database');
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if ($this->database->is_public) {
|
||||
@@ -34,31 +39,37 @@ class Database extends Component
|
||||
}
|
||||
$this->refreshFileStorages();
|
||||
}
|
||||
|
||||
public function instantSaveExclude()
|
||||
{
|
||||
$this->submit();
|
||||
}
|
||||
|
||||
public function instantSaveLogDrain()
|
||||
{
|
||||
if (!$this->database->service->destination->server->isLogDrainEnabled()) {
|
||||
if (! $this->database->service->destination->server->isLogDrainEnabled()) {
|
||||
$this->database->is_log_drain_enabled = false;
|
||||
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
|
||||
|
||||
return;
|
||||
}
|
||||
$this->submit();
|
||||
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
if ($this->database->is_public && !$this->database->public_port) {
|
||||
if ($this->database->is_public && ! $this->database->public_port) {
|
||||
$this->dispatch('error', 'Public port is required.');
|
||||
$this->database->is_public = false;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($this->database->is_public) {
|
||||
if (!str($this->database->status)->startsWith('running')) {
|
||||
if (! str($this->database->status)->startsWith('running')) {
|
||||
$this->dispatch('error', 'Database must be started to be publicly accessible.');
|
||||
$this->database->is_public = false;
|
||||
|
||||
return;
|
||||
}
|
||||
StartDatabaseProxy::run($this->database);
|
||||
@@ -71,10 +82,12 @@ class Database extends Component
|
||||
}
|
||||
$this->submit();
|
||||
}
|
||||
|
||||
public function refreshFileStorages()
|
||||
{
|
||||
$this->fileStorages = $this->database->fileStorages()->get();
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -8,12 +8,15 @@ use Livewire\Component;
|
||||
class EditCompose extends Component
|
||||
{
|
||||
public Service $service;
|
||||
|
||||
public $serviceId;
|
||||
|
||||
protected $rules = [
|
||||
'service.docker_compose_raw' => 'required',
|
||||
'service.docker_compose' => 'required',
|
||||
'service.is_container_label_escape_enabled' => 'required',
|
||||
];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->service = Service::find($this->serviceId);
|
||||
@@ -21,17 +24,19 @@ class EditCompose extends Component
|
||||
|
||||
public function saveEditedCompose()
|
||||
{
|
||||
$this->dispatch('info', "Saving new docker compose...");
|
||||
$this->dispatch('info', 'Saving new docker compose...');
|
||||
$this->dispatch('saveCompose', $this->service->docker_compose_raw);
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
$this->validate([
|
||||
'service.is_container_label_escape_enabled' => 'required',
|
||||
]);
|
||||
$this->service->save(['is_container_label_escape_enabled' => $this->service->is_container_label_escape_enabled]);
|
||||
$this->dispatch('success', "Service updated successfully");
|
||||
$this->dispatch('success', 'Service updated successfully');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.edit-compose');
|
||||
|
||||
@@ -8,14 +8,19 @@ use Livewire\Component;
|
||||
class EditDomain extends Component
|
||||
{
|
||||
public $applicationId;
|
||||
|
||||
public ServiceApplication $application;
|
||||
|
||||
protected $rules = [
|
||||
'application.fqdn' => 'nullable',
|
||||
'application.required_fqdn' => 'required|boolean',
|
||||
];
|
||||
public function mount() {
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->application = ServiceApplication::find($this->applicationId);
|
||||
}
|
||||
|
||||
public function updatedApplicationFqdn()
|
||||
{
|
||||
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
|
||||
@@ -26,6 +31,7 @@ class EditDomain extends Component
|
||||
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
|
||||
$this->application->save();
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
@@ -46,6 +52,7 @@ class EditDomain extends Component
|
||||
$this->dispatch('configurationChanged');
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.edit-domain');
|
||||
|
||||
@@ -14,14 +14,17 @@ use App\Models\StandaloneMongodb;
|
||||
use App\Models\StandaloneMysql;
|
||||
use App\Models\StandalonePostgresql;
|
||||
use App\Models\StandaloneRedis;
|
||||
use Livewire\Component;
|
||||
use Illuminate\Support\Str;
|
||||
use Livewire\Component;
|
||||
|
||||
class FileStorage extends Component
|
||||
{
|
||||
public LocalFileVolume $fileStorage;
|
||||
|
||||
public ServiceApplication|StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|ServiceDatabase|Application $resource;
|
||||
|
||||
public string $fs_path;
|
||||
|
||||
public ?string $workdir = null;
|
||||
|
||||
protected $rules = [
|
||||
@@ -30,6 +33,7 @@ class FileStorage extends Component
|
||||
'fileStorage.mount_path' => 'required',
|
||||
'fileStorage.content' => 'nullable',
|
||||
];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->resource = $this->fileStorage->service;
|
||||
@@ -41,7 +45,9 @@ class FileStorage extends Component
|
||||
$this->fs_path = $this->fileStorage->fs_path;
|
||||
}
|
||||
}
|
||||
public function convertToDirectory() {
|
||||
|
||||
public function convertToDirectory()
|
||||
{
|
||||
try {
|
||||
$this->fileStorage->deleteStorageOnServer();
|
||||
$this->fileStorage->is_directory = true;
|
||||
@@ -54,7 +60,9 @@ class FileStorage extends Component
|
||||
$this->dispatch('refresh_storages');
|
||||
}
|
||||
}
|
||||
public function convertToFile() {
|
||||
|
||||
public function convertToFile()
|
||||
{
|
||||
try {
|
||||
$this->fileStorage->deleteStorageOnServer();
|
||||
$this->fileStorage->is_directory = false;
|
||||
@@ -67,7 +75,9 @@ class FileStorage extends Component
|
||||
$this->dispatch('refresh_storages');
|
||||
}
|
||||
}
|
||||
public function delete() {
|
||||
|
||||
public function delete()
|
||||
{
|
||||
try {
|
||||
$this->fileStorage->deleteStorageOnServer();
|
||||
$this->fileStorage->delete();
|
||||
@@ -78,6 +88,7 @@ class FileStorage extends Component
|
||||
$this->dispatch('refresh_storages');
|
||||
}
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
$original = $this->fileStorage->getOriginal();
|
||||
@@ -92,13 +103,16 @@ class FileStorage extends Component
|
||||
} catch (\Throwable $e) {
|
||||
$this->fileStorage->setRawAttributes($original);
|
||||
$this->fileStorage->save();
|
||||
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
$this->submit();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.file-storage');
|
||||
|
||||
@@ -11,11 +11,17 @@ use Livewire\Component;
|
||||
class Index extends Component
|
||||
{
|
||||
public ?Service $service = null;
|
||||
|
||||
public ?ServiceApplication $serviceApplication = null;
|
||||
|
||||
public ?ServiceDatabase $serviceDatabase = null;
|
||||
|
||||
public array $parameters;
|
||||
|
||||
public array $query;
|
||||
|
||||
public Collection $services;
|
||||
|
||||
public $s3s;
|
||||
|
||||
protected $listeners = ['generateDockerCompose'];
|
||||
@@ -27,7 +33,7 @@ class Index extends Component
|
||||
$this->parameters = get_route_parameters();
|
||||
$this->query = request()->query();
|
||||
$this->service = Service::whereUuid($this->parameters['service_uuid'])->first();
|
||||
if (!$this->service) {
|
||||
if (! $this->service) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$service = $this->service->applications()->whereUuid($this->parameters['stack_service_uuid'])->first();
|
||||
@@ -39,15 +45,17 @@ class Index extends Component
|
||||
$this->serviceDatabase->getFilesFromServer();
|
||||
}
|
||||
$this->s3s = currentTeam()->s3s;
|
||||
} catch(\Throwable $e) {
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function generateDockerCompose()
|
||||
{
|
||||
$this->service->parse();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.index');
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Livewire\Project\Service;
|
||||
|
||||
use App\Actions\Shared\PullImage;
|
||||
use App\Actions\Service\StartService;
|
||||
use App\Actions\Service\StopService;
|
||||
use App\Actions\Shared\PullImage;
|
||||
use App\Events\ServiceStatusChanged;
|
||||
use App\Models\Service;
|
||||
use Livewire\Component;
|
||||
@@ -13,8 +13,11 @@ use Spatie\Activitylog\Models\Activity;
|
||||
class Navbar extends Component
|
||||
{
|
||||
public Service $service;
|
||||
|
||||
public array $parameters;
|
||||
|
||||
public array $query;
|
||||
|
||||
public $isDeploymentProgress = false;
|
||||
|
||||
public function mount()
|
||||
@@ -25,13 +28,16 @@ class Navbar extends Component
|
||||
$this->dispatch('configurationChanged');
|
||||
}
|
||||
}
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
$userId = auth()->user()->id;
|
||||
|
||||
return [
|
||||
"echo-private:user.{$userId},ServiceStatusChanged" => 'serviceStarted',
|
||||
];
|
||||
}
|
||||
|
||||
public function serviceStarted()
|
||||
{
|
||||
$this->dispatch('success', 'Service status changed.');
|
||||
@@ -48,10 +54,12 @@ class Navbar extends Component
|
||||
$this->dispatch('check_status');
|
||||
$this->dispatch('success', 'Service status updated.');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.navbar');
|
||||
}
|
||||
|
||||
public function checkDeployments()
|
||||
{
|
||||
$activity = Activity::where('properties->type_uuid', $this->service->uuid)->latest()->first();
|
||||
@@ -62,17 +70,20 @@ class Navbar extends Component
|
||||
$this->isDeploymentProgress = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function start()
|
||||
{
|
||||
$this->checkDeployments();
|
||||
if ($this->isDeploymentProgress) {
|
||||
$this->dispatch('error', 'There is a deployment in progress.');
|
||||
|
||||
return;
|
||||
}
|
||||
$this->service->parse();
|
||||
$activity = StartService::run($this->service);
|
||||
$this->dispatch('activityMonitor', $activity->id);
|
||||
}
|
||||
|
||||
public function stop(bool $forceCleanup = false)
|
||||
{
|
||||
StopService::run($this->service);
|
||||
@@ -83,11 +94,13 @@ class Navbar extends Component
|
||||
}
|
||||
ServiceStatusChanged::dispatch();
|
||||
}
|
||||
|
||||
public function restart()
|
||||
{
|
||||
$this->checkDeployments();
|
||||
if ($this->isDeploymentProgress) {
|
||||
$this->dispatch('error', 'There is a deployment in progress.');
|
||||
|
||||
return;
|
||||
}
|
||||
PullImage::run($this->service);
|
||||
|
||||
@@ -8,7 +8,9 @@ use Livewire\Component;
|
||||
class ServiceApplicationView extends Component
|
||||
{
|
||||
public ServiceApplication $application;
|
||||
|
||||
public $parameters;
|
||||
|
||||
protected $rules = [
|
||||
'application.human_name' => 'nullable',
|
||||
'application.description' => 'nullable',
|
||||
@@ -20,10 +22,12 @@ class ServiceApplicationView extends Component
|
||||
'application.is_gzip_enabled' => 'nullable|boolean',
|
||||
'application.is_stripprefix_enabled' => 'nullable|boolean',
|
||||
];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.service-application-view');
|
||||
}
|
||||
|
||||
public function updatedApplicationFqdn()
|
||||
{
|
||||
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
|
||||
@@ -34,34 +38,41 @@ class ServiceApplicationView extends Component
|
||||
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
|
||||
$this->application->save();
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
$this->submit();
|
||||
}
|
||||
|
||||
public function instantSaveAdvanced()
|
||||
{
|
||||
if (!$this->application->service->destination->server->isLogDrainEnabled()) {
|
||||
if (! $this->application->service->destination->server->isLogDrainEnabled()) {
|
||||
$this->application->is_log_drain_enabled = false;
|
||||
$this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.');
|
||||
|
||||
return;
|
||||
}
|
||||
$this->application->save();
|
||||
$this->dispatch('success', 'You need to restart the service for the changes to take effect.');
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
try {
|
||||
$this->application->delete();
|
||||
$this->dispatch('success', 'Application deleted.');
|
||||
|
||||
return redirect()->route('project.service.configuration', $this->parameters);
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->parameters = get_route_parameters();
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -9,8 +9,11 @@ use Livewire\Component;
|
||||
class StackForm extends Component
|
||||
{
|
||||
public Service $service;
|
||||
|
||||
public Collection $fields;
|
||||
protected $listeners = ["saveCompose"];
|
||||
|
||||
protected $listeners = ['saveCompose'];
|
||||
|
||||
public $rules = [
|
||||
'service.docker_compose_raw' => 'required',
|
||||
'service.docker_compose' => 'required',
|
||||
@@ -18,7 +21,9 @@ class StackForm extends Component
|
||||
'service.description' => 'nullable',
|
||||
'service.connect_to_docker_network' => 'nullable',
|
||||
];
|
||||
|
||||
public $validationAttributes = [];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->fields = collect([]);
|
||||
@@ -30,12 +35,12 @@ class StackForm extends Component
|
||||
$rules = data_get($field, 'rules', 'nullable');
|
||||
$isPassword = data_get($field, 'isPassword');
|
||||
$this->fields->put($key, [
|
||||
"serviceName" => $serviceName,
|
||||
"key" => $key,
|
||||
"name" => $fieldKey,
|
||||
"value" => $value,
|
||||
"isPassword" => $isPassword,
|
||||
"rules" => $rules
|
||||
'serviceName' => $serviceName,
|
||||
'key' => $key,
|
||||
'name' => $fieldKey,
|
||||
'value' => $value,
|
||||
'isPassword' => $isPassword,
|
||||
'rules' => $rules,
|
||||
]);
|
||||
|
||||
$this->rules["fields.$key.value"] = $rules;
|
||||
@@ -44,11 +49,13 @@ class StackForm extends Component
|
||||
}
|
||||
$this->fields = $this->fields->sortBy('name');
|
||||
}
|
||||
|
||||
public function saveCompose($raw)
|
||||
{
|
||||
$this->service->docker_compose_raw = $raw;
|
||||
$this->submit();
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
$this->service->save();
|
||||
@@ -82,6 +89,7 @@ class StackForm extends Component
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.stack-form');
|
||||
|
||||
@@ -8,6 +8,7 @@ use Livewire\Component;
|
||||
class Storage extends Component
|
||||
{
|
||||
public $resource;
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
return [
|
||||
@@ -15,6 +16,7 @@ class Storage extends Component
|
||||
'refresh_storages' => '$refresh',
|
||||
];
|
||||
}
|
||||
|
||||
public function addNewVolume($data)
|
||||
{
|
||||
try {
|
||||
@@ -33,6 +35,7 @@ class Storage extends Component
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.storage');
|
||||
|
||||
Reference in New Issue
Block a user