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>
This commit is contained in:
Juan Cruz Viotti 2016-11-02 14:28:21 -04:00 committed by GitHub
parent 428dbeaf55
commit 9ed6e30b00

View File

@ -26,7 +26,11 @@ module.exports = function(SupportedFormatsModel, SelectionStateModel, AnalyticsS
* @type {String[]}
* @public
*/
this.mainSupportedExtensions = _.slice(SupportedFormatsModel.getAllExtensions(), 0, 3);
this.mainSupportedExtensions = _.intersection([
'img',
'iso',
'zip'
], SupportedFormatsModel.getAllExtensions());
/**
* @summary Extra supported extensions
@ -37,7 +41,7 @@ module.exports = function(SupportedFormatsModel, SelectionStateModel, AnalyticsS
this.extraSupportedExtensions = _.difference(
SupportedFormatsModel.getAllExtensions(),
this.mainSupportedExtensions
);
).sort();
/**
* @summary Select image