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

Commit

Permalink
feat(board): Board components added to planner
Browse files Browse the repository at this point in the history
* fix(actions): add action for BoardView

* feat(card): add planner card component

* fix(actions): add actions for to get Board api

* fix(navigation): board side panel navigation added

* feat(column): add column component

* fix(effects): call boardApi in getBoards Effect

* fix(board): add mapper in workitem and Board

* fix(board): use action to update board

* fix(board): add reducer for boardColumn

* fix(board): add states and reducer to board module

* fix(board): add column-workItem reducer

* fix(board): fix tests for board service, reducer, model

* fix(reducer): add  unit test for column-workitem reducer

* fix(board): remove board-api-url action from boardAction

* fix(workitem): add getWorkItemWithIds query to WorItemQuery

* fix(board): integrate board components with action, effects and model

* fix(type): using proper type for side panel context

* fix(board):add drag and drop

* fix(board): assign value in board effects, change type of columnIds, fix unit tests, fix column-workItem reducer

* fix(board): change structure of column component

* fix(css): fix linter error for css

* fix(board): get workitems for each column in board query

* fix(columnWorkitem/board): use switchMap, add dafault to reducer switch case

* fix(board-ngrx): Board State, Actions, Effects, Reducers (#2708)

* fix(states): add BoardState to app.state

* fix(actions): add action for BoardView

* fix(actions): add actions for to get Board api

* fix(common): add optional parameter to have different key in normalization

* fix(reducersBoard): add reducers for BoardView

* fix(effectsBoard): add effects for boardView

* fix(effects): call boardApi in getBoards Effect

* fix(common): add test for nprmalize array

* fix(board): add mapper in workitem and Board

* fix(column-workitem): add state for column-workitem

* fix(board): add reducer for boardColumn

* fix(board): add states and reducer to board module

* fix(board): add column-workItem reducer

* fix(board): fix tests for board service, reducer, model

* fix(reducer): add  unit test for column-workitem reducer

* fix(board): remove board-api-url action from boardAction

* fix(workitem): add getWorkItemWithIds query to WorItemQuery

* fix(board): assign value in board effects, change type of columnIds, fix unit tests, fix column-workItem reducer

* fix(board): add default for column workItem reducer

*  fix(columnWorkitem): add unit test for default case

* fix(card): add assignee component

* fix(board): preparing board model to fetch work items

* fix(board): fetch work item for board

* fix(board): fetch work item bug fixed

* fix(board): send patch and reorder requests

* fix(board): initialize column on updateSuccess if not created

* fix(tests): unit test for column workItem reducer

* fix(workItem): fix workItemMapper test

* fix(board): use array instead of set, update unit tests

* fix(board): send array of column ids in column workitem Update action

* fix(column-workitem): handled column update fail

* fix(board): add quick preview to board view

* fix(workitem-effect): unnecessary code is removed for column change

* fix(board): add unit test for columnWorkitem actions and reduces

* fix(board): board ui state added with board lockdown feature

* fix(quick-preview): add condition to check if request coming from board or list

* fix(quick preview): add context input to correctly redirect to detail page route

* fix(card): fix child iteration name

* fix(board): fix 404 error on redirect to profile

* fix(customQuery): add modal component to board for custom query delete

* fix(board): disable drag n drop for non-collaborators

* fix(board): change username to full name

* fix(field): meta state field is removed from the detail page

* fix(board): add board view For iterations

* fix(card): fix workitem type icon

* fix(grouptype): select the default group type on load

* fix(workItemUtil): check if query is present in current route or not

* fix(package-lock): update package-lock.json
  • Loading branch information
sahil143 authored and sudsen committed Jul 30, 2018
1 parent e8f44e5 commit 2b08437
Show file tree
Hide file tree
Showing 47 changed files with 20,794 additions and 5,834 deletions.
25,279 changes: 19,667 additions & 5,612 deletions package-lock.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/app/actions/board-ui.actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Action } from '@ngrx/store';
import { BoardState } from '../states/board.state';

export const LOCK_BOARD = '[board-ui] Lock';
export const UNLOCK_BOARD = '[board-ui] Unlock';


export class LockBoard implements Action {
readonly type = LOCK_BOARD;
}

export class UnlockBoard implements Action {
readonly type = UNLOCK_BOARD;
}


export type All
= LockBoard
| UnlockBoard;
1 change: 0 additions & 1 deletion src/app/actions/board.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ export type All
= Get
| GetSuccess
| GetError;

46 changes: 46 additions & 0 deletions src/app/actions/column-workitem.action.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { WorkItemUI } from '../models/work-item';
import * as ColumnWorkItemActions from './column-workitem.action';

describe('Unit Test :: ColumnWorkItem Actions', () => {
it('UpdateColumnWorkItem :: should create update action', () => {
const payload = {
workItem: {} as WorkItemUI,
reorder: {
workitem: {} as WorkItemUI,
destinationWorkitemID: '',
direction: 'above'
},
prevColumnId: ''
};
const action = new ColumnWorkItemActions.Update(payload);
expect({...action}).toEqual({
type: ColumnWorkItemActions.UPDATE,
payload: payload
});
});

it('UpdateColumnWorkitemSuccess :: should create UpdateSuccess action', () => {
const payload = {
workItemId: '',
prevColumnId: '',
newColumnIds: ['', '']
};
const action = new ColumnWorkItemActions.UpdateSuccess(payload);
expect({...action}).toEqual({
type: ColumnWorkItemActions.UPDATE_SUCCESS,
payload: payload
});
});

it('UpdateColumnWorkitemError :: should create UpdateError action', () => {
const payload = {
prevColumnId: '',
newColumnIds: ['', '']
};
const action = new ColumnWorkItemActions.UpdateError(payload);
expect({...action}).toEqual({
type: ColumnWorkItemActions.UPDATE_ERROR,
payload: payload
});
});
});
68 changes: 68 additions & 0 deletions src/app/actions/column-workitem.action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Action } from '@ngrx/store';
import { WorkItemService, WorkItemUI } from './../models/work-item';

export const UPDATE = '[column workitem] Update';
export const UPDATE_SUCCESS = '[column workitem] UpdateSuccess';
export const UPDATE_ERROR = '[column workitem] UpdateError';

export class Update implements Action {
payload: {
workItem: WorkItemUI,
reorder: {
workitem: WorkItemUI,
destinationWorkitemID: string,
direction: string
},
prevColumnId: string
};

constructor(payload: {
workItem: WorkItemUI,
reorder: {
workitem: WorkItemUI,
destinationWorkitemID: string,
direction: string
},
prevColumnId: string
}) {
this.payload = payload;
}
readonly type = UPDATE;
}

export class UpdateSuccess implements Action {
payload: {
workItemId: string,
prevColumnId: string,
newColumnIds: string[]
};

constructor(payload: {
workItemId: string,
prevColumnId: string,
newColumnIds: string[]
}) {
this.payload = payload;
}
readonly type = UPDATE_SUCCESS;
}

export class UpdateError implements Action {
payload: {
prevColumnId: string,
newColumnIds: string[]
};

constructor(payload: {
prevColumnId: string,
newColumnIds: string[]
}) {
this.payload = payload;
}
readonly type = UPDATE_ERROR;
}

export type All
= Update
| UpdateSuccess
| UpdateError;
1 change: 1 addition & 0 deletions src/app/actions/index.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ export { All as WITypeActions } from './work-item-type.actions';
export { All as WorkItemActions } from './work-item.actions';
export { All as EventActions } from './event.action';
export { All as BoardActions } from './board.actions';
export { All as BoardUIActions } from './board-ui.actions';
4 changes: 2 additions & 2 deletions src/app/actions/work-item.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class UpdateError implements Action {
readonly type = UPDATE_ERROR;
}

export class Reoder implements Action {
export class Reorder implements Action {
readonly type = REORDER;
payload: {
workitem: WorkItemUI,
Expand Down Expand Up @@ -184,7 +184,7 @@ export type All
| GetChildren
| GetChildrenSuccess
| GetChildrenError
| Reoder
| Reorder
| UpdateWorkitemIteration
| CreateLink
| DeleteLink;
4 changes: 2 additions & 2 deletions src/app/components_ngrx/assignee/assignee.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-container *ngIf="assignees.length < 1">
<span class="dib fa fa-user-plus user-assign-icon margin-right-5"></span>
<small class="dib">Unassigned</small>
<small *ngIf="!overlapAvatar" class="dib">Unassigned</small>
</ng-container>
<ng-container *ngIf="showFullName">
<div class="f8-assignees dib margin-right-15 margin-bottom-7"
Expand All @@ -17,7 +17,7 @@
</ng-container>
<ng-container *ngIf="!showFullName">
<div class="f8-assignees dib margin-bottom-7">
<user-avatar
<user-avatar
*ngFor="let assignee of assignees | slice:0:truncateAfter"
[imgTooltip]="assignee?.name"
[imgPlacement]="'left'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
class="fab-planner-iteration"
[takeFromInput]="false"
[collection]="item.typeList"
[witGroup]="item.name"
[witGroup]="item"
[showTree]="showTree"
[showCompleted]="showCompleted"
[sidePanelOpen]="sidePanelOpen"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,21 @@ export class GroupTypesComponent implements OnInit, OnDestroy {
//reverse function jsonToQuery(second_join);
}

fnBuildQueryParamForBoard(witGroup) {
const type_query = this.filterService.queryBuilder(
'boardContextId', this.filterService.equal_notation, witGroup.id
);
// join query with typeQuery
const second_join = this.filterService.queryJoiner(
{}, this.filterService.and_notation, type_query
);
return this.filterService.jsonToQuery(second_join);
}

addRemoveQueryParams(witGroup) {
// If it's a board view then quoery should only have the board id
if (this.context === 'board') {
return {boardContextId: witGroup.id};
return {q: this.fnBuildQueryParamForBoard(witGroup)};
}

// For list view it works differently
Expand Down Expand Up @@ -134,11 +145,23 @@ export class GroupTypesComponent implements OnInit, OnDestroy {
this.route.queryParams.subscribe(val => {
if (val.hasOwnProperty('q')) {
let selectedTypeGroup: GroupTypeUI;
const selectedTypeGroupName =
this.filterService.getConditionFromQuery(val.q, 'typegroup.name');
if (selectedTypeGroupName) {
selectedTypeGroup =
this.groupTypes.find(g => g.name === selectedTypeGroupName);
if (val['q'].includes('boardContextId')) {
//filter service getConditionFromQuery returns undefined for non AND operations
let selectedTypeGroupId = this.filterService.getConditionFromQuery(val.q, 'boardContextId');
if (selectedTypeGroupId === undefined) {
selectedTypeGroupId = this.filterService.queryToFlat(val.q)[0].value;
}
if (selectedTypeGroupId) {
selectedTypeGroup =
this.groupTypes.find(g => g.id === selectedTypeGroupId);
}
} else {
const selectedTypeGroupName =
this.filterService.getConditionFromQuery(val.q, 'typegroup.name');
if (selectedTypeGroupName) {
selectedTypeGroup =
this.groupTypes.find(g => g.name === selectedTypeGroupName);
}
}
if (selectedTypeGroup && !selectedTypeGroup.selected) {
this.store.dispatch(new GroupTypeActions.SelectType(selectedTypeGroup));
Expand All @@ -154,15 +177,6 @@ export class GroupTypesComponent implements OnInit, OnDestroy {
} else {
this.showCompleted = '';
}

// If it's a board view then check for board context ID
if (val.hasOwnProperty('boardContextId')) {
const selectedTypeGroup: GroupTypeUI =
this.groupTypes.find(g => g.id === val.boardContextId);
if (selectedTypeGroup) {
this.store.dispatch(new GroupTypeActions.SelectType(selectedTypeGroup));
}
}
})
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</div>
<a
class="f8-itr__header"
[routerLink]="getRouterLink()"
[routerLink]="[]"
[queryParams]="addRemoveQueryParams(iteration.id)"
title="{{iteration.name}}">
<div class="truncate padding-right-15">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { AuthenticationService } from 'ngx-login-client';
import { Dialog } from 'ngx-widgets';
import { Subscription } from 'rxjs/Subscription';

import { GroupTypeUI } from '../../models/group-types.model';
import { IterationUI } from '../../models/iteration.model';
import { FilterService } from '../../services/filter.service';
import { GroupTypesService } from '../../services/group-types.service';
Expand All @@ -40,7 +41,7 @@ export class IterationListEntryComponent implements OnInit, OnDestroy {
@Input() iteration: IterationUI;
@Input() selected: boolean = false;
@Input() collection = [];
@Input() witGroup: string = '';
@Input() witGroup: GroupTypeUI;
@Input() showTree: string = '';
@Input() showCompleted: string = '';
@Input() context: 'list' | 'board'; // 'list' or 'board'
Expand Down Expand Up @@ -86,7 +87,7 @@ export class IterationListEntryComponent implements OnInit, OnDestroy {

constructURL(iterationId: string) {
//Query for work item type group
const type_query = this.filterService.queryBuilder('typegroup.name', this.filterService.equal_notation, this.witGroup);
const type_query = this.filterService.queryBuilder('typegroup.name', this.filterService.equal_notation, this.witGroup.name);
//Query for space
const space_query = this.filterService.queryBuilder('space', this.filterService.equal_notation, this.spaceId);
//Query for iteration
Expand All @@ -100,7 +101,23 @@ export class IterationListEntryComponent implements OnInit, OnDestroy {
return this.filterService.jsonToQuery(third_join);
}

constructURLforBoard(iterationId: string) {
//Query for work item type group
const type_query = this.filterService.queryBuilder('boardContextId', this.filterService.equal_notation, this.witGroup.id);
//Query for iteration
const iteration_query = this.filterService.queryBuilder('iteration', this.filterService.equal_notation, iterationId);
// join type and iteration query
const first_join = this.filterService.queryJoiner({}, this.filterService.and_notation, type_query);
const second_join = this.filterService.queryJoiner(first_join, this.filterService.and_notation, iteration_query);
return this.filterService.jsonToQuery(second_join);
}

addRemoveQueryParams(iterationId: string) {
if (this.context === 'board') {
return {
q: this.constructURLforBoard(iterationId)
};
}
if (this.showCompleted && this.showTree) {
return {
q: this.constructURL(iterationId),
Expand All @@ -124,10 +141,6 @@ export class IterationListEntryComponent implements OnInit, OnDestroy {
}
}

getRouterLink() {
return this.context === 'board' ? ['..'] : [];
}

toggleChildrenDisplay(iteration) {
// TODO: Dispatch an action to this
iteration.showChildren = !iteration.showChildren;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
SimpleChange,
SimpleChanges
} from '@angular/core';
import { GroupTypeUI } from '../../models/group-types.model';
import { IterationUI } from '../../models/iteration.model';
import { IterationListEntryComponent } from '../iteration-list-entry/iteration-list-entry.component';

Expand All @@ -18,7 +19,7 @@ export class IterationTreeComponent {

@Input() iterationList: IterationUI[] = [];
@Input() collection: any;
@Input() witGroup: string = '';
@Input() witGroup: GroupTypeUI;
@Input() showTree: string = '';
@Input() showCompleted: string = '';
@Input() context: 'list' | 'board'; // 'list' or 'board'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
[class.hide]="!sidePanelOpen">
Iterations
</p>
<infotip
<infotip
[infotipText]="infotipText"
[class.dib]="sidePanelOpen"
[class.hide]="!sidePanelOpen">
Expand All @@ -36,7 +36,7 @@
*ngFor="let iteration of activeIterations | async">
<a
[routerLinkActive]="'f8-itr--selected'"
[routerLink]="getRouterLink()" [attr.data-id]="iteration.id"
[routerLink]="[]" [attr.data-id]="iteration.id"
[queryParams]="addRemoveQueryParams(iteration.id)"
title="{{ iteration.resolvedParentPath +
'/' + iteration.name }}">
Expand Down
Loading

0 comments on commit 2b08437

Please sign in to comment.