From: Laura Flores Date: Mon, 20 Sep 2021 06:49:53 +0000 (+0000) Subject: mgr/dashboard: add descriptive comments and variable names X-Git-Tag: v17.1.0~818^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=710307e4e932ebdbcaa673bce1c5892d041b2f42;p=ceph.git mgr/dashboard: add descriptive comments and variable names Signed-off-by: Laura Flores --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts index e40ba5190ad4..e316f9327d09 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/telemetry/telemetry.component.ts @@ -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; }