Merge pull request #2131 from resin-io/fix-device-pass

fix(gui): Fix devices passed to writer
This commit is contained in:
Jonas Hermsmeier 2018-03-22 18:12:53 +01:00 committed by GitHub
commit 8bd9ff58c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 10 deletions

View File

@ -69,16 +69,14 @@ const getApplicationEntryPoint = () => {
* This function is extracted for testing purposes.
*
* @param {String} image - image path
* @param {Array<Object>} drives - drives
* @param {Array<String>} 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<Object>} drives - drives
* @param {Array<String>} drives - drives
* @returns {Promise}
*
* @example
* imageWriter.flash('foo.img', [{
* device: '/dev/disk2'
* }]).then(() => {
* imageWriter.flash('foo.img', [ '/dev/disk2' ]).then(() => {
* console.log('Write completed!')
* })
*/

View File

@ -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),