feat(issue): add columns for issue type / assignee

This commit is contained in:
HJJ 2024-04-20 19:56:21 +08:00
parent 57efa17602
commit 3c84d8b5b5
2 changed files with 11 additions and 1 deletions

View File

@ -47,13 +47,19 @@ var ListCmd = &cobra.Command{
columns := []table.Column{
{Title: "Ident", Width: 8},
{Title: "Title", Width: 50},
{Title: "Assignee", Width: 12},
{Title: "Type", Width: 12},
{Title: "State", Width: 10},
}
rows := make([]table.Row, 0)
for _, issue := range _issues {
rows = append(rows, table.Row{issue.Ident, issue.Title, issue.IssueState.Title})
userName := issue.Assignee.Remark
if userName == "" {
userName = issue.Assignee.UserName
}
rows = append(rows, table.Row{issue.Ident, issue.Title, userName, issue.IssueType.Title, issue.IssueState.Title})
}
issueTable := tui.NewTable(enterprise, tui.Issue, columns, rows)

View File

@ -5,6 +5,8 @@ import (
"errors"
"fmt"
"gitee_cli/internal/api/issue_state"
"gitee_cli/internal/api/issue_type"
"gitee_cli/internal/api/user"
"gitee_cli/utils/http_utils"
)
@ -17,6 +19,8 @@ type Issue struct {
Url string `json:"issue_url"`
Description string `json:"description"`
IssueState issue_state.IssueState `json:"issue_state"`
Assignee user.Member `json:"assignee"`
IssueType issue_type.IssueType `json:"issue_type"`
}
func Find(enterpriseId int, params map[string]string) ([]Issue, error) {