Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -763,11 +763,15 @@
"type": "string",
"enum": [
"repository",
"milestone"
"milestone",
"issueType",
"labels"
],
"enumDescriptions": [
"%githubIssues.queries.groupBy.repository%",
"%githubIssues.queries.groupBy.milestone%",
"%githubIssues.queries.groupBy.repository%"
"%githubIssues.queries.groupBy.issueType%",
"%githubIssues.queries.groupBy.labels%"
]
}
}
Expand Down
2 changes: 2 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@
"githubIssues.queries.groupBy": "The categories to group issues by when displaying them, in the order in which they should be grouped.",
"githubIssues.queries.groupBy.repository": "Group issues by their repository.",
"githubIssues.queries.groupBy.milestone": "Group issues by their milestone.",
"githubIssues.queries.groupBy.issueType": "Group issues by their GitHub issue type (Bug, Feature, Task, etc.).",
"githubIssues.queries.groupBy.labels": "Group issues by their labels (issues can appear in multiple groups).",
"githubIssues.queries.default.myIssues": "My Issues",
"githubIssues.queries.default.createdIssues": "Created Issues",
"githubIssues.queries.default.recentIssues": "Recent Issues",
Expand Down
1 change: 1 addition & 0 deletions src/github/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export interface Issue {
commentCount: number;
reactionCount: number;
reactions: Reaction[];
issueType?: string;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ignore this comment

}

export interface PullRequest extends Issue {
Expand Down
40 changes: 33 additions & 7 deletions src/issues/issuesView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,50 @@ export class IssuesTreeData
return issues;
}
const groupByValue = groupByOrder[indexInGroupByOrder];
if ((groupByValue !== 'milestone' && groupByValue !== 'repository') || groupByOrder.findIndex(groupBy => groupBy === groupByValue) !== indexInGroupByOrder) {
if ((groupByValue !== 'milestone' && groupByValue !== 'repository' && groupByValue !== 'issueType' && groupByValue !== 'labels') || groupByOrder.findIndex(groupBy => groupBy === groupByValue) !== indexInGroupByOrder) {
return this.getIssueGroupsForGroupIndex(repoRootUri, queryLabel, isFirst, groupByOrder, indexInGroupByOrder + 1, issues);
}

const groups = groupBy(issues, issue => {
if (groupByValue === 'repository') {
return `${issue.remote.owner}/${issue.remote.repositoryName}`;
} else {
return issue.milestone?.title ?? 'No Milestone';
const groups: { [key: string]: IssueItem[] } = {};

if (groupByValue === 'labels') {
// For labels, an issue can appear in multiple groups if it has multiple labels
for (const issue of issues) {
const issueLabels = issue.item.labels && issue.item.labels.length > 0
? issue.item.labels.map(l => l.name)
: ['No Labels'];
for (const label of issueLabels) {
if (!groups[label]) {
groups[label] = [];
}
groups[label].push(issue);
}
}
});
} else if (groupByValue === 'issueType') {
// Group by GitHub's native issue type (Bug, Feature, Task, etc.)
const groupsTemp = groupBy(issues, issue => {
return issue.item.issueType ?? 'No Issue Type';
});
Object.assign(groups, groupsTemp);
} else {
const groupsTemp = groupBy(issues, issue => {
if (groupByValue === 'repository') {
return `${issue.remote.owner}/${issue.remote.repositoryName}`;
} else if (groupByValue === 'milestone') {
return issue.milestone?.title ?? 'No Milestone';
}
return 'Other';
});
Object.assign(groups, groupsTemp);
}
const nodes: IssueGroupNode[] = [];
for (const group in groups) {
nodes.push(new IssueGroupNode(repoRootUri, queryLabel, isFirst, indexInGroupByOrder, group, groupByOrder, groups[group]));
}
return nodes;
}


private async getIssueGroupChildren(issueGroupNode: IssueGroupNode): Promise<IssueItem[] | IssueGroupNode[]> {
return this.getIssueGroupsForGroupIndex(issueGroupNode.repoRootUri, issueGroupNode.queryLabel, issueGroupNode.isInFirstQuery, issueGroupNode.groupByOrder, issueGroupNode.groupLevel + 1, issueGroupNode.issuesInGroup);
}
Expand Down
2 changes: 1 addition & 1 deletion src/issues/stateManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ interface SingleRepoState {
folderManager: FolderRepositoryManager;
}

export type QueryGroup = 'repository' | 'milestone';
export type QueryGroup = 'repository' | 'milestone' | 'issueType' | 'labels';

export interface IssueQueryResult {
groupBy: QueryGroup[];
Expand Down