]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: add descriptive comments and variable names
authorLaura Flores <lflores@redhat.com>
Mon, 20 Sep 2021 06:49:53 +0000 (06:49 +0000)
committerLaura Flores <lflores@redhat.com>
Mon, 20 Sep 2021 06:49:53 +0000 (06:49 +0000)
Signed-off-by: Laura Flores <lflores@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts

index e40ba5190ad424bbec5deaf8ea5dda880e23c4e1..e316f9327d0901d3d449a6790c517cc3ade55df8 100644 (file)
@@ -88,14 +88,20 @@ export class TelemetryComponent extends CdForm implements OnInit {
     this.configForm = this.formBuilder.group(controlsConfig);
   }
 
+  // Helper function used in createPreviewForm to display the ranges and values of `osd_perf_histograms`
+  // horizontally instead of vertically.
   private replacer(key: string, value: any) {
+    // Detect either the 'ranges' or 'values' 2D array (arr_2d), both of which
+    // need to be displayed horizontally. This will be done by converting the inner arrays
+    // of the 2D array into strings.
     if ((key === 'ranges' || key === 'values') && Array.isArray(value)) {
-      const x = [];
+      const arr_2d = [];
       for (let i = 0; i < value.length; i++) {
-        x.push(JSON.stringify(value[i]));
+        arr_2d.push(JSON.stringify(value[i]));
       }
-      return x;
+      return arr_2d;
     }
+    // Else, just return the value as is, without any formatting.
     return value;
   }