Add AdminLTE-style CSS framework to app.css
- Introduced AdminLTE CSS variables for color palette, body colors, card styles, and button styles. - Implemented card components with variants for primary, success, warning, danger, and info. - Added button styles including sizes and outline variants. - Created form controls, select inputs, and input groups with consistent styling. - Included utility classes for text and background colors, gradients, and shadows. - Developed components for badges, alerts, callouts, progress bars, tables, small boxes, and info boxes. - Integrated modal, dropdown, spinner, tooltip, and direct chat styles. - Established timeline and close button styles, with dark mode support for specific components.
This commit is contained in:
@@ -60,6 +60,64 @@ class Overview extends Component
|
||||
} catch (\Exception $e) {
|
||||
$this->notes = '';
|
||||
}
|
||||
|
||||
// Preload Statistics telemetry data in background to warm the cache
|
||||
// This ensures when user navigates to Statistics page, data is already available
|
||||
$this->preloadStatisticsData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Preload statistics data to warm the cache for faster Statistics page loading.
|
||||
* Runs as a non-blocking background operation using dispatch_async if available,
|
||||
* otherwise falls back to synchronous cache warming.
|
||||
*/
|
||||
protected function preloadStatisticsData(): void
|
||||
{
|
||||
// Only preload if cache is empty (don't waste resources if already cached)
|
||||
$graphTypes = ['cpu', 'memory', 'network', 'disk'];
|
||||
$timeRange = 'hour';
|
||||
$aggregation = 'average';
|
||||
|
||||
foreach ($graphTypes as $graphType) {
|
||||
$cacheKey = 'proxmox-stats-' . $this->server->id . '-' . $graphType . '-' . $timeRange . '-' . $aggregation;
|
||||
|
||||
// Skip if already cached
|
||||
if (Cache::has($cacheKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Warm the cache in background
|
||||
try {
|
||||
Cache::remember($cacheKey, 30, function () use ($timeRange, $aggregation) {
|
||||
$proxmox = new Proxmox;
|
||||
$stats = $proxmox->request('/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/rrddata', data: [
|
||||
'timeframe' => $timeRange,
|
||||
'cf' => $aggregation === 'maximum' ? 'MAX' : 'AVERAGE',
|
||||
]);
|
||||
|
||||
$rawData = $stats->json()['data'] ?? [];
|
||||
|
||||
// Limit data points to prevent memory issues (same logic as Statistics)
|
||||
$maxPoints = 40;
|
||||
if (count($rawData) > $maxPoints) {
|
||||
$step = ceil(count($rawData) / $maxPoints);
|
||||
$sampledData = [];
|
||||
for ($i = 0; $i < count($rawData); $i += $step) {
|
||||
$sampledData[] = $rawData[$i];
|
||||
}
|
||||
if (end($rawData) !== end($sampledData)) {
|
||||
$sampledData[] = end($rawData);
|
||||
}
|
||||
return $sampledData;
|
||||
}
|
||||
|
||||
return $rawData;
|
||||
});
|
||||
} catch (\Throwable $e) {
|
||||
// Silently fail - this is just a preload optimization
|
||||
\Log::debug('Overview: Stats preload failed for ' . $graphType, ['error' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function checkStatus()
|
||||
|
||||
Reference in New Issue
Block a user