On Electron, the user can click and press over a button,
then move the mouse away from the button and release,
and the button will erroneusly keep the `:focus` state style.
The current workaround consists of:
- Iterate through all the Bootstrap button styles.
- Set the default 'background', `color` and `border-color` to match the
style of the normal state.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This directives will be used in the header navigation instead of
re-using this logic from the `NavigationController`.
A consequence of this change is that `NavigationController` is no longer
needed, and therefore is removed.
This modal provides a more advanced way to select a drive. It prevents
certain issues the dropdown was having, like the contents overflowing
when there were many connected drives.
Fixes: https://github.com/resin-io/etcher/issues/202
Turns out that even by using `process.exit(1)`, the electron main
process doesn't exit instantly, but continues executing code.
This causes electron to throw on `electron.globalShortcut` because this
functionality is not available given that we didn't create a renderer
view.
Fixes: https://github.com/resin-io/etcher/issues/215
This error was reported by TrackJS various times:
```
TypeError: Cannot read property 'length' of undefined
at EventEmitter.<anonymous> (file:///Users/jviotti/Projects/resin/etcher/lib/browser/app.js:104:15)
at emitOne (events.js:77:13)
at EventEmitter.emit (events.js:169:7)
at /Users/jviotti/Projects/resin/etcher/lib/browser/modules/drive-scanner.js:131:17
at processQueue (/Users/jviotti/Projects/resin/etcher/node_modules/angular/angular.js:15616:28)
at /Users/jviotti/Projects/resin/etcher/node_modules/angular/angular.js:15632:27
at Scope.$eval (/Users/jviotti/Projects/resin/etcher/node_modules/angular/angular.js:16884:28)
at Scope.$digest (/Users/jviotti/Projects/resin/etcher/node_modules/angular/angular.js:16700:31)
at /Users/jviotti/Projects/resin/etcher/node_modules/angular/angular.js:16923:26
at completeOutstandingRequest (/Users/jviotti/Projects/resin/etcher/node_modules/angular/angular.js:5825:10),
```
The error refers to the following line in `app.js`:
```js
if (drives.length === 1 && self.selection.hasImage()) {
```
Which indicates that the array of detected drives returned to the main
controller is `undefined` for some reason.
The problem resides in the `.scan()` method of `DriveScannerService`:
```js
this.scan = function() {
return $q.when(drives.listRemovable()).catch(dialog.showError);
};
```
When an error is thrown when scanning the drives, the `.catch()` block
is called. This means that the error is not propagated to the outer code
and the promise resolves with `undefined`.
The solution is to move `.catch()` to the place `.scan()` is called,
instead of making use of it in the low-level parts of the process.