应用列表中展示子表中的副本数量
Former-commit-id: 8388d26ea87ae143f542e9c3660b5ea1aa3f56a3
This commit is contained in:
parent
68c82f7807
commit
405c972314
|
@ -577,6 +577,10 @@ type (
|
|||
TotalCount int64 `json:"totalCount"` // 任务总数
|
||||
Apps []App `json:"apps"` //应用列表
|
||||
}
|
||||
Replica {
|
||||
ClusterName string `json:"clusterName"`
|
||||
Replica int32 `json:"replica"`
|
||||
}
|
||||
App {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
@ -589,6 +593,7 @@ type (
|
|||
ParticipantName string `json:"participantName"`
|
||||
Storage string `json:"storage"`
|
||||
CreateTime string `json:"createTime"`
|
||||
Replicas []Replica `json:"replicas"`
|
||||
}
|
||||
)
|
||||
|
||||
|
|
|
@ -49,6 +49,10 @@ func (l *AppListLogic) AppList(req *types.AppListReq) (resp *types.AppListResp,
|
|||
resp = &types.AppListResp{}
|
||||
l.svcCtx.DbEngin.Raw("SELECT t.*,phy.name as p_name,phy.id as p_id FROM task t LEFT JOIN cloud c ON c.task_id = t.id join sc_participant_phy_info phy on c.participant_id = phy.id WHERE c.kind in ('Deployment', 'StatefulSet', 'Ingress', 'Service') AND t.`ns_id` = ? AND t.`deleted_at` IS NULL ORDER BY t.created_time Desc", req.Namespace).Scan(&tasks)
|
||||
for _, task := range tasks {
|
||||
|
||||
var replicas []types.Replica
|
||||
l.svcCtx.DbEngin.Raw("SELECT sc_participant_phy_info.name,replica FROM cloud left join sc_participant_phy_info on cloud.participant_id = sc_participant_phy_info.id WHERE task_id =?", task.Id).Scan(&replicas)
|
||||
|
||||
resp.Apps = append(resp.Apps, types.App{
|
||||
Id: task.Id,
|
||||
Name: task.Name,
|
||||
|
@ -58,6 +62,7 @@ func (l *AppListLogic) AppList(req *types.AppListReq) (resp *types.AppListResp,
|
|||
CreateTime: task.CommitTime.Format("2006-01-02 15:04:05"),
|
||||
ParticipantId: task.PId,
|
||||
ParticipantName: task.PName,
|
||||
Replicas: replicas,
|
||||
})
|
||||
}
|
||||
return
|
||||
|
|
|
@ -541,6 +541,11 @@ type AppListResp struct {
|
|||
Apps []App `json:"apps"` //应用列表
|
||||
}
|
||||
|
||||
type Replica struct {
|
||||
ClusterName string `json:"clusterName"`
|
||||
Replica int32 `json:"replica"`
|
||||
}
|
||||
|
||||
type App struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
|
@ -553,6 +558,7 @@ type App struct {
|
|||
ParticipantName string `json:"participantName"`
|
||||
Storage string `json:"storage"`
|
||||
CreateTime string `json:"createTime"`
|
||||
Replicas []Replica `json:"replicas"`
|
||||
}
|
||||
|
||||
type AppDetailReq struct {
|
||||
|
|
Loading…
Reference in New Issue