我正在尝试创建自定义的jira仪表板。
我的要求是将当前冲刺和类别中的所有issues
提取到Open
,In Progress
和Closed
中。
获取项目的所有冲刺-API
https://host.com/rest/greenhopper/1.0/sprintquery/PROJECTID?
我使用以下API来获取所有问题。 (不是没有其他更好的api来获取)
https://host.com/rest/greenhopper/1.0/sprintquery/ACTIVESPRINTID?includeFutureSprints=false&includeHistoricSprints=true&os_username=USERNAME&os_password=PASSWORD
现在,我想使用barChart
在ng2-charts
中显示这些详细信息。
下面是我的代码。
cardsData = [
{ title: 'X', item: 'x', id: '22407' },
{ title: 'Y', item: 'y', id: '21756' },
];
ngOnInit() {
this.cardsData.map(x => {
if (x.id) {
this.lineChartLabels.push(x.title);
this.getActiveSprint(x.id);
}
});
}
getActiveSprint(id) {
this.service.getActiveSprintID(id).subscribe(response => {
const activeSprintID = response.sprints.slice(-1)[0].id;
this.getJiraItems(id, activeSprintID);
this.cardsData.filter((status) => {
return status.id === id;
}).map(x => x['activeSprintID'] = activeSprintID);
});
}
getJiraItems(RapidViewID: string, SprintID: string) {
this.httpSubscription = this.service.getJiraOpenIssues(RapidViewID, SprintID)
.subscribe((response) => {
const issuesNotCompletedInCurrentSprint = response.contents.issuesNotCompletedInCurrentSprint;
const completedIssues = response.contents.completedIssues.length;
const openIssue = [];
const inProgressIssue = [];
this.lineData.push(completedIssues);
issuesNotCompletedInCurrentSprint.filter((item) => {
if (item.statusId === '1') {
openIssue.push(item);
} else if (item.statusId === '3') {
inProgressIssue.push(item);
}
});
this.totalOpenIssue.push(openIssue.length);
this.totalInprogressIssue.push(inProgressIssue.length);
this.pieChartData = [openIssue.length, inProgressIssue.length, completedIssues];
this.cardsData.filter((status) => {
return status.title === 'JIRA OVERVIEW';
}).map(x => x['lineChartData'] = [
{ data: this.totalOpenIssue, label: 'Open' },
{ data: this.totalInprogressIssue, label: 'InProgress' },
{ data: this.lineData, label: 'Completed' }
]);
this.cardsData.filter((status) => {
return status.id === RapidViewID;
}).map(x => x['pieChartData'] = this.pieChartData);
this.isLoading = false;
});
}
问题是,open
或in progress
项目的数据映射不正确,评论评论也停留在illegal use of map property
。
请帮助我纠正代码并删除不需要的行。