feat: Implement VM console access, display VM power state, and add VM statistics retrieval.
This commit is contained in:
@@ -66,6 +66,7 @@ class VirtualMachineController extends Controller
|
||||
if (!$vm) {
|
||||
return back()->withErrors('Invalid request.');
|
||||
}
|
||||
$vm->load('datacenter', 'host');
|
||||
$title = 'Edit Virtual Machine';
|
||||
return view('administrator.pages.package.vm.edit', compact('title', 'vm'));
|
||||
}
|
||||
@@ -137,10 +138,18 @@ class VirtualMachineController extends Controller
|
||||
->editColumn('updated_at', function ($d) {
|
||||
return $d->updated_at ? $d->updated_at->format('H:i:s d/m/Y') : '';
|
||||
})
|
||||
->editColumn('power_state', function ($d) {
|
||||
if ($d->power_state == 'POWERED_ON') {
|
||||
return '<span class="badge bg-success">Đang bật</span>';
|
||||
} elseif ($d->power_state == 'POWERED_OFF') {
|
||||
return '<span class="badge bg-secondary">Đang tắt</span>';
|
||||
}
|
||||
return $d->power_state ?? 'N/A';
|
||||
})
|
||||
->editColumn('datacenter.name', function ($d) {
|
||||
return $d->datacenter ? $d->datacenter->name . ' - ' . $d->datacenter->datacenter_id : 'N/A';
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->rawColumns(['action', 'power_state'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user