smitajoshi12 commented on code in PR #6535:
URL: https://github.com/apache/ozone/pull/6535#discussion_r1608515878


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx:
##########
@@ -144,20 +145,19 @@ export class DiskUsage extends 
React.Component<Record<string, object>, IDUState>
       const dataSize = duResponse.size;
       let subpaths: IDUSubpath[] = duResponse.subPaths;
 
-      subpaths.sort((a, b) => (a.size < b.size) ? 1 : -1);
-
       // Only show top n blocks with the most DU,
       // other blocks are merged as a single block
-      if (subpaths.length > limit) {
+      if (subpaths.length > limit || (subpaths.length > 0 && limit === 
MAX_DISPLAY_LIMIT)) {
         subpaths = subpaths.slice(0, limit);
         let topSize = 0;
-        for (let i = 0; i < limit; ++i) {
+        for (let i = 0; limit === MAX_DISPLAY_LIMIT ? i < subpaths.length : i 
< limit; ++i) {

Review Comment:
   @dombizita 
   
   If Limit=10 and subpath.length=5 then It will not enter in Outer If Condition
   5 > 10 it will become false
   if (subpaths.length > limit || (subpaths.length > 0 && limit === 
MAX_DISPLAY_LIMIT)) {
                 subpaths = subpaths.slice(0, limit);
                 let topSize = 0;
                 **for (let i = 0; limit === MAX_DISPLAY_LIMIT ? i < 
subpaths.length : i < limit; ++i)** {
                   topSize += subpaths[i].size;
                 }
                 const otherSize = dataSize - topSize;
                 if (otherSize > 0) {
                   const other: IDUSubpath = {path: OTHER_PATH_NAME, size: 
otherSize};
                   subpaths.push(other);
                 }
         }



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