diff --git a/build/css/main.css b/build/css/main.css index 5e202182..abf17de3 100644 --- a/build/css/main.css +++ b/build/css/main.css @@ -5938,6 +5938,10 @@ html { margin-top: 15px; margin-bottom: 15px; } +.space-vertical-small { + margin-top: 10px; + margin-bottom: 10px; } + .space-top-medium { margin-top: 15px; } @@ -5951,6 +5955,32 @@ html { .space-right-tiny { margin-right: 5px; } +/* + * Copyright 2016 Resin.io + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +.label { + font-size: 11px; + font-weight: normal; + padding: 8px 25px; } + +.label-default { + background-color: #3e4147; + color: #919191; } + .label-default > b { + color: #f2f2f2; } + /* * Copyright 2016 Resin.io * @@ -6428,6 +6458,9 @@ button.btn:focus, button.progress-button:focus { .page-settings .checkbox input[type="checkbox"]:not(:checked) + * { color: #ddd; } +.monospace { + font-family: monospace; } + .icon-caption { margin-top: 10px; } .icon-caption[disabled] { @@ -6436,6 +6469,9 @@ button.btn:focus, button.progress-button:focus { .block { display: block; } +.inline-block { + display: inline-block; } + body { letter-spacing: 1px; } diff --git a/lib/cli/etcher.js b/lib/cli/etcher.js index 872c5fa2..cd3dba41 100644 --- a/lib/cli/etcher.js +++ b/lib/cli/etcher.js @@ -85,26 +85,25 @@ form.run([ } }); -}).then(function(success) { +}).then(function(results) { if (options.robot) { - console.log(`done ${success}`); + console.log(`done ${results.passedValidation} ${results.sourceChecksum}`); } else if (options.ipc) { process.send({ command: 'done', - data: { - success: success - } + data: results }); } else { - if (success) { + if (results.passedValidation) { console.log('Your flash is complete!'); + console.log(`Checksum: ${results.sourceChecksum}`); } else { console.error('Validation failed!'); } } - if (success) { + if (results.passedValidation) { process.exit(EXIT_CODES.SUCCESS); } else { process.exit(EXIT_CODES.VALIDATION_ERROR); @@ -114,6 +113,11 @@ form.run([ if (options.robot) { console.error(error.message); + } else if (options.ipc) { + process.send({ + command: 'error', + data: error + }); } else { utils.printError(error); } diff --git a/lib/gui/app.js b/lib/gui/app.js index 7d87a5e4..74da7f61 100644 --- a/lib/gui/app.js +++ b/lib/gui/app.js @@ -258,16 +258,18 @@ app.controller('AppController', function( device: drive.device }); - return self.writer.flash(image, drive).then(function(success) { + return self.writer.flash(image, drive).then(function(results) { // TODO: Find a better way to manage flash/check // success/error state than a global boolean flag. - self.success = success; + self.success = results.passedValidation; if (self.success) { OSNotificationService.send('Success!', 'Your flash is complete'); AnalyticsService.logEvent('Done'); - $state.go('success'); + $state.go('success', { + checksum: results.sourceChecksum + }); } else { OSNotificationService.send('Oops!', 'Looks like your flash has failed'); AnalyticsService.logEvent('Validation error'); diff --git a/lib/gui/modules/image-writer.js b/lib/gui/modules/image-writer.js index eff56bf2..a89f4653 100644 --- a/lib/gui/modules/image-writer.js +++ b/lib/gui/modules/image-writer.js @@ -106,7 +106,7 @@ imageWriter.service('ImageWriterService', function($q, $timeout, SettingsModel, * @param {Object} drive - drive * @param {Function} onProgress - in progress callback (state) * - * @fulfil {Boolean} - whether the operation succeeded + * @fulfil {Object} - flash results * @returns {Promise} * * @example @@ -165,23 +165,30 @@ imageWriter.service('ImageWriterService', function($q, $timeout, SettingsModel, }); child.on('message', function(message) { - if (message.command === 'progress') { - return onProgress(message.data); + switch (message.command) { + case 'progress': { + onProgress(message.data); + break; + } + + case 'done': { + resolve(message.data); + break; + } + + case 'error': { + reject(message.data); + break; + } } }); child.on('error', reject); child.on('close', function(code) { - if (code === EXIT_CODES.SUCCESS) { - return resolve(true); + if (code !== EXIT_CODES.SUCCESS && code !== EXIT_CODES.VALIDATION_ERROR) { + return reject(new Error(`Child process exitted with error code: ${code}`)); } - - if (code === EXIT_CODES.VALIDATION_ERROR) { - return resolve(false); - } - - return reject(new Error(`Child process exitted with error code: ${code}`)); }); }); }; @@ -197,6 +204,7 @@ imageWriter.service('ImageWriterService', function($q, $timeout, SettingsModel, * @param {String} image - image path * @param {Object} drive - drive * + * @fulfil {Object} flash results * @returns {Promise} * * @example diff --git a/lib/gui/pages/finish/controllers/finish.js b/lib/gui/pages/finish/controllers/finish.js index 822f43bb..9e5ad0a7 100644 --- a/lib/gui/pages/finish/controllers/finish.js +++ b/lib/gui/pages/finish/controllers/finish.js @@ -16,7 +16,7 @@ 'use strict'; -module.exports = function($state, SelectionStateModel, ImageWriterService, AnalyticsService, SettingsModel) { +module.exports = function($state, $stateParams, SelectionStateModel, ImageWriterService, AnalyticsService, SettingsModel) { /** * @summary Settings data @@ -25,6 +25,13 @@ module.exports = function($state, SelectionStateModel, ImageWriterService, Analy */ this.settings = SettingsModel.data; + /** + * @summary Route params + * @type Object + * @public + */ + this.params = $stateParams; + /** * @summary Restart the flashing process * @function diff --git a/lib/gui/pages/finish/finish.js b/lib/gui/pages/finish/finish.js index 10bd8d8e..42b1c9d7 100644 --- a/lib/gui/pages/finish/finish.js +++ b/lib/gui/pages/finish/finish.js @@ -41,7 +41,7 @@ FinishPage.controller('FinishController', require('./controllers/finish')); FinishPage.config(function($stateProvider) { $stateProvider .state('success', { - url: '/success', + url: '/success/:checksum', controller: 'FinishController as finish', templateUrl: './pages/finish/templates/success.tpl.html' }); diff --git a/lib/gui/pages/finish/templates/success.tpl.html b/lib/gui/pages/finish/templates/success.tpl.html index d5a29e56..896dbe5e 100644 --- a/lib/gui/pages/finish/templates/success.tpl.html +++ b/lib/gui/pages/finish/templates/success.tpl.html @@ -2,9 +2,9 @@
Safely ejected and ready for use
+Safely ejected and ready for use
-