mirror of
https://github.com/goharbor/harbor
synced 2024-09-21 00:39:58 +00:00
return count of jobs which are failed when listing policies
This commit is contained in:
parent
e2afc3e51c
commit
6f7c2aa5a5
|
@ -150,10 +150,12 @@ func FilterRepPolicies(name string, projectID int64) ([]*models.RepPolicy, error
|
||||||
|
|
||||||
sql := `select rp.id, rp.project_id, p.name as project_name, rp.target_id,
|
sql := `select rp.id, rp.project_id, p.name as project_name, rp.target_id,
|
||||||
rt.name as target_name, rp.name, rp.enabled, rp.description,
|
rt.name as target_name, rp.name, rp.enabled, rp.description,
|
||||||
rp.cron_str, rp.start_time, rp.creation_time, rp.update_time
|
rp.cron_str, rp.start_time, rp.creation_time, rp.update_time,
|
||||||
|
count(rj.status) as error_job_count
|
||||||
from replication_policy rp
|
from replication_policy rp
|
||||||
join project p on rp.project_id=p.project_id
|
left join project p on rp.project_id=p.project_id
|
||||||
join replication_target rt on rp.target_id=rt.id `
|
left join replication_target rt on rp.target_id=rt.id
|
||||||
|
left join replication_job rj on rp.id=rj.policy_id and rj.status="error" `
|
||||||
|
|
||||||
if len(name) != 0 && projectID != 0 {
|
if len(name) != 0 && projectID != 0 {
|
||||||
sql += `where rp.name like ? and rp.project_id = ? `
|
sql += `where rp.name like ? and rp.project_id = ? `
|
||||||
|
|
|
@ -56,12 +56,13 @@ type RepPolicy struct {
|
||||||
TargetName string `json:"target_name,omitempty"`
|
TargetName string `json:"target_name,omitempty"`
|
||||||
Name string `orm:"column(name)" json:"name"`
|
Name string `orm:"column(name)" json:"name"`
|
||||||
// Target RepTarget `orm:"-" json:"target"`
|
// Target RepTarget `orm:"-" json:"target"`
|
||||||
Enabled int `orm:"column(enabled)" json:"enabled"`
|
Enabled int `orm:"column(enabled)" json:"enabled"`
|
||||||
Description string `orm:"column(description)" json:"description"`
|
Description string `orm:"column(description)" json:"description"`
|
||||||
CronStr string `orm:"column(cron_str)" json:"cron_str"`
|
CronStr string `orm:"column(cron_str)" json:"cron_str"`
|
||||||
StartTime time.Time `orm:"column(start_time)" json:"start_time"`
|
StartTime time.Time `orm:"column(start_time)" json:"start_time"`
|
||||||
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
CreationTime time.Time `orm:"column(creation_time);auto_now_add" json:"creation_time"`
|
||||||
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
UpdateTime time.Time `orm:"column(update_time);auto_now" json:"update_time"`
|
||||||
|
ErrorJobCount int `json:"error_job_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid ...
|
// Valid ...
|
||||||
|
|
Loading…
Reference in New Issue
Block a user