Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
feat(workitemtypes): WorkItemTypes are now retrieves using jsonapi. (#…
Browse files Browse the repository at this point in the history
…1068)

* feat(workitemtypes): WorkItemTypes are now retrieves using jsonapi.
* fix(workitemtypes): added proper type descriptions.
  • Loading branch information
michaelkleinhenz authored and kwk committed Mar 3, 2017
1 parent 44dbeb5 commit 6ee510e
Show file tree
Hide file tree
Showing 8 changed files with 632 additions and 432 deletions.
986 changes: 589 additions & 397 deletions src/app/shared/mock-data/schema-mock-generator.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/shared/mock-http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class MockHttp extends Http {
// add new paths here
switch (path.path) {
case '/workitemtypes':
return this.createResponse(url.toString(), 200, 'ok', this.mockDataService.getWorkItemTypes() );
return this.createResponse(url.toString(), 200, 'ok', { data: this.mockDataService.getWorkItemTypes() } );
case '/workitems':
if (path.extraPath) {
return this.createResponse(url.toString(), 200, 'ok', this.mockDataService.getWorkItemOrEntity(path.extraPath) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ describe('Comment section for the work item detailed view - ', () => {
} as User;

fakeWorkItemTypes = [
{ name: 'system.userstory' },
{ name: 'system.valueproposition' },
{ name: 'system.fundamental' },
{ name: 'system.experience' },
{ name: 'system.feature' },
{ name: 'system.bug' }
{ attributes: { name: 'system.userstory' } },
{ attributes: { name: 'system.valueproposition' } },
{ attributes: { name: 'system.fundamental' } },
{ attributes: { name: 'system.experience' } },
{ attributes: { name: 'system.feature' } },
{ attributes: { name: 'system.bug' } }
] as WorkItemType[];

fakeComments = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ describe('Detailed view and edit a selected work item - ', () => {
} as User;

fakeWorkItemTypes = [
{ name: 'system.userstory' },
{ name: 'system.valueproposition' },
{ name: 'system.fundamental' },
{ name: 'system.experience' },
{ name: 'system.feature' },
{ name: 'system.bug' }
{ attributes: { name: 'system.userstory' } },
{ attributes: { name: 'system.valueproposition' } },
{ attributes: { name: 'system.fundamental' } },
{ attributes: { name: 'system.experience' } },
{ attributes: { name: 'system.feature' } },
{ attributes: { name: 'system.bug' } }
] as WorkItemType[];

fakeWorkItemLinkTypes = {'forwardLinks': [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ describe('Work item list view - ', () => {
} as User;

fakeWorkItemTypes = [
{ name: 'system.userstory' },
{ name: 'system.valueproposition' },
{ name: 'system.fundamental' },
{ name: 'system.experience' },
{ name: 'system.feature' },
{ name: 'system.bug' }
{ attributes: { name: 'system.userstory' } },
{ attributes: { name: 'system.valueproposition' } },
{ attributes: { name: 'system.fundamental' } },
{ attributes: { name: 'system.experience' } },
{ attributes: { name: 'system.feature' } },
{ attributes: { name: 'system.bug' } }
] as WorkItemType[];


Expand Down
28 changes: 18 additions & 10 deletions src/app/work-item/work-item-type.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
export class WorkItemType {
name: string;
version: number;
fields:
{
'system.assignee': {},
'system.creator': {},
'system.description': {},
'system.remote_item_id': {},
'system.state': {},
'system.title': {},
id: string;
type: string;
attributes: {
name: string;
version: number;
description: string;
fields:
{
'system.area': {},
'system.created_at': {},
'system.assignee': {},
'system.creator': {},
'system.description': {},
'system.iteration': {},
'system.remote_item_id': {},
'system.state': {},
'system.title': {},
};
};
}
8 changes: 4 additions & 4 deletions src/app/work-item/work-item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ <h2 class="header-text margin-0">Choose a new work item type</h2>
</div>
</div>
<div class="row row-cards-pf">
<div *ngFor="let type of workItemTypes" class="col-xs-12 col-sm-6 col-md-4 col-lg-3" (click)="onChangeType(type.name)">
<div *ngFor="let type of workItemTypes" class="col-xs-12 col-sm-6 col-md-4 col-lg-3" (click)="onChangeType(type.attributes.name)">
<div class="card-pf card-pf-view card-pf-view-select">
<div class="card-pf-body">
<div class="card-pf-top-element">
<i almIcon [iconType]="type.name" class="card-pf-icon-circle"></i>
<i almIcon [iconType]="type.attributes.name" class="card-pf-icon-circle"></i>
</div>
<h2 class="card-pf-title text-center">
{{type.name}}
{{type.attributes.name}}
</h2>
<p class="card-pf-info">Definition goes here. Lorem Ipsum dolor sit amet, consectetur adpisicing</p>
<p class="card-pf-info">{{type.attributes.description}}</p>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/work-item/work-item.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ export class WorkItemService {
.get(this.workItemTypeUrl)
.toPromise()
.then((response) => {
this.workItemTypes = response.json() as WorkItemType[];
this.workItemTypes = response.json().data as WorkItemType[];
return this.workItemTypes;
})
.catch ((e) => {
Expand Down Expand Up @@ -578,7 +578,7 @@ export class WorkItemService {
} else {
return this.getWorkItemTypes()
.then((response) => {
this.availableStates = response[0].fields['system.state'].type.values.map((item: string, index: number) => {
this.availableStates = response[0].attributes.fields['system.state'].type.values.map((item: string, index: number) => {
return {
option: item,
};
Expand Down

0 comments on commit 6ee510e

Please sign in to comment.