Skip to content

Commit

Permalink
fix: task obj_name rename to obj_type (#20410)
Browse files Browse the repository at this point in the history
Co-authored-by: Qiu Jian <[email protected]>
  • Loading branch information
swordqiu and Qiu Jian authored May 30, 2024
1 parent 3ba9b14 commit ca5fa2d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pkg/apis/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ type TaskListInput struct {

Id []string `json:"id" help:"id filter"`
ObjId []string `json:"obj_id" help:"object id filter"`
ObjName []string `json:"obj_name" help:"object type (in singular form) filter"`
ObjType []string `json:"obj_type" help:"object type (in singular form) filter"`
ObjName []string `json:"obj_name" help:"object name filter"`
TaskName []string `json:"task_name" help:"task name filter"`
IsMulti *bool `json:"is_multi" negative:"is_single" help:"is multi task"`
IsComplete *bool `json:"is_complete" negative:"not_complete" help:"is task completed, either fail or complete"`
Expand Down
10 changes: 7 additions & 3 deletions pkg/cloudcommon/db/taskman/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ func (manager *STaskManager) QueryTasksOfObject(obj db.IStandaloneModel, since t
subq1 := manager.Query()
{
subq1 = subq1.Equals("obj_id", obj.GetId())
subq1 = subq1.Equals("obj_name", obj.Keyword())
subq1 = subq1.Equals("obj_type", obj.Keyword())
if !since.IsZero() {
subq1 = subq1.GE("created_at", since)
}
Expand All @@ -1006,7 +1006,7 @@ func (manager *STaskManager) QueryTasksOfObject(obj db.IStandaloneModel, since t
sqlchemy.Equals(taskObjs.Field("obj_id"), obj.GetId()),
))
subq2 = subq2.Filter(sqlchemy.Equals(subq2.Field("obj_id"), MULTI_OBJECTS_ID))
subq2 = subq2.Filter(sqlchemy.Equals(subq2.Field("obj_name"), obj.Keyword()))
subq2 = subq2.Filter(sqlchemy.Equals(subq2.Field("obj_type"), obj.Keyword()))
if !since.IsZero() {
subq2 = subq2.Filter(sqlchemy.GE(subq2.Field("created_at"), since))
}
Expand Down Expand Up @@ -1087,7 +1087,11 @@ func (manager *STaskManager) ListItemFilter(
}

if len(input.ObjName) > 0 {
q = q.In("obj_name", input.ObjName)
q = q.In("object", input.ObjName)
}

if len(input.ObjType) > 0 {
q = q.In("obj_type", input.ObjType)
}

if len(input.TaskName) > 0 {
Expand Down

0 comments on commit ca5fa2d

Please sign in to comment.