From fecccb0b28a923229c6b3bfeb4388f46e148482e Mon Sep 17 00:00:00 2001 From: Jonas Hermsmeier Date: Thu, 22 Mar 2018 16:52:01 +0100 Subject: [PATCH] fix(gui): Fix devices passed to writer Change-Type: patch --- lib/gui/app/modules/image-writer.js | 14 +++++--------- lib/gui/app/pages/main/controllers/flash.js | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/gui/app/modules/image-writer.js b/lib/gui/app/modules/image-writer.js index b17781e0..86451b00 100644 --- a/lib/gui/app/modules/image-writer.js +++ b/lib/gui/app/modules/image-writer.js @@ -69,16 +69,14 @@ const getApplicationEntryPoint = () => { * This function is extracted for testing purposes. * * @param {String} image - image path - * @param {Array} drives - drives + * @param {Array} drives - drives * @param {Function} onProgress - in progress callback (state) * * @fulfil {Object} - flash results * @returns {Promise} * * @example - * imageWriter.performWrite('path/to/image.img', { - * device: '/dev/disk2' - * }, (state) => { + * imageWriter.performWrite('path/to/image.img', [ '/dev/disk2' ], (state) => { * console.log(state.percentage) * }) */ @@ -138,7 +136,7 @@ exports.performWrite = (image, drives, onProgress) => { ipc.server.on('ready', (data, socket) => { ipc.server.emit(socket, 'write', { imagePath: image, - destinations: _.map(drives, [ 'device' ]), + destinations: drives, validateWriteOnSuccess: settings.get('validateWriteOnSuccess'), unmountOnSuccess: settings.get('unmountOnSuccess'), checksumAlgorithms: [ 'sha512' ] @@ -229,13 +227,11 @@ exports.performWrite = (image, drives, onProgress) => { * This function will update `imageWriter.state` with the current writing state. * * @param {String} image - image path - * @param {Array} drives - drives + * @param {Array} drives - drives * @returns {Promise} * * @example - * imageWriter.flash('foo.img', [{ - * device: '/dev/disk2' - * }]).then(() => { + * imageWriter.flash('foo.img', [ '/dev/disk2' ]).then(() => { * console.log('Write completed!') * }) */ diff --git a/lib/gui/app/pages/main/controllers/flash.js b/lib/gui/app/pages/main/controllers/flash.js index d991266b..ad15c032 100644 --- a/lib/gui/app/pages/main/controllers/flash.js +++ b/lib/gui/app/pages/main/controllers/flash.js @@ -72,7 +72,7 @@ module.exports = function ( const iconPath = '../../../assets/icon.png' - imageWriter.flash(image.path, [ drive ]).then(() => { + imageWriter.flash(image.path, [ drive.device ]).then(() => { if (!flashState.wasLastFlashCancelled()) { notification.send('Success!', { body: messages.info.flashComplete(path.basename(image.path), drive),