相关区域名称可以显示别名

This commit is contained in:
GoEdgeLab
2022-08-23 19:15:44 +08:00
parent 3be0275081
commit bcf911f11a
12 changed files with 20 additions and 20 deletions

View File

@@ -36,7 +36,7 @@ func (this *IndexAction) RunGet(params struct {
this.NotFound("firewallPolicy", params.FirewallPolicyId) this.NotFound("firewallPolicy", params.FirewallPolicyId)
return return
} }
selectedCountryIds := []int64{} var selectedCountryIds = []int64{}
if policyConfig.Inbound != nil && policyConfig.Inbound.Region != nil { if policyConfig.Inbound != nil && policyConfig.Inbound.Region != nil {
selectedCountryIds = policyConfig.Inbound.Region.DenyCountryIds selectedCountryIds = policyConfig.Inbound.Region.DenyCountryIds
} }
@@ -46,11 +46,11 @@ func (this *IndexAction) RunGet(params struct {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
countryMaps := []maps.Map{} var countryMaps = []maps.Map{}
for _, country := range countriesResp.RegionCountries { for _, country := range countriesResp.RegionCountries {
countryMaps = append(countryMaps, maps.Map{ countryMaps = append(countryMaps, maps.Map{
"id": country.Id, "id": country.Id,
"name": country.Name, "name": country.DisplayName,
"letter": strings.ToUpper(string(country.Pinyin[0][0])), "letter": strings.ToUpper(string(country.Pinyin[0][0])),
"isChecked": lists.ContainsInt64(selectedCountryIds, country.Id), "isChecked": lists.ContainsInt64(selectedCountryIds, country.Id),
}) })

View File

@@ -37,7 +37,7 @@ func (this *ProvincesAction) RunGet(params struct {
this.NotFound("firewallPolicy", params.FirewallPolicyId) this.NotFound("firewallPolicy", params.FirewallPolicyId)
return return
} }
selectedProvinceIds := []int64{} var selectedProvinceIds = []int64{}
if policyConfig.Inbound != nil && policyConfig.Inbound.Region != nil { if policyConfig.Inbound != nil && policyConfig.Inbound.Region != nil {
selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds
} }
@@ -49,11 +49,11 @@ func (this *ProvincesAction) RunGet(params struct {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
provinceMaps := []maps.Map{} var provinceMaps = []maps.Map{}
for _, province := range provincesResp.RegionProvinces { for _, province := range provincesResp.RegionProvinces {
provinceMaps = append(provinceMaps, maps.Map{ provinceMaps = append(provinceMaps, maps.Map{
"id": province.Id, "id": province.Id,
"name": province.Name, "name": province.DisplayName,
"isChecked": lists.ContainsInt64(selectedProvinceIds, province.Id), "isChecked": lists.ContainsInt64(selectedProvinceIds, province.Id),
}) })
} }

View File

@@ -55,7 +55,7 @@ func (this *CountriesAction) RunGet(params struct {
for _, country := range countriesResp.RegionCountries { for _, country := range countriesResp.RegionCountries {
countryMaps = append(countryMaps, maps.Map{ countryMaps = append(countryMaps, maps.Map{
"id": country.Id, "id": country.Id,
"name": country.Name, "name": country.DisplayName,
"letter": strings.ToUpper(string(country.Pinyin[0][0])), "letter": strings.ToUpper(string(country.Pinyin[0][0])),
"isChecked": lists.ContainsInt64(selectedCountryIds, country.Id), "isChecked": lists.ContainsInt64(selectedCountryIds, country.Id),
}) })

View File

@@ -46,7 +46,7 @@ func (this *ProvincesAction) RunGet(params struct {
selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds selectedProvinceIds = policyConfig.Inbound.Region.DenyProvinceIds
} }
provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithCountryIdRequest{ provincesResp, err := this.RPC().RegionProvinceRPC().FindAllRegionProvincesWithRegionCountryId(this.AdminContext(), &pb.FindAllRegionProvincesWithRegionCountryIdRequest{
RegionCountryId: int64(ChinaCountryId), RegionCountryId: int64(ChinaCountryId),
}) })
if err != nil { if err != nil {
@@ -57,7 +57,7 @@ func (this *ProvincesAction) RunGet(params struct {
for _, province := range provincesResp.RegionProvinces { for _, province := range provincesResp.RegionProvinces {
provinceMaps = append(provinceMaps, maps.Map{ provinceMaps = append(provinceMaps, maps.Map{
"id": province.Id, "id": province.Id,
"name": province.Name, "name": province.DisplayName,
"isChecked": lists.ContainsInt64(selectedProvinceIds, province.Id), "isChecked": lists.ContainsInt64(selectedProvinceIds, province.Id),
}) })
} }

View File

@@ -55,7 +55,7 @@ func (this *CountriesAction) RunGet(params struct {
for _, country := range countriesResp.RegionCountries { for _, country := range countriesResp.RegionCountries {
countryMaps = append(countryMaps, maps.Map{ countryMaps = append(countryMaps, maps.Map{
"id": country.Id, "id": country.Id,
"name": country.Name, "name": country.DisplayName,
"letter": strings.ToUpper(string(country.Pinyin[0][0])), "letter": strings.ToUpper(string(country.Pinyin[0][0])),
"isChecked": lists.ContainsInt64(selectedCountryIds, country.Id), "isChecked": lists.ContainsInt64(selectedCountryIds, country.Id),
}) })

View File

@@ -57,7 +57,7 @@ func (this *ProvincesAction) RunGet(params struct {
for _, province := range provincesResp.RegionProvinces { for _, province := range provincesResp.RegionProvinces {
provinceMaps = append(provinceMaps, maps.Map{ provinceMaps = append(provinceMaps, maps.Map{
"id": province.Id, "id": province.Id,
"name": province.Name, "name": province.DisplayName,
"isChecked": lists.ContainsInt64(selectedProvinceIds, province.Id), "isChecked": lists.ContainsInt64(selectedProvinceIds, province.Id),
}) })
} }

View File

@@ -40,7 +40,7 @@ func (this *IndexAction) RunGet(params struct{}) {
if country != nil { if country != nil {
countryMaps = append(countryMaps, maps.Map{ countryMaps = append(countryMaps, maps.Map{
"id": country.Id, "id": country.Id,
"name": country.Name, "name": country.DisplayName,
}) })
} }
} }
@@ -58,7 +58,7 @@ func (this *IndexAction) RunGet(params struct{}) {
if province != nil { if province != nil {
provinceMaps = append(provinceMaps, maps.Map{ provinceMaps = append(provinceMaps, maps.Map{
"id": province.Id, "id": province.Id,
"name": province.Name, "name": province.DisplayName,
}) })
} }
} }

View File

@@ -25,7 +25,7 @@ func (this *ProvinceOptionsAction) RunPost(params struct{}) {
} }
provinceMaps = append(provinceMaps, maps.Map{ provinceMaps = append(provinceMaps, maps.Map{
"id": province.Id, "id": province.Id,
"name": province.Name, "name": province.DisplayName,
"codes": province.Codes, "codes": province.Codes,
}) })
} }

View File

@@ -32,7 +32,7 @@ func (this *SelectCountriesPopupAction) RunGet(params struct {
for _, country := range countriesResp.RegionCountries { for _, country := range countriesResp.RegionCountries {
countryMaps = append(countryMaps, maps.Map{ countryMaps = append(countryMaps, maps.Map{
"id": country.Id, "id": country.Id,
"name": country.Name, "name": country.DisplayName,
"letter": strings.ToUpper(string(country.Pinyin[0][0])), "letter": strings.ToUpper(string(country.Pinyin[0][0])),
"isChecked": lists.ContainsInt64(selectedCountryIds, country.Id), "isChecked": lists.ContainsInt64(selectedCountryIds, country.Id),
}) })
@@ -61,7 +61,7 @@ func (this *SelectCountriesPopupAction) RunPost(params struct {
} }
countryMaps = append(countryMaps, maps.Map{ countryMaps = append(countryMaps, maps.Map{
"id": country.Id, "id": country.Id,
"name": country.Name, "name": country.DisplayName,
}) })
} }
this.Data["countries"] = countryMaps this.Data["countries"] = countryMaps

View File

@@ -33,7 +33,7 @@ func (this *SelectProvincesPopupAction) RunGet(params struct {
for _, province := range provincesResp.RegionProvinces { for _, province := range provincesResp.RegionProvinces {
provinceMaps = append(provinceMaps, maps.Map{ provinceMaps = append(provinceMaps, maps.Map{
"id": province.Id, "id": province.Id,
"name": province.Name, "name": province.DisplayName,
"isChecked": lists.ContainsInt64(selectedProvinceIds, province.Id), "isChecked": lists.ContainsInt64(selectedProvinceIds, province.Id),
}) })
} }
@@ -61,7 +61,7 @@ func (this *SelectProvincesPopupAction) RunPost(params struct {
} }
provinceMaps = append(provinceMaps, maps.Map{ provinceMaps = append(provinceMaps, maps.Map{
"id": province.Id, "id": province.Id,
"name": province.Name, "name": province.DisplayName,
}) })
} }
this.Data["provinces"] = provinceMaps this.Data["provinces"] = provinceMaps

View File

@@ -164,7 +164,7 @@ span.disabled {
a.enabled, a.enabled,
span.enabled, span.enabled,
span.green { span.green {
color: #21ba45; color: #2c662d;
} }
span.grey, span.grey,
label.grey, label.grey,

View File

@@ -19,7 +19,7 @@ a.disabled, a.disabled:hover, a.disabled:active, span.disabled {
} }
a.enabled, span.enabled, span.green { a.enabled, span.enabled, span.green {
color: #21ba45; color: #2c662d;
} }
span.grey, label.grey, p.grey { span.grey, label.grey, p.grey {