feat: tune premium squads visual in web app

This commit is contained in:
3252a8
2026-05-11 00:15:29 +03:00
parent 57821ba2a9
commit b759ddb0f5
8 changed files with 311 additions and 59 deletions
+32
View File
@@ -606,6 +606,24 @@ class PanelApiService:
logging.error("Failed to get internal squads. Response: %s", response_data)
return None
async def get_internal_squad(self, squad_uuid: str) -> Optional[Dict[str, Any]]:
response_data = await self._request(
"GET", f"/internal-squads/{squad_uuid}", log_full_response=False
)
if response_data and not response_data.get("error") and "response" in response_data:
response = response_data.get("response")
if isinstance(response, dict):
inner = response.get("internalSquad") or response.get("squad")
if isinstance(inner, dict):
return inner
return response
logging.error(
"Failed to get internal squad %s. Response: %s",
squad_uuid,
response_data,
)
return None
async def get_internal_squad_accessible_nodes(
self,
squad_uuid: str,
@@ -634,6 +652,20 @@ class PanelApiService:
)
return None
async def get_hosts(self) -> Optional[List[Dict[str, Any]]]:
response_data = await self._request("GET", "/hosts", log_full_response=False)
if response_data and not response_data.get("error") and "response" in response_data:
response = response_data.get("response")
if isinstance(response, list):
return response
if isinstance(response, dict):
for key in ("hosts", "items", "data"):
value = response.get(key)
if isinstance(value, list):
return value
logging.error("Failed to get hosts. Response: %s", response_data)
return None
async def reset_user_traffic(self, user_uuid: str) -> bool:
endpoint = f"/users/{user_uuid}/actions/reset-traffic"
response_data = await self._request("POST", endpoint, log_full_response=False)