diff --git a/frontend/src/components/BackendServers.js b/frontend/src/components/BackendServers.js index 0cdbbc4..22be498 100644 --- a/frontend/src/components/BackendServers.js +++ b/frontend/src/components/BackendServers.js @@ -112,6 +112,15 @@ const BackendServers = () => { }; useEffect(() => { + // CRITICAL FIX: Clear state when cluster changes to prevent showing other cluster's data + // Race condition: Old cluster data remains visible while new cluster data is fetching + if (selectedCluster) { + setBackends([]); + setFilteredBackends([]); + setFrontends([]); + setSslCertificates([]); + } + fetchBackends(); fetchFrontends(); fetchSSLCertificates(); @@ -1932,15 +1941,41 @@ const BackendServers = () => { placeholder="Select an SSL certificate (optional unless verify=required)" showSearch filterOption={(input, option) => - option.children.toLowerCase().includes(input.toLowerCase()) + (option.label || '').toLowerCase().includes(input.toLowerCase()) } + optionLabelProp="label" > - {sslCertificates.map((cert) => ( - - ))} + {sslCertificates.map((cert) => { + // Status icon based on certificate validity + const statusIcon = cert.status === 'valid' ? '✅' : + cert.status === 'expiring_soon' ? '⚠️' : '❌'; + const expiryInfo = cert.days_until_expiry !== undefined ? + `(${cert.days_until_expiry} days)` : ''; + const sslTypeTag = cert.ssl_type === 'Global' ? '🌍 Global' : '📍 Cluster'; + + return ( + + ); + })} diff --git a/frontend/src/components/DashboardV2.js b/frontend/src/components/DashboardV2.js index 8aca262..18f073b 100644 --- a/frontend/src/components/DashboardV2.js +++ b/frontend/src/components/DashboardV2.js @@ -399,6 +399,13 @@ const DashboardV2 = () => { useEffect(() => { if (!selectedCluster) return; + // CRITICAL FIX: Clear all dashboard state when cluster changes + setStatsData({}); + setFrontendOptions([]); + setBackendOptions([]); + setBackendHealth([]); + setSlowestBackends([]); + let isMounted = true; const loadInitialData = async () => { diff --git a/frontend/src/components/FrontendManagement.js b/frontend/src/components/FrontendManagement.js index 8436e51..81e7194 100644 --- a/frontend/src/components/FrontendManagement.js +++ b/frontend/src/components/FrontendManagement.js @@ -147,6 +147,15 @@ const FrontendManagement = () => { }; useEffect(() => { + // CRITICAL FIX: Clear state when cluster changes to prevent showing other cluster's data + // Race condition: Old cluster data remains visible while new cluster data is fetching + if (selectedCluster) { + setFrontends([]); + setFilteredFrontends([]); + setBackends([]); + setSslCertificates([]); + } + fetchFrontends(); fetchBackends(); fetchSSLCertificates(); diff --git a/frontend/src/components/WAFManagement.js b/frontend/src/components/WAFManagement.js index 78cc354..addc85d 100644 --- a/frontend/src/components/WAFManagement.js +++ b/frontend/src/components/WAFManagement.js @@ -274,6 +274,13 @@ const WAFManagement = () => { }; useEffect(() => { + // CRITICAL FIX: Clear state when cluster changes to prevent showing other cluster's data + if (selectedCluster) { + setRules([]); + setFilteredRules([]); + setFrontends([]); + } + fetchRules(); fetchStats(); checkPendingChanges();