Revert "rector: arrrrr"

This reverts commit 16c0cd10d8.
This commit is contained in:
Andras Bacsai
2025-01-07 15:31:43 +01:00
parent da07b4fdcf
commit 1fe4dd722b
349 changed files with 3689 additions and 4184 deletions

View File

@@ -4,7 +4,6 @@ namespace App\Livewire\Project\Service;
use App\Actions\Docker\GetContainersStatus;
use App\Models\Service;
use Exception;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
@@ -72,11 +71,9 @@ class Configuration extends Component
$application->restart();
$this->dispatch('success', 'Service application restarted successfully.');
}
} catch (Exception $e) {
} catch (\Exception $e) {
return handleError($e, $this);
}
return null;
}
public function restartDatabase($id)
@@ -87,11 +84,9 @@ class Configuration extends Component
$database->restart();
$this->dispatch('success', 'Service database restarted successfully.');
}
} catch (Exception $e) {
} catch (\Exception $e) {
return handleError($e, $this);
}
return null;
}
public function check_status()
@@ -105,10 +100,8 @@ class Configuration extends Component
$database->refresh();
});
$this->dispatch('$refresh');
} catch (Exception $e) {
} catch (\Exception $e) {
return handleError($e, $this);
}
return null;
}
}

View File

@@ -6,7 +6,6 @@ use App\Actions\Database\StartDatabaseProxy;
use App\Actions\Database\StopDatabaseProxy;
use App\Models\ServiceDatabase;
use Livewire\Component;
use Throwable;
class Database extends Component
{
@@ -96,7 +95,7 @@ class Database extends Component
$this->database->save();
updateCompose($this->database);
$this->dispatch('success', 'Database saved.');
} catch (Throwable) {
} catch (\Throwable) {
} finally {
$this->dispatch('generateDockerCompose');
}

View File

@@ -31,12 +31,12 @@ class EditCompose extends Component
public function refreshEnvs()
{
$this->service = Service::query()->find($this->serviceId);
$this->service = Service::find($this->serviceId);
}
public function mount()
{
$this->service = Service::query()->find($this->serviceId);
$this->service = Service::find($this->serviceId);
}
public function saveEditedCompose()

View File

@@ -5,7 +5,6 @@ namespace App\Livewire\Project\Service;
use App\Models\ServiceApplication;
use Livewire\Component;
use Spatie\Url\Url;
use Throwable;
class EditDomain extends Component
{
@@ -20,7 +19,7 @@ class EditDomain extends Component
public function mount()
{
$this->application = ServiceApplication::query()->find($this->applicationId);
$this->application = ServiceApplication::find($this->applicationId);
}
public function submit()
@@ -44,13 +43,13 @@ class EditDomain extends Component
updateCompose($this->application);
if (str($this->application->fqdn)->contains(',')) {
$this->dispatch('warning', 'Some services do not support multiple domains, which can lead to problems and is NOT RECOMMENDED.<br><br>Only use multiple domains if you know what you are doing.');
} elseif (! $warning) {
$this->dispatch('success', 'Service saved.');
} else {
! $warning && $this->dispatch('success', 'Service saved.');
}
$this->application->service->parse();
$this->dispatch('refresh');
$this->dispatch('configurationChanged');
} catch (Throwable $e) {
} catch (\Throwable $e) {
$originalFqdn = $this->application->getOriginal('fqdn');
if ($originalFqdn !== $this->application->fqdn) {
$this->application->fqdn = $originalFqdn;
@@ -58,8 +57,6 @@ class EditDomain extends Component
return handleError($e, $this);
}
return null;
}
public function render()

View File

@@ -18,7 +18,6 @@ use App\Models\StandaloneRedis;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Livewire\Component;
use Throwable;
class FileStorage extends Component
{
@@ -62,13 +61,11 @@ class FileStorage extends Component
$this->fileStorage->is_based_on_git = false;
$this->fileStorage->save();
$this->fileStorage->saveStorageOnServer();
} catch (Throwable $e) {
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->dispatch('refreshStorages');
}
return null;
}
public function convertToFile()
@@ -82,21 +79,21 @@ class FileStorage extends Component
}
$this->fileStorage->save();
$this->fileStorage->saveStorageOnServer();
} catch (Throwable $e) {
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->dispatch('refreshStorages');
}
return null;
}
public function delete($password)
{
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation') && ! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
return null;
return;
}
}
try {
@@ -110,13 +107,11 @@ class FileStorage extends Component
}
$this->fileStorage->delete();
$this->dispatch('success', $message);
} catch (Throwable $e) {
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->dispatch('refreshStorages');
}
return null;
}
public function submit()
@@ -130,14 +125,12 @@ class FileStorage extends Component
$this->fileStorage->save();
$this->fileStorage->saveStorageOnServer();
$this->dispatch('success', 'File updated.');
} catch (Throwable $e) {
} catch (\Throwable $e) {
$this->fileStorage->setRawAttributes($original);
$this->fileStorage->save();
return handleError($e, $this);
}
return null;
}
public function instantSave()

View File

@@ -7,7 +7,6 @@ use App\Models\ServiceApplication;
use App\Models\ServiceDatabase;
use Illuminate\Support\Collection;
use Livewire\Component;
use Throwable;
class Index extends Component
{
@@ -46,11 +45,9 @@ class Index extends Component
$this->serviceDatabase->getFilesFromServer();
}
$this->s3s = currentTeam()->s3s;
} catch (Throwable $e) {
} catch (\Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function generateDockerCompose()

View File

@@ -10,7 +10,6 @@ use App\Models\Service;
use Illuminate\Support\Facades\Auth;
use Livewire\Component;
use Spatie\Activitylog\Models\Activity;
use Throwable;
class Navbar extends Component
{
@@ -71,10 +70,14 @@ class Navbar extends Component
try {
// TODO: This is a temporary solution. We need to refactor this.
// We need to delete null bytes somehow.
$activity = Activity::query()->where('properties->type_uuid', $this->service->uuid)->latest()->first();
$activity = Activity::where('properties->type_uuid', $this->service->uuid)->latest()->first();
$status = data_get($activity, 'properties.status');
$this->isDeploymentProgress = $status === 'queued' || $status === 'in_progress';
} catch (Throwable) {
if ($status === 'queued' || $status === 'in_progress') {
$this->isDeploymentProgress = true;
} else {
$this->isDeploymentProgress = false;
}
} catch (\Throwable) {
$this->isDeploymentProgress = false;
}
}

View File

@@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Livewire\Component;
use Spatie\Url\Url;
use Throwable;
class ServiceApplicationView extends Component
{
@@ -51,10 +50,12 @@ class ServiceApplicationView extends Component
public function delete($password)
{
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation') && ! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
if (! Hash::check($password, Auth::user()->password)) {
$this->addError('password', 'The provided password is incorrect.');
return null;
return;
}
}
try {
@@ -62,7 +63,7 @@ class ServiceApplicationView extends Component
$this->dispatch('success', 'Application deleted.');
return redirect()->route('project.service.configuration', $this->parameters);
} catch (Throwable $e) {
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
@@ -93,11 +94,11 @@ class ServiceApplicationView extends Component
updateCompose($this->application);
if (str($this->application->fqdn)->contains(',')) {
$this->dispatch('warning', 'Some services do not support multiple domains, which can lead to problems and is NOT RECOMMENDED.<br><br>Only use multiple domains if you know what you are doing.');
} elseif (! $warning) {
$this->dispatch('success', 'Service saved.');
} else {
! $warning && $this->dispatch('success', 'Service saved.');
}
$this->dispatch('generateDockerCompose');
} catch (Throwable $e) {
} catch (\Throwable $e) {
$originalFqdn = $this->application->getOriginal('fqdn');
if ($originalFqdn !== $this->application->fqdn) {
$this->application->fqdn = $originalFqdn;
@@ -105,8 +106,6 @@ class ServiceApplicationView extends Component
return handleError($e, $this);
}
return null;
}
public function render()

View File

@@ -3,10 +3,8 @@
namespace App\Livewire\Project\Service;
use App\Models\Service;
use Exception;
use Illuminate\Support\Collection;
use Livewire\Component;
use Throwable;
class StackForm extends Component
{
@@ -80,7 +78,7 @@ class StackForm extends Component
$this->validate();
$isValid = validateComposeFile($this->service->docker_compose_raw, $this->service->server->id);
if ($isValid !== 'OK') {
throw new Exception("Invalid docker-compose file.\n$isValid");
throw new \Exception("Invalid docker-compose file.\n$isValid");
}
$this->service->save();
$this->service->saveExtraFields($this->fields);
@@ -89,7 +87,7 @@ class StackForm extends Component
$this->service->saveComposeConfigs();
$this->dispatch('refreshEnvs');
$notify && $this->dispatch('success', 'Service saved.');
} catch (Throwable $e) {
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
if (is_null($this->service->config_hash)) {
@@ -98,8 +96,6 @@ class StackForm extends Component
$this->dispatch('configurationChanged');
}
}
return null;
}
public function render()

View File

@@ -4,7 +4,6 @@ namespace App\Livewire\Project\Service;
use App\Models\LocalPersistentVolume;
use Livewire\Component;
use Throwable;
class Storage extends Component
{
@@ -43,7 +42,7 @@ class Storage extends Component
public function addNewVolume($data)
{
try {
LocalPersistentVolume::query()->create([
LocalPersistentVolume::create([
'name' => $data['name'],
'mount_path' => $data['mount_path'],
'host_path' => $data['host_path'],
@@ -54,11 +53,9 @@ class Storage extends Component
$this->dispatch('success', 'Storage added successfully');
$this->dispatch('clearAddStorage');
$this->dispatch('refreshStorages');
} catch (Throwable $e) {
} catch (\Throwable $e) {
return handleError($e, $this);
}
return null;
}
public function render()