44 Commits

Author SHA1 Message Date
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
caea581589 Move SettingsController to settings module 2016-03-10 14:57:55 -04:00
Juan Cruz Viotti
793001e133 Move burn state to ImageWriterService
Previously, the burn state lived in the controller, however if the user
moved to another page (the settings page for example) and then returned,
the progress state would be lost, leading to a broken progress bar.

Fixes: https://github.com/resin-io/etcher/issues/190
2016-03-10 12:01:22 -04:00
Juan Cruz Viotti
6367dd8a57 Implement NotifierService
This service provides an easy-to-use and safe (regarding to memory
leaks) way to emit data from services to controllers.

This component will be used in `ImageWriterService` to emit the progress
state instead of accepting an `onProgress` callback.
2016-03-10 12:01:22 -04:00
Juan Cruz Viotti
fdcc5d6b71 Stop scanner interval before starting a new one
This ensures there are no orphaned intervals running.
2016-03-08 16:19:48 -04:00
Juan Cruz Viotti
9f4b793c8d Add a setting to disable auto-unmount on success 2016-03-02 12:06:33 -04:00
Juan Cruz Viotti
64c27235bf Make use of UI Router 2016-03-01 19:50:25 -04:00
Juan Cruz Viotti
f208d2e34d Make use of settings to prevent tracking in analytics module
`SettingsService` is injected manually using `$injector` to a void a
circular dependency over `$rootScope` by `$localStorage`.
2016-03-01 12:55:15 -04:00
Juan Cruz Viotti
61a1527c7e Implement settings screen 2016-03-01 12:22:03 -04:00
Juan Cruz Viotti
75f22c0209 Implement AnalyticsService.logEvent() 2016-03-01 09:38:43 -04:00
Juan Cruz Viotti
1d75ec02aa Include TrackJS Angular module in Analytics module 2016-02-29 15:54:21 -04:00
Juan Cruz Viotti
1c6675ab4f Integrate Mixpanel 2016-02-29 15:52:00 -04:00
Juan Cruz Viotti
7949853086 Refer to Etcher instead of Resin Etcher 2016-02-08 13:04:54 -04:00
Juan Cruz Viotti
bad9500bc6 Add missin param annotation caught by JSCS 2016-01-31 21:15:40 -04:00
Juan Cruz Viotti
826710950d Merge pull request #134 from resin-io/refactor/track
Move TrackJS integration to a separate Angular module
2016-01-26 12:04:13 -04:00
Juan Cruz Viotti
4cf9ea70a5 Inline DriveScannerRefreshService in DriveScannerService
No need for this extra level of abstraction.
2016-01-26 10:27:29 -04:00
Juan Cruz Viotti
fd86807f86 Move TrackJS integration to a separate Angular module 2016-01-26 10:21:47 -04:00
Juan Cruz Viotti
111529ee71 Fix sporadic Cannot read property 'then' of undefined
This error happened when trying to burn an image when there is already a
burn in progress.

Fixes: https://github.com/resin-io/resin-etcher/issues/96
2016-01-22 13:10:13 -04:00
Juan Cruz Viotti
84d87e5a10 Move burn state log to app controller
This change required re-architecting the way we store the burn state.
2016-01-22 12:30:42 -04:00
Juan Cruz Viotti
122f136ff8 Refactor Etcher using ES6 features 2016-01-22 11:38:46 -04:00
Juan Cruz Viotti
13af009b4c Fix style issues detected by JSCS 2016-01-22 10:25:33 -04:00
Juan Cruz Viotti
34b7bdb59f Move LoggerService timestamp to $log decorator 2016-01-22 10:17:18 -04:00
Juan Cruz Viotti
efb055eb89 Upgrade Electron to v0.36.4 2016-01-22 09:37:57 -04:00
Federico Martín Alconada Verzini
6331ee4aa1 Add button to burn the same image again. Fixes #74 2016-01-20 12:28:15 -04:00
Juan Cruz Viotti
238c459d01 Make LoggerService use Angular's $log
This has the added benefit that services like TrackJS, which deeply
integrate with Angular, will share the messages with the service.
2016-01-19 10:26:51 -04:00
Juan Cruz Viotti
f20fb36328 Merge pull request #100 from resin-io/feat/logger
Implement a decent debug logger service
2016-01-19 10:16:33 -04:00
Juan Cruz Viotti
6478982896 Implement a decent debug logger service
This service prints the exact date and time of the messages.
2016-01-19 10:07:59 -04:00
Juan Cruz Viotti
b3dde83083 Implement removeDrive and removeImage in selection service 2016-01-19 09:42:57 -04:00
Juan Cruz Viotti
7f724b6295 Show burn speed information during write
The speed is shown right below the Burn button.
2016-01-18 14:55:13 -04:00
Juan Cruz Viotti
cf41b6279d Save burn progress speed in image writer state 2016-01-18 14:55:13 -04:00
Juan Cruz Viotti
d9641fc557 Rename setProgress to setProgressState
It shows the intention more clearly now that the function not only
accepts a plain percentage.
2016-01-18 14:55:13 -04:00
Juan Cruz Viotti
a46a716512 Make setProgress accept an options object
This allows us to pass more things than just the percentage to
`setProgress`.
2016-01-18 14:55:13 -04:00
Juan Cruz Viotti
e30de45707 Implement ImageWriterService.reset()
This function allows the client to easily reset the progress state
without breaking encapsulation.
2016-01-18 14:55:13 -04:00
Juan Cruz Viotti
3705d0fc3a Namespace ImageWriter progress in state object
This change allows us to scale the state information to more properties
than just the percentage.
2016-01-18 14:55:13 -04:00
Juan Cruz Viotti
f218cc1b59 Make DriveScanner.start() return an EventEmitter instance 2016-01-18 13:46:51 -04:00
Juan Cruz Viotti
491a0ae9c9 Trigger drive scans after slight delays
This allows unit tests to easily capture the first run, as otherwise
happens too fast.
2016-01-18 13:46:51 -04:00
Juan Cruz Viotti
35c3351533 Change license to Apache 2.0 2016-01-03 22:42:44 -04:00
Juan Cruz Viotti
408a3096fc Rename Herostratus to Resin Etcher 2016-01-01 18:07:45 -04:00
Juan Cruz Viotti
739a191e66 Merge branch 'master' into jviotti/feat/41/burn-again 2015-12-01 10:41:12 -04:00
Juan Cruz Viotti
c63755205b Implement burn complete screen
This screen informs the user that the burn has completed and that the
drive can be ejected directly.

It also provides a button to burn another image without exitting the
application.

Fixes: https://github.com/resin-io/herostratus/issues/41
2015-12-01 08:21:17 -04:00
Juan Cruz Viotti
133f927234 Show error dialogs on JavaScript exceptions
Fixes: https://github.com/resin-io/herostratus/issues/50
2015-11-30 11:51:51 -04:00
Juan Cruz Viotti
a6ec66d0b3 Pass the whole drive object to the writer
Currently we only pass the drive device. By passing all the object
(containing the mountpoint, size, etc) we allow more control to the
writer in how to treat the device before/during/after the burning
process.
2015-11-23 13:28:15 -04:00
Juan Cruz Viotti
4bfb161e5c Initial commit 2015-10-29 09:36:21 -04:00