feat: improve setup wizard UX, add cluster sync error handling, and conditional demo data seeding
Add SEED_DEMO_DATA environment variable to control demo data population, enhance setup wizard with welcome screen and theme toggle, add smooth animations for wizard transitions, improve dashboard endpoint to return structured objects for last_syncs and faulty_nodes instead of raw models, implement comprehensive error handling in cluster sync with failed status tracking and audit logging, fix Proxmox provider
This commit is contained in:
@@ -8,20 +8,28 @@ from app.services.providers.base import Provider, ProviderConnection
|
||||
class ProxmoxProvider(Provider):
|
||||
name = "proxmox"
|
||||
|
||||
def auth_header(self, token: str) -> str:
|
||||
token = token.strip()
|
||||
if token.startswith("PVEAPIToken="):
|
||||
return token
|
||||
return f"PVEAPIToken={token}"
|
||||
|
||||
async def test_connection(self, connection: ProviderConnection) -> dict[str, Any]:
|
||||
headers = {"Authorization": self.auth_header(connection.token)}
|
||||
async with httpx.AsyncClient(verify=connection.verify_tls, timeout=10) as client:
|
||||
response = await client.get(
|
||||
f"{connection.api_url.rstrip('/')}/api2/json/version",
|
||||
headers={"Authorization": connection.token},
|
||||
headers=headers,
|
||||
)
|
||||
response.raise_for_status()
|
||||
return response.json().get("data", {})
|
||||
|
||||
async def sync_inventory(self, connection: ProviderConnection) -> dict[str, list[dict[str, Any]]]:
|
||||
headers = {"Authorization": self.auth_header(connection.token)}
|
||||
async with httpx.AsyncClient(verify=connection.verify_tls, timeout=20) as client:
|
||||
resources = await client.get(
|
||||
f"{connection.api_url.rstrip('/')}/api2/json/cluster/resources",
|
||||
headers={"Authorization": connection.token},
|
||||
headers=headers,
|
||||
)
|
||||
resources.raise_for_status()
|
||||
data = resources.json().get("data", [])
|
||||
@@ -32,10 +40,11 @@ class ProxmoxProvider(Provider):
|
||||
return {"nodes": nodes, "workloads": workloads, "networks": networks}
|
||||
|
||||
async def list_networks(self, connection: ProviderConnection) -> list[dict[str, Any]]:
|
||||
headers = {"Authorization": self.auth_header(connection.token)}
|
||||
async with httpx.AsyncClient(verify=connection.verify_tls, timeout=20) as client:
|
||||
resources = await client.get(
|
||||
f"{connection.api_url.rstrip('/')}/api2/json/cluster/resources",
|
||||
headers={"Authorization": connection.token},
|
||||
headers=headers,
|
||||
)
|
||||
resources.raise_for_status()
|
||||
data = resources.json().get("data", [])
|
||||
@@ -53,4 +62,3 @@ class ProxmoxProvider(Provider):
|
||||
if connection.read_only:
|
||||
return {"applied": False, "reason": "Cluster is read-only", "rules": rules}
|
||||
return {"applied": False, "reason": "Apply adapter intentionally requires explicit implementation", "rules": rules}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user