diff --git a/lib/gui/modules/error.js b/lib/gui/modules/error.js index ef50ab9f569..298713cd929 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 af8066e901f..f5e172f9c21 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 a57d7de8fa9..4bbe40c23c0 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 fcb1e0e4b6e..98e57b4df60 100644 --- a/lib/gui/pages/main/templates/main.tpl.html +++ b/lib/gui/pages/main/templates/main.tpl.html @@ -74,10 +74,7 @@ + ng-click="main.showSelectedImageDetails()">