diff --git a/lib/gui/modules/error.js b/lib/gui/modules/error.js index ef50ab9f56..298713cd92 100644 --- a/lib/gui/modules/error.js +++ b/lib/gui/modules/error.js @@ -21,6 +21,7 @@ */ const angular = require('angular'); +const _ = require('lodash'); const MODULE_NAME = 'Etcher.Modules.Error'; const error = angular.module(MODULE_NAME, [ @@ -41,6 +42,10 @@ error.service('ErrorService', function(AnalyticsService, OSDialogService) { * ErrorService.reportException(new Error('Something happened')); */ this.reportException = (exception) => { + if (_.isUndefined(exception)) { + return; + } + OSDialogService.showError(exception, exception.description); AnalyticsService.logException(exception); }; diff --git a/lib/gui/pages/main/controllers/main.js b/lib/gui/pages/main/controllers/main.js index af8066e901..f5e172f9c2 100644 --- a/lib/gui/pages/main/controllers/main.js +++ b/lib/gui/pages/main/controllers/main.js @@ -22,6 +22,7 @@ module.exports = function( FlashStateModel, SettingsModel, TooltipModalService, + ErrorService, OSOpenExternalService ) { @@ -31,7 +32,6 @@ module.exports = function( this.state = FlashStateModel; this.settings = SettingsModel; this.external = OSOpenExternalService; - this.tooltipModal = TooltipModalService; /** * @summary Determine if the image step should be disabled @@ -65,4 +65,21 @@ module.exports = function( return !SelectionStateModel.hasImage() || this.shouldImageStepBeDisabled(); }; + /** + * @summary Display a tooltip with the selected image details + * @function + * @public + * + * @returns {Promise} + * + * @example + * MainController.showSelectedImageDetails() + */ + this.showSelectedImageDetails = () => { + return TooltipModalService.show({ + title: 'Image File Name', + message: SelectionStateModel.getImagePath() + }).catch(ErrorService.reportException); + }; + }; diff --git a/lib/gui/pages/main/main.js b/lib/gui/pages/main/main.js index a57d7de8fa..4bbe40c23c 100644 --- a/lib/gui/pages/main/main.js +++ b/lib/gui/pages/main/main.js @@ -25,9 +25,12 @@ const angular = require('angular'); const MODULE_NAME = 'Etcher.Pages.Main'; +require('angular-moment'); + const MainPage = angular.module(MODULE_NAME, [ + 'angularMoment', + require('angular-ui-router'), - require('angular-moment'), require('angular-middle-ellipses'), require('angular-seconds-to-date'), diff --git a/lib/gui/pages/main/templates/main.tpl.html b/lib/gui/pages/main/templates/main.tpl.html index 5a285a3108..508ec78da4 100644 --- a/lib/gui/pages/main/templates/main.tpl.html +++ b/lib/gui/pages/main/templates/main.tpl.html @@ -62,10 +62,7 @@
=1.5.3 <2.0.0", - "resolved": "https://registry.npmjs.org/angular/-/angular-1.5.7.tgz" + "version": "1.6.1", + "from": "angular@>=1.6.1 <2.0.0", + "resolved": "https://registry.npmjs.org/angular/-/angular-1.6.1.tgz" }, "angular-if-state": { "version": "1.0.0", @@ -13,9 +13,9 @@ "resolved": "https://registry.npmjs.org/angular-if-state/-/angular-if-state-1.0.0.tgz", "dependencies": { "angular-ui-router": { - "version": "0.3.1", - "from": "angular-ui-router@>=0.3.1 <0.4.0", - "resolved": "https://registry.npmjs.org/angular-ui-router/-/angular-ui-router-0.3.1.tgz" + "version": "0.4.2", + "from": "angular-ui-router@>=0.4.2 <0.5.0", + "resolved": "https://registry.npmjs.org/angular-ui-router/-/angular-ui-router-0.4.2.tgz" } } }, @@ -25,9 +25,9 @@ "resolved": "https://registry.npmjs.org/angular-middle-ellipses/-/angular-middle-ellipses-1.0.0.tgz" }, "angular-moment": { - "version": "1.0.0-beta.6", - "from": "angular-moment@>=1.0.0-beta.6 <2.0.0", - "resolved": "https://registry.npmjs.org/angular-moment/-/angular-moment-1.0.0-beta.6.tgz" + "version": "1.0.1", + "from": "angular-moment@1.0.1", + "resolved": "https://registry.npmjs.org/angular-moment/-/angular-moment-1.0.1.tgz" }, "angular-seconds-to-date": { "version": "1.0.0", @@ -35,14 +35,14 @@ "resolved": "https://registry.npmjs.org/angular-seconds-to-date/-/angular-seconds-to-date-1.0.0.tgz" }, "angular-ui-bootstrap": { - "version": "1.3.3", - "from": "angular-ui-bootstrap@>=1.3.2 <2.0.0", - "resolved": "https://registry.npmjs.org/angular-ui-bootstrap/-/angular-ui-bootstrap-1.3.3.tgz" + "version": "2.5.0", + "from": "angular-ui-bootstrap@>=2.5.0 <2.6.0", + "resolved": "https://registry.npmjs.org/angular-ui-bootstrap/-/angular-ui-bootstrap-2.5.0.tgz" }, "angular-ui-router": { - "version": "0.2.18", - "from": "angular-ui-router@>=0.2.18 <0.3.0", - "resolved": "https://registry.npmjs.org/angular-ui-router/-/angular-ui-router-0.2.18.tgz" + "version": "0.4.2", + "from": "angular-ui-router@>=0.4.2 <0.5.0", + "resolved": "https://registry.npmjs.org/angular-ui-router/-/angular-ui-router-0.4.2.tgz" }, "ansi-escapes": { "version": "1.4.0", diff --git a/package.json b/package.json index f8cbb8f44b..1e09818206 100644 --- a/package.json +++ b/package.json @@ -61,13 +61,13 @@ "removedrive": "^1.1.1" }, "dependencies": { - "angular": "^1.5.3", + "angular": "^1.6.1", "angular-if-state": "^1.0.0", "angular-middle-ellipses": "^1.0.0", - "angular-moment": "^1.0.0-beta.6", + "angular-moment": "^1.0.1", "angular-seconds-to-date": "^1.0.0", - "angular-ui-bootstrap": "^1.3.2", - "angular-ui-router": "^0.2.18", + "angular-ui-bootstrap": "^2.5.0", + "angular-ui-router": "^0.4.2", "archive-type": "^3.2.0", "bluebird": "^3.0.5", "bootstrap-sass": "^3.3.5", @@ -104,7 +104,7 @@ "yauzl": "^2.6.0" }, "devDependencies": { - "angular-mocks": "^1.4.7", + "angular-mocks": "^1.6.1", "browserify": "^13.0.1", "electron-builder": "^2.6.0", "electron-mocha": "^3.1.1", diff --git a/tests/gui/modules/image-writer.spec.js b/tests/gui/modules/image-writer.spec.js index ccdd72527e..f4bd7130c0 100644 --- a/tests/gui/modules/image-writer.spec.js +++ b/tests/gui/modules/image-writer.spec.js @@ -62,7 +62,7 @@ describe('Browser: ImageWriter', function() { }); ImageWriterService.flash('foo.img', '/dev/disk2'); - ImageWriterService.flash('foo.img', '/dev/disk2'); + ImageWriterService.flash('foo.img', '/dev/disk2').catch(angular.noop); $rootScope.$apply(); m.chai.expect(this.performWriteStub).to.have.been.calledOnce; }); @@ -97,13 +97,13 @@ describe('Browser: ImageWriter', function() { }); it('should set flashing to false when done', function() { - ImageWriterService.flash('foo.img', '/dev/disk2'); + ImageWriterService.flash('foo.img', '/dev/disk2').catch(angular.noop); $rootScope.$apply(); m.chai.expect(FlashStateModel.isFlashing()).to.be.false; }); it('should set the error code in the flash results', function() { - ImageWriterService.flash('foo.img', '/dev/disk2'); + ImageWriterService.flash('foo.img', '/dev/disk2').catch(angular.noop); $rootScope.$apply(); const flashResults = FlashStateModel.getFlashResults(); m.chai.expect(flashResults.errorCode).to.equal('FOO');