From 162af739e44ee6908a8a630a053b3716a145f528 Mon Sep 17 00:00:00 2001 From: andersonid Date: Wed, 1 Oct 2025 16:12:21 -0300 Subject: [PATCH] Fix Namespace Analysis code duplication - Remove duplicate createNamespaceDetails() function - Fix validation.rule_name to validation.validation_type - Keep only showNamespaceDetailsSimple() function - Eliminate redundant code in namespace analysis modal - Improve code maintainability and reduce duplication --- app/static/index.html | 74 +------------------------------------------ 1 file changed, 1 insertion(+), 73 deletions(-) diff --git a/app/static/index.html b/app/static/index.html index b597ec1..cdefcb1 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -1181,78 +1181,6 @@ showNamespaceDetailsSimple(namespaceName); } - // Create detailed HTML for namespace issues - function createNamespaceDetails(namespace) { - let html = ` -
-

📋 ${namespace.namespace} - Detailed Analysis

-
-

Pods: ${Object.keys(namespace.pods || {}).length}

-

Total Issues: ${namespace.total_validations || 0}

-

Severity Breakdown:

-
    -
  • Errors: ${namespace.severity_breakdown?.error || 0}
  • -
  • Warnings: ${namespace.severity_breakdown?.warning || 0}
  • -
  • Info: ${namespace.severity_breakdown?.info || 0}
  • -
-
-
-

🔍 Pod Analysis

- `; - - // Add details for each pod - Object.values(namespace.pods || {}).forEach(pod => { - html += ` -
-
📦 ${pod.pod_name}
-

Status: ${pod.phase}

-

Node: ${pod.node_name}

-
-
Containers:
- `; - - pod.containers.forEach(container => { - const hasRequests = Object.keys(container.resources?.requests || {}).length > 0; - const hasLimits = Object.keys(container.resources?.limits || {}).length > 0; - - html += ` -
-

${container.name} (${container.image})

-

Requests: ${hasRequests ? JSON.stringify(container.resources.requests) : '❌ Not defined'}

-

Limits: ${hasLimits ? JSON.stringify(container.resources.limits) : '❌ Not defined'}

-
- `; - }); - - html += ` -
-
-
Issues Found:
- `; - - pod.validations.forEach(validation => { - const severityClass = `severity-${validation.severity}`; - html += ` -
-

${validation.rule_name}: ${validation.message}

-

Recommendation: ${validation.recommendation}

-
- `; - }); - - html += ` -
-
- `; - }); - - html += ` -
-
- `; - - return html; - } // Show namespace details in modal function showNamespaceDetailsSimple(namespaceName) { @@ -1336,7 +1264,7 @@ const severityClass = `severity-${validation.severity}`; content += `
-

${validation.rule_name}: ${validation.message}

+

${validation.validation_type}: ${validation.message}

Recommendation: ${validation.recommendation}

`;