Fix: Translate all remaining Portuguese text to English in routes, services and frontend

This commit is contained in:
2025-09-25 20:40:52 -03:00
parent cceb0a92b8
commit f8279933d6
4 changed files with 36 additions and 36 deletions

View File

@@ -1,5 +1,5 @@
"""
Rotas da API
API Routes
"""
import logging
from typing import List, Optional
@@ -37,7 +37,7 @@ async def get_cluster_status(
k8s_client=Depends(get_k8s_client),
prometheus_client=Depends(get_prometheus_client)
):
"""Obter status geral do cluster"""
"""Get overall cluster status"""
try:
# Coletar dados básicos
pods = await k8s_client.get_all_pods()
@@ -52,7 +52,7 @@ async def get_cluster_status(
# Obter informações de overcommit
overcommit_info = await prometheus_client.get_cluster_overcommit()
# Obter recomendações VPA
# Get VPA recommendations
vpa_recommendations = await k8s_client.get_vpa_recommendations()
# Generate report
@@ -76,7 +76,7 @@ async def get_namespace_status(
k8s_client=Depends(get_k8s_client),
prometheus_client=Depends(get_prometheus_client)
):
"""Obter status de um namespace específico"""
"""Get status of a specific namespace"""
try:
# Coletar dados do namespace
namespace_resources = await k8s_client.get_namespace_resources(namespace)
@@ -109,7 +109,7 @@ async def get_pods(
namespace: Optional[str] = None,
k8s_client=Depends(get_k8s_client)
):
"""Listar pods com informações de recursos"""
"""List pods with resource information"""
try:
if namespace:
namespace_resources = await k8s_client.get_namespace_resources(namespace)
@@ -129,7 +129,7 @@ async def get_validations(
page_size: int = 50,
k8s_client=Depends(get_k8s_client)
):
"""Listar validações de recursos com paginação"""
"""List resource validations with pagination"""
try:
# Coletar pods
if namespace:
@@ -178,7 +178,7 @@ async def get_validations_by_namespace(
include_system_namespaces: bool = False,
k8s_client=Depends(get_k8s_client)
):
"""Listar validações agrupadas por namespace com paginação"""
"""List validations grouped by namespace with pagination"""
try:
# Coletar todos os pods com filtro de namespaces do sistema
pods = await k8s_client.get_all_pods(include_system_namespaces=include_system_namespaces)
@@ -196,7 +196,7 @@ async def get_validations_by_namespace(
"severity_breakdown": {"error": 0, "warning": 0}
}
# Agrupar validações por pod
# Group validations by pod
if pod.name not in namespace_validations[pod.namespace]["pods"]:
namespace_validations[pod.namespace]["pods"][pod.name] = {
"pod_name": pod.name,
@@ -214,7 +214,7 @@ async def get_validations_by_namespace(
for validation in pod_validations:
namespace_validations[pod.namespace]["severity_breakdown"][validation.severity] += 1
# Converter para lista e ordenar por total de validações
# Convert to list and sort by total validations
namespace_list = list(namespace_validations.values())
namespace_list.sort(key=lambda x: x["total_validations"], reverse=True)
@@ -243,7 +243,7 @@ async def get_vpa_recommendations(
namespace: Optional[str] = None,
k8s_client=Depends(get_k8s_client)
):
"""Obter recomendações do VPA"""
"""Get VPA recommendations"""
try:
recommendations = await k8s_client.get_vpa_recommendations()
@@ -348,7 +348,7 @@ async def apply_recommendation(
recommendation: ApplyRecommendationRequest,
k8s_client=Depends(get_k8s_client)
):
"""Aplicar recomendação de recursos"""
"""Apply resource recommendation"""
try:
# TODO: Implementar aplicação de recomendações
# Por enquanto, apenas simular
@@ -374,7 +374,7 @@ async def get_historical_validations(
time_range: str = "24h",
k8s_client=Depends(get_k8s_client)
):
"""Obter validações com análise histórica do Prometheus"""
"""Get validations with historical analysis from Prometheus"""
try:
validation_service = ValidationService()
@@ -408,7 +408,7 @@ async def get_historical_validations(
async def get_cluster_historical_summary(
time_range: str = "24h"
):
"""Obter resumo histórico do cluster"""
"""Get cluster historical summary"""
try:
historical_service = HistoricalAnalysisService()
summary = await historical_service.get_cluster_historical_summary(time_range)

View File

@@ -131,7 +131,7 @@ class ReportService:
problems[problem_type] = []
problems[problem_type].append(validation)
# Generate recommendations específicas
# Generate specific recommendations
if "missing_requests" in problems:
count = len(problems["missing_requests"])
recommendations.append(
@@ -148,12 +148,12 @@ class ReportService:
if "invalid_ratio" in problems:
count = len(problems["invalid_ratio"])
recommendations.append(
f"Ajustar ratio limit:request para {count} containers"
f"Adjust limit:request ratio for {count} containers"
)
if "overcommit" in problems:
recommendations.append(
"Resolver overcommit de recursos no namespace"
"Resolve resource overcommit in namespace"
)
return recommendations

View File

@@ -1,5 +1,5 @@
"""
Serviço de validação de recursos seguindo best practices Red Hat
Resource validation service following Red Hat best practices
"""
import logging
from typing import List, Dict, Any
@@ -13,7 +13,7 @@ from app.services.historical_analysis import HistoricalAnalysisService
logger = logging.getLogger(__name__)
class ValidationService:
"""Serviço para validação de recursos"""
"""Service for resource validation"""
def __init__(self):
self.cpu_ratio = settings.cpu_limit_ratio
@@ -23,7 +23,7 @@ class ValidationService:
self.historical_analysis = HistoricalAnalysisService()
def validate_pod_resources(self, pod: PodResource) -> List[ResourceValidation]:
"""Validar recursos de um pod"""
"""Validate pod resources"""
validations = []
for container in pod.containers:
@@ -39,7 +39,7 @@ class ValidationService:
pod: PodResource,
time_range: str = '24h'
) -> List[ResourceValidation]:
"""Validar recursos de um pod incluindo análise histórica"""
"""Validate pod resources including historical analysis"""
# Validações estáticas
static_validations = self.validate_pod_resources(pod)
@@ -60,7 +60,7 @@ class ValidationService:
namespace: str,
container: Dict[str, Any]
) -> List[ResourceValidation]:
"""Validar recursos de um container"""
"""Validate container resources"""
validations = []
resources = container.get("resources", {})
requests = resources.get("requests", {})
@@ -90,7 +90,7 @@ class ValidationService:
recommendation="Define limits to avoid excessive resource consumption"
))
# 3. Validar ratio limit:request
# 3. Validate limit:request ratio
if requests and limits:
cpu_validation = self._validate_cpu_ratio(
pod_name, namespace, container["name"], requests, limits
@@ -104,7 +104,7 @@ class ValidationService:
if memory_validation:
validations.append(memory_validation)
# 4. Validar valores mínimos
# 4. Validate minimum values
if requests:
min_validation = self._validate_minimum_values(
pod_name, namespace, container["name"], requests
@@ -121,7 +121,7 @@ class ValidationService:
requests: Dict[str, str],
limits: Dict[str, str]
) -> ResourceValidation:
"""Validar ratio CPU limit:request"""
"""Validate CPU limit:request ratio"""
if "cpu" not in requests or "cpu" not in limits:
return None
@@ -166,7 +166,7 @@ class ValidationService:
requests: Dict[str, str],
limits: Dict[str, str]
) -> ResourceValidation:
"""Validar ratio memória limit:request"""
"""Validate memory limit:request ratio"""
if "memory" not in requests or "memory" not in limits:
return None
@@ -210,7 +210,7 @@ class ValidationService:
container_name: str,
requests: Dict[str, str]
) -> List[ResourceValidation]:
"""Validar valores mínimos de requests"""
"""Validate minimum request values"""
validations = []
# Validar CPU mínima
@@ -286,7 +286,7 @@ class ValidationService:
namespace_resources: NamespaceResources,
node_capacity: Dict[str, str]
) -> List[ResourceValidation]:
"""Validar overcommit em um namespace"""
"""Validate overcommit in a namespace"""
validations = []
# Calcular total de requests do namespace
@@ -328,7 +328,7 @@ class ValidationService:
return validations
def generate_recommendations(self, validations: List[ResourceValidation]) -> List[str]:
"""Gerar recomendações baseadas nas validações"""
"""Generate recommendations based on validations"""
recommendations = []
# Agrupar validações por tipo

View File

@@ -741,7 +741,7 @@
updateStats(data);
showSuccess('Cluster status loaded successfully. Loading analysis...');
// Carregar automaticamente as validações após o scan inicial
// Automatically load validations after initial scan
await loadValidationsByNamespace();
} catch (error) {
@@ -1029,9 +1029,9 @@
let html = '';
// Botão anterior
html += `<button onclick="loadPage(${pagination.page - 1})" ${pagination.page <= 1 ? 'disabled' : ''}>Anterior</button>`;
html += `<button onclick="loadPage(${pagination.page - 1})" ${pagination.page <= 1 ? 'disabled' : ''}>Previous</button>`;
// Páginas
// Pages
const startPage = Math.max(1, pagination.page - 2);
const endPage = Math.min(pagination.total_pages, pagination.page + 2);
@@ -1055,11 +1055,11 @@
}
// Botão próximo
html += `<button onclick="loadPage(${pagination.page + 1})" ${pagination.page >= pagination.total_pages ? 'disabled' : ''}>Próximo</button>`;
html += `<button onclick="loadPage(${pagination.page + 1})" ${pagination.page >= pagination.total_pages ? 'disabled' : ''}>Next</button>`;
// Informações da paginação
html += `<div class="pagination-info">
Página ${pagination.page} de ${pagination.total_pages}
Page ${pagination.page} of ${pagination.total_pages}
(${pagination.total} namespaces)
</div>`;
@@ -1151,7 +1151,7 @@
displayHistoricalSummary(summaryData.summary);
}
// Carregar validações históricas
// Load historical validations
const params = new URLSearchParams({
time_range: timeRange
});
@@ -1180,7 +1180,7 @@
const container = document.getElementById('historicalSummary');
if (!summary || Object.keys(summary).length === 0) {
container.innerHTML = '<p>Não foi possível obter dados históricos do Prometheus.</p>';
container.innerHTML = '<p>Unable to get historical data from Prometheus.</p>';
return;
}
@@ -1266,7 +1266,7 @@
</div>
<div class="validation-message">${validation.message}</div>
<div class="validation-recommendation">
<strong>Recomendação:</strong> ${validation.recommendation}
<strong>Recommendation:</strong> ${validation.recommendation}
</div>
</div>
`).join('')}