fix(gui): Fix devices passed to writer

Change-Type: patch
This commit is contained in:
Jonas Hermsmeier 2018-03-22 16:52:01 +01:00
parent 43d79ebd05
commit fecccb0b28
No known key found for this signature in database
GPG Key ID: 1B870F801A0CEE9F
2 changed files with 6 additions and 10 deletions

View File

@ -69,16 +69,14 @@ const getApplicationEntryPoint = () => {
* This function is extracted for testing purposes. * This function is extracted for testing purposes.
* *
* @param {String} image - image path * @param {String} image - image path
* @param {Array<Object>} drives - drives * @param {Array<String>} drives - drives
* @param {Function} onProgress - in progress callback (state) * @param {Function} onProgress - in progress callback (state)
* *
* @fulfil {Object} - flash results * @fulfil {Object} - flash results
* @returns {Promise} * @returns {Promise}
* *
* @example * @example
* imageWriter.performWrite('path/to/image.img', { * imageWriter.performWrite('path/to/image.img', [ '/dev/disk2' ], (state) => {
* device: '/dev/disk2'
* }, (state) => {
* console.log(state.percentage) * console.log(state.percentage)
* }) * })
*/ */
@ -138,7 +136,7 @@ exports.performWrite = (image, drives, onProgress) => {
ipc.server.on('ready', (data, socket) => { ipc.server.on('ready', (data, socket) => {
ipc.server.emit(socket, 'write', { ipc.server.emit(socket, 'write', {
imagePath: image, imagePath: image,
destinations: _.map(drives, [ 'device' ]), destinations: drives,
validateWriteOnSuccess: settings.get('validateWriteOnSuccess'), validateWriteOnSuccess: settings.get('validateWriteOnSuccess'),
unmountOnSuccess: settings.get('unmountOnSuccess'), unmountOnSuccess: settings.get('unmountOnSuccess'),
checksumAlgorithms: [ 'sha512' ] checksumAlgorithms: [ 'sha512' ]
@ -229,13 +227,11 @@ exports.performWrite = (image, drives, onProgress) => {
* This function will update `imageWriter.state` with the current writing state. * This function will update `imageWriter.state` with the current writing state.
* *
* @param {String} image - image path * @param {String} image - image path
* @param {Array<Object>} drives - drives * @param {Array<String>} drives - drives
* @returns {Promise} * @returns {Promise}
* *
* @example * @example
* imageWriter.flash('foo.img', [{ * imageWriter.flash('foo.img', [ '/dev/disk2' ]).then(() => {
* device: '/dev/disk2'
* }]).then(() => {
* console.log('Write completed!') * console.log('Write completed!')
* }) * })
*/ */

View File

@ -72,7 +72,7 @@ module.exports = function (
const iconPath = '../../../assets/icon.png' const iconPath = '../../../assets/icon.png'
imageWriter.flash(image.path, [ drive ]).then(() => { imageWriter.flash(image.path, [ drive.device ]).then(() => {
if (!flashState.wasLastFlashCancelled()) { if (!flashState.wasLastFlashCancelled()) {
notification.send('Success!', { notification.send('Success!', {
body: messages.info.flashComplete(path.basename(image.path), drive), body: messages.info.flashComplete(path.basename(image.path), drive),