refactor: streamline data loading process in Statistics and overview views for improved performance

This commit is contained in:
2025-12-17 19:29:46 -05:00
parent e41c9d7eca
commit 801898e295
3 changed files with 93 additions and 126 deletions

View File

@@ -86,7 +86,7 @@
</div>
</div>
<div class="flex flex-col gap-1.5" wire:poll.{{ $fastPolling ? '2s' : '30s' }}="checkStatus"
<div class="flex flex-col gap-1.5" wire:init="checkStatus" wire:poll.{{ $fastPolling ? '2s' : '30s' }}="checkStatus"
wire:key="{{ $fastPolling ? 'fast' : 'slow' }}">
<div class="flex items-center gap-2.5 min-w-0 group">
<h1 class="text-2xl sm:text-3xl font-bold text-gray-900 dark:text-white break-words tracking-tight">Server Overview</h1>
@@ -342,7 +342,7 @@
@endphp
<!-- Resource Stats Grid -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 lg:gap-5">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 lg:gap-5" wire:loading.class="opacity-50" wire:target="checkStatus">
@foreach($resourceAllocations as $resource)
<div class="group bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-2xl shadow-sm hover:shadow-md hover:border-gray-300 dark:hover:border-gray-700 transition-all duration-200 p-4 lg:p-5">
<div class="flex items-start justify-between mb-4">
@@ -464,7 +464,7 @@
<div class="lte-card-body">
<div style="margin-bottom: 1rem;">
<label style="font-size: 0.875rem; font-weight: 600; display: block; margin-bottom: 0.5rem;">Hostname</label>
<input type="text" wire:model.defer="hostname" class="lte-form-control" placeholder="Enter hostname" />
<input type="text" wire:model.live.debounce.300ms="hostname" class="lte-form-control" placeholder="Enter hostname" />
</div>
@if($hostnameError)
<div class="lte-alert lte-alert-danger" style="font-size: 0.875rem;">{{ $hostnameError }}</div>
@@ -635,11 +635,11 @@
<div class="lte-card-body">
<div style="margin-bottom: 1rem;">
<label style="font-size: 0.875rem; font-weight: 600; display: block; margin-bottom: 0.5rem;">New Password</label>
<input type="password" wire:model.defer="password" class="lte-form-control" placeholder="Enter new password" />
<input type="password" wire:model.live.debounce.300ms="password" class="lte-form-control" placeholder="Enter new password" />
</div>
<div style="margin-bottom: 1rem;">
<label style="font-size: 0.875rem; font-weight: 600; display: block; margin-bottom: 0.5rem;">Confirm Password</label>
<input type="password" wire:model.defer="password_confirmation" class="lte-form-control" placeholder="Confirm password" />
<input type="password" wire:model.live.debounce.300ms="password_confirmation" class="lte-form-control" placeholder="Confirm password" />
</div>
@if($passwordError)
<div class="lte-alert lte-alert-danger" style="font-size: 0.875rem; margin-bottom: 1rem;">{{ $passwordError }}</div>
@@ -727,7 +727,7 @@
</p>
<div class="bg-info/10 border border-info/25 rounded-lg p-4 mb-4">
<p class="text-xs text-info font-semibold mb-2 opacity-90">
<x-ri-info-line class="inline size-3.5 mr-1" />
<x-ri-information-line class="inline size-3.5 mr-1" />
Important Note
</p>
<p class="text-xs text-gray-600 dark:text-gray-300 opacity-80">
@@ -1026,7 +1026,7 @@
<div class="flex flex-col gap-3 flex-1">
@if($isEditingNotes)
<div class="space-y-3 flex-1 flex flex-col">
<textarea wire:model="notes"
<textarea wire:model.live.debounce.500ms="notes"
class="bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-3 py-2 text-sm w-full resize-y flex-1 focus:outline-none focus:ring-2 focus:ring-primary/50 focus:border-primary transition-colors font-mono"
placeholder="Enter notes with Markdown support..."></textarea>
@if($notesError)