aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts
diff options
context:
space:
mode:
author杨宇千 <crupest@outlook.com>2019-02-22 15:24:26 +0000
committer杨宇千 <crupest@outlook.com>2019-02-22 15:24:26 +0000
commitfe5838a966a314b72ecb4d992f86f5fce635a96f (patch)
tree6d00a55b9e5f98315384f33aaf5bfc5a60645a0d /Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts
parent25e606b67506b3bc0242414aebe472f13a02bd9c (diff)
parente236b5064cd62f40bc910fafe48ac4b9701a4bcd (diff)
downloadtimeline-fe5838a966a314b72ecb4d992f86f5fce635a96f.tar.gz
timeline-fe5838a966a314b72ecb4d992f86f5fce635a96f.tar.bz2
timeline-fe5838a966a314b72ecb4d992f86f5fce635a96f.zip
Merged PR 5: Develop link feature on todo page.
Develop link feature on todo page. Related work items: #1, #3
Diffstat (limited to 'Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts')
-rw-r--r--Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts b/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts
index 619e9a6b..ed28bc59 100644
--- a/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts
+++ b/Timeline/ClientApp/src/app/todo-list-page/todo-list.service.ts
@@ -29,6 +29,7 @@ export interface WorkItem {
id: number;
title: string;
closed: boolean;
+ detailUrl: string;
}
@Injectable({
@@ -41,20 +42,21 @@ export class TodoListService {
constructor(private client: HttpClient) { }
- private getAzureDevOpsPat(): Observable<AzureDevOpsAccessInfo> {
+ private getAzureDevOpsAccessInfo(): Observable<AzureDevOpsAccessInfo> {
return this.client.get<AzureDevOpsAccessInfo>('/api/TodoPage/AzureDevOpsAccessInfo');
}
getWorkItemList(): Observable<WorkItem[]> {
- return this.getAzureDevOpsPat().pipe(
+ return this.getAzureDevOpsAccessInfo().pipe(
switchMap(
accessInfo => {
+ const baseUrl = `https://dev.azure.com/${accessInfo.organization}/${accessInfo.project}/`;
const headers = new HttpHeaders({
'Accept': 'application/json',
'Authorization': `Basic ${btoa(accessInfo.username + ':' + accessInfo.personalAccessToken)}`
});
return this.client.post<WiqlResult>(
- `https://dev.azure.com/${accessInfo.organization}/${accessInfo.project}/_apis/wit/wiql?api-version=5.0`, {
+ `${baseUrl}_apis/wit/wiql?api-version=5.0`, {
query: 'SELECT [System.Id] FROM workitems WHERE [System.TeamProject] = @project'
}, { headers: headers }).pipe(
switchMap(result => result.workItems),
@@ -62,7 +64,8 @@ export class TodoListService {
map(result => <WorkItem>{
id: result.id,
title: <string>result.fields[TodoListService.titleFieldName],
- closed: ((<string>result.fields[TodoListService.stateFieldName]).toLowerCase() === 'closed')
+ closed: ((<string>result.fields[TodoListService.stateFieldName]).toLowerCase() === 'closed'),
+ detailUrl: `${baseUrl}_workitems/edit/${result.id}/`
}),
toArray()
);