Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue gantt filter root instead of children node #3276

Merged
merged 1 commit into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,6 @@ func (f *ComponentGantt) Render(ctx context.Context, c *cptype.Component, scenar
return err
}

req := apistructs.IssuePagingRequest{
IssueListRequest: apistructs.IssueListRequest{
ProjectID: f.projectID,
Type: []apistructs.IssueType{apistructs.IssueTypeRequirement, apistructs.IssueTypeTask},
IterationIDs: f.State.Values.IterationIDs,
Label: f.State.Values.LabelIDs,
Assignees: f.State.Values.AssigneeIDs,
},
PageNo: 1,
PageSize: 500,
}

expand := make(map[uint64][]Item)
switch event.Operation {
case cptype.InitializeOperation, cptype.RenderingOperation:
Expand All @@ -86,12 +74,31 @@ func (f *ComponentGantt) Render(ctx context.Context, c *cptype.Component, scenar
},
}

req := apistructs.IssuePagingRequest{
IssueListRequest: apistructs.IssueListRequest{
ProjectID: f.projectID,
Type: []apistructs.IssueType{apistructs.IssueTypeRequirement, apistructs.IssueTypeTask},
IterationIDs: f.State.Values.IterationIDs,
Label: f.State.Values.LabelIDs,
Assignees: f.State.Values.AssigneeIDs,
},
PageNo: 1,
PageSize: 500,
}
issues, _, err := f.issueSvc.GetIssueChildren(0, req)
if err != nil {
return err
}
expand[0] = f.convertIssueItem(issues)
case cptype.OperationKey(apistructs.ExpandNode):
req := apistructs.IssuePagingRequest{
IssueListRequest: apistructs.IssueListRequest{
ProjectID: f.projectID,
Type: []apistructs.IssueType{apistructs.IssueTypeTask},
},
PageNo: 1,
PageSize: 500,
}
for _, key := range op.Meta.Keys {
issues, _, err := f.issueSvc.GetIssueChildren(key, req)
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions modules/dop/dao/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,10 @@ const (
func (client *DBClient) FindIssueChildren(id uint64, req apistructs.IssuePagingRequest) ([]IssueItem, uint64, error) {
sql := client.Debug().Table("dice_issue_relation b").Joins(joinIssueChildren).Joins(joinStateNew).
Where("b.issue_id = ? AND b.type = ?", id, apistructs.IssueRelationInclusion)
if id == 0 {
sql = client.Debug().Table("dice_issues as a").Joins(joinRelation, apistructs.IssueRelationInclusion).Joins(joinStateNew).
Where("b.id IS NULL")
}
sql = sql.Where("a.deleted = 0").Where("a.project_id = ?", req.ProjectID)
if len(req.Type) > 0 {
sql = sql.Where("a.type IN (?)", req.Type)
Expand Down
14 changes: 7 additions & 7 deletions modules/dop/services/issue/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1601,13 +1601,13 @@ func (svc *Issue) GetIssueChildren(id uint64, req apistructs.IssuePagingRequest)
if req.PageSize == 0 {
req.PageSize = 20
}
if id == 0 {
requirements, tasks, total, err := svc.db.FindIssueRoot(req)
if err != nil {
return nil, 0, err
}
return append(requirements, tasks...), total, nil
}
// if id == 0 {
// requirements, tasks, total, err := svc.db.FindIssueRoot(req)
// if err != nil {
// return nil, 0, err
// }
// return append(requirements, tasks...), total, nil
// }
return svc.db.FindIssueChildren(id, req)
}

Expand Down