ArafatKhan2198 commented on code in PR #10198:
URL: https://github.com/apache/ozone/pull/10198#discussion_r3218298695


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/containers/containers.tsx:
##########
@@ -64,6 +65,7 @@ const TAB_STATE_MAP: Record<string, string> = {
   '3': 'OVER_REPLICATED',
   '4': 'MIS_REPLICATED',
   '5': 'REPLICA_MISMATCH',
+  '6': 'QUASI_CLOSED',

Review Comment:
   TAB_STATE_MAP: The '6': 'QUASI_CLOSED' entry is removed. That map is only 
for building /api/v1/containers/unhealthy/{state} URLs for tabs 1–5. Tab 6 
never used that value in practice because it always calls /quasiClosed instead. 
Keeping it in the map was misleading. The flow is now: handle tabKey === '6' 
first (quasi-closed path), then if (!containerStateName) return for the Export 
tab and any unknown keys, then the unhealthy fetch for tabs 1–5.
   
   



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/v2/pages/containers/containers.tsx:
##########
@@ -272,20 +276,86 @@ const Containers: React.FC<{}> = () => {
   };
 
   // ── Container data fetching ───────────────────────────────────────────────
+
+  // Fetches the quasi-closed count independently to populate Highlights on 
page load.
+  const fetchQuasiClosedCount = async () => {
+    try {
+      const response = await fetchData<QuasiClosedContainersResponse>(
+        '/api/v1/containers/quasiClosed',
+        'GET',
+        { limit: 1, minContainerId: 0 }
+      );
+      setState(prev => ({
+        ...prev,
+        quasiClosedCount: response.quasiClosedCount ?? prev.quasiClosedCount,
+      }));
+    } catch (_) {
+      // Non-critical: count stays 0 until the tab is opened.
+    }
+  };
+
   const fetchTabData = async (
     tabKey: string,
     minContainerId: number,
     currentPageSize: number
   ) => {
     const containerStateName = TAB_STATE_MAP[tabKey];
-    if (!containerStateName) return; // skip Export tab (key='6') or unknown 
keys
+    if (!containerStateName) return; // skip Export tab (key='7') or unknown 
keys
     const fetchSize = currentPageSize + 1;
 
     setTabStates(prev => ({
       ...prev,
       [tabKey]: { ...prev[tabKey], loading: true },
     }));
 
+    if (tabKey === '6') {
+      // Quasi-closed tab uses its own dedicated in-memory endpoint.
+      try {
+        const response = await fetchData<QuasiClosedContainersResponse>(
+          '/api/v1/containers/quasiClosed',
+          'GET',
+          { limit: fetchSize, minContainerId }
+        );
+        const allContainers = response.containers ?? [];
+        const hasNextPage = allContainers.length > currentPageSize;
+        const pageContainers = allContainers.slice(0, currentPageSize);
+        // Map stateEnterTime → unhealthySince so the shared ContainerTable 
renders correctly.
+        const mapped = pageContainers.map(c => ({
+          ...c,
+          containerState: 'QUASI_CLOSED',
+          unhealthySince: c.stateEnterTime,

Review Comment:
   The inline spread + cast is replaced with a small toContainer(qc: 
QuasiClosedContainer): Container helper that maps every field explicitly, then 
const mapped: Container[] = pageContainers.map(toContainer). That way renames 
or shape changes on QuasiClosedContainer surface at compile time instead of 
silently breaking at runtime.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to