fix(snapshots): send required node param and add storage-support hint
useCreateSnapshot omitted the required ?node= query param, so creation failed with a 422. Pass node through, and add a UI hint plus a clear error message when the VM storage does not support snapshots. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -215,12 +215,12 @@ export function useSnapshots(serverId: number, vmid: number, type: string, node:
|
||||
});
|
||||
}
|
||||
|
||||
export function useCreateSnapshot(serverId: number, vmid: number, type: string) {
|
||||
export function useCreateSnapshot(serverId: number, vmid: number, type: string, node: string) {
|
||||
const qc = useQueryClient();
|
||||
const prefix = type === 'lxc' ? 'container' : 'vm';
|
||||
return useMutation({
|
||||
mutationFn: (body: { snapname: string; description?: string; vmstate?: boolean }) =>
|
||||
apiClient.post(`/proxmox/api/${serverId}/${prefix}/${vmid}/snapshots`, body),
|
||||
apiClient.post(`/proxmox/api/${serverId}/${prefix}/${vmid}/snapshots?node=${node}`, body),
|
||||
onSuccess: () => {
|
||||
qc.invalidateQueries({ queryKey: vmKeys.snapshots(serverId, vmid) });
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user