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


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx:
##########
@@ -295,165 +295,167 @@ export class DiskUsage extends 
React.Component<Record<string, object>, IDUState>
       keys.push('Entity Type');
       values.push(summaryResponse.type);
 
-      if (summaryResponse.countStats.type === 'KEY') {
-        const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`;
-        const { request: metadataRequest, controller: metadataNewController } 
= AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal);
-        cancelKeyMetadataSignal = metadataNewController;
-        metadataRequest.then(response => {
-          keys.push('File Size');
-          values.push(byteToSize(response.data.size, 3));
-          keys.push('File Size With Replication');
-          values.push(byteToSize(response.data.sizeWithReplica, 3));
-          console.log(values);
-
-          this.setState({
-            showPanel: true,
-            panelKeys: keys,
-            panelValues: values
+      if (summaryResponse.status !== 'INITIALIZING') {
+        if (summaryResponse.countStats.type === 'KEY') {
+          const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`;

Review Comment:
   Add comments to explain the purpose of the checks for `INITIALIZING` status. 
This will help future maintainers understand the rationale behind these 
conditions.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx:
##########
@@ -295,165 +295,167 @@ export class DiskUsage extends 
React.Component<Record<string, object>, IDUState>
       keys.push('Entity Type');
       values.push(summaryResponse.type);
 
-      if (summaryResponse.countStats.type === 'KEY') {
-        const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`;
-        const { request: metadataRequest, controller: metadataNewController } 
= AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal);
-        cancelKeyMetadataSignal = metadataNewController;
-        metadataRequest.then(response => {
-          keys.push('File Size');
-          values.push(byteToSize(response.data.size, 3));
-          keys.push('File Size With Replication');
-          values.push(byteToSize(response.data.sizeWithReplica, 3));
-          console.log(values);
-
-          this.setState({
-            showPanel: true,
-            panelKeys: keys,
-            panelValues: values
+      if (summaryResponse.status !== 'INITIALIZING') {
+        if (summaryResponse.countStats.type === 'KEY') {
+          const keyEndpoint = `/api/v1/namespace/du?path=${path}&replica=true`;
+          const { request: metadataRequest, controller: metadataNewController 
} = AxiosGetHelper(keyEndpoint, cancelKeyMetadataSignal);
+          cancelKeyMetadataSignal = metadataNewController;
+          metadataRequest.then(response => {
+            keys.push('File Size');
+            values.push(byteToSize(response.data.size, 3));
+            keys.push('File Size With Replication');
+            values.push(byteToSize(response.data.sizeWithReplica, 3));
+            console.log(values);
+
+            this.setState({
+              showPanel: true,
+              panelKeys: keys,
+              panelValues: values
+            });
+          }).catch(error => {
+            this.setState({
+              isLoading: false,
+              showPanel: false
+            });
+            showDataFetchError(error.toString());
           });
-        }).catch(error => {
-          this.setState({
-            isLoading: false,
-            showPanel: false
-          });
-          showDataFetchError(error.toString());
-        });
-        return;
-      }
+          return;
+        }
 
-      if (summaryResponse.countStats.status === 'PATH_NOT_FOUND') {
-        showDataFetchError(`Invalid Path: ${path}`);
-        return;
-      }
+        if (summaryResponse.countStats.status === 'PATH_NOT_FOUND') {
+          showDataFetchError(`Invalid Path: ${path}`);
+          return;
+        }
 
-      if (summaryResponse.countStats.numVolume !== -1) {
-        keys.push('Volumes');
-        values.push(summaryResponse.countStats.numVolume);
-      }
+        if (summaryResponse.countStats.numVolume !== -1) {
+          keys.push('Volumes');
+          values.push(summaryResponse.countStats.numVolume);
+        }
 
-      if (summaryResponse.countStats.numBucket !== -1) {
-        keys.push('Buckets');
-        values.push(summaryResponse.countStats.numBucket);
-      }
+        if (summaryResponse.countStats.numBucket !== -1) {
+          keys.push('Buckets');
+          values.push(summaryResponse.countStats.numBucket);
+        }
 
-      if (summaryResponse.countStats.numDir !== -1) {
-        keys.push('Total Directories');
-        values.push(summaryResponse.countStats.numDir);
-      }
+        if (summaryResponse.countStats.numDir !== -1) {
+          keys.push('Total Directories');
+          values.push(summaryResponse.countStats.numDir);
+        }
 
-      if (summaryResponse.countStats.numKey !== -1) {
-        keys.push('Total Keys');
-        values.push(summaryResponse.countStats.numKey);
-      }
+        if (summaryResponse.countStats.numKey !== -1) {
+          keys.push('Total Keys');
+          values.push(summaryResponse.countStats.numKey);
+        }
 
-      if (summaryResponse.objectInfo.bucketName && 
summaryResponse.objectInfo.bucketName !== -1) {
-        keys.push('Bucket Name');
-        values.push(summaryResponse.objectInfo.bucketName);
-      }
+        if (summaryResponse.objectInfo.bucketName && 
summaryResponse.objectInfo.bucketName !== -1) {
+          keys.push('Bucket Name');
+          values.push(summaryResponse.objectInfo.bucketName);
+        }
 
-      if (summaryResponse.objectInfo.bucketLayout && 
summaryResponse.objectInfo.bucketLayout !== -1) {
-        keys.push('Bucket Layout');
-        values.push(summaryResponse.objectInfo.bucketLayout);
-      }
+        if (summaryResponse.objectInfo.bucketLayout && 
summaryResponse.objectInfo.bucketLayout !== -1) {
+          keys.push('Bucket Layout');
+          values.push(summaryResponse.objectInfo.bucketLayout);
+        }
 
-      if (summaryResponse.objectInfo.creationTime && 
summaryResponse.objectInfo.creationTime !== -1) {
-        keys.push('Creation Time');
-        values.push(moment(summaryResponse.objectInfo.creationTime).format('ll 
LTS'));
-      }
+        if (summaryResponse.objectInfo.creationTime && 
summaryResponse.objectInfo.creationTime !== -1) {
+          keys.push('Creation Time');
+          
values.push(moment(summaryResponse.objectInfo.creationTime).format('ll LTS'));
+        }
 
-      if (summaryResponse.objectInfo.dataSize && 
summaryResponse.objectInfo.dataSize !== -1) {
-        keys.push('Data Size');
-        values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3));
-      }
+        if (summaryResponse.objectInfo.dataSize && 
summaryResponse.objectInfo.dataSize !== -1) {
+          keys.push('Data Size');
+          values.push(byteToSize(summaryResponse.objectInfo.dataSize, 3));
+        }
 
-      if (summaryResponse.objectInfo.encInfo && 
summaryResponse.objectInfo.encInfo !== -1) {
-        keys.push('ENC Info');
-        values.push(summaryResponse.objectInfo.encInfo);
-      }
+        if (summaryResponse.objectInfo.encInfo && 
summaryResponse.objectInfo.encInfo !== -1) {
+          keys.push('ENC Info');
+          values.push(summaryResponse.objectInfo.encInfo);
+        }
 
-      if (summaryResponse.objectInfo.fileName && 
summaryResponse.objectInfo.fileName !== -1) {
-        keys.push('File Name');
-        values.push(summaryResponse.objectInfo.fileName);
-      }
+        if (summaryResponse.objectInfo.fileName && 
summaryResponse.objectInfo.fileName !== -1) {
+          keys.push('File Name');

Review Comment:
   Can you please avoid these changes from the patch.



-- 
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