diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 7051b3b..50d9bda 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -106,7 +106,12 @@ public function index(Request $request) if ($tab === "applications") { $applications = $servers->flatMap(fn(YnhServer $server) => $server->applications); } - return view('home.index', compact('tab', 'servers', 'orders', 'users', 'invitations', 'memory_usage', 'disk_usage', 'security_events', 'interdependencies', 'traces', 'pendingActions', 'domains', 'applications')); + + $backups = collect(); + if ($tab === 'backups') { + $backups = $servers->flatMap(fn(YnhServer $server) => $server->backups); + } + return view('home.index', compact('tab', 'servers', 'orders', 'users', 'invitations', 'memory_usage', 'disk_usage', 'security_events', 'interdependencies', 'traces', 'pendingActions', 'domains', 'applications', 'backups')); } private function memoryUsage(Collection $servers): Collection diff --git a/resources/views/home/cards/_towerify_backups.blade.php b/resources/views/home/cards/_towerify_backups.blade.php new file mode 100644 index 0000000..84db5c6 --- /dev/null +++ b/resources/views/home/cards/_towerify_backups.blade.php @@ -0,0 +1,97 @@ +@if(Auth::user()->canListServers()) + +
+
+
+

+ {{ __('Backups') }} +

+
+
+ + @if($backups->isEmpty()) +
+
+
+ None. +
+
+
+ @else +
+ + + + + + + + + + + + @foreach($backups->sortByDesc('updated_at') as $backup) + + + + + + + + + + + @endforeach + +
{{ __('Date') }}{{ __('Server') }}{{ __('Name') }}{{ __('Size') }}
+ {{ $backup->updated_at->format('Y-m-d H:i:s') }} + + {{ $backup->server->name }} + + {{ $backup->name }} + + {{ formatBytes($backup->size) }} + + @if($server->isReady() && Auth::user()->canManageServers()) + + + + @endif +
+ @foreach($backup->result['apps'] as $app => $status) + @if($status === 'Success') + {{ $app }} + @else + {{ $app }} + @endif + @endforeach +
+
+ @endif +
+ +@endif \ No newline at end of file diff --git a/resources/views/home/index.blade.php b/resources/views/home/index.blade.php index 6b94d5b..3ed6f71 100644 --- a/resources/views/home/index.blade.php +++ b/resources/views/home/index.blade.php @@ -6,6 +6,8 @@ {{ __('My Apps') }} @elseif($tab === 'servers') {{ __('Servers') }} + @elseif($tab === 'backups') + {{ __('Backups') }} @elseif($tab === 'domains') {{ __('Domains') }} @elseif($tab === 'applications') @@ -52,6 +54,14 @@ @endif @if(Auth::user()->canListServers()) + + @endif + @if(Auth::user()->canListServers())