diff --git a/lib/gui/app/models/store.js b/lib/gui/app/models/store.js index f005f263..341df642 100644 --- a/lib/gui/app/models/store.js +++ b/lib/gui/app/models/store.js @@ -56,8 +56,6 @@ const verifyNoNilFields = (object, fields, name) => { * @private */ const flashStateNoNilFields = [ - 'percentage', - 'eta', 'speed', 'totalSpeed' ] @@ -94,8 +92,8 @@ const DEFAULT_STATE = Immutable.fromJS({ successful: 0, failed: 0, percentage: 0, - speed: 0, - totalSpeed: 0 + speed: null, + totalSpeed: null } }) @@ -255,18 +253,6 @@ const storeReducer = (state = DEFAULT_STATE, action) => { }) } - if (!utils.isValidPercentage(action.data.percentage)) { - throw errors.createError({ - title: `Invalid state percentage: ${action.data.percentage}` - }) - } - - if (!_.isNumber(action.data.eta)) { - throw errors.createError({ - title: `Invalid state eta: ${action.data.eta}` - }) - } - return state.set('flashState', Immutable.fromJS(action.data)) } diff --git a/lib/gui/app/modules/progress-status.js b/lib/gui/app/modules/progress-status.js index 57d60536..6e2dae99 100644 --- a/lib/gui/app/modules/progress-status.js +++ b/lib/gui/app/modules/progress-status.js @@ -18,6 +18,7 @@ const settings = require('../models/settings') const utils = require('../../../shared/utils') +const units = require('../../../shared/units') /** * @summary Make the progress status subtitle string @@ -58,7 +59,11 @@ exports.fromFlashState = (state) => { return 'Finishing...' } else if (isFlashing) { - return `${state.percentage}% Flashing` + if (state.percentage != null) { + return `${state.percentage}% Flashing` + } else { + return `${units.bytesToClosestUnit(state.position)} flashed` + } } else if (isValidating) { return `${state.percentage}% Validating` } else if (!isFlashing && !isValidating) { diff --git a/lib/gui/app/os/window-progress.js b/lib/gui/app/os/window-progress.js index dcc8bccf..0053cc69 100644 --- a/lib/gui/app/os/window-progress.js +++ b/lib/gui/app/os/window-progress.js @@ -90,7 +90,9 @@ exports.currentWindow = electron.remote.getCurrentWindow() * }) */ exports.set = (state) => { - exports.currentWindow.setProgressBar(utils.percentageToFloat(state.percentage)) + if (state.percentage != null) { + exports.currentWindow.setProgressBar(utils.percentageToFloat(state.percentage)) + } exports.currentWindow.setTitle(getWindowTitle(state)) } diff --git a/lib/gui/app/pages/main/templates/main.tpl.html b/lib/gui/app/pages/main/templates/main.tpl.html index 684f8a60..dd181600 100644 --- a/lib/gui/app/pages/main/templates/main.tpl.html +++ b/lib/gui/app/pages/main/templates/main.tpl.html @@ -133,9 +133,9 @@ -