diff --git a/lib/gui/components/flash-error-modal/controllers/flash-error-modal.js b/lib/gui/components/flash-error-modal/controllers/flash-error-modal.js deleted file mode 100644 index 290236ff..00000000 --- a/lib/gui/components/flash-error-modal/controllers/flash-error-modal.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ - -'use strict'; - -module.exports = function( - $uibModalInstance, - FlashStateModel, - AnalyticsService, - flashErrorData -) { - - /** - * @summary Flash error data - * @property - * @public - */ - this.data = flashErrorData; - - /** - * @summary Retry flash process - * @function - * @public - * - * @example - * FlashErrorModalController.retry(); - */ - this.retry = () => { - FlashStateModel.resetState(); - AnalyticsService.logEvent('Restart after failure'); - $uibModalInstance.dismiss(); - }; - -}; diff --git a/lib/gui/components/flash-error-modal/flash-error-modal.js b/lib/gui/components/flash-error-modal/flash-error-modal.js index 982343ed..d9302018 100644 --- a/lib/gui/components/flash-error-modal/flash-error-modal.js +++ b/lib/gui/components/flash-error-modal/flash-error-modal.js @@ -23,12 +23,12 @@ const angular = require('angular'); const MODULE_NAME = 'Etcher.Components.FlashErrorModal'; const FlashErrorModal = angular.module(MODULE_NAME, [ - require('../modal/modal'), + require('../warning-modal/warning-modal'), require('../../models/flash-state'), + require('../../models/selection-state'), require('../../modules/analytics') ]); -FlashErrorModal.controller('FlashErrorModalController', require('./controllers/flash-error-modal')); FlashErrorModal.service('FlashErrorModalService', require('./services/flash-error-modal')); module.exports = MODULE_NAME; diff --git a/lib/gui/components/flash-error-modal/services/flash-error-modal.js b/lib/gui/components/flash-error-modal/services/flash-error-modal.js index 42674ebc..26b18095 100644 --- a/lib/gui/components/flash-error-modal/services/flash-error-modal.js +++ b/lib/gui/components/flash-error-modal/services/flash-error-modal.js @@ -16,9 +16,7 @@ 'use strict'; -const _ = require('lodash'); - -module.exports = function(ModalService) { +module.exports = function(WarningModalService, FlashStateModel, SelectionStateModel, AnalyticsService) { /** * @summary Open the flash error modal @@ -32,16 +30,18 @@ module.exports = function(ModalService) { * FlashErrorModalService.show('The drive is not large enough!'); */ this.show = (message) => { - return ModalService.open({ - template: './components/flash-error-modal/templates/flash-error-modal.tpl.html', - controller: 'FlashErrorModalController as modal', - size: 'flash-error-modal', - resolve: { - flashErrorData: _.constant({ - message: message - }) + return WarningModalService.display({ + confirmationLabel: 'Retry', + description: message + }).then((confirmed) => { + FlashStateModel.resetState(); + + if (confirmed) { + AnalyticsService.logEvent('Restart after failure'); + } else { + SelectionStateModel.clear(); } - }).result; + }); }; }; diff --git a/lib/gui/components/flash-error-modal/styles/_flash-error-modal.scss b/lib/gui/components/flash-error-modal/styles/_flash-error-modal.scss deleted file mode 100644 index 2a9cbad4..00000000 --- a/lib/gui/components/flash-error-modal/styles/_flash-error-modal.scss +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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. - */ - -.modal-flash-error-modal .modal-title .glyphicon { - color: $palette-theme-danger-background; -} diff --git a/lib/gui/components/flash-error-modal/templates/flash-error-modal.tpl.html b/lib/gui/components/flash-error-modal/templates/flash-error-modal.tpl.html deleted file mode 100644 index 7110b76f..00000000 --- a/lib/gui/components/flash-error-modal/templates/flash-error-modal.tpl.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - -