Get region names from API instead of hard-coding them

This commit is contained in:
2024-05-06 16:57:12 -04:00
parent 4c4db6a734
commit 8ea657c757
21 changed files with 333 additions and 107 deletions
+32 -30
View File
@@ -35,36 +35,38 @@ var elements = {
"username": "username"
};
// Regions (Linode doesn't provide "friendly" names via the API)
// Region names for legacy DCs no longer in the API
var regionNames = {
"us-central": "Dallas, TX, USA",
"us-west": "Fremont, CA, USA",
"us-southeast": "Atlanta, GA, USA",
"us-east": "Newark, NJ, USA",
"us-east-1b": "Newark 2, NJ, USA",
"eu-west": "London, England, UK",
"ap-south": "Singapore, SG",
"eu-central": "Frankfurt, DE",
"ap-northeast": "Tokyo, JP",
"ap-northeast-1a": "Tokyo 2, JP",
"ca-central": "Toronto, ON, CA",
"ap-west": "Mumbai, IN",
"ap-southeast": "Sydney, NSW, AU",
"philadelphia": "Philadelphia, PA, USA",
"absecon": "Absecon, NJ, USA",
"us-iad": "Washington DC, USA",
"us-ord": "Chicago, IL, USA",
"fr-par": "Paris, FR",
"in-maa": "Chennai, IN",
"us-sea": "Seattle, WA, USA",
"br-gru": "San Paulo, BR",
"nl-ams": "Amsterdam, NL",
"se-sto": "Stockholm, SE",
"jp-osa": "Osaka, JP",
"it-mil": "Milan, IT",
"id-cgk": "Jakarta, ID",
"us-lax": "Los Angeles, CA, USA",
"us-mia": "Miami, FL, USA"
"us-east-1b": "Newark 2, NJ",
"philadelphia": "Philadelphia, PA",
"absecon": "Absecon, NJ"
};
// Group contries into regions for easier selection
var countryContinents = {
"us": "na",
"gb": "eu",
"jp": "ap",
"sg": "ap",
"de": "eu",
"in": "ap",
"ca": "na",
"au": "ap",
"fr": "eu",
"br": "sa",
"nl": "eu",
"se": "eu",
"es": "eu",
"it": "eu",
"id": "ap",
"nz": "ap",
"pl": "eu",
"za": "af",
"my": "ap",
"hk": "ap",
"co": "sa",
"mx": "na",
"cl": "sa"
};
// Human-readable event titles
@@ -862,4 +864,4 @@ function translateKernel(slug, element)
apiGet("/linode/kernels/" + slug, callback, null);
}
export { settings, elements, regionNames, apiDelete, apiGet, apiPost, apiPut, drawSeries, md5, migrateETA, oauthPost, oauthScopes, objPut, parseParams, setupHeader, eventTitles, timeString, translateKernel };
export { settings, elements, regionNames, countryContinents, apiDelete, apiGet, apiPost, apiPut, drawSeries, md5, migrateETA, oauthPost, oauthScopes, objPut, parseParams, setupHeader, eventTitles, timeString, translateKernel };