403 Commits

Author SHA1 Message Date
Jonas Hermsmeier
f15587807a test: Use mocha with promises instead of callbacks (#1268)
This changes the test cases to just return the Promises,
to avoid timing out on failures and to provide better
error messages and stack traces.

Change-Type: patch
2017-04-09 21:30:58 +02:00
Jonas Hermsmeier
b3b928ae4f feat(image-stream): Support Apple Disk Images (#1257)
This adds support for flashing Apple Disk Images (.dmg)

Change-Type: minor
2017-04-07 21:34:18 +02:00
Benedict Aas
ff495a45a8 refactor(GUI): remove angular from SettingsModel and rename (#1261)
We remove the usage of Angular in SettingsModel in our efforts to make
Etcher as agnostic as possible as we make our move to React.
2017-04-07 10:45:43 -04:00
Juan Cruz Viotti
802d9abb1d refactor: unify image objects across GUI and image-stream (#1229)
`image-stream` returns image objects that look like this:

```js
{
  stream: <readable stream>,
  transform: <transform stream>,
  size: {
    original: <number>,
    final: {
      value: <number>,
      estimation: <boolean>
    }
  },
  ...
}
```

While the GUI handles image objects that look like this:

```sh
{
  path: <string>,
  size: <number>,
  ...
}
```

It looks like we should share a common structure between both, so we can
use `image-stream` images in `drive-constraints`, for example.

Turns out that we actually transform `image-stream` image objects to GUI
image objects when the user selects an image using the image selector
dialog, which is another indicator that we should normalise this
situation.

As a solution, this commit does the following:

- Add `path` to `image-stream` image object
- Reuse `image-stream` image objects in the GUI, given they are a
  superset of GUI image objects

See: https://github.com/resin-io/etcher/pull/1223#discussion_r108165110
Fixes: https://github.com/resin-io/etcher/issues/1232
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-06 09:41:08 -04:00
Juan Cruz Viotti
e16234e3e8 refactor(GUI): get rid of drive-constraints Angular factory wrapper (#1250)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-04 13:44:03 -04:00
Juan Cruz Viotti
71d5fad2b0 refactor(image-stream): get rid of rindle (#1246)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-04 09:49:00 -04:00
Juan Cruz Viotti
c5a711af0f refactor(CLI): make use of mountutils to unmount drives (#1209)
`mountutils` is a native C++ NodeJS addon the Etcher team has been
working on to solve several issues we've been having with third party
unmount programs.

We'll see how this little module behaves after some real world usage.
I'm confident that it will fix the issues linked in this commit.

This commit also upgrades `npm` to 4.4.4 in Appveyor, given there is a
known building issue on Windows that is solved in a recent version.

Change-Type: minor
Changelog-Entry: Fix several unmount related issues in all platforms.
See: https://github.com/resin-io-modules/mountutils
Fixes: https://github.com/resin-io/etcher/issues/1177
Fixes: https://github.com/resin-io/etcher/issues/985
Fixes: https://github.com/resin-io/etcher/issues/750
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-02 21:34:05 -04:00
Juan Cruz Viotti
997133c979 refactor(GUI): get rid of basename Angular filter (#1252)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-01 14:52:06 -04:00
Juan Cruz Viotti
4a3a123f42 refactor(image-stream): get rid of read-chunk (#1243)
We also took the opportunity to make `utils.getArchiveMimeType()`
asynchronous.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-01 14:47:14 -04:00
Juan Cruz Viotti
57952f6f55 fix(CLI): don't print stack traces by default (#1206)
Currently, the Etcher CLI will print scary stack traces for every single
error (e.g: if you forgot to pass an image to the tool), given that
`errors.getDescription()` will return a stack trace if no other
description could be found.

This commit introduces an `ETCHER_CLI_DEBUG` environment variable, which
when set, it will cause the Etcher CLI to output stack traces, plus a
boolean `userFriendlyDescriptionsOnly` option to
`errors.getDescription()`, so we can control whether
`errors.getDescription()` returns things like stack traces, or
stringified error objects.

Change-Type: minor
Changelog-Entry: Don't print stack traces by default in the CLI.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-28 09:43:15 -04:00
Andrew Scheller
c9702c3a6d chore: get the CI tests working again (#1182)
* chore: get the CI tests working again
 * an updated eslint-plugin-lodash was creating extra linter errors where we
   were using built-in String methods instead of the lodash equivalents
 * an updated codespell package now installs with a different executable-name
   (no .py extension), and now supports multiple dictionaries
 * while I was at it I replaced the messy double-quoting-string logic with the
   command-join module

Changelog-type: patch

* chore: downgrade codespell to 1.9.2 because the latest version has issues running on Windows
(we'll hopefully be able to revert this commit when codespell works again properly!)
2017-03-15 16:32:25 -04:00
Ștefan Daniel Mihăilă
fe20f5061f fix(GUI): don't log absolute paths in Mixpanel (#1161)
The event data may contain absolute paths that contain user information that
should not be logged in Mixpanel. Instead, we replace absolute path properties
with their base name.

Change-Type: patch
Changelog-Entry: Don't include user paths in Mixpanel analytics events.
2017-03-15 00:05:48 -04:00
Ștefan Daniel Mihăilă
34c85eb150 feat(GUI): improve analytics events (#1111)
* feat(GUI): improve analytics events

This commit adds more events to our current analytics.
Will further improve in a future commit.

Change-Type: patch
See: https://github.com/resin-io/etcher/issues/1100

* refactor(gui): use single function to set normal and dangerous settings

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-10 15:18:49 -04:00
Juan Cruz Viotti
e4a9a03239 refactor: unify error related tasks (#1154)
The current error handling logic is a mess. We have code that tries to
fetch information about errors in different places throughout the
application, and its incredibly hard to ensure certain types of error
get decent human friendly error messages.

This commit groups, improves, and tests all error related functions in
`lib/shared/errors.js`.

Here's a summary of the changes, in more detail:

- Move the `HUMAN_FRIENDLY` object to `shared/errors.js`
- Extend `HUMAN_FRIENDLY` with error descriptions
- Add `ENOMEM` to `shared/errors.js`
- Group CLI and `OSDialogService` mechanisms for getting an error title
  and an error description
- Move error serialisation routines from `robot` to `shared/errors.js`
- Create and use `createError()` and `createUserError()` utility
  functions
- Add user friendly descriptions to many errors
- Don't report user errors to TrackJS

Fixes: https://github.com/resin-io/etcher/issues/1098
Change-Type: minor
Changelog-Entry: Make errors more user friendly throughout the application.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-10 13:11:45 -04:00
Juan Cruz Viotti
df8611df11 chore: add ESLint Lodash plugin (#1148)
This is one step towards enforcing the linter until we barely have to
check for style issues on code reviews.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-08 19:11:15 -04:00
Juan Cruz Viotti
6c8bc117ab chore: revise ESLint built-in configuration (#1149)
There are a lot of new rules since the last time I revised the ESLint
rules documentation.

I've updated the main `.eslintrc.yml` to include some newer additions,
plus I added another ESLint configuration file inside `tests`, so we can
add some stricted rules to the production code while relaxing them for
the test suite (due to the fact that Mocha is not very ES6 friendly and
Angular tests require a bit of dark magic to setup).

This is a summary of the most important changes:

- Disallow "magic numbers"

These should now be extracted to constants, which forces us to think of
a good name for them, and thus make the code more self-documenting (I
had to Google up the meaning of some existing magic numbers, so I guess
this will be great for readability purposes).

- Require consistent `return` statements

Some functions relied on JavaScript relaxed casting mechanism to work,
which now have explicit return values. This flag also helped me detect
some promises that were not being returned, and therefore risked not
being caught by the exception handlers in case of errors.

- Disallow redefining function arguments

Immutability makes functions easier to reason about.

- Enforce JavaScript string templates instead of string concatenation

We were heavily mixing boths across the codebase.

There are some extra rules that I tweaked, however most of codebase
changes in this commit are related to the rules mentioned above.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-07 23:46:44 -04:00
Juan Cruz Viotti
98284bd5e2 fix(GUI): don't report "invalid archive" errors to TrackJS (#1152)
These errors happen when the user selects an archive that contains no
image, or multiple images, and represents a user error, rather than an
unhandled exception.

For this reason, we should not report this to TrackJS.

This means, however, that we need a reliable way to know whether an
error should be reporter or not. This commit implements
`AnalyticsService.shouldReportError()` for this purpose, which will
check an optional `report` property of the error object.

In order to ensure that errors that we don't control are reported, the
function will return `true` if the error object doesn't have that
property.

Change-Type: patch
Changelog-Entry: Don't report "invalid archive" errors to TrackJS.
Fixes: https://github.com/resin-io/etcher/issues/1103
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-02 12:21:48 -04:00
Ștefan Daniel Mihăilă
5b9104e8aa feat(GUI): warn when atempting to burn Windows images (#1043)
Change-Type: minor
Changelog-Entry: Show warning when user tries to flash a Windows image
Closes: https://github.com/resin-io/etcher/issues/1035
2017-02-24 15:12:03 -04:00
Benedict Aas
db8f7d0862 refactor(gui): revert drive/image selection step order swap (#1086)
We revert the drive and image selection step order swap back from drive
selection first and image second, to image first and drive second.

See: https://github.com/resin-io/etcher/pull/1049
2017-02-10 11:59:01 -04:00
Ștefan Daniel Mihăilă
92fdba3642 upgrade: angular to v1.6.1; angular-ui-bootstrap to v2.5.0 (#1083)
Angular 1.5 has a bug that causes angular's `$exceptionHandler`
to be called for rejected `$q` promises even if they have
a rejection handler. This bug caused duplicate error messages
in Etcher.

A consequence of upgrading to Angular 1.6 is that `$q` promises
without a rejection handler will throw `Possibly unhandled rejection`
errors. To avoid these errors, this commit moves code responsible
for opening a tooltip from the template to the controller and handles
the rejection.

Other packages upgraded:
- angular-moment to v1.0.1
- angular-ui-router to v0.4.2
- angular-mocks to v1.6.1

Change-type: patch
Changelog-Entry: Fix duplicate error messages
Fixes: https://github.com/resin-io/etcher/issues/1082
See: https://github.com/angular/angular.js/issues/7992
See: https://github.com/angular/angular.js/pull/13662
2017-02-07 19:12:32 -04:00
Juan Cruz Viotti
70c7ddc52a fix(GUI): don't auto select system drives in unsafe mode
Currently Etcher will auto-select a system drive if its the only
available one when the "unsafe mode" is enabled, which doesn't feel
right.

Change-Type: patch
Changelog-Entry: Don't auto select system drives in unsafe mode.
See: https://github.com/resin-io/etcher/pull/1061
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-07 13:34:07 -04:00
Juan Cruz Viotti
8e5840ce69 chore: integrate codespell and fix existing spelling issues
This tool scans the comments of every source file and reports back
spelling errors.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-06 14:53:20 -04:00
Juan Cruz Viotti
95d4f2f608 fix(GUI): prevent flashing the drive where the source image is located
Currently Etcher will allow you to flash an image to the same drive that
contains the image. As a way to protect against that case we introduce
the concept of a "source drive", which means a drive that contains the
source image.

This commit adds the following logic around this new concept:

- Don't auto-select a source drive
- De-select an already selected drive if an image inside it is selected
- Disable the drive in the drive selector modal
- Add a "Source Drive" badge to the drive in the drive selector modal

Fixes: https://github.com/resin-io/etcher/issues/830
Change-Type: minor
Changelog-Entry: Prevent flashing the drive where the source image is located.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-06 14:53:08 -04:00
Juan Cruz Viotti
ea95177e94 test(GUI): fix non-running test in DrivesModel test suite (#1061)
We have a test to ensure a drive is not auto-selected when its
protected, however the real functionality of this test was not being
tested given that the size the fake drive had was not enough to hold the
image.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-30 10:03:24 -04:00
Juan Cruz Viotti
fd9d3ce749
Revert "refactor: remove extended archives extra functionality (#1055)"
This reverts commit b78473ea0ebd76233217fb4f236bb34be635da90.
2017-01-26 18:36:33 -04:00
Juan Cruz Viotti
b78473ea0e refactor: remove extended archives extra functionality (#1055)
We currently attempt to read extra metadata from ZIP files, such as a
logo, image name, image url, etc. In order to simplify the metadata
story, we decided that this metadata will not live on the image itself,
but rather on a centralised repo, which greatly simplified our custom
archive extraction logic and allows us to make use of these nice
features even when streaming the image directly from the internet.

We'll be working on bringing back this functionality from a centralised
repo in subsequent commits.

Change-Type: major
Changelog-Entry: Remove extended archives metadata extraction logic.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-26 15:21:01 -04:00
Juan Cruz Viotti
1bfcee06e2 refactor(image-stream): stream original/final sizes (#1050)
The `image-stream` module currently returns a readable stream, a
transform stream, a "size", and an optional "estimatedUncompressedSize".

Based on this information, its hard to say what "size" represents. Some
format handlers return the compressed size and provide a decompression
transform stream while others return the decompressed stream directly
and put the decompressed size in "size".

As a way to simplify this, every format handler now returns a "size"
object with the following properties:

- `original`: The original compressed size
- `final.estimated`: Whether the final size is an estimation or not
- `final.value`: The final uncompressed size

As a bonus, we extract the file size retrieval logic to
`imageStream.getFromFilePath()`, which is the onlt part where the
concept of a file should be referred to.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-26 12:01:53 -04:00
Benedict Aas
b25b2d1179 feat(GUI): swap drive and image selection step order (#1049)
Change the first step to be drive selection and the second step to be
image selection, instead of vice versa as it previously was.

Changelog-Entry: Swap the order of the drive and image selection steps.
2017-01-26 12:01:10 -04:00
Juan Cruz Viotti
0e1f50422e refactor: integrate etcher-image-stream into the etcher repository (#1040)
This is a long lasting task. The `etcher-image-stream` project takes
care of converting any kind of image input into a NodeJS readable
stream, handling things like decompression in betwee, however its a
module that, except for weird cases, there is no benefit on having
separate from the main repository.

In order to validate the assumption above, we've left the module
separate for almost a year, and no use case has emerged to keep it
like that.

This commit joins the code and tests of that module in the main
repository.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 10:32:37 -04:00
Juan Cruz Viotti
acc1f05269 refactor: move lib/shared/child-writer to lib/child-writer (#1041)
The `child-writer` module is not re-used by both the GUI and the CLI, so
it makes sense to have it in `lib/child-writer`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-24 12:06:34 -04:00
Benedict Aas
0f2cba38d1 fix: allow undefined drives and images in DriveConstraintsModel (#1016)
Currently the `DriveConstraintsModel` errors when given an `undefined`
drive, or image; this commit changes that behaviour. Comes with tests.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 18:14:09 -04:00
Juan Cruz Viotti
aea4403a16 refactor: move all byte-size conversion logic to lib/shared/units.js (#1021)
This commit extracts the byte-related conversions from the `byte-size`
AngularJS module and the `FlashStateModel` to a re-usable generic
CommonJS module at `lib/shared/units.js`, than can also be used by the
CLI.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 16:11:28 -04:00
Juan Cruz Viotti
c552494480 refactor: extract application messages to lib/shared/messages.js (#1022)
There are certain application messages that should be re-used between
the CLI and the GUI. In order to allow such re-usability, we extract out
the application messages used in JavaScript into
`lib/shared/messages.js` as a collection of Lodash `_.template`
templates.

Notice this file doesn't include application messages included in
Angular templates directly since it'd be hard to refactor all of them.
We plan to move to React soon, which will allow moving the remaining
messages very easily.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 11:03:46 -04:00
Juan Cruz Viotti
c707c76633 feat(CLI): improve error messages (#1015)
- Inline dictionary of common error codes and friendly descriptions

We used to rely on `resin-cli-errors` for this, however the friendly
descriptions set there can be usually very Resin CLI specific, and thus
confusing to Etcher users.

The dictionary, along with other error related utilities live in
`lib/cli/errors.js`.

- Print error descriptions and codes if they are found

- Move `utils.printError()` to `errors.print()`

Change-Type: minor
Changelog-Entry: Improve Etcher CLI error messages.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-11 18:45:59 -04:00
Juan Cruz Viotti
0b0b097620 refactor(GUI): extract and test child writer CLI argument utilities (#1012)
These utilities were extracted to `lib/shared/child-writer/cli.js`, and
unit tests have been written for them.

As a result of testing, `.getBooleanArgumentForm()` has been extended to
support single letter options.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-10 21:36:33 -04:00
Juan Cruz Viotti
7fa2f437c1 feat(CLI): replace --robot with an ETCHER_CLI_ROBOT env var (#1010)
The `--robot` option of the CLI causes the program to output
machine-parseable strings, which can be easily consumed by the GUI to
update progress and other information.

The problem is that if the CLI fails to parse its command line arguments
when being called from the GUI for whatever reason, the `.fail()` Yargs
handler will be called, which doesn't output error information in the
usual "robot" format, causing the GUI to not understand the error
message.

Since the `.fail()` Yargs handler doesn't have access to the passed
options, we moved the "robot" functionality to an environment variable,
which we can easily check from there.

As a bonus, this PR refactors the whole robot logic into
`lib/shared/robot.js` and adds unit tests to it.

See: https://github.com/resin-io/etcher/issues/986
Change-Type: major
Changelog-Entry: Replace the `--robot` CLI option with an `ETCHER_CLI_ROBOT` environment variable.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-10 19:46:59 -04:00
Juan Cruz Viotti
735478bf52 fix(GUI): don't split robot input by new lines inside properties (#1008)
We've recently PRed a commit that handles multiple IPC messages being
triggered at the same time, confusing `JSON.parse()`. As a solution to
such problem, we are splitting the CLI output on new lines, based on the
assumption that each line represents a different object, however we
didn't consider that in the case of errors, we include an `stacktrace`
property which usually includes new line characters, causing such
information to be completely garbled and cause `JSON.parse()` once again
to get confused.

As a solution, we only split by new lines that are not surrounded by
quotes (since they represent a JSON property).

See: https://github.com/resin-io/etcher/pull/997
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-10 12:25:16 -04:00
Ștefan Daniel Mihăilă
050d187e6f refactor: extract SelectionStateModel stateless functions (#982)
`SelectionStateModel`'s methods `isSystemDrive` and `isDriveLocked`
don't depend on application state. They have been extracted in a different
AngularJS service: `DriveConstraintsModel`. The new service's actual
implementation is in `lib/src`, in order to be reused by the CLI.

Miscellaneous changes:

- Rename `lib/src` to `lib/shared`
- Refactor `drive-constraints` to throw when image is undefined

The default behaviour was to pretend that we're all good if the if
the image is not specified. We're not using this "feature", and
it can be dangerous if we forget to pass in the image.

- Make `isSystemDrive` return `false` if `system` property is undefined
- Use `drive-constraints` in `store.js`

Change-Type: patch
2017-01-06 12:42:11 -04:00
Benedict Aas
d7e1fe09fc feat(gui): label system drives in drive-list widget (#978)
System drives in the drive-list widget now have a red warning label
beneath. Also new is the `isSystemDrive()` method under
`SelectionStateModel` and its unit-tests.

See: https://github.com/resin-io/etcher/issues/888
Changelog-Entry: Label system drives in the drive-list widget
2016-12-16 10:41:04 -04:00
Juan Cruz Viotti
6456a8fe96 upgrade: drivelist to v5.0.1 (#869)
- Fix internal SDCard reader descriptions in GNU/Linux.
- Transform `mountpoint` into an array of mountpoints.

Change-Type: patch
Changelog-Entry: Fix internal SDCard drive descriptions.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-16 13:52:20 +00:00
Juan Cruz Viotti
4e3bdb7e22 refactor(CLI): move UNIX umount functionality to repository (#866)
- Move UNIX unmount functionality to the CLI module
- Run `electron-mocha` for the CLI code
- Make unmount command templates that take a `drivelist` object as input

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-14 11:11:49 +02:00
Juan Cruz Viotti
dae07ad050 test: fix failing ImageSelectionController tests (#856)
This was a small issue affected due to the change in order of the
supported extensions in the ImageSelectionController.

Since we want to test that the array contents are equally the same
independently on the order, we sort both sides of the assertion.

This issue was not caught before since `electron-mocha` was reporting
exit code 0 even when there were changes failing, causing the CI
services to incorrectly support success.

See: https://github.com/resin-io/etcher/pull/854
See: https://github.com/resin-io/etcher/pull/806
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-09 21:23:30 +02:00
Juan Cruz Viotti
5ac486d941 style: refer to Resin.io as resin.io, according to the style manual (#823)
> For all, lower-case capitalization unless beginning a sentence (Ex. I
> like resin.io. Resin.io is great.)

See: https://github.com/resin-io/docs#style-manual
See: https://github.com/resin-io/etcher/issues/797
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-03 10:57:29 -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
c7f4313ded upgrade: etcher-image-stream to v5.1.0 (#752)
We're particularly interested in the following change:

- Add `etch` support.

Also:

- Add a `.description` property to all archive related errors.
- Rename archive metadata base path from `_info` to `.meta`.

Change-Type: minor
Changelog-Entry: Add support for `etch` images.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-10-07 15:32:25 -03: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
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
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
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