403 Commits

Author SHA1 Message Date
Juan Cruz Viotti
f55100d09b Fix lint warnings (#359)
- `os` in unused in `byte-size.spec.js`

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-25 14:50:23 -04:00
Juan Cruz Viotti
d5b3e0a83f Upgrade drivelist to v3.0.0 (#354)
This new version reports the size as a number of bytes instead of a
human readable string, so we have to take care of converting back to a
readable GB format ourselves.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-25 12:46:59 -04:00
Juan Cruz Viotti
afeba11424 Move GUI code into lib/gui (#358)
This refactoring will be useful on future changes, where there will be
a single application entry point that will execute the CLI or the GUI
version depending on the environment.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-25 12:08:19 -04:00
Juan Cruz Viotti
dcff257f20 Upgrade Electron to v0.37.6 (#350)
* Upgrade Electron to v0.37.6

The main motiviation for such upgrade is that an error manifesting
itself as `Cannot read property 'object' of undefined` on certain Linux
systems was fixed in v0.37.4.

See https://github.com/electron/electron/issues/5229
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>

* Make use of shell module by requiring `shell`

Otherwise we get a strange issue when trying to stub it:

    TypeError: Attempted to wrap undefined property openExternal as function

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-21 10:26:29 -04:00
Juan Cruz Viotti
5baf8e5407 Improve UX when closing the drive selector modal (#339)
The current "Close" button makes it confusing to the user to know if
he's accepting his changes, or just discarding them.

The "Close" button in the top right corner was replaced with a standard
cross icon, and there is a new "Continue" block button fixed in the
bottom of the modal.

Fixes: https://github.com/resin-io/etcher/issues/294
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-18 13:16:17 -04:00
Juan Cruz Viotti
ed592f0597 Add application version to footer (#335)
* Implement ManifestBind directive

This directive is useful to bind the contents of an element to a
property in the `package.json` manifest.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>

* Add application version to footer

Fixes: https://github.com/resin-io/etcher/issues/292
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-17 23:57:56 -04:00
Juan Cruz Viotti
fa3c598f98 Fix double-quote lint warnings (#329)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-15 16:44:29 -04:00
Juan Cruz Viotti
0dcc7b22b8 Implement SVGIcon Angular directive (#324)
* Inherit current scope in osOpenExternal directive

This directive attempts to create a new isolated scope, which leads the
errors when using this directive on top of another directive in the same
element.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>

* Implement SVGIcon Angular directive

This directive replaces part of `hero-icon`, the old Polymer component.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-13 16:14:46 -04:00
Juan Cruz Viotti
a874d4b808 Make all angular modules export the name of the module (#318)
This makes them very nicely require-able, for example:

    angular.module('MyModule', [
      require('my-dependency');
    ]);

From https://medium.com/@kentcdodds/how-to-distribute-your-angularjs-module-e04d4dd58ddc#.yqg2zo8im
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-13 14:22:51 -04:00
Juan Cruz Viotti
42db5992fa Reorganize utilities and desktop integration modules (#316)
- Rename `Etcher.Utils.Dropzone` to `Etcher.OS.Dropzone`
- Rename `Etcher.Utils.OpenExternal` to `Etcher.OS.OpenExternal`
- Rename `Etcher.Utils.WindowProgress` to `Etcher.OS.WindowProgress`
- Rename `Etcher.notification` to `Etcher.OS.Notification`
- Rename `Etcher.notifier` to `Etcher.Utils.Notifier`
- Rename `Etcher.path` to `Etcher.Utils.Path`

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-13 13:34:31 -04:00
Juan Cruz Viotti
e3bac8dc64 Connect DriveSelector with SelectionStateModel (#305)
Previously, `DriveSelector` kept a temporary selection state until the
modal was closed, which caused the selected drives to be passed to
`SelectionStateModel`.

This proves to be problematic when attempting to pass changes to
`SelectionStateModel` to `DriveSelector`. For example, consider the case
where the `DriveSelector` modal is opened with two drives, and one is
ejected. The remaining drive will be auto-selected by Etcher in the
background, but `DriveSelector` will not update itself with such change.

Fixes: https://github.com/resin-io/etcher/issues/304
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-12 14:42:51 -04:00
Juan Cruz Viotti
3efea5b308 Replace all occurrences of "burn" with "flash" (#300)
Technically, a removable drive is flashed, not burned.

Fixes: https://github.com/resin-io/etcher/issues/297
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-12 12:00:43 -04:00
Juan Cruz Viotti
8417f94649 Allow to drag and drop an image to the first step (#288)
See https://github.com/electron/electron/blob/master/docs/api/file-object.md
Fixes: https://github.com/resin-io/etcher/issues/279
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-11 15:40:13 -04:00
Juan Cruz Viotti
67daf086a2 Detect removal of selected drive (#264)
Suppose you plug a device, select it in Etcher, but then eject it from
your computer. Etcher will keep the selection thinking the drive is
still there.

With this PR, the selected drive, if any, is ensured its still inside
the array of available drives, otherwise the selected is cleared.

Fixes: https://github.com/resin-io/etcher/issues/254
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-08 12:17:36 -04:00
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
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
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
a14e5235ff Split DriveSelector components into separate files 2016-04-01 12:30:42 -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
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
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
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
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
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
e5ddb2f2cb Make writer.getImageStream() extract images from zip archives 2016-03-07 09:20:58 -04:00
Juan Cruz Viotti
64c27235bf Make use of UI Router 2016-03-01 19:50:25 -04:00
Juan Cruz Viotti
61a1527c7e Implement settings screen 2016-03-01 12:22:03 -04:00
Juan Cruz Viotti
7949853086 Refer to Etcher instead of Resin Etcher 2016-02-08 13:04:54 -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
9de813f8cf Remove unused variables caught by jshint 2016-01-24 19:26:32 -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
f7ddce3000 Enable ES6 in JSHint
- Also rename `Promise` to `Bluebird` since now JSHint complains that
`Promise` is already defined.
2016-01-22 10:53:16 -04:00
Juan Cruz Viotti
861ecdfeb7 Adapt JSCS for tests 2016-01-22 10:25:33 -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
b3dde83083 Implement removeDrive and removeImage in selection service 2016-01-19 09:42:57 -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
408a3096fc Rename Herostratus to Resin Etcher 2016-01-01 18:07:45 -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