Browse Source

Merge pull request #14012 from GordonSmith/HPCC-24484

HPCC-24484 ECL Watch Disk Usage stat issue

Reviewed-By: Miguel Vazquez <miguel.vazquez@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 4 years ago
parent
commit
2fe1d92097
1 changed files with 7 additions and 4 deletions
  1. 7 4
      esp/src/src/DiskUsage.ts

+ 7 - 4
esp/src/src/DiskUsage.ts

@@ -20,6 +20,8 @@ interface CompontentT {
 
 type DetailsT = GetTargetClusterUsageEx.TargetClusterUsage | CompontentT;
 
+const calcPct = (val, tot) => Math.round((val / tot) * 100);
+
 export class Summary extends FlexGrid {
 
     private _loadingMsg;
@@ -118,7 +120,8 @@ export class Summary extends FlexGrid {
                                 details.rowCount++;
                                 details.inUse += du.InUse;
                                 details.total += du.Total;
-                                details.max = details.max < du.InUse ? du.InUse : details.max;
+                                const usage = calcPct(du.InUse, du.Total);
+                                details.max = details.max < usage ? usage : details.max;
                             });
                         });
                     });
@@ -136,9 +139,9 @@ export class Summary extends FlexGrid {
                         const totalMean = details.total / details.rowCount;
                         const inUseMean = details.inUse / details.rowCount;
                         this._usage[key].gauge
-                            .value((details.max / totalMean))
+                            .value(details.max / 100)
                             .valueDescription(nlsHPCC.Max)
-                            .tickValue((inUseMean / totalMean))
+                            .tickValue(inUseMean / totalMean)
                             .tickValueDescription(nlsHPCC.Mean)
                             .tooltip(key)
                             ;
@@ -182,7 +185,7 @@ export class Details extends Table {
         this._details.ComponentUsages.forEach(cu => {
             cu.MachineUsages.forEach(mu => {
                 mu.DiskUsages.forEach(du => {
-                    data.push([du.PercentUsed, cu.Name, du.Name, mu.NetAddress !== "." ? mu.NetAddress : mu.Name, du.Path, du.InUse, du.Total]);
+                    data.push([calcPct(du.InUse, du.Total), cu.Name, du.Name, mu.NetAddress !== "." ? mu.NetAddress : mu.Name, du.Path, du.InUse, du.Total]);
                 });
             });
         });