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

Commit

Permalink
Merge branch 'master' into display_parent
Browse files Browse the repository at this point in the history
  • Loading branch information
nimishamukherjee authored Oct 23, 2017
2 parents 3b3dbc7 + 724b157 commit c19af81
Show file tree
Hide file tree
Showing 11 changed files with 160 additions and 47 deletions.
4 changes: 2 additions & 2 deletions runtime/tests/run_functional_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ OS=$(uname -a | awk '{print $1;}')

# Download dependencies
echo -n Updating Webdriver and Selenium...
node_modules/protractor/bin/webdriver-manager update --versions.chrome 2.33
node_modules/protractor/bin/webdriver-manager update --versions.chrome 2.30
# Start selenium server just for this test run
echo -n Starting Webdriver and Selenium...
(node_modules/protractor/bin/webdriver-manager --versions.chrome 2.33 start >>$LOGFILE 2>&1 &)
(node_modules/protractor/bin/webdriver-manager --versions.chrome 2.30 start >>$LOGFILE 2>&1 &)
# Wait for port 4444 to be listening connections
if [ $OS = 'Darwin' ]
then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<!-- Active iteration -->
<div class="f8-itr__panel">
<div class="f8-itr__panel-hdr f8-itr__panel-hdr--active">
<div class="f8-itr__panel-hdr f8-itr__panel-hdr--active nohover">
<span class="fa fa-check pull-left margin-right-10"
tooltip="{{sidePanelOpen ? '' : 'Active Iteration'}}"
placement="right"></span>
Expand Down Expand Up @@ -99,7 +99,7 @@
</div>
<!-- Nested Iteration Display -->
<div class="f8-itr__panel">
<div class="f8-itr__panel-hdr pointer f8-itr__panel-hdr--active">
<div class="f8-itr__panel-hdr f8-itr__panel-hdr--active nohover">
<div class="f8-itr__add"
[class.show]="sidePanelOpen"
[class.hide]="!sidePanelOpen">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
border-left: 4px solid;
border-left-color: transparent;
cursor: default; // as item is not clickable
&:hover {
&:not(.nohover):hover {
background: @color-pf-black-700;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h4>Please wait, we are loading your data.</h4>
<toolbar-panel
context="listview"
[wiTypes]="workItemTypes"
(onCreateNewWorkItemSelected)="typeSelectPanel.openPanel()"
(onCreateNewWorkItemSelected)="onCreateFromContext()"
[currentBoardType]="currentBoardType"
[areas]="areas"
[loggedInUser]="loggedInUser">
Expand Down
29 changes: 24 additions & 5 deletions src/app/components/planner-list/planner-list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import { CollaboratorService } from '../../services/collaborator.service';
import { LabelService } from '../../services/label.service';
import { LabelModel } from '../../models/label.model';
import { UrlService } from './../../services/url.service';
import { WorkItemDetailAddTypeSelectorComponent } from './../work-item-create/work-item-create.component';

@Component({
encapsulation: ViewEncapsulation.None,
Expand All @@ -78,12 +79,13 @@ import { UrlService } from './../../services/url.service';
export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnDestroy {
@ViewChildren('activeFilters', {read: ElementRef}) activeFiltersRef: QueryList<ElementRef>;
@ViewChild('activeFiltersDiv') activeFiltersDiv: any;
@ViewChild('typeSelectPanel') typeSelectPanel: WorkItemDetailAddTypeSelectorComponent;

@ViewChild('listContainer') listContainer: any;
@ViewChild('treeList') treeList: TreeListComponent;
@ViewChild('detailPreview') detailPreview: WorkItemDetailComponent;
@ViewChild('sidePanel') sidePanelRef: any;
@ViewChild('associateIterationModal') associateIterationModal: any;
@ViewChild('typeSelectPanel') typeSelectPanel: any;

actionConfig: ActionConfig;
emptyStateConfig: EmptyStateConfig;
Expand Down Expand Up @@ -219,9 +221,8 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
primaryActions: [{
id: 'createWI',
title: 'Create work item',
tooltip: 'Start the server',
tooltip: 'Create work item',
styleClass: this.loggedIn ? 'show-wi' : 'hide-wi'

}],
moreActions: []
} as ActionConfig,
Expand Down Expand Up @@ -608,6 +609,24 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
});
}

// This opens the create new work item dialog. It parses the query string
// first to get iterationId and areaId for pre-selection in the new work item
// dialog. Note that this only works for the current capabilities of the query
// toolbar for now. If we extend that, we also need to extend this method.
onCreateFromContext() {
console.log('Activated create work item from a list view.');
let query = this.route.snapshot.queryParams['q'];
if (query) {
let contextIteration = this.filterService.getConditionFromQuery(query, "iteration");
let contextArea = this.filterService.getConditionFromQuery(query, "area");
this.typeSelectPanel.openPanel(contextIteration, contextArea);
} else {
console.log('No current query for add from empty list');
// use standard non-context create dialog
this.typeSelectPanel.openPanel();
}
}

listenToEvents() {
this.eventListeners.push(
this.broadcaster.on<string>('logout')
Expand Down Expand Up @@ -816,8 +835,8 @@ export class PlannerListComponent implements OnInit, AfterViewInit, DoCheck, OnD
handleAction($event: Action, item: any): void {
switch($event.id){
case 'createWI':
//Empty state's Creat Work Item button
this.typeSelectPanel.openPanel()
// Empty state's Create Work Item button
this.onCreateFromContext()
break;
case 'move2top':
this.workItemToMove = item.data;
Expand Down
31 changes: 17 additions & 14 deletions src/app/components/work-item-create/work-item-create.component.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import { WorkItemDetailAddTypeSelectorWidgetComponent } from './work-item-create-selector/work-item-create-selector.component';
import { Subscription } from 'rxjs/Subscription';
import { cloneDeep, trimEnd } from 'lodash';

import { Component, OnInit, Input, OnChanges, ViewChild } from '@angular/core';
import { Router, ActivatedRoute, NavigationExtras } from '@angular/router';

import { cloneDeep, trimEnd } from 'lodash';
import { Broadcaster } from 'ngx-base';
import { AlmArrayFilter } from 'ngx-widgets';
import { AuthenticationService } from 'ngx-login-client';
import { Subscription } from 'rxjs/Subscription';
import { Space, Spaces } from 'ngx-fabric8-wit';

import { WorkItemDetailAddTypeSelectorWidgetComponent } from './work-item-create-selector/work-item-create-selector.component';
import { WorkItemService } from '../../services/work-item.service';
import { WorkItemListEntryComponent } from '../work-item-list-entry/work-item-list-entry.component';
import { WorkItemType } from '../../models/work-item-type';
import { WorkItem } from '../../models/work-item';

import {
AlmArrayFilter
} from 'ngx-widgets';

@Component({
selector: 'detail-add-type-selector',
templateUrl: './work-item-create.component.html',
Expand All @@ -32,7 +30,9 @@ export class WorkItemDetailAddTypeSelectorComponent implements OnInit, OnChanges
loggedIn: boolean = false;
workItemTypes: WorkItemType[] = [];
spaceSubscription: Subscription = null;

selectedIterationId: string;
selectedAreaId: string;

constructor(
private router: Router,
private route: ActivatedRoute,
Expand Down Expand Up @@ -73,15 +73,16 @@ export class WorkItemDetailAddTypeSelectorComponent implements OnInit, OnChanges
}
}

showTypes() {
this.workItemDetailAddTypeSelectorWidget.open();
}

closePanel() {
this.workItemDetailAddTypeSelectorWidget.close();
}

openPanel() {
// optional, we can supply context area and iteration that is
// appended to the next url to be consumed by the create dialog
// for pre-selecting values.
openPanel(iterationId?: string, areaId?: string) {
this.selectedIterationId = iterationId;
this.selectedAreaId = areaId;
this.workItemDetailAddTypeSelectorWidget.open();
}

Expand All @@ -92,6 +93,8 @@ export class WorkItemDetailAddTypeSelectorComponent implements OnInit, OnChanges
this.router.url.split('plan')[0], '/')
+ '/plan/detail/new?type='
+ type.id
);
+ (this.selectedIterationId?'&iteration='+this.selectedIterationId:'')
+ (this.selectedAreaId?'&area='+this.selectedAreaId:'')
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,13 @@ export class WorkItemNewDetailComponent implements OnInit, OnDestroy {
.takeUntil(takeUntilObserver)
.subscribe((params) => {
let workItemId = params['id'];
if (workItemId === 'new'){
if (workItemId === 'new') {
// Create new work item ID
// you can add type, iteration and area GET params to the url to preselect values
let type = this.route.snapshot.queryParams['type'];
this.createWorkItemObj(type);
let iteration = this.route.snapshot.queryParams['iteration'];
let area = this.route.snapshot.queryParams['area'];
this.createWorkItemObj(type, iteration, area);
} else if (workItemId.split('-').length > 1) {
// The ID is a UUID
// To make it backword compaitable
Expand Down Expand Up @@ -159,7 +162,7 @@ export class WorkItemNewDetailComponent implements OnInit, OnDestroy {
onResize(event){

}
createWorkItemObj(type: string) {
createWorkItemObj(type: string, iterationId: string, areaId: string) {
this.workItem = new WorkItem();
this.workItem.id = null;
this.workItem.attributes = new Map<string, string | number>();
Expand All @@ -176,23 +179,52 @@ export class WorkItemNewDetailComponent implements OnInit, OnDestroy {
}
}
} as WorkItemRelations;

// create base empty relationship structure
this.workItem.relationships = Object.assign(this.workItem.relationships, {});
// Add creator
this.userService.getUser()
.subscribe(
user => {
this.workItem.relationships = Object.assign(
this.workItem.relationships,
{
creator: {
data: user
}
}
);
this.workItem.relationships.creator = {
data: user
};
},
err => console.log(err)
);

// if the iteration is given, add the iteration
if (iterationId) {
this.iterationService.getIterationById(iterationId)
.subscribe(
iteration => {
// update the iteration value list
this.getIterations();
// select the returned iteration in that list
this.iterations.forEach(thisIteration => thisIteration.selected = thisIteration.key === iteration.id);
// set the value on the model
this.workItem.relationships.iteration = {
data: iteration
};
},
err => console.log(err)
);
}
// if the area is given, add the area
if (areaId) {
this.areaService.getAreaById(areaId)
.subscribe(
area => {
// update the area value list
this.getAreas();
// select the returned area in that list
this.areas.forEach(thisArea => thisArea.selected = thisArea.key === area.id);
// set the value on the model
this.workItem.relationships.area = {
data: area
};
},
err => console.log(err)
);
}
this.workItem.relationalData = {};
this.workItemService.resolveType(this.workItem);
this.workItem.attributes['system.state'] = 'new';
Expand Down Expand Up @@ -886,6 +918,7 @@ export class WorkItemNewDetailComponent implements OnInit, OnDestroy {
});
}
}

iterationUpdated(iterationId: string): void {
if (iterationId === '0') return; // Loading item
this.loadingIteration = true;
Expand Down
13 changes: 13 additions & 0 deletions src/app/services/area.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ export class AreaService {
}
}

getAreaById(areaId: string): Observable<AreaModel> {
return this.getAreas().first()
.map((resultAreas) => {
for (let i=0; i<resultAreas.length; i++) {
if (resultAreas[i].id===areaId)
return resultAreas[i];
}
})
.catch( err => {
return Observable.throw(new Error(err.message));
});
}

/**
* checkValidUrl checks if the API url for
* iterations is valid or not
Expand Down
Loading

0 comments on commit c19af81

Please sign in to comment.