You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/10/11 19:40:36 UTC

[GitHub] [ozone] smengcl commented on a diff in pull request #3789: HDDS-7141. Recon: Improve Disk Usage Page

smengcl commented on code in PR #3789:
URL: https://github.com/apache/ozone/pull/3789#discussion_r992709434


##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx:
##########
@@ -152,26 +152,39 @@ export class DiskUsage extends React.Component<Record<string, object>, IDUState>
         subpaths.push(other);
       }
 
-      const pathLabels = subpaths.map(subpath => {
-        // The return subPath must be normalized in a format with
-        // a leading slash and without trailing slash
-        const pieces = subpath.path.split('/');
-        const subpathName = pieces[pieces.length - 1];
-        // Differentiate key without trailing slash
-        return (subpath.isKey || subpathName === OTHER_PATH_NAME) ? subpathName : subpathName + '/';
-      });
+      let pathLabels, values, percentage, sizeStr, pieces, subpathName;
+
+      if (duResponse.subPathCount === 0 || subpaths === 0) {
+        pieces = duResponse && duResponse.path.split('/');
+        subpathName = pieces[pieces.length - 1];
+        pathLabels = [subpathName];
+        values = [0.1];
+        percentage = [100.00];
+        sizeStr = [this.byteToSize(duResponse.size, 1)];
+      }
+      else {
+        pathLabels = subpaths.map(subpath => {
+          // The return subPath must be normalized in a format with
+          // a leading slash and without trailing slash
+          pieces = subpath.path.split('/');
+          subpathName = pieces[pieces.length - 1];
+          // Differentiate key without trailing slash
+          return (subpath.isKey || subpathName === OTHER_PATH_NAME) ? subpathName : subpathName + '/';
+        });
 
-      const values = subpaths.map(subpath => {
+      values = subpaths.map(subpath => {
         return subpath.size / dataSize;
       });
 
-      const percentage = values.map(value => {
+      percentage = values.map(value => {
         return (value * 100).toFixed(2);
       });
 
-      const sizeStr = subpaths.map(subpath => {
-        return this.byteToSize(subpath.size, 1);
-      });
+        sizeStr = subpaths.map(subpath => {
+          return this.byteToSize(subpath.size, 1);
+        }); 
+      }

Review Comment:
   nit: indentation



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.less:
##########
@@ -38,15 +38,46 @@
     margin-right: 25px;
   }
 
-  h3 {
-    display: inline-block;
-    padding-right: 5px;
+  .legendtext {
+    fill: rgba(0, 0, 0, 0.65) !important;
+    line-height: 1.5;
+    font-size: 16px !important;
+    font-feature-settings: 'tnum', "tnum";
+    font-variant: tabular-nums;
+  }
+
+  .gtitle {
+    font-size: 22px;
+    font-weight: 500 !important;
+    fill: rgba(0, 0, 0, 0.60) !important;
+    font-feature-settings: 'tnum', "tnum";
+    font-variant: tabular-nums;
+  }
+
+  .slicetext {
+    fill: rgba(0, 0, 0, 0.60) !important;
+    font-size: 17px !important;
+    line-height: 1.5;
+    font-feature-settings: 'tnum', "tnum";
+    font-variant: tabular-nums;
   }
 }
 
-.input {
+  .input {

Review Comment:
   nit: indentation. along with others like this
   ```suggestion
   .input {
   ```



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/index.less:
##########
@@ -19,14 +19,11 @@
 body {
   margin: 0;
   padding: 0;
-  font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI',
-    'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
-    'Helvetica Neue', sans-serif;
+  font-family: 'Roboto', sans-serif;

Review Comment:
   We should probably leave this untouched. And override this in the class's CSS instead if needed.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx:
##########
@@ -152,26 +152,39 @@ export class DiskUsage extends React.Component<Record<string, object>, IDUState>
         subpaths.push(other);
       }
 
-      const pathLabels = subpaths.map(subpath => {
-        // The return subPath must be normalized in a format with
-        // a leading slash and without trailing slash
-        const pieces = subpath.path.split('/');
-        const subpathName = pieces[pieces.length - 1];
-        // Differentiate key without trailing slash
-        return (subpath.isKey || subpathName === OTHER_PATH_NAME) ? subpathName : subpathName + '/';
-      });
+      let pathLabels, values, percentage, sizeStr, pieces, subpathName;
+
+      if (duResponse.subPathCount === 0 || subpaths === 0) {
+        pieces = duResponse && duResponse.path.split('/');
+        subpathName = pieces[pieces.length - 1];
+        pathLabels = [subpathName];
+        values = [0.1];

Review Comment:
   Why the value 0.1?



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx:
##########
@@ -409,30 +422,44 @@ export class DiskUsage extends React.Component<Record<string, object>, IDUState>
                 {(duResponse.size > 0) ?
                   ((duResponse.size > 0 && duResponse.subPathCount === 0) ?
                     <div style={{height: 800}}>
+                    <div  className='metadatainformation'>
                       <br/> {' '}
-                      <h3>This object is a key with a file size of {this.byteToSize(duResponse.size, 1)}.<br/> {' '}
                         You can also view its metadata details by clicking the top right button.
-                      </h3>
-                    </div> :
+                    </div>

Review Comment:
   Ditto Zita. We can safely remove the second line as well.



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/views/diskUsage/diskUsage.tsx:
##########
@@ -406,33 +419,32 @@ export class DiskUsage extends React.Component<Record<string, object>, IDUState>
                 </Col>
               </Row>
               <Row>
-                {(duResponse.size > 0) ?
-                  ((duResponse.size > 0 && duResponse.subPathCount === 0) ?
+                {(duResponse.size > 0)?
                     <div style={{height: 800}}>
+                    <div  className='metadatainformation'>

Review Comment:
   ```suggestion
                       <div className='metadatainformation'>
   ```



##########
hadoop-ozone/recon/src/main/resources/webapps/recon/ozone-recon-web/src/index.less:
##########
@@ -19,14 +19,11 @@
 body {
   margin: 0;
   padding: 0;
-  font-family: -apple-system, BlinkMacSystemFont, 'Roboto', 'Segoe UI',
-    'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans',
-    'Helvetica Neue', sans-serif;
+  font-family: 'Roboto', sans-serif;
   -webkit-font-smoothing: antialiased;
   -moz-osx-font-smoothing: grayscale;
 }
 
 code {
-  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
-    monospace;
+  font-family: 'Roboto', sans-serif;

Review Comment:
   `code` is supposed to use monospace fonts correct? Why change it to Roboto?



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org