Skip to content

Commit 5ddc92e

Browse files
committed
JBDS-4388 Humanize download progress and size for on install page
1 parent 2e5a362 commit 5ddc92e

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

browser/pages/install/controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import Logger from '../../services/logger';
44
import duration from 'humanize-duration';
5+
import humanize from 'humanize';
56

67
class InstallController {
78
constructor($scope, $timeout, installerDataSvc) {
@@ -155,7 +156,7 @@ class ProgressState {
155156
}
156157

157158
this.current = Math.round(this.currentAmount / this.totalSize * 100);
158-
this.label = this.sizeInKB(this.currentAmount) + ' / ' + this.sizeInKB(this.totalSize) + ' KB (' + this.current + '%), ' + this.durationFormat(remaining) + ' left';
159+
this.label = this.sizeInKB(this.currentAmount) + ' / ' + this.sizeInKB(this.totalSize) + ' (' + this.current + '%), ' + this.durationFormat(remaining) + ' left';
159160
this.$timeout(()=>this.$scope.$apply());
160161
}
161162
}
@@ -191,7 +192,7 @@ class ProgressState {
191192
}
192193

193194
sizeInKB(amount) {
194-
return Math.round(amount / 1024);
195+
return humanize.filesize(amount);
195196
}
196197
}
197198

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"fs-extra": "2.1.2",
4040
"glob": "7.1.1",
4141
"globby": "6.1.0",
42+
"humanize": "0.0.9",
4243
"humanize-duration": "3.10.0",
4344
"mkdirp": "^0.5.1",
4445
"patternfly": "3.23.2",

test/unit/pages/install/controller-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ describe('Install controller', function() {
223223
});
224224
it('lable value', function() {
225225
expect(progress.label).to.have.string(
226-
progress.sizeInKB(progress.currentAmount) + ' / ' + progress.sizeInKB(progress.totalSize) + ' KB (' + progress.current + '%)'
226+
progress.sizeInKB(progress.currentAmount) + ' / ' + progress.sizeInKB(progress.totalSize) + ' (' + progress.current + '%)'
227227
);
228228
});
229229
it('calls angular async update', function() {

0 commit comments

Comments
 (0)