improve dashboard

This commit is contained in:
Andras Bacsai 2023-10-11 10:08:37 +02:00
parent f943fdc5be
commit f001e9bc34
4 changed files with 10 additions and 35 deletions

View File

@ -11,19 +11,11 @@ class Dashboard extends Component
{ {
public $projects = []; public $projects = [];
public $servers = []; public $servers = [];
public int $s3s = 0;
public int $resources = 0;
public function mount() public function mount()
{ {
$this->servers = Server::ownedByCurrentTeam()->get(); $this->servers = Server::ownedByCurrentTeam()->get();
$this->s3s = S3Storage::ownedByCurrentTeam()->get()->count(); $this->projects = Project::ownedByCurrentTeam()->get();
$projects = Project::ownedByCurrentTeam()->get();
foreach ($projects as $project) {
$this->resources += $project->applications->count();
$this->resources += $project->postgresqls->count();
}
$this->projects = $projects;
} }
// public function getIptables() // public function getIptables()
// { // {

View File

@ -14,27 +14,7 @@
<span>Your subscription has been activated! Welcome onboard!</span> <span>Your subscription has been activated! Welcome onboard!</span>
</div> </div>
@endif @endif
<div class="w-full rounded stats stats-vertical lg:stats-horizontal">
<div class="stat">
<div class="stat-title">Servers</div>
<div class="stat-value">{{ $servers->count() }} </div>
</div>
<div class="stat">
<div class="stat-title">Projects</div>
<div class="stat-value">{{ $projects->count() }}</div>
</div>
<div class="stat">
<div class="stat-title">Resources</div>
<div class="stat-value">{{ $resources }}</div>
<div class="stat-desc">Applications, databases, etc...</div>
</div>
<div class="stat">
<div class="stat-title">S3 Storages</div>
<div class="stat-value">{{ $s3s }}</div>
</div>
</div>
<h3 class="pb-4">Projects</h3> <h3 class="pb-4">Projects</h3>
@if ($projects->count() === 1) @if ($projects->count() === 1)
@ -60,6 +40,10 @@
{{ $project->description }}</div> {{ $project->description }}</div>
</a> </a>
@endif @endif
<a class="mx-4 rounded group-hover:text-white hover:no-underline "
href="{{ route('project.resources.new', ['project_uuid' => data_get($project, 'uuid'), 'environment_name' => data_get($project, 'environments.0.name', 'production')]) }}">
<span class="font-bold hover:text-warning">+ New Resource</span>
</a>
<a class="mx-4 rounded group-hover:text-white" <a class="mx-4 rounded group-hover:text-white"
href="{{ route('project.edit', ['project_uuid' => data_get($project, 'uuid')]) }}"> href="{{ route('project.edit', ['project_uuid' => data_get($project, 'uuid')]) }}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon hover:text-warning" viewBox="0 0 24 24" <svg xmlns="http://www.w3.org/2000/svg" class="icon hover:text-warning" viewBox="0 0 24 24"
@ -108,11 +92,11 @@
</a> </a>
@endforeach @endforeach
</div> </div>
<script> <script>
function gotoProject(uuid) { function gotoProject(uuid) {
window.location.href = '/project/' + uuid; window.location.href = '/project/' + uuid;
} }
</script> </script>
{{-- <x-forms.button wire:click='getIptables'>Get IPTABLES</x-forms.button> --}} {{-- <x-forms.button wire:click='getIptables'>Get IPTABLES</x-forms.button> --}}
</div> </div>

View File

@ -65,8 +65,8 @@
@endif @endif
<div class="text-xs">{{ $application->status }}</div> <div class="text-xs">{{ $application->status }}</div>
</a> </a>
<a class="flex gap-2 p-1 mx-4 text-xs font-bold rounded hover:no-underline hover:text-warning" <a class="flex gap-2 p-1 mx-4 font-bold rounded group-hover:text-white hover:no-underline"
href="{{ route('project.service.logs', [...$parameters, 'service_name' => $application->name]) }}">Logs</a> href="{{ route('project.service.logs', [...$parameters, 'service_name' => $application->name]) }}"><span class="hover:text-warning">Logs</span></a>
</div> </div>
@endforeach @endforeach
@foreach ($databases as $database) @foreach ($databases as $database)
@ -94,8 +94,8 @@
@endif @endif
<div class="text-xs">{{ $database->status }}</div> <div class="text-xs">{{ $database->status }}</div>
</a> </a>
<a class="flex gap-2 p-1 mx-4 text-xs font-bold rounded hover:no-underline hover:text-warning" <a class="flex gap-2 p-1 mx-4 font-bold rounded hover:no-underline group-hover:text-white"
href="{{ route('project.service.logs', [...$parameters, 'service_name' => $database->name]) }}">Logs</a> href="{{ route('project.service.logs', [...$parameters, 'service_name' => $database->name]) }}"><span class="hover:text-warning">Logs</span></a>
</div> </div>
@endforeach @endforeach
</div> </div>

View File

@ -135,7 +135,6 @@ Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/force-password-reset', [Controller::class, 'force_passoword_reset'])->name('auth.force-password-reset'); Route::get('/force-password-reset', [Controller::class, 'force_passoword_reset'])->name('auth.force-password-reset');
}); });
Route::get('/subscription', SubscriptionShow::class)->name('subscription.index'); Route::get('/subscription', SubscriptionShow::class)->name('subscription.index');
// Route::get('/help', Help::class)->name('help');
Route::get('/settings', [Controller::class, 'settings'])->name('settings.configuration'); Route::get('/settings', [Controller::class, 'settings'])->name('settings.configuration');
Route::get('/settings/license', [Controller::class, 'license'])->name('settings.license'); Route::get('/settings/license', [Controller::class, 'license'])->name('settings.license');
Route::get('/profile', fn () => view('profile', ['request' => request()]))->name('profile'); Route::get('/profile', fn () => view('profile', ['request' => request()]))->name('profile');