mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 15:27:17 +00:00
Decouple DriveScannerService from Dialog
This commit is contained in:
parent
f879245fce
commit
3bdaadcfb8
@ -118,7 +118,7 @@ app.controller('AppController', function(
|
||||
WindowProgressService.set(state.progress);
|
||||
});
|
||||
|
||||
this.scanner.start(2000).on('scan', function(drives) {
|
||||
this.scanner.start(2000).on('error', dialog.showError).on('scan', function(drives) {
|
||||
|
||||
// Notice we only autoselect the drive if there is an image,
|
||||
// which means that the first step was completed successfully,
|
||||
|
@ -23,17 +23,8 @@
|
||||
const angular = require('angular');
|
||||
const _ = require('lodash');
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
const electron = require('electron');
|
||||
const drivelist = require('drivelist');
|
||||
|
||||
if (window.mocha) {
|
||||
var path = require('path');
|
||||
var srcPath = path.join(__dirname, '..', '..', 'src');
|
||||
var dialog = electron.remote.require(path.join(srcPath, 'dialog'));
|
||||
} else {
|
||||
var dialog = electron.remote.require('./src/dialog');
|
||||
}
|
||||
|
||||
const driveScanner = angular.module('Etcher.drive-scanner', []);
|
||||
|
||||
driveScanner.service('DriveScannerService', function($q, $interval, $timeout) {
|
||||
@ -141,7 +132,9 @@ driveScanner.service('DriveScannerService', function($q, $interval, $timeout) {
|
||||
return self.scan().then(function(drives) {
|
||||
emitter.emit('scan', drives);
|
||||
self.setDrives(drives);
|
||||
}).catch(dialog.showError);
|
||||
}).catch(function(error) {
|
||||
emitter.emit('error', error);
|
||||
});
|
||||
};
|
||||
|
||||
// Make sure any pending interval is cancelled
|
||||
|
Loading…
x
Reference in New Issue
Block a user