ui ui ui ui ui ui ux ux ux ux ux ux
This commit is contained in:
@@ -42,19 +42,21 @@ class BackupEdit extends Component
|
||||
|
||||
public function delete()
|
||||
{
|
||||
// TODO: Delete backup from server and add a confirmation modal
|
||||
$this->backup->delete();
|
||||
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
$previousUrl = url()->previous();
|
||||
$url = Url::fromString($previousUrl);
|
||||
$url = $url->withoutQueryParameter('selectedBackupId');
|
||||
$url = $url->withFragment('backups');
|
||||
$url = $url->getPath() . "#{$url->getFragment()}";
|
||||
return redirect($url);
|
||||
} else {
|
||||
return redirect()->route('project.database.backup.index', $this->parameters);
|
||||
try {
|
||||
$this->backup->delete();
|
||||
if ($this->backup->database->getMorphClass() === 'App\Models\ServiceDatabase') {
|
||||
$previousUrl = url()->previous();
|
||||
$url = Url::fromString($previousUrl);
|
||||
$url = $url->withoutQueryParameter('selectedBackupId');
|
||||
$url = $url->withFragment('backups');
|
||||
$url = $url->getPath() . "#{$url->getFragment()}";
|
||||
return redirect($url);
|
||||
} else {
|
||||
return redirect()->route('project.database.backup.index', $this->parameters);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
@@ -63,7 +65,7 @@ class BackupEdit extends Component
|
||||
$this->custom_validate();
|
||||
$this->backup->save();
|
||||
$this->backup->refresh();
|
||||
$this->dispatch('success', 'Backup updated successfully');
|
||||
$this->dispatch('success', 'Backup updated successfully.');
|
||||
} catch (\Throwable $e) {
|
||||
$this->dispatch('error', $e->getMessage());
|
||||
}
|
||||
|
||||
@@ -34,7 +34,12 @@ class Database extends Component
|
||||
}
|
||||
$this->refreshFileStorages();
|
||||
}
|
||||
public function instantSaveAdvanced()
|
||||
public function instantSaveExclude()
|
||||
{
|
||||
$this->submit();
|
||||
|
||||
}
|
||||
public function instantSaveLogDrain()
|
||||
{
|
||||
if (!$this->database->service->destination->server->isLogDrainEnabled()) {
|
||||
$this->database->is_log_drain_enabled = false;
|
||||
@@ -74,6 +79,7 @@ class Database extends Component
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
ray('asdf');
|
||||
$this->validate();
|
||||
$this->database->save();
|
||||
updateCompose($this->database);
|
||||
|
||||
28
app/Livewire/Project/Service/EditCompose.php
Normal file
28
app/Livewire/Project/Service/EditCompose.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Project\Service;
|
||||
|
||||
use App\Models\Service;
|
||||
use Livewire\Component;
|
||||
|
||||
class EditCompose extends Component
|
||||
{
|
||||
public Service $service;
|
||||
public $serviceId;
|
||||
protected $rules = [
|
||||
'service.docker_compose_raw' => 'required',
|
||||
'service.docker_compose' => 'required',
|
||||
];
|
||||
public function mount() {
|
||||
$this->service = Service::find($this->serviceId);
|
||||
}
|
||||
|
||||
public function saveEditedCompose() {
|
||||
$this->dispatch('warning', "Saving new docker compose...");
|
||||
$this->dispatch('saveCompose', $this->service->docker_compose_raw);
|
||||
}
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.edit-compose');
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Project\Service;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class Modal extends Component
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.service.modal');
|
||||
}
|
||||
}
|
||||
@@ -16,17 +16,24 @@ class Navbar extends Component
|
||||
public array $parameters;
|
||||
public array $query;
|
||||
public $isDeploymentProgress = false;
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
$userId = auth()->user()->id;
|
||||
return [
|
||||
"echo-private:user.{$userId},ServiceStatusChanged" => 'serviceStarted',
|
||||
"serviceStatusChanged"
|
||||
];
|
||||
}
|
||||
public function serviceStarted() {
|
||||
$this->dispatch('success', 'Service started.');
|
||||
}
|
||||
public function serviceStatusChanged()
|
||||
{
|
||||
$this->dispatch('refresh')->self();
|
||||
}
|
||||
public function check_status() {
|
||||
public function check_status()
|
||||
{
|
||||
$this->dispatch('check_status');
|
||||
$this->dispatch('success', 'Service status updated.');
|
||||
}
|
||||
@@ -44,7 +51,7 @@ class Navbar extends Component
|
||||
$this->isDeploymentProgress = false;
|
||||
}
|
||||
}
|
||||
public function deploy()
|
||||
public function start()
|
||||
{
|
||||
$this->checkDeployments();
|
||||
if ($this->isDeploymentProgress) {
|
||||
@@ -73,9 +80,9 @@ class Navbar extends Component
|
||||
return;
|
||||
}
|
||||
PullImage::run($this->service);
|
||||
$this->dispatch('image-pulled');
|
||||
StopService::run($this->service);
|
||||
$this->service->parse();
|
||||
$this->dispatch('imagePulled');
|
||||
$activity = StartService::run($this->service);
|
||||
$this->dispatch('activityMonitor', $activity->id);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace App\Livewire\Project\Service;
|
||||
|
||||
use App\Models\Service;
|
||||
use Livewire\Component;
|
||||
|
||||
class StackForm extends Component
|
||||
{
|
||||
public $service;
|
||||
public Service $service;
|
||||
public $fields = [];
|
||||
protected $listeners = ["saveCompose"];
|
||||
public $rules = [
|
||||
|
||||
Reference in New Issue
Block a user