Enhance Proxmox components with input validation, error handling, and UI improvements
This commit is contained in:
@@ -78,6 +78,12 @@ class Overview extends Component
|
||||
|
||||
protected function fetchGraphData(string $graphType, string $timeRange, string $aggregation)
|
||||
{
|
||||
$allowedRanges = ['hour', 'day', 'week', 'month', 'year'];
|
||||
$allowedAggs = ['average', 'maximum'];
|
||||
if (!in_array($timeRange, $allowedRanges, true) || !in_array($aggregation, $allowedAggs, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$cacheKey = 'proxmox-stats-' . $this->server->id . '-' . $graphType . '-' . $timeRange . '-' . $aggregation;
|
||||
$data = Cache::remember($cacheKey, 60, function () use ($timeRange, $aggregation) {
|
||||
$proxmox = new Proxmox;
|
||||
@@ -507,9 +513,10 @@ class Overview extends Component
|
||||
try {
|
||||
$proxmox = new Proxmox;
|
||||
|
||||
// Save notes to Proxmox VM description
|
||||
// Save notes to Proxmox VM description (limit to 8KB to avoid bloating Proxmox config)
|
||||
$notes = mb_substr($this->notes ?? '', 0, 8192);
|
||||
$proxmox->request('/nodes/' . $this->server->node->name . '/qemu/' . $this->server->vm_id . '/config', 'put', [
|
||||
'description' => $this->notes ?? '',
|
||||
'description' => $notes,
|
||||
]);
|
||||
|
||||
$this->notify('Notes saved successfully', 'success');
|
||||
|
||||
Reference in New Issue
Block a user