revert(nodes): remove server auto-setup feature
All checks were successful
Backend Tests / pytest (Python 3.12) (push) Successful in 1m35s
Deploy to Production / Trigger production update (push) Successful in 8s

Drop the /api/servers/auto-setup endpoint, the AutoSetupDialog UI and the
useAutoSetupServer hook. Rename the auto_setup locale strings to
auto_create_token. Also normalize the storages response to an array.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 22:18:38 +05:00
parent 493814f44f
commit f18ba4d597
6 changed files with 15 additions and 378 deletions

View File

@@ -68,7 +68,9 @@ export function useClusterTopology() {
export function useStorages(serverId: number, node: string) {
return useQuery({
queryKey: nodeKeys.storages(serverId, node),
queryFn: () => apiClient.get<unknown[]>(`/proxmox/api/${serverId}/storages?node=${node}`),
queryFn: () => apiClient
.get<{ storages: unknown[] } | unknown[]>(`/proxmox/api/${serverId}/storages?node=${node}`)
.then(r => Array.isArray(r) ? r : (r as { storages: unknown[] }).storages),
enabled: serverId > 0 && !!node,
});
}
@@ -146,38 +148,6 @@ export function useClusterInfo(serverId: number) {
});
}
export interface AutoSetupArgs {
name: string;
hostname?: string;
ip_address: string;
port?: number;
api_user?: string;
password: string;
verify_ssl?: boolean;
description?: string;
}
export interface AutoSetupResult {
cluster?: boolean;
nodes_count?: number;
servers?: Array<{ name: string; node: string; ip: string; status: string }>;
message?: string;
}
// Add a server by password — the backend auto-creates an API token.
export function useAutoSetupServer() {
const qc = useQueryClient();
return useMutation({
mutationFn: (data: AutoSetupArgs) => apiClient.post<AutoSetupResult>('/proxmox/api/servers/auto-setup', data),
onSuccess: () => {
qc.invalidateQueries({ queryKey: nodeKeys.servers });
qc.invalidateQueries({ queryKey: nodeKeys.topology });
qc.invalidateQueries({ queryKey: vmKeys.all });
qc.invalidateQueries({ queryKey: vmKeys.resourcesAll });
},
});
}
// ==================== Node network interfaces ====================
export function useNodeNetworks(serverId: number, node: string) {