更新资源积分

This commit is contained in:
zhanggangyong
2026-01-10 19:27:57 +00:00
parent 613dd08118
commit 51ea6b8310
45 changed files with 4366 additions and 7100 deletions
+12
View File
@@ -3341,9 +3341,19 @@ async def list_platform_agent_allocations(
result = await db.execute(query)
# 查询所有模板配置,用于获取管理员设置的CPU和内存
template_configs_result = await db.execute(select(PlatformAgentTemplateConfig))
template_configs = {config.template_name: config for config in template_configs_result.scalars().all()}
data = []
for quota, channel in result.all():
display_info = TEMPLATE_DISPLAY_INFO.get(quota.template_name, {})
# 从模板配置中获取管理员设置的CPU和内存限制
template_config = template_configs.get(quota.template_name)
cpu_limit = template_config.cpu_limit if template_config and template_config.cpu_limit else "100m"
memory_limit = template_config.memory_limit if template_config and template_config.memory_limit else "256Mi"
data.append({
"id": str(quota.id),
"channelId": str(quota.target_id),
@@ -3353,6 +3363,8 @@ async def list_platform_agent_allocations(
"podQuota": quota.pod_quota,
"podUsed": quota.pod_used,
"podRemaining": quota.pod_quota - quota.pod_used,
"cpuLimit": cpu_limit,
"memoryLimit": memory_limit,
"allocatedAt": quota.allocated_at.isoformat() if quota.allocated_at else None,
})