mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
Merge pull request #5823 from ioito/hotfix/qx-rds-zone
fix: 添加rds zone name详情
This commit is contained in:
@@ -284,6 +284,13 @@ type DBInstanceDetails struct {
|
||||
// IP子网名称
|
||||
// example: test-network
|
||||
Network string `json:"network"`
|
||||
|
||||
// Zone1名称
|
||||
Zone1Name string `json:"zone1_name"`
|
||||
// Zone2名称
|
||||
Zone2Name string `json:"zone2_name"`
|
||||
// Zone3名称
|
||||
Zone3Name string `json:"zone3_name"`
|
||||
}
|
||||
|
||||
type DBInstanceResourceInfoBase struct {
|
||||
|
||||
@@ -139,7 +139,7 @@ type SDBInstance struct {
|
||||
|
||||
func (manager *SDBInstanceManager) GetContextManagers() [][]db.IModelManager {
|
||||
return [][]db.IModelManager{
|
||||
{VpcManager},
|
||||
{CloudregionManager},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,14 +481,21 @@ func (manager *SDBInstanceManager) FetchCustomizeColumns(
|
||||
regRows := manager.SCloudregionResourceBaseManager.FetchCustomizeColumns(ctx, userCred, query, objs, fields, isList)
|
||||
|
||||
vpcIds := make([]string, len(rows))
|
||||
zone1Ids := make([]string, len(rows))
|
||||
zone2Ids := make([]string, len(rows))
|
||||
zone3Ids := make([]string, len(rows))
|
||||
for i := range rows {
|
||||
rows[i] = api.DBInstanceDetails{
|
||||
VirtualResourceDetails: virtRows[i],
|
||||
ManagedResourceInfo: manRows[i],
|
||||
CloudregionResourceInfo: regRows[i],
|
||||
}
|
||||
rows[i] = objs[i].(*SDBInstance).getMoreDetails(rows[i])
|
||||
vpcIds[i] = objs[i].(*SDBInstance).VpcId
|
||||
instance := objs[i].(*SDBInstance)
|
||||
rows[i] = instance.getMoreDetails(rows[i])
|
||||
vpcIds[i] = instance.VpcId
|
||||
zone1Ids[i] = instance.Zone1
|
||||
zone2Ids[i] = instance.Zone2
|
||||
zone3Ids[i] = instance.Zone3
|
||||
}
|
||||
|
||||
vpcs := make(map[string]SVpc)
|
||||
@@ -506,6 +513,27 @@ func (manager *SDBInstanceManager) FetchCustomizeColumns(
|
||||
}
|
||||
}
|
||||
|
||||
zone1, err := db.FetchIdNameMap2(ZoneManager, zone1Ids)
|
||||
if err != nil {
|
||||
return rows
|
||||
}
|
||||
|
||||
zone2, err := db.FetchIdNameMap2(ZoneManager, zone2Ids)
|
||||
if err != nil {
|
||||
return rows
|
||||
}
|
||||
|
||||
zone3, err := db.FetchIdNameMap2(ZoneManager, zone3Ids)
|
||||
if err != nil {
|
||||
return rows
|
||||
}
|
||||
|
||||
for i := range rows {
|
||||
rows[i].Zone1Name = zone1[zone1Ids[i]]
|
||||
rows[i].Zone2Name = zone2[zone2Ids[i]]
|
||||
rows[i].Zone3Name = zone3[zone3Ids[i]]
|
||||
}
|
||||
|
||||
return rows
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user