1106 Commits

Author SHA1 Message Date
Juan Cruz Viotti
31728801f5 Don't show a progress bar in update notifier modal (#445)
Fixes: https://github.com/resin-io/etcher/issues/442
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-26 21:18:13 -04:00
Juan Cruz Viotti
b14e94fc3b Fix GNU/Linux not opening an external resource when elevated (#446)
We currently had a workaround in place to make use of `node-open`
instead of Electron's built-in `shell` module since the latter didn't
work on older Electron versions on GNU/Linux for some reason.

After some experimentation, `node-open` doesn't seem to be working for
elevated applications anymore. I honestly didn't chase the issue further
since Electron `shell` has been fixed, and works fine when elevated,
therefore this PR basically undoes the previous workaround.

Fixes: https://github.com/resin-io/etcher/issues/443
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-26 21:18:03 -04:00
Juan Cruz Viotti
7d0ea21567 Run linter as part of npm test (#436)
* Fix lint warnings

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

* Run linter as part of `npm test`

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-24 15:35:51 -04:00
Juan Cruz Viotti
abb7dc6469 Prevent pressing "space" to re-click the "Flash" button (#435)
Currently we disable pointer events on the "Flash" button once a flash
is in progress to prevent the user from clicking it, but we didn't
consider that if the user kept focus on the button, he can press the
"space" bar for the same effect.

Fixes: https://github.com/resin-io/etcher/issues/431
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-24 14:21:31 -04:00
Juan Cruz Viotti
6af2bd0d30 Prevent global shorcuts from interferring with other applications (#433)
Fixes: https://github.com/resin-io/etcher/issues/389
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-24 12:40:25 -04:00
Juan Cruz Viotti
2948d13075 Fix image drag and drop not working anymore (#432)
There has been changes in the model regarding with how the image
information was stored, and the dropzone directive was never modified to
comply with those changes.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-24 11:52:50 -04:00
Juan Cruz Viotti
3b30748b1f Add support for .gz and .bz2 (#419)
See: https://github.com/resin-io/etcher/issues/325
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-24 10:38:12 -04:00
Juan Cruz Viotti
c1074de198 Upgrade electron to v1.1.1 (#427)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-24 10:37:31 -04:00
Juan Cruz Viotti
e1a3c88b10 Display image checksum on success in the CLI (#417)
* Upgrade etcher-image-write to v5.0.0

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

* Display image CRC32 checksum on success

Fixes: http://github.com/resin-io/etcher/issues/357
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-19 10:13:10 -04:00
Alexandros Marinos
198d24741a make inbound links from the etcher app traceable in resin's analytics (#411) 2016-05-15 21:33:59 -04:00
Juan Cruz Viotti
bf37ee72df Prevent selection of drives that are not large enough (#408)
* Make .selectImage() dialog return an object with a `path` property

This allows to return more than one value for the selected image,
like image size and other metadata for example.

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

* Return image size from .selectImage() dialog

This property will be useful to perform some sanity checks, like
ensuring the selected drive is large enough to contain the image.

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

* Store both the image path and the image size in the selection model

In order to simplify accessing such properties in an encapsulated
manner, `SelectionStateModel.getImage()` was replaced with the following
functions:

- `SelectionStateModel.getImagePath()`.
- `SelectionStateModel.getImageSize()`.

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

* Increase SelectionStateModel setter validation

The model not providing any kind of validation was the source of some
bugs I encountered while implementing the previous commits that would
not have happened otherwise.

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

* Prevent selection of drives that are not large enough

- The drive selector modal was modified such that drives that are not
large enough are crossed out, and the user is not able to click them.

- In the case of drive auto-selection, not large enough drives won't
attempt to get autoselected.

This commit introduces:

- The `SelectionStateModel.isDriveLargeEnough()` function.

Fixes: https://github.com/resin-io/etcher/issues/344
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-12 15:38:19 -04:00
Juan Cruz Viotti
c31ccdbdbe Move the code that performs the writing to lib/cli (#407)
The CLI is the only entity that calls it directly.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-12 15:16:15 -04:00
Juan Cruz Viotti
a4e2639c00 Implement update notifier modal (#406)
Auto-update functionality is not ready for usage. As a workaround to
prevent users staying with older versions, we now check for updates at
startup, and if the user is not running the latest version, we present a
modal informing the user of the availiblity of a new version, and
provide a call to action to open the Etcher website in his web browser.

Extra features:

- The user can skip the update, and tell the program to delay the
notification for 7 days.

Misc changes:

- Center modal with flexbox, to allow more flexibility on the modal height.
interacting with the S3 server.
- Implement `ManifestBindService`, which now serves as a backend for the
`manifest-bind` directive to allow the directive's functionality to be
re-used by other services.
- Namespace checkbox styles that are specific to the settings page.

Fixes: https://github.com/resin-io/etcher/issues/396
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-12 13:11:30 -04:00
Juan Cruz Viotti
662c589ab9 Implement writing by spawning the CLI as a child process (#400)
After this change, the CLI becomes the only entity actually performing
I/O with the devices, and the GUI is just a wrapper around it.

When you click "Flash", the GUI spawns the CLI with all the appropriate
options, including `--ipc`, which uses an IPC communication channel to
report status back to the parent process.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-11 17:52:09 -04:00
Juan Cruz Viotti
883cae0d87 Remove implicit "Enable" from settings items (#404)
The fact that there is a checkbox at the left of the items already makes
clear the ticking them enables the setting.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-11 09:25:36 -04:00
Juan Cruz Viotti
e0416cf2dc Refactor how application selection is accessed from DriveSelectorModal (#397)
* Refactor SelectionStateModel.isCurrentDrive() to only check `.device`

This set of changes modify `SelectionStateModel.isCurrentDrive()` to
only return true if the `.device` property is equal, and ignore the
rest, since there can be tons of false positives if the drive doesn't
exactly matches otherwise.

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

* Implement SelectionStateModel.toggleSetDrive()

This function is useful to toggle the current drive selected based on a
drive object.

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

* Make use of SelectionStateModel directly in DriveSelectorModal

Currently, we were basically proxying (with some additions)
`SelectionStateModel` through a service called
`DriveSelectorStateService`, which was completely unnecessary.

Now, we make use of `SelectionStateModel`, after moving any custom logic
from `DriveSelectorStateService` to `SelectionStateModel`.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-10 15:05:25 -04:00
Juan Cruz Viotti
cb4798e0a5 Add support for XZ compressed images (#376)
This PR introduces `etcher-image-stream`:

https://github.com/resin-io-modules/etcher-image-stream

a module that will handle support for decompression, URL streaming, and
any other way to get a source of data to write in Etcher.

Most of the changes in this PR are because XZ decompression includes a
native dependency (no pure JS implementations out there for now), so we
had to tweak various things for the dependency to work correctly on
Etcher/Electron.

See: https://github.com/resin-io/etcher/issues/325
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-04 02:07:43 -04:00
Juan Cruz Viotti
5575cb1af8 Revert "Implement writing by spawning the CLI as a child process (#385)" (#394)
This reverts commit fab2d767b0ae6b0401b428910096af236897973d.
2016-05-04 01:57:26 -04:00
Juan Cruz Viotti
ccef599bcf Fix application not being elevated in Windows (#393)
After elevation routine refactoring, it looks like we have to exit the
parent process after a short while, otherwise it kills the app before
the elevated child process is executed.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-04 01:35:19 -04:00
Juan Cruz Viotti
369e38b310 Improve "Select Image" supported file types label with a tooltip (#392)
Fixes: https://github.com/resin-io/etcher/issues/378
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-04 01:30:54 -04:00
Juan Cruz Viotti
7d254160c5 Show the forked command as a debug analytics message (#388)
This is very useful for debugging.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-05-02 10:01:50 -04:00
Juan Cruz Viotti
fab2d767b0 Implement writing by spawning the CLI as a child process (#385)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-29 13:01:06 -04:00
Juan Cruz Viotti
d52f948e46 Use correct exit codes when running Etcher CLI with --robot (#384)
Currently, the exit codes documented in the help section was not
honoured if the CLI was ran with the `--robot` option. In this case, the
CLI would exit with code 0 even if the validation failed.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-29 12:30:09 -04:00
Juan Cruz Viotti
087a008d0d Make sure CLI args are parsed correctly when spawning in OS X (#383)
The binary used when spawning the CLI in OS X during development is
`electron-prebuilt/disk/Electron.app/Contents/MacOS/Electron`.

To make sure we catch both `Electron` and `electron`, make the
executable name lowercase before comparing it.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-29 11:55:23 -04:00
Juan Cruz Viotti
36bd696da9 Make use of etcher-image-write (#382)
This is the new name of the older `resin-image-write` dependency.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-29 09:45:52 -04:00
Juan Cruz Viotti
ad758cf391 Implement Etcher.OS.Dialog module (#381)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-29 09:03:20 -04:00
Juan Cruz Viotti
bd410bd88c Document exit codes in Etcher CLI help (#379)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-29 09:03:08 -04:00
Juan Cruz Viotti
1de3d7b26c Make sure the CLI handles arguments correctly when being packaged (#374)
The CLI now attempts to detect whether it is being run as an argument to
a JavaScript runner (like node or electron), or as a final packaged
executable by applying some heuristics on the first argument.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-27 14:24:49 -04:00
Juan Cruz Viotti
d7ce744e26 Document that ELECTRON_RUN_AS_NODE doesn't load app.asar by default (#375)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-27 14:24:32 -04:00
Juan Cruz Viotti
d80da9f7ce Move Etcher CLI exit code definitions to lib/src (#369)
The purpose is that defined exit codes can be reused in the GUI, so they
are kept in sync more easily.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-26 13:40:44 -04:00
Juan Cruz Viotti
3af8d4d4a2 Upgrade resin-image-write to v4.0.0 (#368)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-26 13:33:39 -04:00
Juan Cruz Viotti
ccae6bf783 Prefix robot progress state output with "progress" (#367)
This makes it a bit easier to determine if a `stdout` line is a progress
state or not, rather than checking for both `write` or `check`.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-26 12:30:06 -04:00
Juan Cruz Viotti
4a856d24df Add entry point file to decide between GUI/CLI (#365)
This file runs the Etcher CLI if the binary was ran with
`ELECTRON_RUN_AS_NODE`, or the GUI otherwise.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-26 11:39:15 -04:00
Juan Cruz Viotti
bb4ad6a042 Add an option to control unmounting on success in Etcher CLI (#362)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-26 09:38:29 -04:00
Juan Cruz Viotti
8bdc089de4 Implement validation support in Etcher CLI (#361)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-25 15:47:05 -04:00
Juan Cruz Viotti
86cbff940c Implement Etcher CLI "robot" option (#360)
This option makes the Etcher CLI outputs state information in a way that
can be easily parsed by a parent process spawning it.

The format of the state output is:

  <type> <percentage>% <eta>s <speed>

This can be easily parsed as follows:

  const output = line.split(' ');

  const state = {
    type: output[0],
    percentage: parseInt(output[1], 10),
    eta: parseInt(output[2], 10),
    speed: parseInt(output[3], 10)
  };

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-25 14:50:34 -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
1ac0fae405 Fix Error: Cannot find module ../global-shortcut in Windows (#353)
Since the Electron upgrade, Windows users are hitting a weird error
about `global-shortcut` not existing.

A solution is to `require('global-shortcut')` instead of accessing it as
a property of `electorn`.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-22 13:03:46 -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
148b9d15ae Integrate Etcher CLI in the main repository (#352)
This PR integrates the Etcher CLI code-wise, but doesn't yet handles the
distribution part of the story.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-21 10:08:53 -04:00
Juan Cruz Viotti
4d70676612 Distinguish between flash and validation events in Mixpanel (#347)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-20 14:56:58 -04:00
Juan Cruz Viotti
975c949fdf Allow to bypass elevation with an environment variable (#343)
This is mostly used for debugging purposes, or by power users that know
what they're doing.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-19 11:07:59 -04:00
Juan Cruz Viotti
ed70e4e590 Refactor initial elevation routine (#341)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-19 09:40:25 -04:00
Juan Cruz Viotti
284f2a0ebb Add dashed underline to footer links (#340)
Fixes: https://github.com/resin-io/etcher/issues/338
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-18 13:16:26 -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
35ac745452 Link the version string in the footer to the CHANGELOG (#337)
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-18 12:39:18 -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
34ae49df38 Reset writer state on flash error (#330)
Not doing so leads the writer state to have a `progress` of `100%`,
while `isFlashing()` is `false`, which is an inconsistent state.

Fixes: https://github.com/resin-io/etcher/issues/327
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-04-15 16:43:42 -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