fix: add latitude for huawei cloud

This commit is contained in:
Qu Xuan
2019-10-30 16:52:56 +08:00
parent 5d0f9488cd
commit f307985470
4 changed files with 14 additions and 2 deletions
+3 -2
View File
@@ -115,8 +115,9 @@ const (
CITY_HOLLAND = "Holland" //荷兰
// 南非
CITY_PRETORIA = "Pretoria" //比勒陀利亚
CITY_CAPE_TOWN = "Cape Town" //开普敦
CITY_PRETORIA = "Pretoria" //比勒陀利亚
CITY_CAPE_TOWN = "Cape Town" //开普敦
CITY_JOHANNESBURG = "Johannesburg" //约翰内斯堡
// 泰国
CITY_BANGKOK = "Bangkok" //曼谷
+6
View File
@@ -679,6 +679,12 @@ func (manager *SCloudregionManager) ListItemFilter(ctx context.Context, q *sqlch
break
}
}
cityStr, _ := query.GetString("city")
if cityStr == "Other" {
q = q.IsNullOrEmpty("city")
query.(*jsonutils.JSONDict).Remove("city")
}
return q, nil
}
+3
View File
@@ -59,6 +59,9 @@ func (this *SCloudregionManager) getRegionAttributeList(session *mcclient.Client
cities := make(map[string]int)
for i := range listResult.Data {
cityStr, _ := listResult.Data[i].GetString(attr)
if len(cityStr) == 0 && attr == "city" {
cityStr = "Other"
}
if len(cityStr) > 0 {
if _, ok := cities[cityStr]; ok {
cities[cityStr] += 1
@@ -24,6 +24,7 @@ import (
// ref: https://countrycode.org
var LatitudeAndLongitude = map[string]cloudprovider.SGeographicInfo{
"cn-east-2": {Latitude: 31.210344, Longitude: 121.455364, City: api.CITY_SHANG_HAI, CountryCode: api.COUNTRY_CODE_CN},
"cn-east-3": {Latitude: 31.210344, Longitude: 121.455364, City: api.CITY_SHANG_HAI, CountryCode: api.COUNTRY_CODE_CN},
"cn-north-1": {Latitude: 39.997743, Longitude: 116.304542, City: api.CITY_BEI_JING, CountryCode: api.COUNTRY_CODE_CN},
"cn-north-4": {Latitude: 39.997743, Longitude: 116.304542, City: api.CITY_BEI_JING, CountryCode: api.COUNTRY_CODE_CN},
"cn-south-1": {Latitude: 23.12911, Longitude: 113.264385, City: api.CITY_GUANG_ZHOU, CountryCode: api.COUNTRY_CODE_CN},
@@ -34,4 +35,5 @@ var LatitudeAndLongitude = map[string]cloudprovider.SGeographicInfo{
"eu-west-0": {Latitude: 48.856614, Longitude: 2.3522219, City: api.CITY_PARIS, CountryCode: api.COUNTRY_CODE_FR},
"cn-northeast-1": {Latitude: 38.91400300000001, Longitude: 121.614682, City: api.CITY_SHANG_HAI, CountryCode: api.COUNTRY_CODE_CN},
"cn-southwest-2": {Latitude: 26.6470035286, Longitude: 106.6302113880, City: api.CITY_GUI_YANG, CountryCode: api.COUNTRY_CODE_CN},
"af-south-1": {Latitude: -26.1714537, Longitude: 27.8999389, City: api.CITY_JOHANNESBURG, CountryCode: api.COUNTRY_CODE_ZA},
}