Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: move s3 storages to separate view

Andras Bacsaif952553c7694
diff --git a/app/Livewire/Team/Storage/Create.php b/app/Livewire/Storage/Create.php
similarity index 95%
rename from app/Livewire/Team/Storage/Create.php
rename to app/Livewire/Storage/Create.php
index a25fc9821c..d1af807d5d 100644
--- a/app/Livewire/Team/Storage/Create.php
+++ b/app/Livewire/Storage/Create.php
@@ -1,6 +1,6 @@
<?php
-namespace App\Livewire\Team\Storage;
+namespace App\Livewire\Storage;
use App\Models\S3Storage;
use Livewire\Component;
@@ -65,7 +65,7 @@ class Create extends Component
$this->storage->team_id = currentTeam()->id;
$this->storage->testConnection();
$this->storage->save();
- return redirect()->route('team.storage.show', $this->storage->uuid);
+ return redirect()->route('storage.show', $this->storage->uuid);
} catch (\Throwable $e) {
$this->dispatch('error', 'Failed to create storage.', $e->getMessage());
// return handleError($e, $this);
diff --git a/app/Livewire/Team/Storage/Form.php b/app/Livewire/Storage/Form.php
similarity index 94%
rename from app/Livewire/Team/Storage/Form.php
rename to app/Livewire/Storage/Form.php
index 1fd0d470b2..79c1f0c305 100644
--- a/app/Livewire/Team/Storage/Form.php
+++ b/app/Livewire/Storage/Form.php
@@ -1,6 +1,6 @@
<?php
-namespace App\Livewire\Team\Storage;
+namespace App\Livewire\Storage;
use App\Models\S3Storage;
use Livewire\Component;
@@ -43,7 +43,7 @@ class Form extends Component
{
try {
$this->storage->delete();
- return redirect()->route('team.storage.index');
+ return redirect()->route('storage.index');
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --git a/app/Livewire/Team/Storage/Index.php b/app/Livewire/Storage/Index.php
similarity index 73%
rename from app/Livewire/Team/Storage/Index.php
rename to app/Livewire/Storage/Index.php
index c158345648..f071a0af02 100644
--- a/app/Livewire/Team/Storage/Index.php
+++ b/app/Livewire/Storage/Index.php
@@ -1,6 +1,6 @@
<?php
-namespace App\Livewire\Team\Storage;
+namespace App\Livewire\Storage;
use App\Models\S3Storage;
use Livewire\Component;
@@ -13,6 +13,6 @@ class Index extends Component
}
public function render()
{
- return view('livewire.team.storage.index');
+ return view('livewire.storage.index');
}
}
diff --git a/app/Livewire/Storage/Show.php b/app/Livewire/Storage/Show.php
new file mode 100644
index 0000000000..988fb30cb0
--- /dev/null
+++ b/app/Livewire/Storage/Show.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Livewire\Storage;
+
+use App\Models\S3Storage;
+use Livewire\Component;
+
+class Show extends Component
+{
+ public $storage = null;
+ public function mount()
+ {
+ $this->storage = S3Storage::ownedByCurrentTeam()->whereUuid(request()->storage_uuid)->first();
+ if (!$this->storage) {
+ abort(404);
+ }
+ }
+ public function render()
+ {
+ return view('livewire.storage.show');
+ }
+}
diff --git a/app/Livewire/Team/Storage/Show.php b/app/Livewire/Team/Storage/Show.php
index 6fbb6034f7..ab2acbbb9b 100644
--- a/app/Livewire/Team/Storage/Show.php
+++ b/app/Livewire/Team/Storage/Show.php
@@ -17,6 +17,6 @@ class Show extends Component
}
public function render()
{
- return view('livewire.team.storage.show');
+ return view('livewire.storage.show');
}
}
diff --git a/app/Models/S3Storage.php b/app/Models/S3Storage.php
index 9d60ce4919..dc0b93466d 100644
--- a/app/Models/S3Storage.php
+++ b/app/Models/S3Storage.php
@@ -48,7 +48,7 @@ class S3Storage extends BaseModel
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.storage.show', ['storage_uuid' => $this->uuid])]);
+ $mail->view('emails.s3-connection-error', ['name' => $this->name, 'reason' => $e->getMessage(), 'url' => route('storage.show', ['storage_uuid' => $this->uuid])]);
$users = collect([]);
$members = $this->team->members()->get();
foreach ($members as $user) {
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index 96af53d3f9..0eebffd1ed 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -156,6 +156,20 @@
Destinations
</a>
</li>
+ <li>
+ <a title="S3 Storages"
+ class="{{ request()->is('storages*') ? 'menu-item-active menu-item' : 'menu-item' }}"
+ href="{{ route('storage.index') }}">
+ <svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 24 24">
+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
+ <path d="M4 6a8 3 0 1 0 16 0A8 3 0 1 0 4 6"/>
+ <path d="M4 6v6a8 3 0 0 0 16 0V6"/>
+ <path d="M4 12v6a8 3 0 0 0 16 0v-6"/>
+ </g>
+ </svg>
+ S3 Storages
+ </a>
+ </li>
<li>
<a title="Notifications"
class="{{ request()->is('notifications*') ? 'menu-item-active menu-item' : 'menu-item' }}"
diff --git a/resources/views/components/team/navbar.blade.php b/resources/views/components/team/navbar.blade.php
index 9c857478ef..0c6c449019 100644
--- a/resources/views/components/team/navbar.blade.php
+++ b/resources/views/components/team/navbar.blade.php
@@ -5,7 +5,7 @@
<livewire:team.create/>
</x-modal-input>
</div>
- <div class="subtitle">Team settings & shared environment variables.</div>
+ <div class="subtitle">Team wide configurations.</div>
<nav class="navbar-main">
<a class="{{ request()->routeIs('team.index') ? 'dark:text-white' : '' }}" href="{{ route('team.index') }}">
<button>General</button>
@@ -14,10 +14,6 @@
href="{{ route('team.member.index') }}">
<button>Members</button>
</a>
- <a class="{{ request()->routeIs('team.storage.index') ? 'dark:text-white' : '' }}"
- href="{{ route('team.storage.index') }}">
- <button>S3 Storages</button>
- </a>
<a class="{{ request()->routeIs('team.shared-variables.index') ? 'dark:text-white' : '' }}"
href="{{ route('team.shared-variables.index') }}">
<button>Shared Variables</button>
diff --git a/resources/views/livewire/team/storage/create.blade.php b/resources/views/livewire/storage/create.blade.php
similarity index 100%
rename from resources/views/livewire/team/storage/create.blade.php
rename to resources/views/livewire/storage/create.blade.php
diff --git a/resources/views/livewire/team/storage/form.blade.php b/resources/views/livewire/storage/form.blade.php
similarity index 87%
rename from resources/views/livewire/team/storage/form.blade.php
rename to resources/views/livewire/storage/form.blade.php
index 245a58f2dd..1a2c996967 100644
--- a/resources/views/livewire/team/storage/form.blade.php
+++ b/resources/views/livewire/storage/form.blade.php
@@ -2,12 +2,12 @@
<form class="flex flex-col gap-2 pb-6" wire:submit='submit'>
<div class="flex items-start gap-2">
<div class="pb-4">
- <h2>Storage Details</h2>
- <div>{{ $storage->name }}</div>
+ <h1>Storage Details</h1>
+ <div class="subtitle">{{ $storage->name }}</div>
@if ($storage->is_usable)
- <div> Usable </div>
+ <div>Usable</div>
@else
- <div class="text-red-500"> Not Usable </div>
+ <div class="text-red-500">Not Usable</div>
@endif
</div>
<x-forms.button type="submit">
diff --git a/resources/views/livewire/team/storage/index.blade.php b/resources/views/livewire/storage/index.blade.php
similarity index 71%
rename from resources/views/livewire/team/storage/index.blade.php
rename to resources/views/livewire/storage/index.blade.php
index c2676e11f7..02b6973f2b 100644
--- a/resources/views/livewire/team/storage/index.blade.php
+++ b/resources/views/livewire/storage/index.blade.php
@@ -1,13 +1,11 @@
<div>
- <x-team.navbar :team="auth()->user()->currentTeam()" />
<div class="flex items-start gap-2">
- <h2 class="pb-4">S3 Storages</h2>
+ <h1>S3 Storages</h1>
<x-modal-input buttonTitle="+ Add" title="New S3 Storage">
- <livewire:team.storage.create />
+ <livewire:storage.create />
</x-modal-input>
- {{-- <a class="dark:text-white hover:no-underline" href="/team/storages/new"> <x-forms.button>+ Add
- </x-forms.button></a> --}}
</div>
+ <div class="subtitle">S3 storages for backups.</div>
<div class="grid gap-2 lg:grid-cols-2">
@forelse ($s3 as $storage)
<div x-data x-on:click="goto('{{ $storage->uuid }}')" @class(['gap-2 border cursor-pointer box group border-transparent'])>
@@ -27,7 +25,7 @@
</div>
<script>
function goto(uuid) {
- window.location.href = '/team/storages/' + uuid;
+ window.location.href = '/storages/' + uuid;
}
</script>
</div>
diff --git a/resources/views/livewire/storage/show.blade.php b/resources/views/livewire/storage/show.blade.php
new file mode 100644
index 0000000000..137f7bdff1
--- /dev/null
+++ b/resources/views/livewire/storage/show.blade.php
@@ -0,0 +1,3 @@
+<div>
+ <livewire:storage.form :storage="$storage" />
+</div>
diff --git a/resources/views/livewire/team/storage/show.blade.php b/resources/views/livewire/team/storage/show.blade.php
deleted file mode 100644
index 83fa95a08c..0000000000
--- a/resources/views/livewire/team/storage/show.blade.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<div>
- <x-team.navbar :team="auth()
- ->user()
- ->currentTeam()" />
- <livewire:team.storage.form :storage="$storage" />
-</div>
diff --git a/resources/views/livewire/team/storages/create.blade.php b/resources/views/livewire/team/storages/create.blade.php
deleted file mode 100644
index 379e555e9f..0000000000
--- a/resources/views/livewire/team/storages/create.blade.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<div>
- {{-- If you look to others for fulfillment, you will never truly be fulfilled. --}}
-</div>
diff --git a/routes/web.php b/routes/web.php
index ce2c4f4188..623de722a7 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -27,11 +27,11 @@ use App\Livewire\Notifications\Telegram as NotificationTelegram;
use App\Livewire\Notifications\Discord as NotificationDiscord;
use App\Livewire\Team\Index as TeamIndex;
-
-use App\Livewire\Team\Storage\Index as TeamStorageIndex;
-use App\Livewire\Team\Storage\Show as TeamStorageShow;
use App\Livewire\Team\Member\Index as TeamMemberIndex;
+use App\Livewire\Storage\Index as StorageIndex;
+use App\Livewire\Storage\Show as StorageShow;
+
use App\Livewire\CommandCenter\Index as CommandCenterIndex;
use App\Livewire\ForcePasswordReset;
use App\Livewire\Project\Index as ProjectIndex;
@@ -135,14 +135,12 @@ Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/telegram', NotificationTelegram::class)->name('notifications.telegram');
Route::get('/discord', NotificationDiscord::class)->name('notifications.discord');
});
+ Route::get('/storages', StorageIndex::class)->name('storage.index');
+ Route::get('/storages/{storage_uuid}', StorageShow::class)->name('storage.show');
Route::prefix('team')->group(function () {
Route::get('/', TeamIndex::class)->name('team.index');
- // Route::get('/new', TeamCreate::class)->name('team.create');
Route::get('/members', TeamMemberIndex::class)->name('team.member.index');
Route::get('/shared-variables', TeamSharedVariablesIndex::class)->name('team.shared-variables.index');
- Route::get('/storages', TeamStorageIndex::class)->name('team.storage.index');
- // Route::get('/storages/new', TeamStorageCreate::class)->name('team.storage.create');
- Route::get('/storages/{storage_uuid}', TeamStorageShow::class)->name('team.storage.show');
});
Route::get('/command-center', CommandCenterIndex::class)->name('command-center');