diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php
index 6338d7625..fcc570f30 100644
--- a/app/Http/Controllers/Controller.php
+++ b/app/Http/Controllers/Controller.php
@@ -2,11 +2,13 @@
namespace App\Http\Controllers;
+use App\Events\TestEvent;
use App\Models\InstanceSettings;
use App\Models\S3Storage;
use App\Models\StandalonePostgresql;
use App\Models\TeamInvitation;
use App\Models\User;
+use App\Providers\RouteServiceProvider;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
@@ -14,11 +16,55 @@
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
+use Laravel\Fortify\Fortify;
+use Laravel\Fortify\Contracts\FailedPasswordResetLinkRequestResponse;
+use Laravel\Fortify\Contracts\SuccessfulPasswordResetLinkRequestResponse;
+use Illuminate\Support\Facades\Password;
class Controller extends BaseController
{
use AuthorizesRequests, ValidatesRequests;
+ public function realtime_test() {
+ if (auth()->user()?->currentTeam()->id !== 0) {
+ return redirect(RouteServiceProvider::HOME);
+ }
+ TestEvent::dispatch();
+ return 'Look at your other tab.';
+ }
+ public function verify() {
+ return view('auth.verify-email');
+ }
+ public function email_verify() {
+ request()->fulfill();
+ $name = request()->user()?->name;
+ send_internal_notification("User {$name} verified their email address.");
+ return redirect(RouteServiceProvider::HOME);
+ }
+ public function forgot_password() {
+ if (is_transactional_emails_active()) {
+ $arrayOfRequest = request()->only(Fortify::email());
+ request()->merge([
+ 'email' => Str::lower($arrayOfRequest['email']),
+ ]);
+ $type = set_transanctional_email_settings();
+ if (!$type) {
+ return response()->json(['message' => 'Transactional emails are not active'], 400);
+ }
+ request()->validate([Fortify::email() => 'required|email']);
+ $status = Password::broker(config('fortify.passwords'))->sendResetLink(
+ request()->only(Fortify::email())
+ );
+ if ($status == Password::RESET_LINK_SENT) {
+ return app(SuccessfulPasswordResetLinkRequestResponse::class, ['status' => $status]);
+ }
+ if ($status == Password::RESET_THROTTLED) {
+ return response('Already requested a password reset in the past minutes.', 400);
+ }
+ return app(FailedPasswordResetLinkRequestResponse::class, ['status' => $status]);
+ }
+ return response()->json(['message' => 'Transactional emails are not active'], 400);
+ }
public function link()
{
$token = request()->get('token');
@@ -51,90 +97,7 @@ public function link()
return redirect()->route('login')->with('error', 'Invalid credentials.');
}
- public function license()
- {
- if (!isCloud()) {
- abort(404);
- }
- return view('settings.license', [
- 'settings' => InstanceSettings::get(),
- ]);
- }
-
- public function force_passoword_reset()
- {
- return view('auth.force-password-reset');
- }
- public function boarding()
- {
- if (currentTeam()->boarding || isDev()) {
- return view('boarding');
- } else {
- return redirect()->route('dashboard');
- }
- }
-
- public function settings()
- {
- if (isInstanceAdmin()) {
- $settings = InstanceSettings::get();
- $database = StandalonePostgresql::whereName('coolify-db')->first();
- if ($database) {
- if ($database->status !== 'running') {
- $database->status = 'running';
- $database->save();
- }
- $s3s = S3Storage::whereTeamId(0)->get();
- }
- return view('settings.configuration', [
- 'settings' => $settings,
- 'database' => $database,
- 's3s' => $s3s ?? [],
- ]);
- } else {
- return redirect()->route('dashboard');
- }
- }
-
- public function team()
- {
- $invitations = [];
- if (auth()->user()->isAdminFromSession()) {
- $invitations = TeamInvitation::whereTeamId(currentTeam()->id)->get();
- }
- return view('team.index', [
- 'invitations' => $invitations,
- ]);
- }
-
- public function storages()
- {
- $s3 = S3Storage::ownedByCurrentTeam()->get();
- return view('team.storages.all', [
- 's3' => $s3,
- ]);
- }
-
- public function storages_show()
- {
- $storage = S3Storage::ownedByCurrentTeam()->whereUuid(request()->storage_uuid)->firstOrFail();
- return view('team.storages.show', [
- 'storage' => $storage,
- ]);
- }
-
- public function members()
- {
- $invitations = [];
- if (auth()->user()->isAdminFromSession()) {
- $invitations = TeamInvitation::whereTeamId(currentTeam()->id)->get();
- }
- return view('team.members', [
- 'invitations' => $invitations,
- ]);
- }
-
- public function acceptInvitation()
+ public function accept_invitation()
{
try {
$resetPassword = request()->query('reset-password');
@@ -169,7 +132,7 @@ public function acceptInvitation()
}
}
- public function revokeInvitation()
+ public function revoke_invitation()
{
try {
$invitation = TeamInvitation::whereUuid(request()->route('uuid'))->firstOrFail();
diff --git a/app/Http/Controllers/DatabaseController.php b/app/Http/Controllers/DatabaseController.php
deleted file mode 100644
index 684e427f9..000000000
--- a/app/Http/Controllers/DatabaseController.php
+++ /dev/null
@@ -1,84 +0,0 @@
-load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
- if (!$project) {
- return redirect()->route('dashboard');
- }
- $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
- if (!$environment) {
- return redirect()->route('dashboard');
- }
- $database = $environment->databases()->where('uuid', request()->route('database_uuid'))->first();
- if (!$database) {
- return redirect()->route('dashboard');
- }
- return view('project.database.configuration', ['database' => $database]);
- }
-
- public function executions()
- {
- $backup_uuid = request()->route('backup_uuid');
- $project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
- if (!$project) {
- return redirect()->route('dashboard');
- }
- $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
- if (!$environment) {
- return redirect()->route('dashboard');
- }
- $database = $environment->databases()->where('uuid', request()->route('database_uuid'))->first();
- if (!$database) {
- return redirect()->route('dashboard');
- }
- $backup = $database->scheduledBackups->where('uuid', $backup_uuid)->first();
- if (!$backup) {
- return redirect()->route('dashboard');
- }
- $executions = collect($backup->executions)->sortByDesc('created_at');
- return view('project.database.backups.executions', [
- 'database' => $database,
- 'backup' => $backup,
- 'executions' => $executions,
- 's3s' => currentTeam()->s3s,
- ]);
- }
-
- public function backups()
- {
- $project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
- if (!$project) {
- return redirect()->route('dashboard');
- }
- $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
- if (!$environment) {
- return redirect()->route('dashboard');
- }
- $database = $environment->databases()->where('uuid', request()->route('database_uuid'))->first();
- if (!$database) {
- return redirect()->route('dashboard');
- }
- // No backups for redis
- if ($database->getMorphClass() === 'App\Models\StandaloneRedis') {
- return redirect()->route('project.database.configuration', [
- 'project_uuid' => $project->uuid,
- 'environment_name' => $environment->name,
- 'database_uuid' => $database->uuid,
- ]);
- }
- return view('project.database.backups.all', [
- 'database' => $database,
- 's3s' => currentTeam()->s3s,
- ]);
- }
-}
diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php
index 16d0efa20..c28e266dd 100644
--- a/app/Jobs/ContainerStatusJob.php
+++ b/app/Jobs/ContainerStatusJob.php
@@ -162,6 +162,10 @@ public function handle()
// Notify user that this container should not be there.
}
}
+ if (data_get($container,'Name') === '/coolify-db') {
+ $foundDatabases[] = 0;
+ }
+
}
$serviceLabelId = data_get($labels, 'coolify.serviceId');
if ($serviceLabelId) {
@@ -212,7 +216,7 @@ public function handle()
}
$name = data_get($exitedService, 'name');
$fqdn = data_get($exitedService, 'fqdn');
- $containerName = $name ? "$name ($fqdn)" : $fqdn;
+ $containerName = $name ? "$name, available at $fqdn" : $fqdn;
$projectUuid = data_get($service, 'environment.project.uuid');
$serviceUuid = data_get($service, 'uuid');
$environmentName = data_get($service, 'environment.name');
diff --git a/app/Livewire/Boarding/Index.php b/app/Livewire/Boarding/Index.php
index 9c59f66ab..cc282d4c0 100644
--- a/app/Livewire/Boarding/Index.php
+++ b/app/Livewire/Boarding/Index.php
@@ -274,7 +274,7 @@ public function showNewResource()
{
$this->skipBoarding();
return redirect()->route(
- 'project.resources.new',
+ 'project.resource.create',
[
'project_uuid' => $this->createdProject->uuid,
'environment_name' => 'production',
diff --git a/app/Livewire/CommandCenter/Index.php b/app/Livewire/CommandCenter/Index.php
new file mode 100644
index 000000000..fd6bb7ed6
--- /dev/null
+++ b/app/Livewire/CommandCenter/Index.php
@@ -0,0 +1,18 @@
+servers = Server::isReachable()->get();
+ }
+ public function render()
+ {
+ return view('livewire.command-center.index');
+ }
+}
diff --git a/app/Livewire/ForcePasswordReset.php b/app/Livewire/ForcePasswordReset.php
index e5a9a079a..7bbec9d32 100644
--- a/app/Livewire/ForcePasswordReset.php
+++ b/app/Livewire/ForcePasswordReset.php
@@ -22,6 +22,10 @@ public function mount()
{
$this->email = auth()->user()->email;
}
+ public function render()
+ {
+ return view('livewire.force-password-reset')->layout('layouts.simple');
+ }
public function submit()
{
try {
diff --git a/app/Livewire/Profile/Form.php b/app/Livewire/Profile/Index.php
similarity index 85%
rename from app/Livewire/Profile/Form.php
rename to app/Livewire/Profile/Index.php
index 3d395bf8f..0a2a34766 100644
--- a/app/Livewire/Profile/Form.php
+++ b/app/Livewire/Profile/Index.php
@@ -5,21 +5,19 @@
use Livewire\Attributes\Validate;
use Livewire\Component;
-class Form extends Component
+class Index extends Component
{
public int $userId;
public string $email;
#[Validate('required')]
public string $name;
-
public function mount()
{
$this->userId = auth()->user()->id;
$this->name = auth()->user()->name;
$this->email = auth()->user()->email;
}
-
public function submit()
{
@@ -34,4 +32,8 @@ public function submit()
return handleError($e, $this);
}
}
+ public function render()
+ {
+ return view('livewire.profile.index');
+ }
}
diff --git a/app/Livewire/Project/AddEnvironment.php b/app/Livewire/Project/AddEnvironment.php
index be80c21e1..c28cafd16 100644
--- a/app/Livewire/Project/AddEnvironment.php
+++ b/app/Livewire/Project/AddEnvironment.php
@@ -27,7 +27,7 @@ public function submit()
'project_id' => $this->project->id,
]);
- return redirect()->route('project.resources', [
+ return redirect()->route('project.resource.index', [
'project_uuid' => $this->project->uuid,
'environment_name' => $environment->name,
]);
diff --git a/app/Livewire/Project/Application/Configuration.php b/app/Livewire/Project/Application/Configuration.php
index 691cbb7c4..1bf9e6c3b 100644
--- a/app/Livewire/Project/Application/Configuration.php
+++ b/app/Livewire/Project/Application/Configuration.php
@@ -4,7 +4,6 @@
use App\Models\Application;
use App\Models\Server;
-use App\Models\StandaloneDocker;
use Livewire\Component;
class Configuration extends Component
diff --git a/app/Livewire/Project/Application/Deployments.php b/app/Livewire/Project/Application/Deployment/Index.php
similarity index 56%
rename from app/Livewire/Project/Application/Deployments.php
rename to app/Livewire/Project/Application/Deployment/Index.php
index 241167a8f..9d07550f4 100644
--- a/app/Livewire/Project/Application/Deployments.php
+++ b/app/Livewire/Project/Application/Deployment/Index.php
@@ -1,15 +1,15 @@
load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ if (!$project) {
+ return redirect()->route('dashboard');
+ }
+ $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
+ if (!$environment) {
+ return redirect()->route('dashboard');
+ }
+ $application = $environment->applications->where('uuid', request()->route('application_uuid'))->first();
+ if (!$application) {
+ return redirect()->route('dashboard');
+ }
+ ['deployments' => $deployments, 'count' => $count] = $application->deployments(0, 40);
+ $this->application = $application;
+ $this->deployments = $deployments;
+ $this->deployments_count = $count;
$this->current_url = url()->current();
$this->show_pull_request_only();
$this->show_more();
}
- private function show_pull_request_only() {
+ private function show_pull_request_only()
+ {
if ($this->pull_request_id) {
$this->deployments = $this->deployments->where('pull_request_id', $this->pull_request_id);
}
@@ -57,4 +74,8 @@ public function load_deployments(int|null $take = null)
$this->show_pull_request_only();
$this->show_more();
}
+ public function render()
+ {
+ return view('livewire.project.application.deployment.index');
+ }
}
diff --git a/app/Http/Controllers/ApplicationController.php b/app/Livewire/Project/Application/Deployment/Show.php
similarity index 52%
rename from app/Http/Controllers/ApplicationController.php
rename to app/Livewire/Project/Application/Deployment/Show.php
index 12411d3fd..b83c3f3af 100644
--- a/app/Http/Controllers/ApplicationController.php
+++ b/app/Livewire/Project/Application/Deployment/Show.php
@@ -1,35 +1,20 @@
load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
- if (!$project) {
- return redirect()->route('dashboard');
- }
- $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
- if (!$environment) {
- return redirect()->route('dashboard');
- }
- $application = $environment->applications->where('uuid', request()->route('application_uuid'))->first();
- if (!$application) {
- return redirect()->route('dashboard');
- }
- ['deployments' => $deployments, 'count' => $count] = $application->deployments(0, 40);
- return view('project.application.deployments', ['application' => $application, 'deployments' => $deployments, 'deployments_count' => $count]);
- }
-
- public function deployment()
- {
+ public function mount() {
$deploymentUuid = request()->route('deployment_uuid');
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
@@ -46,7 +31,7 @@ public function deployment()
}
// $activity = Activity::where('properties->type_uuid', '=', $deploymentUuid)->first();
// if (!$activity) {
- // return redirect()->route('project.application.deployments', [
+ // return redirect()->route('project.application.deployment.index', [
// 'project_uuid' => $project->uuid,
// 'environment_name' => $environment->name,
// 'application_uuid' => $application->uuid,
@@ -54,17 +39,32 @@ public function deployment()
// }
$application_deployment_queue = ApplicationDeploymentQueue::where('deployment_uuid', $deploymentUuid)->first();
if (!$application_deployment_queue) {
- return redirect()->route('project.application.deployments', [
+ return redirect()->route('project.application.deployment.index', [
'project_uuid' => $project->uuid,
'environment_name' => $environment->name,
'application_uuid' => $application->uuid,
]);
}
- return view('project.application.deployment', [
- 'application' => $application,
- // 'activity' => $activity,
- 'application_deployment_queue' => $application_deployment_queue,
- 'deployment_uuid' => $deploymentUuid,
- ]);
+ $this->application = $application;
+ $this->application_deployment_queue = $application_deployment_queue;
+ $this->deployment_uuid = $deploymentUuid;
+ }
+
+ public function refreshQueue()
+ {
+ $this->application_deployment_queue->refresh();
+ }
+
+ public function polling()
+ {
+ $this->dispatch('deploymentFinished');
+ $this->application_deployment_queue->refresh();
+ if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') {
+ $this->isKeepAliveOn = false;
+ }
+ }
+ public function render()
+ {
+ return view('livewire.project.application.deployment.show');
}
}
diff --git a/app/Livewire/Project/Application/DeploymentLogs.php b/app/Livewire/Project/Application/DeploymentLogs.php
deleted file mode 100644
index d2d07035d..000000000
--- a/app/Livewire/Project/Application/DeploymentLogs.php
+++ /dev/null
@@ -1,27 +0,0 @@
-application_deployment_queue->refresh();
- }
-
- public function polling()
- {
- $this->dispatch('deploymentFinished');
- $this->application_deployment_queue->refresh();
- if (data_get($this->application_deployment_queue, 'status') == 'finished' || data_get($this->application_deployment_queue, 'status') == 'failed') {
- $this->isKeepAliveOn = false;
- }
- }
-}
diff --git a/app/Livewire/Project/Application/Heading.php b/app/Livewire/Project/Application/Heading.php
index f6bf4852b..170f1db6e 100644
--- a/app/Livewire/Project/Application/Heading.php
+++ b/app/Livewire/Project/Application/Heading.php
@@ -60,7 +60,7 @@ public function deployNew()
force_rebuild: false,
is_new_deployment: true,
);
- return redirect()->route('project.application.deployment', [
+ return redirect()->route('project.application.deployment.show', [
'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $this->deploymentUuid,
@@ -83,7 +83,7 @@ public function deploy(bool $force_rebuild = false)
deployment_uuid: $this->deploymentUuid,
force_rebuild: $force_rebuild,
);
- return redirect()->route('project.application.deployment', [
+ return redirect()->route('project.application.deployment.show', [
'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $this->deploymentUuid,
@@ -113,7 +113,7 @@ public function restartNew()
restart_only: true,
is_new_deployment: true,
);
- return redirect()->route('project.application.deployment', [
+ return redirect()->route('project.application.deployment.show', [
'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $this->deploymentUuid,
@@ -128,7 +128,7 @@ public function restart()
deployment_uuid: $this->deploymentUuid,
restart_only: true,
);
- return redirect()->route('project.application.deployment', [
+ return redirect()->route('project.application.deployment.show', [
'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $this->deploymentUuid,
diff --git a/app/Livewire/Project/Application/Previews.php b/app/Livewire/Project/Application/Previews.php
index 91a28c994..dffb9461c 100644
--- a/app/Livewire/Project/Application/Previews.php
+++ b/app/Livewire/Project/Application/Previews.php
@@ -52,7 +52,7 @@ public function deploy(int $pull_request_id, string|null $pull_request_html_url
force_rebuild: true,
pull_request_id: $pull_request_id,
);
- return redirect()->route('project.application.deployment', [
+ return redirect()->route('project.application.deployment.show', [
'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $this->deployment_uuid,
diff --git a/app/Livewire/Project/Application/Rollback.php b/app/Livewire/Project/Application/Rollback.php
index 64d83a5be..a26d5cd47 100644
--- a/app/Livewire/Project/Application/Rollback.php
+++ b/app/Livewire/Project/Application/Rollback.php
@@ -29,7 +29,7 @@ public function rollbackImage($commit)
commit: $commit,
force_rebuild: false,
);
- return redirect()->route('project.application.deployment', [
+ return redirect()->route('project.application.deployment.show', [
'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $deployment_uuid,
diff --git a/app/Livewire/Project/CloneProject.php b/app/Livewire/Project/CloneMe.php
similarity index 97%
rename from app/Livewire/Project/CloneProject.php
rename to app/Livewire/Project/CloneMe.php
index 2dea157a2..993c9516c 100644
--- a/app/Livewire/Project/CloneProject.php
+++ b/app/Livewire/Project/CloneMe.php
@@ -8,7 +8,7 @@
use Livewire\Component;
use Visus\Cuid2\Cuid2;
-class CloneProject extends Component
+class CloneMe extends Component
{
public string $project_uuid;
public string $environment_name;
@@ -41,7 +41,7 @@ public function mount($project_uuid)
public function render()
{
- return view('livewire.project.clone-project');
+ return view('livewire.project.clone-me');
}
public function selectServer($server_id, $destination_id)
@@ -152,7 +152,7 @@ public function clone()
}
$newService->parse();
}
- return redirect()->route('project.resources', [
+ return redirect()->route('project.resource.index', [
'project_uuid' => $newProject->uuid,
'environment_name' => $newEnvironment->name,
]);
diff --git a/app/Livewire/Project/Database/Backup/Execution.php b/app/Livewire/Project/Database/Backup/Execution.php
new file mode 100644
index 000000000..07f7db03c
--- /dev/null
+++ b/app/Livewire/Project/Database/Backup/Execution.php
@@ -0,0 +1,41 @@
+route('backup_uuid');
+ $project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ if (!$project) {
+ return redirect()->route('dashboard');
+ }
+ $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
+ if (!$environment) {
+ return redirect()->route('dashboard');
+ }
+ $database = $environment->databases()->where('uuid', request()->route('database_uuid'))->first();
+ if (!$database) {
+ return redirect()->route('dashboard');
+ }
+ $backup = $database->scheduledBackups->where('uuid', $backup_uuid)->first();
+ if (!$backup) {
+ return redirect()->route('dashboard');
+ }
+ $executions = collect($backup->executions)->sortByDesc('created_at');
+ $this->database = $database;
+ $this->backup = $backup;
+ $this->executions = $executions;
+ $this->s3s = currentTeam()->s3s;
+ }
+ public function render()
+ {
+ return view('livewire.project.database.backup.execution');
+ }
+}
diff --git a/app/Livewire/Project/Database/Backup/Index.php b/app/Livewire/Project/Database/Backup/Index.php
new file mode 100644
index 000000000..6211a0e47
--- /dev/null
+++ b/app/Livewire/Project/Database/Backup/Index.php
@@ -0,0 +1,39 @@
+load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ if (!$project) {
+ return redirect()->route('dashboard');
+ }
+ $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
+ if (!$environment) {
+ return redirect()->route('dashboard');
+ }
+ $database = $environment->databases()->where('uuid', request()->route('database_uuid'))->first();
+ if (!$database) {
+ return redirect()->route('dashboard');
+ }
+ // No backups for redis
+ if ($database->getMorphClass() === 'App\Models\StandaloneRedis') {
+ return redirect()->route('project.database.configuration', [
+ 'project_uuid' => $project->uuid,
+ 'environment_name' => $environment->name,
+ 'database_uuid' => $database->uuid,
+ ]);
+ }
+ $this->database = $database;
+ $this->s3s = currentTeam()->s3s;
+ }
+ public function render()
+ {
+ return view('livewire.project.database.backup.index');
+ }
+}
diff --git a/app/Livewire/Project/Database/BackupEdit.php b/app/Livewire/Project/Database/BackupEdit.php
index e8e763c73..86aec0f6a 100644
--- a/app/Livewire/Project/Database/BackupEdit.php
+++ b/app/Livewire/Project/Database/BackupEdit.php
@@ -52,7 +52,7 @@ public function delete()
$url = $url->getPath() . "#{$url->getFragment()}";
return redirect($url);
} else {
- return redirect()->route('project.database.backups.all', $this->parameters);
+ return redirect()->route('project.database.backup.index', $this->parameters);
}
}
diff --git a/app/Livewire/Project/Database/Configuration.php b/app/Livewire/Project/Database/Configuration.php
new file mode 100644
index 000000000..c988477de
--- /dev/null
+++ b/app/Livewire/Project/Database/Configuration.php
@@ -0,0 +1,29 @@
+load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ if (!$project) {
+ return redirect()->route('dashboard');
+ }
+ $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
+ if (!$environment) {
+ return redirect()->route('dashboard');
+ }
+ $database = $environment->databases()->where('uuid', request()->route('database_uuid'))->first();
+ if (!$database) {
+ return redirect()->route('dashboard');
+ }
+ $this->database = $database;
+ }
+ public function render()
+ {
+ return view('livewire.project.database.configuration');
+ }
+}
diff --git a/app/Livewire/Project/DeleteProject.php b/app/Livewire/Project/DeleteProject.php
index 23ca8eb79..7ac4aa281 100644
--- a/app/Livewire/Project/DeleteProject.php
+++ b/app/Livewire/Project/DeleteProject.php
@@ -25,6 +25,6 @@ public function delete()
return $this->dispatch('error', 'Project has resources defined, please delete them first.');
}
$project->delete();
- return redirect()->route('projects');
+ return redirect()->route('project.index');
}
}
diff --git a/app/Livewire/Project/Edit.php b/app/Livewire/Project/Edit.php
index d08aa3e59..e674e3dd9 100644
--- a/app/Livewire/Project/Edit.php
+++ b/app/Livewire/Project/Edit.php
@@ -12,6 +12,15 @@ class Edit extends Component
'project.name' => 'required|min:3|max:255',
'project.description' => 'nullable|string|max:255',
];
+ public function mount() {
+ $projectUuid = request()->route('project_uuid');
+ $teamId = currentTeam()->id;
+ $project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();
+ if (!$project) {
+ return redirect()->route('dashboard');
+ }
+ $this->project = $project;
+ }
public function submit()
{
diff --git a/app/Livewire/Project/Index.php b/app/Livewire/Project/Index.php
new file mode 100644
index 000000000..1e6f79855
--- /dev/null
+++ b/app/Livewire/Project/Index.php
@@ -0,0 +1,21 @@
+projects = Project::ownedByCurrentTeam()->get();
+ $this->servers = Server::ownedByCurrentTeam()->count();
+ }
+ public function render()
+ {
+ return view('livewire.project.index');
+ }
+}
diff --git a/app/Livewire/Project/New/Select.php b/app/Livewire/Project/New/Select.php
index 47834a7fc..3133efc97 100644
--- a/app/Livewire/Project/New/Select.php
+++ b/app/Livewire/Project/New/Select.php
@@ -55,7 +55,7 @@ public function render()
public function updatedSelectedEnvironment()
{
- return redirect()->route('project.resources.new', [
+ return redirect()->route('project.resource.create', [
'project_uuid' => $this->parameters['project_uuid'],
'environment_name' => $this->selectedEnvironment,
]);
@@ -157,7 +157,7 @@ public function setServer(Server $server)
public function setDestination(string $destination_uuid)
{
$this->destination_uuid = $destination_uuid;
- return redirect()->route('project.resources.new', [
+ return redirect()->route('project.resource.create', [
'project_uuid' => $this->parameters['project_uuid'],
'environment_name' => $this->parameters['environment_name'],
'type' => $this->type,
diff --git a/app/Http/Controllers/ProjectController.php b/app/Livewire/Project/Resource/Create.php
similarity index 63%
rename from app/Http/Controllers/ProjectController.php
rename to app/Livewire/Project/Resource/Create.php
index 1e7d6b9cd..db5dc03f4 100644
--- a/app/Http/Controllers/ProjectController.php
+++ b/app/Livewire/Project/Resource/Create.php
@@ -1,52 +1,18 @@
Project::ownedByCurrentTeam()->get(),
- 'servers' => Server::ownedByCurrentTeam()->count(),
- ]);
- }
-
- public function edit()
- {
- $projectUuid = request()->route('project_uuid');
- $teamId = currentTeam()->id;
- $project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();
- if (!$project) {
- return redirect()->route('dashboard');
- }
- return view('project.edit', ['project' => $project]);
- }
-
- public function show()
- {
- $projectUuid = request()->route('project_uuid');
- $teamId = currentTeam()->id;
-
- $project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();
- if (!$project) {
- return redirect()->route('dashboard');
- }
- $project->load(['environments']);
- return view('project.show', ['project' => $project]);
- }
-
- public function new()
- {
+ public $type;
+ public function mount() {
$services = getServiceTemplates();
- $type = Str::of(request()->query('type'));
+ $type = str(request()->query('type'));
$destination_uuid = request()->query('destination');
$server_id = request()->query('server_id');
@@ -81,14 +47,14 @@ public function new()
$oneClickService = data_get($services, "$oneClickServiceName.compose");
$oneClickDotEnvs = data_get($services, "$oneClickServiceName.envs", null);
if ($oneClickDotEnvs) {
- $oneClickDotEnvs = Str::of(base64_decode($oneClickDotEnvs))->split('/\r\n|\r|\n/')->filter(function ($value) {
+ $oneClickDotEnvs = str(base64_decode($oneClickDotEnvs))->split('/\r\n|\r|\n/')->filter(function ($value) {
return !empty($value);
});
}
if ($oneClickService) {
$destination = StandaloneDocker::whereUuid($destination_uuid)->first();
$service = Service::create([
- 'name' => "$oneClickServiceName-" . Str::random(10),
+ 'name' => "$oneClickServiceName-" . str()->random(10),
'docker_compose_raw' => base64_decode($oneClickService),
'environment_id' => $environment->id,
'server_id' => (int) $server_id,
@@ -99,8 +65,8 @@ public function new()
$service->save();
if ($oneClickDotEnvs?->count() > 0) {
$oneClickDotEnvs->each(function ($value) use ($service) {
- $key = Str::before($value, '=');
- $value = Str::of(Str::after($value, '='));
+ $key = str()->before($value, '=');
+ $value = str(str()->after($value, '='));
$generatedValue = $value;
if ($value->contains('SERVICE_')) {
$command = $value->after('SERVICE_')->beforeLast('_');
@@ -123,24 +89,10 @@ public function new()
]);
}
}
- return view('project.new', [
- 'type' => $type->value()
- ]);
+ $this->type = $type->value();
}
-
- public function resources()
+ public function render()
{
- $project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
- if (!$project) {
- return redirect()->route('dashboard');
- }
- $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first();
- if (!$environment) {
- return redirect()->route('dashboard');
- }
- return view('project.resources', [
- 'project' => $project,
- 'environment' => $environment
- ]);
+ return view('livewire.project.resource.create');
}
}
diff --git a/app/Livewire/Project/Resource/Index.php b/app/Livewire/Project/Resource/Index.php
new file mode 100644
index 000000000..2a7570c9d
--- /dev/null
+++ b/app/Livewire/Project/Resource/Index.php
@@ -0,0 +1,29 @@
+load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
+ if (!$project) {
+ return redirect()->route('dashboard');
+ }
+ $environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first();
+ if (!$environment) {
+ return redirect()->route('dashboard');
+ }
+ $this->project = $project;
+ $this->environment = $environment;
+ }
+ public function render()
+ {
+ return view('livewire.project.resource.index');
+ }
+}
diff --git a/app/Livewire/Project/Service/Configuration.php b/app/Livewire/Project/Service/Configuration.php
new file mode 100644
index 000000000..5954b3b36
--- /dev/null
+++ b/app/Livewire/Project/Service/Configuration.php
@@ -0,0 +1,54 @@
+user()->id;
+ return [
+ "echo-private:user.{$userId},ServiceStatusChanged" => 'checkStatus',
+ "refreshStacks",
+ "checkStatus",
+ ];
+ }
+ 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'])->firstOrFail();
+ $this->applications = $this->service->applications->sort();
+ $this->databases = $this->service->databases->sort();
+ }
+ public function checkStatus()
+ {
+ dispatch_sync(new ContainerStatusJob($this->service->server));
+ $this->refreshStacks();
+ $this->dispatch('serviceStatusChanged');
+ }
+ public function refreshStacks()
+ {
+ $this->applications = $this->service->applications->sort();
+ $this->applications->each(function ($application) {
+ $application->refresh();
+ });
+ $this->databases = $this->service->databases->sort();
+ $this->databases->each(function ($database) {
+ $database->refresh();
+ });
+ }
+}
diff --git a/app/Livewire/Project/Service/Index.php b/app/Livewire/Project/Service/Index.php
index e55dc610c..21009cb44 100644
--- a/app/Livewire/Project/Service/Index.php
+++ b/app/Livewire/Project/Service/Index.php
@@ -2,53 +2,51 @@
namespace App\Livewire\Project\Service;
-use App\Jobs\ContainerStatusJob;
use App\Models\Service;
+use App\Models\ServiceApplication;
+use App\Models\ServiceDatabase;
+use Illuminate\Support\Collection;
use Livewire\Component;
class Index extends Component
{
public Service $service;
- public $applications;
- public $databases;
+ public ?ServiceApplication $serviceApplication = null;
+ public ?ServiceDatabase $serviceDatabase = null;
public array $parameters;
public array $query;
- public function getListeners()
+ public Collection $services;
+ public $s3s;
+
+ protected $listeners = ['generateDockerCompose'];
+
+ public function mount()
{
- $userId = auth()->user()->id;
- return [
- "echo-private:user.{$userId},ServiceStatusChanged" => 'checkStatus',
- "refreshStacks",
- "checkStatus",
- ];
+ try {
+ $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;
+ $this->serviceApplication->getFilesFromServer();
+ } else {
+ $this->serviceDatabase = $this->service->databases()->whereName($this->parameters['service_name'])->first();
+ $this->serviceDatabase->getFilesFromServer();
+ }
+ $this->s3s = currentTeam()->s3s;
+ } catch(\Throwable $e) {
+ return handleError($e, $this);
+ }
+
+ }
+ public function generateDockerCompose()
+ {
+ $this->service->parse();
}
public function render()
{
return view('livewire.project.service.index');
}
- public function mount()
- {
- $this->parameters = get_route_parameters();
- $this->query = request()->query();
- $this->service = Service::whereUuid($this->parameters['service_uuid'])->firstOrFail();
- $this->applications = $this->service->applications->sort();
- $this->databases = $this->service->databases->sort();
- }
- public function checkStatus()
- {
- dispatch_sync(new ContainerStatusJob($this->service->server));
- $this->refreshStacks();
- $this->dispatch('serviceStatusChanged');
- }
- public function refreshStacks()
- {
- $this->applications = $this->service->applications->sort();
- $this->applications->each(function ($application) {
- $application->refresh();
- });
- $this->databases = $this->service->databases->sort();
- $this->databases->each(function ($database) {
- $database->refresh();
- });
- }
}
diff --git a/app/Livewire/Project/Service/Show.php b/app/Livewire/Project/Service/Show.php
deleted file mode 100644
index 272e0a399..000000000
--- a/app/Livewire/Project/Service/Show.php
+++ /dev/null
@@ -1,52 +0,0 @@
-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;
- $this->serviceApplication->getFilesFromServer();
- } else {
- $this->serviceDatabase = $this->service->databases()->whereName($this->parameters['service_name'])->first();
- $this->serviceDatabase->getFilesFromServer();
- }
- $this->s3s = currentTeam()->s3s;
- } catch(\Throwable $e) {
- return handleError($e, $this);
- }
-
- }
- public function generateDockerCompose()
- {
- $this->service->parse();
- }
- public function render()
- {
- return view('livewire.project.service.show');
- }
-}
diff --git a/app/Livewire/Project/Shared/Danger.php b/app/Livewire/Project/Shared/Danger.php
index 44a9d5cf3..37664c870 100644
--- a/app/Livewire/Project/Shared/Danger.php
+++ b/app/Livewire/Project/Shared/Danger.php
@@ -25,7 +25,7 @@ public function delete()
{
try {
DeleteResourceJob::dispatchSync($this->resource);
- return redirect()->route('project.resources', [
+ return redirect()->route('project.resource.index', [
'project_uuid' => $this->projectUuid,
'environment_name' => $this->environmentName
]);
diff --git a/app/Livewire/Project/Shared/ExecuteContainerCommand.php b/app/Livewire/Project/Shared/ExecuteContainerCommand.php
index a3a63c154..f06f7784d 100644
--- a/app/Livewire/Project/Shared/ExecuteContainerCommand.php
+++ b/app/Livewire/Project/Shared/ExecuteContainerCommand.php
@@ -10,7 +10,6 @@
use App\Models\StandaloneMysql;
use App\Models\StandalonePostgresql;
use App\Models\StandaloneRedis;
-use Illuminate\Support\Sleep;
use Livewire\Component;
class ExecuteContainerCommand extends Component
diff --git a/app/Livewire/Project/Show.php b/app/Livewire/Project/Show.php
new file mode 100644
index 000000000..0824ab32e
--- /dev/null
+++ b/app/Livewire/Project/Show.php
@@ -0,0 +1,26 @@
+route('project_uuid');
+ $teamId = currentTeam()->id;
+
+ $project = Project::where('team_id', $teamId)->where('uuid', $projectUuid)->first();
+ if (!$project) {
+ return redirect()->route('dashboard');
+ }
+ $project->load(['environments']);
+ $this->project = $project;
+ }
+ public function render()
+ {
+ return view('livewire.project.show');
+ }
+}
diff --git a/app/Livewire/PrivateKey/Create.php b/app/Livewire/Security/PrivateKey/Create.php
similarity index 98%
rename from app/Livewire/PrivateKey/Create.php
rename to app/Livewire/Security/PrivateKey/Create.php
index a82b6fb48..62d763601 100644
--- a/app/Livewire/PrivateKey/Create.php
+++ b/app/Livewire/Security/PrivateKey/Create.php
@@ -1,6 +1,6 @@
private_key = PrivateKey::ownedByCurrentTeam(['name', 'description', 'private_key', 'is_git_related'])->whereUuid(request()->private_key_uuid)->firstOrFail();
$this->public_key = $this->private_key->publicKey();
}catch(\Throwable $e) {
return handleError($e, $this);
diff --git a/app/Livewire/Server/Delete.php b/app/Livewire/Server/Delete.php
index 73edf5ffe..3333283eb 100644
--- a/app/Livewire/Server/Delete.php
+++ b/app/Livewire/Server/Delete.php
@@ -19,7 +19,7 @@ public function delete()
return;
}
$this->server->delete();
- return redirect()->route('server.all');
+ return redirect()->route('server.index');
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --git a/app/Livewire/Server/Destination/Show.php b/app/Livewire/Server/Destination/Show.php
index 7fa2a2823..4e0f54296 100644
--- a/app/Livewire/Server/Destination/Show.php
+++ b/app/Livewire/Server/Destination/Show.php
@@ -15,7 +15,7 @@ public function mount()
try {
$this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
if (is_null($this->server)) {
- return redirect()->route('server.all');
+ return redirect()->route('server.index');
}
} catch (\Throwable $e) {
return handleError($e, $this);
diff --git a/app/Livewire/Server/All.php b/app/Livewire/Server/Index.php
similarity index 80%
rename from app/Livewire/Server/All.php
rename to app/Livewire/Server/Index.php
index fad5f3fba..45bb1c3e1 100644
--- a/app/Livewire/Server/All.php
+++ b/app/Livewire/Server/Index.php
@@ -6,7 +6,7 @@
use Illuminate\Database\Eloquent\Collection;
use Livewire\Component;
-class All extends Component
+class Index extends Component
{
public ?Collection $servers = null;
@@ -15,6 +15,6 @@ public function mount () {
}
public function render()
{
- return view('livewire.server.all');
+ return view('livewire.server.index');
}
}
diff --git a/app/Livewire/Server/LogDrains.php b/app/Livewire/Server/LogDrains.php
index 902ec4b75..b922cc0c9 100644
--- a/app/Livewire/Server/LogDrains.php
+++ b/app/Livewire/Server/LogDrains.php
@@ -43,7 +43,7 @@ public function mount()
try {
$server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
if (is_null($server)) {
- return redirect()->route('server.all');
+ return redirect()->route('server.index');
}
$this->server = $server;
} catch (\Throwable $e) {
diff --git a/app/Livewire/Server/PrivateKey/Show.php b/app/Livewire/Server/PrivateKey/Show.php
index 9fa0acb75..71dea7c9d 100644
--- a/app/Livewire/Server/PrivateKey/Show.php
+++ b/app/Livewire/Server/PrivateKey/Show.php
@@ -17,7 +17,7 @@ public function mount()
try {
$this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
if (is_null($this->server)) {
- return redirect()->route('server.all');
+ return redirect()->route('server.index');
}
$this->privateKeys = PrivateKey::ownedByCurrentTeam()->get()->where('is_git_related', false);
} catch (\Throwable $e) {
diff --git a/app/Livewire/Server/Proxy/Logs.php b/app/Livewire/Server/Proxy/Logs.php
index ed12f8c49..7949b0086 100644
--- a/app/Livewire/Server/Proxy/Logs.php
+++ b/app/Livewire/Server/Proxy/Logs.php
@@ -15,7 +15,7 @@ public function mount()
try {
$this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
if (is_null($this->server)) {
- return redirect()->route('server.all');
+ return redirect()->route('server.index');
}
} catch (\Throwable $e) {
return handleError($e, $this);
diff --git a/app/Livewire/Server/Proxy/Show.php b/app/Livewire/Server/Proxy/Show.php
index b1175d3b7..7e21e3344 100644
--- a/app/Livewire/Server/Proxy/Show.php
+++ b/app/Livewire/Server/Proxy/Show.php
@@ -20,7 +20,7 @@ public function mount()
try {
$this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
if (is_null($this->server)) {
- return redirect()->route('server.all');
+ return redirect()->route('server.index');
}
} catch (\Throwable $e) {
return handleError($e, $this);
diff --git a/app/Livewire/Server/Show.php b/app/Livewire/Server/Show.php
index 065335835..13ebc97d4 100644
--- a/app/Livewire/Server/Show.php
+++ b/app/Livewire/Server/Show.php
@@ -17,7 +17,7 @@ public function mount()
try {
$this->server = Server::ownedByCurrentTeam()->whereUuid(request()->server_uuid)->first();
if (is_null($this->server)) {
- return redirect()->route('server.all');
+ return redirect()->route('server.index');
}
} catch (\Throwable $e) {
diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.php
new file mode 100644
index 000000000..44c653b74
--- /dev/null
+++ b/app/Livewire/Settings/Index.php
@@ -0,0 +1,38 @@
+first();
+ if ($database) {
+ if ($database->status !== 'running') {
+ $database->status = 'running';
+ $database->save();
+ }
+ $s3s = S3Storage::whereTeamId(0)->get();
+ }
+ $this->settings = $settings;
+ $this->database = $database;
+ $this->s3s = $s3s ?? [];
+ } else {
+ return redirect()->route('dashboard');
+ }
+ }
+ public function render()
+ {
+ return view('livewire.settings.index');
+ }
+}
diff --git a/app/Livewire/CheckLicense.php b/app/Livewire/Settings/License.php
similarity index 79%
rename from app/Livewire/CheckLicense.php
rename to app/Livewire/Settings/License.php
index 8d4351fce..64ad0a6f7 100644
--- a/app/Livewire/CheckLicense.php
+++ b/app/Livewire/Settings/License.php
@@ -1,15 +1,16 @@
'nullable',
'settings.is_resale_license_active' => 'nullable',
@@ -20,12 +21,17 @@ class CheckLicense extends Component
'settings.is_resale_license_active' => 'Is License Active',
];
- public function mount()
- {
+ public function mount () {
+ if (!isCloud()) {
+ abort(404);
+ }
$this->instance_id = config('app.id');
$this->settings = InstanceSettings::get();
}
-
+ public function render()
+ {
+ return view('livewire.settings.license')->layout('layouts.subscription');
+ }
public function submit()
{
$this->validate();
diff --git a/app/Livewire/Subscription/Show.php b/app/Livewire/Subscription/Index.php
similarity index 86%
rename from app/Livewire/Subscription/Show.php
rename to app/Livewire/Subscription/Index.php
index 6c92f7555..afc3729c6 100644
--- a/app/Livewire/Subscription/Show.php
+++ b/app/Livewire/Subscription/Index.php
@@ -6,7 +6,7 @@
use App\Providers\RouteServiceProvider;
use Livewire\Component;
-class Show extends Component
+class Index extends Component
{
public InstanceSettings $settings;
public bool $alreadySubscribed = false;
@@ -26,6 +26,6 @@ public function stripeCustomerPortal() {
}
public function render()
{
- return view('livewire.subscription.show')->layout('layouts.subscription');
+ return view('livewire.subscription.index')->layout('layouts.subscription');
}
}
diff --git a/app/Livewire/Team/Delete.php b/app/Livewire/Team/Delete.php
deleted file mode 100644
index 097419c4c..000000000
--- a/app/Livewire/Team/Delete.php
+++ /dev/null
@@ -1,29 +0,0 @@
-delete();
-
- $currentTeam->members->each(function ($user) use ($currentTeam) {
- if ($user->id === auth()->user()->id) {
- return;
- }
- $user->teams()->detach($currentTeam);
- $session = DB::table('sessions')->where('user_id', $user->id)->first();
- if ($session) {
- DB::table('sessions')->where('id', $session->id)->delete();
- }
- });
-
- refreshSession();
- return redirect()->route('team.index');
- }
-}
diff --git a/app/Livewire/Team/Form.php b/app/Livewire/Team/Form.php
deleted file mode 100644
index 3deaf0b92..000000000
--- a/app/Livewire/Team/Form.php
+++ /dev/null
@@ -1,35 +0,0 @@
- 'required|min:3|max:255',
- 'team.description' => 'nullable|min:3|max:255',
- ];
- protected $validationAttributes = [
- 'team.name' => 'name',
- 'team.description' => 'description',
- ];
-
- public function mount()
- {
- $this->team = currentTeam();
- }
-
- public function submit()
- {
- $this->validate();
- try {
- $this->team->save();
- refreshSession();
- } catch (\Throwable $e) {
- return handleError($e, $this);
- }
- }
-}
diff --git a/app/Livewire/Team/Index.php b/app/Livewire/Team/Index.php
new file mode 100644
index 000000000..b7482e671
--- /dev/null
+++ b/app/Livewire/Team/Index.php
@@ -0,0 +1,65 @@
+ 'required|min:3|max:255',
+ 'team.description' => 'nullable|min:3|max:255',
+ ];
+ protected $validationAttributes = [
+ 'team.name' => 'name',
+ 'team.description' => 'description',
+ ];
+ public function mount() {
+ $this->team = currentTeam();
+
+ if (auth()->user()->isAdminFromSession()) {
+ $this->invitations = TeamInvitation::whereTeamId(currentTeam()->id)->get();
+ }
+ }
+ public function render()
+ {
+ return view('livewire.team.index');
+ }
+
+ public function submit()
+ {
+ $this->validate();
+ try {
+ $this->team->save();
+ refreshSession();
+ $this->dispatch('success', 'Team updated successfully.');
+ } catch (\Throwable $e) {
+ return handleError($e, $this);
+ }
+ }
+
+ public function delete()
+ {
+ $currentTeam = currentTeam();
+ $currentTeam->delete();
+
+ $currentTeam->members->each(function ($user) use ($currentTeam) {
+ if ($user->id === auth()->user()->id) {
+ return;
+ }
+ $user->teams()->detach($currentTeam);
+ $session = DB::table('sessions')->where('user_id', $user->id)->first();
+ if ($session) {
+ DB::table('sessions')->where('id', $session->id)->delete();
+ }
+ });
+
+ refreshSession();
+ return redirect()->route('team.index');
+ }
+}
diff --git a/app/Livewire/Team/Member/Index.php b/app/Livewire/Team/Member/Index.php
new file mode 100644
index 000000000..bca24c26c
--- /dev/null
+++ b/app/Livewire/Team/Member/Index.php
@@ -0,0 +1,20 @@
+user()->isAdminFromSession()) {
+ $this->invitations = TeamInvitation::whereTeamId(currentTeam()->id)->get();
+ }
+ }
+ public function render()
+ {
+ return view('livewire.team.member.index');
+ }
+}
diff --git a/app/Livewire/Team/Notification/Index.php b/app/Livewire/Team/Notification/Index.php
new file mode 100644
index 000000000..86754d619
--- /dev/null
+++ b/app/Livewire/Team/Notification/Index.php
@@ -0,0 +1,13 @@
+storage->team_id = currentTeam()->id;
$this->storage->testConnection();
$this->storage->save();
- return redirect()->route('team.storages.show', $this->storage->uuid);
+ return redirect()->route('team.storage.show', $this->storage->uuid);
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --git a/app/Livewire/Team/Storage/Form.php b/app/Livewire/Team/Storage/Form.php
index 23b0fe34c..8a26a3471 100644
--- a/app/Livewire/Team/Storage/Form.php
+++ b/app/Livewire/Team/Storage/Form.php
@@ -43,7 +43,7 @@ public function delete()
{
try {
$this->storage->delete();
- return redirect()->route('team.storages.all');
+ return redirect()->route('team.storage.index');
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --git a/app/Livewire/Team/Storage/Index.php b/app/Livewire/Team/Storage/Index.php
new file mode 100644
index 000000000..c15834564
--- /dev/null
+++ b/app/Livewire/Team/Storage/Index.php
@@ -0,0 +1,18 @@
+s3 = S3Storage::ownedByCurrentTeam()->get();
+ }
+ public function render()
+ {
+ return view('livewire.team.storage.index');
+ }
+}
diff --git a/app/Livewire/Team/Storage/Show.php b/app/Livewire/Team/Storage/Show.php
new file mode 100644
index 000000000..6fbb6034f
--- /dev/null
+++ b/app/Livewire/Team/Storage/Show.php
@@ -0,0 +1,22 @@
+storage = S3Storage::ownedByCurrentTeam()->whereUuid(request()->storage_uuid)->first();
+ if (!$this->storage) {
+ abort(404);
+ }
+ }
+ public function render()
+ {
+ return view('livewire.team.storage.show');
+ }
+}
diff --git a/app/Models/S3Storage.php b/app/Models/S3Storage.php
index ec18477eb..9d60ce491 100644
--- a/app/Models/S3Storage.php
+++ b/app/Models/S3Storage.php
@@ -48,7 +48,7 @@ public function testConnection(bool $shouldSave = false)
if ($this->unusable_email_sent === false && is_transactional_emails_active()) {
$mail = new MailMessage();
$mail->subject('Coolify: S3 Storage Connection Error');
- $mail->view('emails.s3-connection-error', ['name' => $this->name, 'reason' => $e->getMessage(), 'url' => route('team.storages.show', ['storage_uuid' => $this->uuid])]);
+ $mail->view('emails.s3-connection-error', ['name' => $this->name, 'reason' => $e->getMessage(), 'url' => route('team.storage.show', ['storage_uuid' => $this->uuid])]);
$users = collect([]);
$members = $this->team->members()->get();
foreach ($members as $user) {
diff --git a/app/Notifications/Container/ContainerRestarted.php b/app/Notifications/Container/ContainerRestarted.php
index 723cad8f6..21dc799f8 100644
--- a/app/Notifications/Container/ContainerRestarted.php
+++ b/app/Notifications/Container/ContainerRestarted.php
@@ -27,7 +27,7 @@ public function via(object $notifiable): array
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("Coolify: A service ({$this->name}) has been restarted automatically on {$this->server->name}");
+ $mail->subject("Coolify: A resource ({$this->name}) has been restarted automatically on {$this->server->name}");
$mail->view('emails.container-restarted', [
'containerName' => $this->name,
'serverName' => $this->server->name,
@@ -38,12 +38,12 @@ public function toMail(): MailMessage
public function toDiscord(): string
{
- $message = "Coolify: A service ({$this->name}) has been restarted automatically on {$this->server->name}";
+ $message = "Coolify: A resource ({$this->name}) has been restarted automatically on {$this->server->name}";
return $message;
}
public function toTelegram(): array
{
- $message = "Coolify: A service ({$this->name}) has been restarted automatically on {$this->server->name}";
+ $message = "Coolify: A resource ({$this->name}) has been restarted automatically on {$this->server->name}";
$payload = [
"message" => $message,
];
diff --git a/app/Notifications/Container/ContainerStopped.php b/app/Notifications/Container/ContainerStopped.php
index ea474a3e9..ac218c5fe 100644
--- a/app/Notifications/Container/ContainerStopped.php
+++ b/app/Notifications/Container/ContainerStopped.php
@@ -26,7 +26,7 @@ public function via(object $notifiable): array
public function toMail(): MailMessage
{
$mail = new MailMessage();
- $mail->subject("Coolify: A service ({$this->name}) has been stopped on {$this->server->name}");
+ $mail->subject("Coolify: A resource has been stopped unexpectedly on {$this->server->name}");
$mail->view('emails.container-stopped', [
'containerName' => $this->name,
'serverName' => $this->server->name,
@@ -37,12 +37,12 @@ public function toMail(): MailMessage
public function toDiscord(): string
{
- $message = "Coolify: A service ({$this->name}) has been stopped on {$this->server->name}";
+ $message = "Coolify: A resource has been stopped unexpectedly on {$this->server->name}";
return $message;
}
public function toTelegram(): array
{
- $message = "Coolify: A service ($this->name} has been stopped on {$this->server->name}";
+ $message = "Coolify: A resource has been stopped unexpectedly on {$this->server->name}";
$payload = [
"message" => $message,
];
diff --git a/app/Providers/FortifyServiceProvider.php b/app/Providers/FortifyServiceProvider.php
index ccd90d14b..630da761d 100644
--- a/app/Providers/FortifyServiceProvider.php
+++ b/app/Providers/FortifyServiceProvider.php
@@ -31,7 +31,7 @@ public function toResponse($request)
{
// First user (root) will be redirected to /settings instead of / on registration.
if ($request->user()->currentTeam->id === 0) {
- return redirect()->route('settings.configuration');
+ return redirect()->route('settings.index');
}
return redirect(RouteServiceProvider::HOME);
}
diff --git a/resources/views/auth/force-password-reset.blade.php b/resources/views/auth/force-password-reset.blade.php
deleted file mode 100644
index df1f415f6..000000000
--- a/resources/views/auth/force-password-reset.blade.php
+++ /dev/null
@@ -1,3 +0,0 @@
-