ATLAS-3582: UI: Show comma formatted numbers in System Details "memory panel" of Statistics popup
diff --git a/dashboardv2/public/js/utils/CommonViewFunction.js b/dashboardv2/public/js/utils/CommonViewFunction.js
index a151fa1..facaee7 100644
--- a/dashboardv2/public/js/utils/CommonViewFunction.js
+++ b/dashboardv2/public/js/utils/CommonViewFunction.js
@@ -81,6 +81,7 @@
formatIntVal = options.formatIntVal,
showListCount = options.showListCount || true,
highlightString = options.highlightString,
+ formatStringVal = options.formatStringVal,
numberFormat = options.numberFormat || _.numberFormatWithComa;
var table = "",
@@ -102,7 +103,16 @@
if ((_.isNumber(val) || !_.isNaN(parseInt(val))) && formatIntVal) {
return numberFormat(val);
} else {
- return getHighlightedString(val);
+ var newVal = val;
+ if (formatStringVal) {
+ newVal = parseInt(val);
+ if (newVal === NaN) {
+ newVal = val;
+ } else {
+ newVal = numberFormat(newVal);
+ }
+ }
+ return getHighlightedString(newVal);
}
} else {
return "N/A";
diff --git a/dashboardv2/public/js/views/site/Statistics.js b/dashboardv2/public/js/views/site/Statistics.js
index fcee124..0329e04 100644
--- a/dashboardv2/public/js/views/site/Statistics.js
+++ b/dashboardv2/public/js/views/site/Statistics.js
@@ -382,6 +382,7 @@
if (!_.isEmpty(systemMemoryData)) {
var memoryTable = CommonViewFunction.propertyTable({
scope: this,
+ formatStringVal: true,
valueObject: systemMemoryData
});
that.ui.memoryCard.html(
diff --git a/dashboardv3/public/js/utils/CommonViewFunction.js b/dashboardv3/public/js/utils/CommonViewFunction.js
index b2b96ab..c99bbf4 100644
--- a/dashboardv3/public/js/utils/CommonViewFunction.js
+++ b/dashboardv3/public/js/utils/CommonViewFunction.js
@@ -81,6 +81,7 @@
formatIntVal = options.formatIntVal,
showListCount = options.showListCount || true,
highlightString = options.highlightString,
+ formatStringVal = options.formatStringVal,
numberFormat = options.numberFormat || _.numberFormatWithComa;
var table = "",
@@ -102,7 +103,16 @@
if ((_.isNumber(val) || !_.isNaN(parseInt(val))) && formatIntVal) {
return numberFormat(val);
} else {
- return getHighlightedString(val);
+ var newVal = val;
+ if (formatStringVal) {
+ newVal = parseInt(val);
+ if (newVal === NaN) {
+ newVal = val;
+ } else {
+ newVal = numberFormat(newVal);
+ }
+ }
+ return getHighlightedString(newVal);
}
} else {
return "N/A";
diff --git a/dashboardv3/public/js/views/site/Statistics.js b/dashboardv3/public/js/views/site/Statistics.js
index fcee124..0329e04 100644
--- a/dashboardv3/public/js/views/site/Statistics.js
+++ b/dashboardv3/public/js/views/site/Statistics.js
@@ -382,6 +382,7 @@
if (!_.isEmpty(systemMemoryData)) {
var memoryTable = CommonViewFunction.propertyTable({
scope: this,
+ formatStringVal: true,
valueObject: systemMemoryData
});
that.ui.memoryCard.html(