forked from LycheeOrg/Lychee
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create maintenance page (LycheeOrg#2332)
- Loading branch information
Showing
24 changed files
with
308 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace App\Livewire\Components\Pages; | ||
|
||
use App\Livewire\Components\Menus\LeftMenu; | ||
use App\Models\Configs; | ||
use App\Policies\SettingsPolicy; | ||
use Illuminate\Support\Facades\Gate; | ||
use Illuminate\View\View; | ||
use Livewire\Component; | ||
|
||
/** | ||
* Admin page to manage lychee install and other commands. | ||
*/ | ||
class Maintenance extends Component | ||
{ | ||
/** | ||
* Rendering of the front-end. | ||
* | ||
* @return View | ||
*/ | ||
public function render(): View | ||
{ | ||
Gate::authorize(SettingsPolicy::CAN_UPDATE, Configs::class); | ||
|
||
return view('livewire.pages.maintenance'); | ||
} | ||
|
||
public function back(): mixed | ||
{ | ||
$this->dispatch('closeLeftMenu')->to(LeftMenu::class); | ||
|
||
return $this->redirect(route('livewire-gallery'), true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'Vous trouverez sur cette page toutes les actions necessaire au bon fonctionment de Lychee.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
return [ | ||
/* | ||
|-------------------------------------------------------------------------- | ||
| Update Page | ||
|-------------------------------------------------------------------------- | ||
*/ | ||
'title' => 'Maintenance', | ||
'description' => 'You will find on this page, all the required actions to keep your Lychee installation running smooth and nicely.', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<div class="w-full"> | ||
<x-header.bar class="h-14 select-none"> | ||
<x-header.back @keydown.escape.window="$wire.back();" wire:click="back" /> | ||
<x-header.title>{{ __('maintenance.title') }}</x-header.title> | ||
</x-header.bar> | ||
<div class="overflow-x-clip overflow-y-auto h-[calc(100vh-56px)] pt-4"> | ||
<div class="settings_view max-w-3xl text-text-main-400 text-sm mx-auto mb-9"> | ||
<div class="w-full mt-5"> | ||
<p class="text-center"> | ||
{{ __('maintenance.description') }} | ||
</p> | ||
</div> | ||
<div class=" mt-9 grid grid-cols-1 gap-4 sm:grid-cols-2 sm:items-stretch md:grid-cols-3 md:gap-8 w-full"> | ||
{{-- Here are the maintenance modules to be added. --}} | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
/** | ||
* We don't care for unhandled exceptions in tests. | ||
* It is the nature of a test to throw an exception. | ||
* Without this suppression we had 100+ Linter warning in this file which | ||
* don't help anything. | ||
* | ||
* @noinspection PhpDocMissingThrowsInspection | ||
* @noinspection PhpUnhandledExceptionInspection | ||
*/ | ||
|
||
namespace Tests\Livewire\Pages; | ||
|
||
// use App\Livewire\Components\Modules\Maintenance\Cleaning; | ||
// use App\Livewire\Components\Modules\Maintenance\FixJobs; | ||
// use App\Livewire\Components\Modules\Maintenance\Optimize; | ||
// use App\Livewire\Components\Modules\Maintenance\Update; | ||
use App\Livewire\Components\Pages\Maintenance; | ||
use Livewire\Livewire; | ||
use Tests\Livewire\Base\BaseLivewireTest; | ||
|
||
class MaintenanceTest extends BaseLivewireTest | ||
{ | ||
public function testDiagnosticsLoggedOut(): void | ||
{ | ||
Livewire::test(Maintenance::class) | ||
->assertForbidden(); | ||
|
||
Livewire::actingAs($this->userMayUpload1)->test(Maintenance::class) | ||
->assertForbidden(); | ||
} | ||
|
||
public function testMaintenanceLogged(): void | ||
{ | ||
Livewire::actingAs($this->admin)->test(Maintenance::class) | ||
->assertViewIs('livewire.pages.maintenance') | ||
// ->assertSeeLivewire(Cleaning::class) | ||
// ->assertSeeLivewire(Optimize::class) | ||
// ->assertSeeLivewire(Update::class) | ||
// ->assertSeeLivewire(FixJobs::class) | ||
->assertSee('Maintenance'); | ||
|
||
Livewire::actingAs($this->admin)->test(Maintenance::class) | ||
->call('back') | ||
->assertDispatched('closeLeftMenu') | ||
->assertRedirect(route('livewire-gallery')); | ||
} | ||
} |