From 9ed6e30b00510678fa7ac69493f1487255c8d551 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Wed, 2 Nov 2016 14:28:21 -0400 Subject: [PATCH] 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 Signed-off-by: Juan Cruz Viotti --- lib/gui/pages/main/controllers/image-selection.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/gui/pages/main/controllers/image-selection.js b/lib/gui/pages/main/controllers/image-selection.js index d61b4bc7..0f925d3f 100644 --- a/lib/gui/pages/main/controllers/image-selection.js +++ b/lib/gui/pages/main/controllers/image-selection.js @@ -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