983 Commits

Author SHA1 Message Date
Juan Cruz Viotti
e8516b1727 Fix shell.openExternal() freezing GNU/Linux
Electron's `shell.openExternal()` fails on GNU/Linux when Electron is

ran with `sudo`.  The issue was reported, and this is a workaround until

its fixed on the Electron side.



`node-open` is smart enough to check the `$SUDO_USER` environment

variable and to prepend `sudo -u <user>` if needed.



We keep `shell.openExternal()` for OSes other than Linux since we intend

to fully rely on it when the issue is fixed, and since its closer

integration with the operating system might lead to more accurate

results than a third party NPM module.



See https://github.com/electron/electron/issues/5039

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-06 11:12:46 -04:00
Juan Cruz Viotti
912373a389 Log Etcher version in Mixpanel and TrackJS
Its hard to attempt to debug or reproduce an issue if we don't know the

version the user is running.



Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-05 13:10:22 -04:00
Juan Cruz Viotti
bdd541e90e Fix uncaught exception if no file was selected from a dialog
The following error is thrown if the open file dialog is cancelled

without any selection:



  Unhandled rejection TypeError: Cannot read property '0' of undefined

    at Number.indexedGetter (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/call_get.js:106:15)

    at Number.tryCatcher (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/util.js:16:23)

    at Promise._settlePromiseFromHandler (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/promise.js:503:31)

    at Promise._settlePromise (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/promise.js:560:18)

    at Promise._settlePromise0 (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/promise.js:605:10)

    at Promise._settlePromises (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/promise.js:684:18)

    at Async._drainQueue (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/async.js:126:16)

    at Async._drainQueues (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/async.js:136:10)

    at Immediate.Async.drainQueues [as _onImmediate] (/home/parallels/Projects/etcher/node_modules/bluebird/js/release/async.js:16:14)

    at processImmediate [as _immediateCallback] (timers.js:383:17)



Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-05 12:38:34 -04:00
Juan Cruz Viotti
f7b22467ee Enable useContentSize BrowserWindow option
From the documentation:



> `useContentSize` Boolean - The `width` and `height` would be used as web

> page’s size, which means the actual window’s size will include window

> frame’s size and be slightly larger. Default is `false`.



The original issue is that when you specify a width/height, the actual

size that you get is slighly smaller, since the OS title bar is included

in the size you provide.



By using the `useContentSize` option, we ensure the `WebView` gets the

intended size, no matter the title bar.



This PR invalidates: https://github.com/resin-io/etcher/pull/244



Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-05 09:26:46 -04:00
Juan Cruz Viotti
c27c9c3a2f Undo :focus styles from Bootstrap.
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>
2016-04-04 18:48:16 -04:00
Juan Cruz Viotti
dca6c783d2 Move application images to assets/ 2016-04-01 13:09:50 -04:00
Juan Cruz Viotti
ea19c771d5 Merge pull request #239 from resin-io/refactor/drive-selector
Split DriveSelector components into separate files
2016-04-01 13:06:55 -04:00
Juan Cruz Viotti
06f74d140b Merge pull request #237 from resin-io/refactor/if-state-directive
Implement `showIfState` and `hideIfState` directives
2016-04-01 13:06:47 -04:00
Juan Cruz Viotti
a14e5235ff Split DriveSelector components into separate files 2016-04-01 12:30:42 -04:00
Juan Cruz Viotti
5001d84e9a Mark DriveScannerService.setDrives() as private 2016-04-01 12:13:12 -04:00
Juan Cruz Viotti
53b3daa335 Implement showIfState and hideIfState directives
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.
2016-04-01 12:09:00 -04:00
Juan Cruz Viotti
a4ebe8af50 Implement an openExternal attribute directive.
This directive will be used in the header and footer instead of having
to rely on `NavigationController` to expose `shell.openExternal`.
2016-04-01 11:03:10 -04:00
Juan Cruz Viotti
3bdaadcfb8 Decouple DriveScannerService from Dialog 2016-04-01 10:32:34 -04:00
Juan Cruz Viotti
f879245fce Merge pull request #234 from resin-io/refactor/selection-state-model
Convert SelectionStateService into a model
2016-04-01 10:31:51 -04:00
Juan Cruz Viotti
70034afc61 Merge pull request #233 from resin-io/refactor/window-progress
Extract browser window progress into WindowProgressService
2016-04-01 10:31:33 -04:00
Juan Cruz Viotti
244d5ca727 Convert SelectionStateService into a model 2016-04-01 10:18:59 -04:00
Juan Cruz Viotti
832d6843df Extract browser window progress into WindowProgressService 2016-04-01 10:08:14 -04:00
Juan Cruz Viotti
d418139def Merge pull request #232 from resin-io/refactor/settings-model
Transform SettingsService into the SettingsModel module
2016-04-01 10:07:59 -04:00
Juan Cruz Viotti
61cd5a1ffe Transform SettingsService into the SettingsModel module 2016-04-01 09:28:28 -04:00
Juan Cruz Viotti
10b714a2ce Add vertical spacing to unmount on success message on finish screen 2016-04-01 09:14:10 -04:00
Juan Cruz Viotti
4ef7dae3c4 Use SettingsService in FinishController
EXposing the settings from the `FinishController` is a better approach
that instantiating the `SettingsController` in the Finish page template.
2016-04-01 09:04:55 -04:00
Juan Cruz Viotti
f5c9a3a32a Move all settings related components to a settings page subdirectory 2016-03-31 15:58:00 -04:00
Juan Cruz Viotti
472f91a504 Group finish page components in a common directory 2016-03-31 15:33:03 -04:00
Juan Cruz Viotti
797a253158 Group all parts of the progress-button component in a single directory 2016-03-31 15:14:10 -04:00
Juan Cruz Viotti
18a1606988 Implement a drive selector modal
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
2016-03-31 12:18:23 -04:00
Juan Cruz Viotti
c75b4b307a Style btn-sm 2016-03-31 10:01:33 -04:00
Juan Cruz Viotti
7b48eeb993 Make a CSS class for fixed-width step buttons 2016-03-31 10:01:24 -04:00
Juan Cruz Viotti
bac70c667f Fix step vertical bars slight misalignment 2016-03-31 08:52:57 -04:00
Juan Cruz Viotti
50e0fcb7e9 Merge pull request #223 from resin-io/refactor/merge-drives-and-drive-scanner
Merge src/drives.js with DriveScannerService
2016-03-31 08:49:36 -04:00
Juan Cruz Viotti
ef16f69df9 Merge pull request #222 from resin-io/fix/use-same-image
Fix "Use same image" not preserving the image selection
2016-03-31 08:49:18 -04:00
Juan Cruz Viotti
34907765df Merge src/drives.js with DriveScannerService
`src/drives.js` made little on its own, and only caused extra thinking
overhead due to indirection.
2016-03-30 16:51:39 -04:00
Juan Cruz Viotti
e541357450 Fix "Use same image" not preserving the image selection 2016-03-30 16:28:22 -04:00
Juan Cruz Viotti
8b5c1a7c41 Remove unnecessary empty line in success partial 2016-03-30 16:11:13 -04:00
Juan Cruz Viotti
e3ed0af0f9 Move Boostrap style customisations to a boostrap.scss file 2016-03-30 16:11:08 -04:00
Juan Cruz Viotti
9bd0ccd550 Normalise step footers captions 2016-03-30 15:53:26 -04:00
Juan Cruz Viotti
79b16beaf0 Make caption's uppercase by default 2016-03-30 15:49:59 -04:00
Juan Cruz Viotti
6f7ea4e772 Convert hero-progress-button into an Angular directive 2016-03-30 15:46:48 -04:00
Juan Cruz Viotti
482b0a52ee Move title normalisation to desktop.css 2016-03-30 14:56:59 -04:00
Juan Cruz Viotti
abdee7fe10 Refactor tick as a scss component 2016-03-30 14:17:03 -04:00
Juan Cruz Viotti
5d52b19c2b Refactor hero-button as a scss component 2016-03-30 14:11:18 -04:00
Juan Cruz Viotti
01ec52f4d7 Refactor caption as a scss component 2016-03-30 14:02:03 -04:00
Juan Cruz Viotti
d47eaa8a2a Refactor badge as a scss component 2016-03-30 13:47:36 -04:00
Juan Cruz Viotti
f530dfcc3c Return to avoid any further code execution after an elevation error
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
2016-03-25 09:41:30 -04:00
Juan Cruz Viotti
84b5117a93 Merge pull request #214 from resin-io/fix/error-dialog-analytics
Throw error after displaying it with dialog
2016-03-21 10:42:08 -04:00
Juan Cruz Viotti
3166dbe4a6 Throw error after displaying it with dialog
Currently, we "swallow" errors by only showing them with the "dialog"
module, causing them to not be logged to TrackJS.
2016-03-21 09:23:53 -04:00
Juan Cruz Viotti
ad082fc268 Configure TrackJS with userId
Otherwise, all we get in TrackJS are "anonymous" users, without a way to
link them to Mixpanel users.
2016-03-21 09:19:20 -04:00
Juan Cruz Viotti
fda6f8a6a5 Fix Cannot read property 'length' of undefined
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.
2016-03-17 09:36:43 -04:00
Juan Cruz Viotti
a40ad6fd54 Allow window to be dragged from anywhere
Fixes: https://github.com/resin-io/etcher/issues/191
2016-03-13 15:10:16 -04:00
Juan Cruz Viotti
dcdc7a18e2 Fix broken state when going to settings in the success screen 2016-03-10 17:15:57 -04:00
Juan Cruz Viotti
61b88c95e0 Merge pull request #203 from resin-io/refactor/controllers
Split controllers into separate files
2016-03-10 17:15:33 -04:00