You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/02/21 12:52:41 UTC
[46/52] [abbrv] kylin git commit: KYLIN-1423 fix HBase size precision
issue
KYLIN-1423 fix HBase size precision issue
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/5666d7f2
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/5666d7f2
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/5666d7f2
Branch: refs/heads/1.x-HBase1.1.3
Commit: 5666d7f238529529a1091063474ad8e39327013d
Parents: b1fe5ea
Author: janzhongi <ji...@ebay.com>
Authored: Wed Feb 17 16:23:08 2016 +0800
Committer: janzhongi <ji...@ebay.com>
Committed: Wed Feb 17 16:23:31 2016 +0800
----------------------------------------------------------------------
webapp/app/js/filters/filter.js | 19 +++++++++++++++----
webapp/app/partials/cubes/cube_detail.html | 4 ++--
2 files changed, 17 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/5666d7f2/webapp/app/js/filters/filter.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/filters/filter.js b/webapp/app/js/filters/filter.js
index 2cf8114..5fd664e 100755
--- a/webapp/app/js/filters/filter.js
+++ b/webapp/app/js/filters/filter.js
@@ -83,20 +83,31 @@ KylinApp
.filter('bytes', function () {
return function (bytes, precision) {
if (bytes === 0) {
- return '0 bytes'
+ return 'N/A';
}
- ;
if (isNaN(parseFloat(bytes)) || !isFinite(bytes)) {
return '-';
}
if (typeof precision === 'undefined') {
- precision = 1;
+ precision = 3;
}
var units = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB'],
number = Math.floor(Math.log(bytes) / Math.log(1024));
- return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
+ switch(number){
+ case 0:
+ precision = 0;
+ break;
+ case 1:
+ case 2:
+ precision = 3;
+ break;
+ default:
+ precision = 5;
+ }
+
+ return Math.round((bytes / Math.pow(1024, Math.floor(number)))*Math.pow(10,precision))/Math.pow(10,precision) + ' ' + units[number];
}
}).filter('resizePieHeight', function () {
return function (item) {
http://git-wip-us.apache.org/repos/asf/kylin/blob/5666d7f2/webapp/app/partials/cubes/cube_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cube_detail.html b/webapp/app/partials/cubes/cube_detail.html
index 41f9275..81dbf46 100755
--- a/webapp/app/partials/cubes/cube_detail.html
+++ b/webapp/app/partials/cubes/cube_detail.html
@@ -106,14 +106,14 @@
<h5><b>HTable:</b> {{table.tableName}}</h5>
<ul>
<li>Region Count: <span class="red">{{table.regionCount}}</span></li>
- <li>Size: <span class="red">{{table.tableSize | bytes:2}}</span></li>
+ <li>Size: <span class="red">{{table.tableSize | bytes}}</span></li>
<li>Start Time: <span class="red">{{table.dateRangeStart | reverseToGMT0}}</span></li>
<li>End Time: <span class="red">{{table.dateRangeEnd | reverseToGMT0}}</span></li>
</ul>
</div>
<div ng-if="cube.hbase">
<div class="hr hr8 hr-double hr-dotted"></div>
- <h5><b>Total Size:</b> <span class="red">{{cube.totalSize | bytes:2}}</span></h5>
+ <h5><b>Total Size:</b> <span class="red">{{cube.totalSize | bytes}}</span></h5>
<h5><b>Total Number:</b> <span class="red">{{cube.hbase.length}}</span></h5>
</div>
<div ng-if="cube.hbase.length == 0">