From 2fa7626942f66572432033150c40f09a2f811aab Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Jan 20 2020 15:40:47 +0000 Subject: coreos: change ordering of AWS regions Put US, EU, and AP regions first since those are the most popular and cheapest. Then put everything else. Within those buckets, sort them in alphabetical order, so e.g. `us-east-1` is before `us-east-2`. This roughly matches the way Fedora Cloud also lists its AMIs. --- diff --git a/sites/static/js/coreos-download.js b/sites/static/js/coreos-download.js index 499652f..4c57436 100644 --- a/sites/static/js/coreos-download.js +++ b/sites/static/js/coreos-download.js @@ -240,6 +240,22 @@ var coreos_download_app = new Vue({ const image = getMember(regions[region], "image"); displayEntries.push({platform: prettyPlatform, region: region, release: release, image: image}); } + // put 'us', 'eu', and 'ap' first since those are the cheapest and + // most popular; then everything else + const continentOrdering = ["us", "eu", "ap"]; + displayEntries = displayEntries.sort(function(a, b) { + const aIdx = continentOrdering.indexOf(a.region.slice(0, 2)); + const bIdx = continentOrdering.indexOf(b.region.slice(0, 2)); + if (aIdx == bIdx) { + return a.region.localeCompare(b.region); + } else if (aIdx == -1) { + return 1; + } else if (bIdx == -1){ + return -1; + } else { + return aIdx - bIdx; + } + }); } Vue.set(this.streamDisplay.cloudLaunchable, platform, {list: displayEntries}); }