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

fix(list view): Introduce parent details in the list view. #2291

Merged
merged 16 commits into from
Oct 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ export class GroupTypesComponent implements OnInit, OnDestroy {
if(groupType.group == 'portfolio') {
gt = gType.find(groupType => groupType.group == 'portfolio' && groupType.level[1] == 0);
}
this.groupTypesService.setCurrentGroupType(gt.wit_collection);
this.groupTypesService.setCurrentGroupType(gt.wit_collection, gt.group);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class IterationListEntryComponent implements OnInit, OnDestroy {
}

setGuidedTypeWI(wiCollection) {
this.groupTypesService.setCurrentGroupType(wiCollection);
this.groupTypesService.setCurrentGroupType(wiCollection, 'execution');
}

constructURL(iterationId: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,6 @@ export class IterationComponent implements OnInit, OnDestroy, OnChanges {
}

setGuidedTypeWI() {
this.groupTypesService.setCurrentGroupType(this.collection);
this.groupTypesService.setCurrentGroupType(this.collection, 'execution');
}
}
8 changes: 6 additions & 2 deletions src/app/components/planner-board/planner-board.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class PlannerBoardComponent implements OnInit, OnDestroy {
private uiLockedBoard = true;
private uiLockedSidebar = false;
private currentSpace: Space;
private included: WorkItem[];

sidePanelOpen: boolean = true;
constructor(
Expand Down Expand Up @@ -254,14 +255,16 @@ export class PlannerBoardComponent implements OnInit, OnDestroy {
return this.workItemService.getWorkItems2(pageSize, exp)
.map(workItemResp => {
let workItems = workItemResp.workItems;
this.included = workItemResp.included;
let cardValue: CardValue[] = [];
this.workItemDataService.setItems(workItems);
lane.workItems = this.workItemService.resolveWorkItems(
workItems,
this.iterations,
[],
this.workItemTypes,
this.labels
this.labels,
this.included
);
lane.cardValue = lane.workItems.map(item => {
return {
Expand Down Expand Up @@ -459,7 +462,8 @@ export class PlannerBoardComponent implements OnInit, OnDestroy {
this.iterations,
[],
this.workItemTypes,
this.labels
this.labels,
workItemResp.included
)];
lane.cardValue = [
...lane.cardValue,
Expand Down
14 changes: 4 additions & 10 deletions src/app/components/planner-list/planner-list.component.less
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,6 @@
}
.tree-children {
padding-left: 0;
.tree-node-level-2 {
.list-pf-container {
padding-left: 30px !important;
}
}
.tree-node-level-3 {
.list-pf-container {
padding-left: 50px !important;
}
}
}
.toggle-children {
width: 10px;
Expand All @@ -109,6 +99,10 @@
}
}
}
.list-pf-chevron+.list-pf-content, .list-pf-select+.list-pf-content {
border-color: transparent;
padding-left: 0;
}
//Patternfly-ng's tree styles - End

//tree-list, drag and drop css
Expand Down
40 changes: 35 additions & 5 deletions src/app/components/planner-list/planner-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
private expandedNode: any = null;
private selectedWI: WorkItem = null;
private initialGroup: GroupTypesModel;
private included: WorkItem[];


constructor(
Expand Down Expand Up @@ -347,6 +348,15 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD

loadWorkItems(): void {
this.initialGroup = this.groupTypesService.getCurrentGroupType();
//if initialGroup is undefined, the page has been refreshed - find group context based on URL
if ( this.route.snapshot.queryParams['q'] ) {
let wits = this.route.snapshot.queryParams['q'].split('workitemtype:')
let collection = wits[1].replace(')','').split(',');
this.groupTypesService.findGroupConext(collection);
}
if(this.initialGroup === undefined)
this.initialGroup = this.groupTypesService.getCurrentGroupType();

this.uiLockedList = true;
if (this.wiSubscriber) {
this.wiSubscriber.unsubscribe();
Expand Down Expand Up @@ -405,8 +415,13 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
newFilterObj[item.id] = item.value;
})
newFilterObj['space'] = this.currentSpace.id;
let showFlatList = false;
if (this.groupTypesService.groupName === 'execution' || this.groupTypesService.groupName === 'requirements')
showFlatList = true;
//console.log('showFlatList', this.groupTypesService.groupName);
let payload = {
parentexists: !!!this.showHierarchyList
//for execution level set this to true
parentexists: true
};
if ( this.route.snapshot.queryParams['q'] ) {
let existingQuery = this.filterService.queryToJson(this.route.snapshot.queryParams['q']);
Expand Down Expand Up @@ -441,12 +456,14 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
this.logger.log(workItemResp.workItems);
const workItems = workItemResp.workItems;
this.nextLink = workItemResp.nextLink;
this.included = workItemResp.included;
this.workItems = this.workItemService.resolveWorkItems(
workItems,
this.iterations,
[], // We don't want to static resolve user at this point
this.workItemTypes,
this.labels
this.labels,
this.included
);
this.workItemDataService.setItems(this.workItems);
// Resolve assignees
Expand Down Expand Up @@ -492,7 +509,8 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
this.iterations,
[],
this.workItemTypes,
this.labels
this.labels,
newWiItemResp.included
)
];
this.workItemDataService.setItems(this.workItems);
Expand All @@ -517,6 +535,14 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD

loadChildren(node): any {
return this.workItemService.getChildren(node.data)
//set the parent information for the child WIs
.then((workItems: WorkItem[]) => {
workItems.map(wi => {
wi.relationships.parent = { data: {} as WorkItem };
wi.relationships.parent.data = node.data;
});
return workItems;
})
.then((workItems: WorkItem[]) => this.workItemService.resolveWorkItems(
workItems,
this.iterations,
Expand Down Expand Up @@ -635,10 +661,14 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
if (this.expandedNode === null) {
//A WI has been selected - add the new WI as a child under that
this.selectedWI.hasChildren = true;
item.relationships.parent = { data: {} as WorkItem }
item.relationships.parent.data = this.selectedWI;
} else {
let index = this.workItems.findIndex(wi => wi.id === this.selectedWI.id)
if(this.selectedWI.id === this.expandedNode.node.data.id) {
//if the selected node is expanded
item.relationships.parent = { data: {} as WorkItem }
item.relationships.parent.data = this.selectedWI;
this.expandedNode.node.data.children.push(item);
if(index > -1) {
//this means selectedWI is a not a child WI - top level WI
Expand Down Expand Up @@ -673,7 +703,7 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
console.log('Error displaying notification. Added WI does not match the applied filters.')
}
}
//if( this.treeList.tree != undefined )
if( this.workItems.length > 0 )
this.treeList.update();
})
);
Expand Down Expand Up @@ -872,7 +902,7 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
handleSelectionChange($event): void {
if($event.item.selected === true) {
this.selectedWI = $event.item;
if(this.expandedNode != null && ($event.item.data.id !== this.expandedNode.node.item.id)) {
if(this.expandedNode != null && ($event.item.id !== this.expandedNode.node.item.id)) {
this.expandedNode = null;
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@
<!-- info area -->
<div class="list-view-pf-main-info">
<div class="list-view-pf-left type f8-wi__list-witype">
<span class="pull-left"
almIcon
[iconType]="workItem.attributes['system.state']"
tooltip="{{workItem.attributes['system.state']}}"
placement="right"></span>
<span class="pull-left">
{{workItem.attributes['system.number']}}
</span>
<span class="color-grey pull-left fa
{{workItem.relationships?.baseType?.data?.attributes?.icon}}"
title="{{workItem.relationships?.baseType?.data?.attributes?.name}}"></span>
<span class="pull-left"> {{workItem.attributes['system.number']}} </span>
</div>
<div class="list-view-pf-body">
<div class="list-view-pf-description">
Expand All @@ -30,6 +27,21 @@
[routerLink]="[constructUrl(workItem)]"
tooltip="Open Detail View"
placement="right"></a>
<div class="f8-wi__list-parent-info">
<div *ngIf="workItem.relationships?.parent?.data">
Child of
<a [routerLink]="[constructUrl(parentWI)]">
{{ parentWI.attributes['system.number'] }}
</a>
<span class="color-grey fa {{parentWI.relationships?.baseType?.data?.attributes?.icon}}"
title="{{ parentWI.relationships?.baseType?.data?.attributes?.name }}">
</span>
<span class="truncate f8-wi__list-parent-info-title margin-left-7"
[innerHTML]="parentWI.attributes['system.title']">
</span>

</div>
</div>
</div>
<div class="f8-wi__list-description">
<f8-label [labels]="workItem.relationships?.labels?.data ?
Expand All @@ -38,6 +50,13 @@
[allowDelete]="false"
(onLabelClick)="labelClick($event)"></f8-label>
</div>
<div class="f8-wi__list-description">
<span class="color-grey pull-left"
almIcon
[iconType]="workItem.attributes['system.state']"
tooltip="{{workItem.attributes['system.state']}}"
placement="right"></span>
</div>
</div>
<div class="list-group-item-text hide f8-wi__list-desc">
{{workItem.attributes['system.description'] ?
Expand All @@ -46,23 +65,23 @@
</div>
</div>
</div>
</div>
<div class="user-avatar margin-right-15">
<img
*ngFor="let assignee of workItem.relationships.assignees.data"
placement="left"
tooltip="{{assignee?.attributes?.fullName}}"
src="{{assignee?.attributes?.imageURL + '&s=23'}}"
onError="this.src='https://avatars0.githubusercontent.com/u/563119?v=3&s=23'" />
<span class="pficon-user not-assigned-user-icon"
*ngIf="!workItem.relationships?.assignees?.data?.length"
tooltip="Unassigned"
placement="left"></span>
</div>
<div class="pull-right"
tooltip="Open Quick Preview"
placement="left">
<a (click)="onDetailPreview($event)"
class="fa fa-columns f8-action-icon"></a>
<div class="user-avatar margin-right-15">
<img
*ngFor="let assignee of workItem.relationships.assignees.data"
placement="left"
tooltip="{{assignee?.attributes?.fullName}}"
src="{{assignee?.attributes?.imageURL + '&s=23'}}"
onError="this.src='https://avatars0.githubusercontent.com/u/563119?v=3&s=23'" />
<span class="pficon-user not-assigned-user-icon"
*ngIf="!workItem.relationships?.assignees?.data?.length"
tooltip="Unassigned"
placement="left"></span>
</div>
<div class="pull-right"
tooltip="Open Quick Preview"
placement="left">
<a (click)="onDetailPreview($event)"
class="fa fa-columns f8-action-icon"></a>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
.f8-wi__list {
&-entry {
display: inline-flex;
flex-direction: column;
padding: 10px 0;
cursor: pointer;
align-items: center;
button {
Expand Down Expand Up @@ -55,6 +57,14 @@
}
}
}
&-parent-info {
width: 100%;
color: gray;
font-size: 10px;
&-title {
width: ~"calc(e('100% - 100px'))";
}
}
&-witype {
float: left;
width: 120px;
Expand Down Expand Up @@ -90,6 +100,10 @@
text-align: left;
}
}

.width-10 {
width: 10%;
}
.list-group-item:hover {
.f8-wi__list-title {
p {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class WorkItemListEntryComponent implements OnInit, OnDestroy {
queryParams: Object = {};
eventListeners: any[] = [];
selectedItemId: string | number = 0;
private parentWI: WorkItem;

constructor(private auth: AuthenticationService,
private broadcaster: Broadcaster,
Expand All @@ -75,6 +76,8 @@ export class WorkItemListEntryComponent implements OnInit, OnDestroy {

ngOnInit(): void {
this.listenToEvents();
if(this.workItem.relationships.parent)
this.parentWI = this.workItem.relationships.parent.data;
this.loggedIn = this.auth.isLoggedIn();
}

Expand Down
4 changes: 4 additions & 0 deletions src/app/models/work-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export class WorkItemRelations {
baseType?: {
data: WorkItemType;
};
parent?: {
data: WorkItem;
};
children?: {
links: {
related: string;
Expand Down Expand Up @@ -69,6 +72,7 @@ export class RelationalData {
area?: AreaModel;
creator?: User;
comments?: Comment[];
parent?: WorkItem;
assignees?: User[];
labels?: LabelModel[];
linkDicts?: LinkDict[];
Expand Down
Loading