1343 Commits

Author SHA1 Message Date
Juan Cruz Viotti
e2652e6ee9 style(GUI): improve wording of supported extensions label (#807)
- Change "and many more" to "and others"

See: https://github.com/resin-io/etcher/issues/787
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-02 18:24:01 -04:00
Juan Cruz Viotti
9ed6e30b00 style(GUI): improve ordering of supported extensions (#806)
The new ordering of the main supported extensions will be: `img`, `iso`,
`zip`.

We make use of `_.intersection` in order to ensure that the values we're
hardcoding indeed exist in the list of all supported format extensions,
otherwise they won't appear at all. This ensures we never show
extensions that are not supported.

Partly fixes: https://github.com/resin-io/etcher/issues/787
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-02 14:28:21 -04:00
Juan Cruz Viotti
0c66fb65f4 fix(GUI): close IPC server after writing (#816)
Currently, we are not making sure the IPC server we start at
`lib/src/child-writer/index.js` gets closed when the child process exits
(successfully or not). This eventually causes issues when the user click
"flash again", since the stateful `ipc` global exposed by `node-ipc`
gets initialised again, causing the module to get to an invalid state
that eventually results in `this.log is not a function`.

- We've added `ipc.server.stop()` to both the `error` and `close` event
  handlers (which are self exclusive, according to the docs).

- We've added `child.kill()` to the child `stderr` handler, since that
  function causes the `close` event to be triggered, which in turns
  calls `ipc.server.stop()`.

Change-Type: patch
Changelog-Entry: Fix `this.log is not a function` error when clicking "flash again".
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-02 00:00:39 -04:00
Andrew Scheller
eabc9991e9 style(CLI): add [options] to usage string 2016-10-31 23:49:59 -04:00
Andrew Scheller
54343d9609 minifix(CLI): fix GitHub issues URL in CLI help 2016-10-31 23:49:12 -04:00
Juan Cruz Viotti
081b719bcb style(CLI): don't wrap CLI help outputdrives (#813)
`yargs` wraps help output lines, causing the examples to be displayed
like this:

```
Examples:
/usr/bin/nodejs bin/etcher
raspberry-pi.img
/usr/bin/nodejs bin/etcher --no-check
raspberry-pi.img
/usr/bin/nodejs bin/etcher -d /dev/disk2
ubuntu.iso
/usr/bin/nodejs bin/etcher -d /dev/disk2
-y rpi.img
```

As a solution, we can set `.wrap(null)` to completely disable wrapping.

Fixes: https://github.com/resin-io/etcher/issues/810
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-31 19:46:39 -04:00
Juan Cruz Viotti
45dac58e2a chore: remove www from etcher homepage URL (#808)
See: https://github.com/resin-io/etcher/pull/795
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-31 17:39:11 -04:00
Juan Cruz Viotti
b4d53fd8e5 chore: update homepage URL to https://www.etcher.io (#795)
The current url we use, http://etcher.io, now redirects to
https://www.etcher.io.

Fixes: https://github.com/resin-io/etcher/issues/794
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-31 13:51:30 -04:00
Juan Cruz Viotti
bc985f08a9 fix(GUI): duplicate drives in Windows (#790)
If a drive contains multiple partitions that Windows recognises and
mounts, then `drivelist` will incorrectly display separate drive objects
for each partition, causing `ngRepeat` to complain in the drive selector
component.

The issue was fixed by grouping the mountpoints of all recognised
partitions in a single drive object, as we do with the other supported
operating systems.

After the fix, `drivelist` also removed its `name` property (since its
now always equal to `device`), so some extra logic to compute an
appropriate display name for the drive has been introduced to
`DriveScannerService`.

Fixes: https://github.com/resin-io/etcher/issues/720
See: https://github.com/resin-io-modules/drivelist/pull/100
Change-Type: patch
Changelog-Entry: Fix duplicate drives in Windows.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-31 01:18:58 -04:00
Juan Cruz Viotti
2337c91dce refactor(GUI): log elevation command in Windows (#784)
We do this for macOS and GNU/Linux for debugging purposes, but we
weren't doing it for Windows.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-29 00:03:34 -04:00
Juan Cruz Viotti
fdbb7673a6 fix(GUI): surround paths in double quotes before elevating (#779)
This PR makes sure every command line argument that represents an
absolute path is surrounded by double quotes, to avoid any potential
escaping issue.

This simplifies a lot the various special character escaping routines we
had in place, since we now only have to make sure double quotes inside
the paths are escaped.

Fixes: https://github.com/resin-io/etcher/issues/773
Change-Type: patch
Changelog-Entry: Prevent escaping issues during elevation by surrounding paths in double quotes.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-27 11:39:14 -04:00
Juan Cruz Viotti
9618291f80 feat(GUI): spawn CLI directly from the AppImage in GNU/Linux (#775)
If we pass relative paths as arguments to the AppImage, they get
resolved from `/tmp/.mount_XXXXXX/usr`. We can exploit this to run the
Etcher CLI directly from the AppImage, rather than having to mount it
ourselves:

```sh
ELECTRON_RUN_AS_NODE=1 Etcher-linux-x64.AppImage bin/resources/app.asar [OPTIONS]
```

By using this little trick, we get rid of both our custom mounting logic
and the need of surrounding the command to run in single quotes,
therefore avoiding a whole new kind of escaping issues.

Since running the CLI directly from the AppImage means that the
`desktopintegration` will be ran for the CLI, we pass the `SKIP`
environment variable to avoid having it prompt the user for
installation.

We also updated the `desktopintegration` script to the latest version,
which reduces the amount of logging plus other minor fixes.

Fixes: https://github.com/resin-io/etcher/issues/637
Change-Type: patch
Changelog-Entry: Fix Etcher leaving zombie processes behind in GNU/Linux.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-26 14:07:17 -04:00
Juan Cruz Viotti
d9822faf2f fix(GUI): emit progress back to parent using node-ipc (#774)
This PR makes use of `node-ipc` to emit progress information from the
child CLI to the GUI process rather than the tailing approach we've
been doing until now.

This change was motivated by the following Electron fix which landed in
v1.4.4: https://github.com/electron/electron/pull/7578. Before such fix,
Electron would not output anything to stdout/stderr if the Electron
process was running with `ELECTRON_RUN_AS_NODE` under Windows, which
forced us to implement `--log` option in the Etcher CLI to output state
information to a file.

Since this issue is fixed, we can consume the Etcher CLI output from
within `child_process.spawn`, which opens more interesting possibilities
for sharing information between both processes.

This coindentally fixes a Windows issue where the tailing module would
receive malformed JSON, causing Etcher to crash at `JSON.parse`. The
reason of this problem was a bug in the tailing module we were using.

Fixes: https://github.com/resin-io/etcher/issues/642
Change-Type: patch
Changelog-Entry: Fix "Unexpected end of JSON" error in Windows.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-25 23:56:39 -04:00
Juan Cruz Viotti
32cac3b78f feat(GUI): use info icon instead of "SHOW FULL FILE NAME" (#770)
The main purpose of this change is to simplify the interface and avoid
unnecessary text.

Fixes: https://github.com/resin-io/etcher/issues/742
Change-Type: minor
Changelog-Entry: Use info icon instead of "SHOW FULL FILE NAME" in first step.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-24 15:17:52 -04:00
Juan Cruz Viotti
1609b8df5b fix(GUI): drag and drop not working anymore (#766)
The "dropzone" directive, which we use to implement drag and drop
support, was not being loaded in the application at all for some reason.
It was probably accidentally deleted during major refactorings.

Change-Type: patch
Changelog-Entry: Fix drag and drop not working anymore.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-24 14:23:33 -04:00
Juan Cruz Viotti
60e3cbd22d fix(GUI): don't clear selection state when re-selecting an image (#753)
Currently, if the "CHANGE" label at the bottom of the image selection
step, once an image has been selected, is clicked, the selection state
is cleared.

Since https://github.com/resin-io/etcher/pull/602, we allow the drive
state to change independently of the image selection state, so the above
behaviour doesn't make sense anymore.

Fixes: https://github.com/resin-io/etcher/issues/730
Change-Type: patch
Changelog-Entry: Don't clear selection state when re-selecting an image.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-07 15:32:16 -03:00
Juan Cruz Viotti
4e5b000440 style(GUI): say "eject" instead of "unmount" in Windows (#754)
In Windows, if the user unmounts a drive, then the drive becomes
inaccessible to the OS. Compare this to UNIX based operating systems,
where an unmounted drive is still available for many I/O operations.

To prevent confusion, we say "eject" instead of "unmount" when running
on Windows, despite "unmount" being the correct way of saying it.

See: https://github.com/resin-io/etcher/issues/750
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-07 15:32:04 -03:00
Andrew Scheller
5fbed138a8 feat(GUI): display image path base name as tooltip on truncated name
Changelog-Entry: Display image path base name as a tooltip on truncated image name.
Change-Type: minor
2016-10-03 14:00:56 -04:00
Juan Cruz Viotti
81751743fe fix(GUI): no write after elevation in GNU/Linux (#721)
When the application is packaged as an AppImage, we're accidentally not
applying the whitespace escaping routine, causing images that contain
white spaces to cause Etcher to stall and never start the write.

The issue was even harder to debug given that the problem was not
reproducible when running Etcher from `npm start`.

Change-Type: patch
Changelog-Entry: Fix flashing never starting after elevation in GNU/Linux.
Fixes: https://github.com/resin-io/etcher/issues/631
Fixes: https://github.com/resin-io/etcher/issues/665
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-25 23:06:15 -04:00
Juan Cruz Viotti
5d54e2b7e3 feat(GUI): allow disabling auto-update notifications (#704)
This feature is very appealing when running Etcher ouside a common
desktop environment, for example, as a Resin.io application. In such a
platform, an update notifier that points the user to the website makes
no sense, since the platform itself is responsible for the update.

For such cases, we added support for an environment variable called
`ETCHER_DISABLE_UPDATES`, that when set, will prevent the update check
altogether.

Change-Type: minor
Changelog-Entry: Allow the user to disable auto-update notifications with an environment variable.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-14 18:19:10 -07:00
Juan Cruz Viotti
401cdb6f52 feat(GUI): image-defined recommended drive size (#703)
Recently, we've added support for a `recommendedDriveSize` property in
the `manifest.json` of extended image archives, which the image can use
to warn the user that his drive, even if it is large enough to hold the
image, might not be large enough to deliver a good usage experience
later on.

When this property is found, the GUI reacts in the following ways:

- Drives that are large enough to hold the image but don't meet the
  recommended drive size are tagged with a warning label in the drive
  selector component.

- Attempting to select a "labeled" drive opens a warning modal asking
  for user confirmation.

- Drives that don't meet the recommended drive size declared in the
  image won't get auto-selected.

- If there is a drive already selected, and the user picks an image
  whose recommended drive size is greater than the drive size, the
  currently selected drive gets auto-deselected.

Code-wise, the following significant changes have been introduced:

- Implement `SelectionStateModel.getImageRecommendedDriveSize()`.
- Implement `SelectionStateModel.isDriveSizeRecommended()`.
- Extract `WarningModal` out of the settings page (the dangerous setting
  modal).

Change-Type: minor
Changelog-Entry: Allow images to declare a recommended minimum drive size.
See: https://github.com/resin-io-modules/etcher-image-stream/pull/36
Fixes: https://github.com/resin-io/etcher/issues/698
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-14 18:06:00 -07:00
Juan Cruz Viotti
7798c3398b refactor(GUI): remove ErrorService.reportException() ENOSPC workaround (#695)
This function used to handle `ENOSPC` as a corner case in order to
prevent it from being shown using the default Analytics/Dialog
machinery. This was because the "alert ribbon" used to react to changes
automatically from the templates, however, now that the "alert ribbon"
was removed, and replaced it with modals, we have finer control of how
and when this error gets shown, so the workaround is no longer
necessary.

See: 951b8de9fc
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-11 10:26:25 -07:00
Juan Cruz Viotti
1037905cbb fix(GUI): don't clear drive selection if clicking "Retry" (#696)
If the user encounters a flash error, and then presses the "Retry"
button, the drive selection is cleared, but then is re-selected right
away because its probably the only available drive, leading to a very
strange behaviour UX-wise.

As a solution, we avoid clearing the drive selection.

Change-Type: patch
Changelog-Entry: Don't clear the drive selection if clicking the "Retry" button.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-11 10:26:09 -07:00
Juan Cruz Viotti
18cc0c5cd9 minifix(CLI): only show final checksum if one exists (#692)
The Etcher CLI displays a nice `Checksum: $checksum` message upon
completion. Since the addition of bmap support, a checksum for an image
might not be calculated, causing the CLI to display `Checksum:
undefined`.

This PR takes care of this small UX issue by only showing the checksum
message if one indeed exists.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-07 14:00:22 -07:00
Juan Cruz Viotti
0ff0c77acc feat: zero out configured bytes from drive before flashing with bmap (#691)
This PR makes use of the `bytesToZeroOutFromTheBeginning` option
introduced in:

- https://github.com/resin-io-modules/etcher-image-stream/pull/34
- https://github.com/resin-io-modules/bmapflash/pull/6

The option, when set in `manifest.json`, causes a certain amount of
bytes to be zeroed out before the bmap-assisted write process starts, in
order to prevent issues on certain ROM bootloaders causing by
`bmap-tools` thinking certain parts of the initial sectors are holes.

The following components were upgraded:

- `etcher-image-stream` was upgraded to v4.1.0
- `etcher-image-write` was upgraded to v8.1.0

Changelog-Entry: Allow archive images to configure a certain amount of bytes to be zeroed out from the beginning of the drive when using bmaps.
Change-Type: minor
Fixes: https://github.com/resin-io/etcher/issues/673
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-07 13:36:08 -07:00
Juan Cruz Viotti
951b8de9fc refactor(GUI): replace the orange alert ribbon with a modal (#689)
As a way to simplify the design and make more use of available
components rather than creating specialised ones, we replaced the
`.alert-ribbon` component, which consisted of an orange alert appearing
at the top of the screen for when a validation failed, the drive ran out
of space, or other issues, with a modal.

This change allowed us to remove the "warning"-related colors from the
theme palette.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-07 12:40:51 -07:00
Juan Cruz Viotti
ce1c1d724d upgrade: etcher-image-write to v8.0.0 (#688)
This new version stops sending a `passedValidation` boolean property
upon completion and still throws an `EVALIDATION` error when validation
fails.

Such small chance allows us to get rid of lot of complexity related to
handling the `passedValidation` value in the application state.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-07 10:24:34 -07:00
Juan Cruz Viotti
73edf02e5f style(GUI): fix state -> step typo in main controller (#687)
A function in the `MainController` was being named
`shouldFlashStateBeDisabled`, however it should have been
`shouldFlashStepBeDisabled`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-06 12:51:01 -07:00
Juan Cruz Viotti
5ab3d52ab9 style(GUI): make "Connect a drive" button blue (#686)
For consistency purposes on the main screen, we switch the "Connect a
drive" button to be the classic primary blue button as the other ones.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-06 12:14:06 -07:00
Juan Cruz Viotti
b01ff5f0db feat(GUI): "Need help?" dynamically opens the image support url (#683)
We've recently added support for a `supportUrl` property in an archive
image `_info/manifest.json`, which the publisher can use to define the
URL where it would like to redirect users facing problems.

This PR makes the "Need help?" link at the top right corner open the
configured `supportUrl` url, and fallback to the original Etcher's help
page if no `supportUrl` is found.

In order to accomplish this, we made the following changes:

- Implement `SelectionStateModel.getImageSupportUrl()`
- Implement `HeaderController` controller

Change-Type: minor
Changelog-Entry: Make the "Need help?" link dynamically open the image support url.
Fixes: https://github.com/resin-io/etcher/issues/662
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-05 18:15:51 -07:00
Juan Cruz Viotti
b1ba1c887f upgrade: etcher-image-stream to v4.0.0 (#682)
We're interested in the following changes:

- Add `supportUrl` property in `_info/manifest.json`.
- Add `releaseNotesUrl` property in `_info/manifest.json`.
- Add `version` property in `_info/manifest.json`.
- Add `checksum` and `checksumType` properties in `_info/manifest.json`.

Link: https://github.com/resin-io-modules/etcher-image-stream/blob/master/CHANGELOG.md
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 15:44:39 -04:00
Juan Cruz Viotti
eda52fe5f0 refactor(GUI): move alert-ribbon to the top of the page (#679)
This component is visually shown on the top of the window, however its
HTML code is placed below the "Flash" button, which is
counter-intuitive.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 12:28:59 -04:00
Juan Cruz Viotti
a8884f4da9 refactor(GUI): unify modal styles (#678)
Despite all modals sharing the same design and layout, each of theme is
being styled separately, when most of the CSS rules can be moved and
generified to `_modal.scss` and re-used by all of them.

This PR also moves `lib/gui/scss/components/_modal.scss` to the "Modal"
Angular's module.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 12:28:33 -04:00
Juan Cruz Viotti
cefff7b934 refactor(GUI): move button min-width rules to page styles (#677)
The `.button` component is not the responsible of knowing the
`min-width` it should occupy in the actual pages.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 11:47:20 -04:00
Juan Cruz Viotti
17b5ef96da refactor(GUI): move _bootstrap.scss alert rules to .alert-ribbon (#680)
We have some global CSS rules that affect `.alert` living in
`_bootstrap.scss`, however `.alert` is only being used by our
`.alert-ribbon` component, so it makes sense to move those rules over
there.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 11:47:01 -04:00
Juan Cruz Viotti
5b0698192b refactor(GUI): badge coloring (#675)
Move `.badge` coloring to the main page's style file, since the style we
currently hardcode on the component itself is very tied to the
particular context the badge is being instantiated in.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 10:30:56 -04:00
Juan Cruz Viotti
0b7232c339 refactor(GUI): explicitly declare .label-danger coloring (#676)
`.label-danger` is defined by Bootstrap, and its coloring re-uses what
was defined in `$brand-danger`, which is currently unset.

To prevent the module from going out of sync with our new CSS palette,
we explicitly declare the colorings in the component file.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 10:30:29 -04:00
Juan Cruz Viotti
e1f843652b refactor(GUI): CSS color-scheme (#674)
This is a big PR that extracts out a sensible set of SCSS color
variables that can be used to customise Etcher's look.

To achieve such goal, the following changes were introduced:

- Create a separate `lib/gui/scss/modules/_theme.scss` to conveniently
  hold all SCSS color variables.

- Decouple button styles from Bootstrap's `.btn`.

- Stop configuring Bootstrap colors as a whole using the SCSS variables
  it exposes and instead declare them directly in the modules that make
  use of them.

- Normalize all modal layouts into one. We had like 3 different modal
  layouts, each with their own title/body colors, etc. To simplify the
  color palette, we make use of a single modal layout everywhere.

- Remove `.progress-button--primary`. `.progress-button` is now
  "primary" by default.

- Be precise about `tick` foreground colors.

- Rename `.label-default` to `.label-inset`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-09-02 09:35:25 -04:00
Juan Cruz Viotti
47c50ffe14 chore(GUI): integrate scss-lint (#666)
This PR integrates SCSS Lint, a tool that will help us keep SCSS tidier.
I've included a sensible configuration at `.scss-lint.yml`, and
documentation on how to install it on `CONTRIBUTING.md`.

The tool will run automatically as part of `npm run lint`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-26 15:09:07 -04:00
Juan Cruz Viotti
fb49b6ce4d refactor(GUI): move main page specific styles to pages/main/styles (#660)
There are many SCSS rules in `lib/gui/scss/main.scss` that only apply to
the main page. In order to keep things tidy, those styles were moved to
`lib/gui/pages/main/styles/_main.scss`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-26 10:26:45 -04:00
Juan Cruz Viotti
da81849d4b refactor: rely on etcher-image-stream to fetch bmap contents (#654)
In order to get the bmap file contents to the Etcher CLI, we were
handling extraction, writing to a temporary file, then reading again,
and all sorts of other mumbo-jumbo, without realising that
`etcher-image-stream` already has this information right where we need
it (in the CLI's writer module) and in the way we need it (as plain
text).

Re-using from there hugely simplifies things.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-24 10:19:18 -04:00
Juan Cruz Viotti
8371757c70 upgrade: etcher-image-write to v7.0.0 (#651)
The change we're interested in is:

- https://github.com/resin-io-modules/etcher-image-write/pull/51

Change-Type: patch
Changelog-Entry: Prevent failed validation due to drive getting auto-mounted in GNU/Linux.
Fixes: https://github.com/resin-io/etcher/issues/574
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-23 10:43:05 -04:00
Juan Cruz Viotti
fce399dfd4 fix(GUI): "modal.dismiss" is not a function (#645)
Steps to reproduce:

- Insert a single drive.
- Open drive selector modal.
- Extract the drive while drive selectector modal is open.
- Check DevTools.

The solution is to use `.close()` instead of `.dismiss()`. After some
diving into the documentation and the code, `.dismiss()` is only
available from within the modal controller, however if you want to close
the modal from outside, `.close()` is the way to go.

Notice that `.close()` returns a rejected promise when being called from
the modal itself, but thats not the case from outside, which is quite
confusing, but means we can safely use `.close()` in this context.

Change-Type: patch
Changelog-Entry: Fix "`modal.dismiss` is not a function" exception.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-22 11:58:42 -04:00
Juan Cruz Viotti
763e2f46f4 minifix(GUI): improve image full file name modal tooltip (#646)
The current tooltip, "SHOW IN FULL", proved to be a bit confusing for
users. We're using "SHOW FULL FILE NAME", as kindly suggested by @dlech.

Fixes: https://github.com/resin-io/etcher/issues/634
Change-Type: patch
Changelog-Entry: Improve image full file name modal tooltip.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-22 11:58:33 -04:00
Juan Cruz Viotti
a5a195e8fb feat: integrate bmap support (#635)
This PR integrates `.bmap` support recently added to
`etcher-image-write` into Etcher itself.

It does it in the following way:

- It adds a `--bmap` option to the Etcher CLI.
- It saves a potential `bmap` file contents to the
  `SelectionStateModel`.
- In the GUI, at the time of writing, if there is a `bmap` file content
  in `SelectionStateModel`, it gets written to a temporary file and such
  path is passed as the `--bmap` option to the CLI.

Since validation checksums don't make sense anymore, the finish screen
doesn't show the checksum box in this case.

Change-Type: minor
Changelog-Entry: Add `.bmap` support.
Fixes: https://github.com/resin-io/etcher/issues/171
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-08-22 09:50:56 -04:00
Juan Cruz Viotti
85676a2e94 refactor(GUI): main controller (#623)
The main page controller contained a lot of undocumented and untested
logic. As a first step towards cleaning up the whole thing, this PR
introduces the following changes:

- Implement `ImageSelectionController`, `DriveSelectionController`, and
  `FlashController` as children of `MainController`. Each of them is
  used by the appropriate main page "steps", and contains logic specific
  to them. The `MainController` hosts functionality that applies to the
  page as a whole.

- Add JSDoc annotations fo every controller function/property.

- Unit test several controller functions.

- Simplify template logic.

The "GUI fifty-thousand foot view" section in ARCHITECTURE.md has been
removed since there is no longer a single place where you can see all
the interactions between components.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-08-05 14:40:51 -04:00
Juan Cruz Viotti
7fa4178161 minifix(GUI): don't call shell.openExternal if resource is undefined (#622)
This PR fixes an uncaught error being thrown when
`OSOpenExternalService.open()` is called with an undefined value.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-08-04 11:02:20 -04:00
Juan Cruz Viotti
c31b45200d refactor(GUI): move drive scanner logic to application entry point (#621)
Currently, the logic the controls the drive scanner and populates the
drive model lives in the main application controller.

This is not optimal because:

- The drive scanner stops populating the drives model when the
  application is not on the main screen.

- An event handler subscribes to the drive scanner every time the user
  navigates back to the main screen.

This PR moves the drive scanner logic to a run block in the entry point
of the application.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-08-03 13:54:46 -04:00
Juan Cruz Viotti
1a46ac0301 refactor(GUI): unify error handling (#620)
Error handling is currently a mess. The knowledge to correctly report an
error both to the end user and to us is scattered in many places.

This PR introduces the following changes:

- Rename `AnalyticsService.logDebug()` to `AnalyticsService.logDebug()`
  to clarify better the intention of the function.

- Move `$log` decorators from an `AnalyticsService` run block to
  `AnalyticsService.logDebug()`.

- Implement `AnalyticsService.logException()`, whose duty is to log an
  exception to TrackJS or any related service, and log it to DevTools.

- Implement `ErrorService.reportException()`, whose duty is to report an
  exception to every interested party. This means logging the error to
  TrackJS, displaying it DevTools and showing a nice alert to the user.
  This function is based from `handleError()` from `MainController`.

- Move global `$exceptionHandler` error handler to the entry point of
  the application, and make it simply call
  `ErrorService.reportException()`.

- Replace every `handleError()` call in `MainController` with
  `ErrorService.reportException()`.

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-08-03 13:29:23 -04:00
Juan Cruz Viotti
be2413d8cb fix(GUI): drive is removed everytime user navigates to main screen (#619)
The problem can be reproduced with the following steps:

- Start Etcher.
- Plug a single drive, and let Etcher auto-select it.
- Navigate to the settings screen.
- Go back to the main screen.

The drive is auto-removed for a very small amount of time, until
auto-selection takes care of selecting it again. This behaviour causes
no harm, but its a bit annoying.

The problem was caused by a previous fix, which auto-removed the drive
if navigating back to the main screen after a flash finished, however
the fix no longer makes a lot of sense now that we allow a drive to be
selected even when no image has been chosen.

Change-Type: patch
Changelog-Entry: Prevent selected drive from getting auto-removed when navigating back to the main screen from another screen.
Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
2016-08-03 11:27:47 -04:00