Skip to content

Commit

Permalink
TSK-203 Add classification tree view
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Rojas Miguel Angel authored and holgerhagen committed Apr 4, 2018
1 parent 88eca3d commit 2efa1c6
Show file tree
Hide file tree
Showing 49 changed files with 747 additions and 215 deletions.
4 changes: 1 addition & 3 deletions web/.angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss",
"./assets/_site.scss",
"./assets/_forms.scss"
"./assets/_styles.scss"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
Expand Down
23 changes: 15 additions & 8 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@angular/router": "5.2.1",
"file-saver": "1.3.3",
"angular-svg-icon": "5.0.0",
"angular-tree-component": "7.0.1",
"angular-tree-component": "7.1.0",
"bootstrap": "3.3.7",
"bootstrap-sass": "3.3.7",
"core-js": "2.5.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,40 +1,20 @@
<div class="classification-list-full-height">
<ul id="cl-list-container" class="list-group footer-space">
<li id="cl-action-toolbar" class="list-group-item tab-align">
<div class="row">
<div class="col-xs-9">
<taskana-import-export-component [currentSelection]="selectionToImport"></taskana-import-export-component>
</div>
</div>
</li>
<taskana-spinner [isRunning]="requestInProgress" class="centered-horizontally"></taskana-spinner>
<li id="wb-action-toolbar" class="list-group-item tab-align">
<div class="row">
<div class="col-xs-12">
<button type="button" (click)="addClassification()" data-toggle="tooltip" title="Add" class="btn btn-default">
<span class="glyphicon glyphicon-plus green" aria-hidden="true"></span>
</button>
<button type="button" (click)="removeClassification()" data-toggle="tooltip" title="Remove" class="btn btn-default remove">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
<taskana-import-export-component [currentSelection]="selectionToImport"></taskana-import-export-component>
<taskana-classification-types-selector class="pull-right" [classificationTypes]="classificationsTypes" [(classificationTypeSelected)]="classificationTypeSelected"
(classificationTypeChanged)=selectClassificationType($event)></taskana-classification-types-selector>
</div>
</div>
</li>
<taskana-spinner [isRunning]="requestInProgress" class="centered-horizontally"></taskana-spinner>
<taskana-tree [treeNodes]="classifications"></taskana-tree>

</ul>
<ul id="wb-pagination" class="pagination vertical-center">
<li>
<a href="#" aria-label="Previous">
<span aria-hidden="true">«</span>
</a>
</li>
<li>
<a href="">1</a>
</li>
<li>
<a href="">2</a>
</li>
<li>
<a href="">3</a>
</li>
<li>
<a href="">4</a>
</li>
<li>
<a href="">5</a>
</li>
<li>
<a href="#" aria-label="Next">
<span aria-hidden="true">»</span>
</a>
</li>
</ul>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@
height: calc(100vh - 55px);
}

.row.list-group {
margin-left: 2px;
.list-group-item {
padding: 5px 0px;
border: none;
}

.list-group > li {
border-left: none;
border-right: none;
}

a > label {
height: 2em;
width: 100%;
}
.tab-align{
margin-bottom: 0px;

.tab-align {
border-bottom: 1px solid #ddd;
padding-bottom: 12px;
&>div{
margin: 6px 0px;
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,46 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';

import {ClassificationListComponent} from './classification-list.component';
import {ImportExportComponent} from 'app/shared/import-export/import-export.component';
import {SpinnerComponent} from 'app/shared/spinner/spinner.component';
import {WorkbasketService} from 'app/services/workbasket/workbasket.service';
import {HttpClient, HttpClientModule} from '@angular/common/http';
import {WorkbasketDefinitionService} from 'app/services/workbasket/workbasketDefinition.service';
import {AlertService} from 'app/services/alert/alert.service';
import {ClassificationService} from 'app/services/classification/classification.service';
import {DomainService} from 'app/services/domains/domain.service';
import { Component, Input } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';

import { TreeNode } from 'app/models/tree-node';

import { ClassificationListComponent } from './classification-list.component';
import { ImportExportComponent } from 'app/shared/import-export/import-export.component';
import { SpinnerComponent } from 'app/shared/spinner/spinner.component';
import { ClassificationTypesSelectorComponent } from 'app/shared/classification-types-selector/classification-types-selector.component';
import { MapValuesPipe } from 'app/pipes/mapValues/map-values.pipe';

import { WorkbasketService } from 'app/services/workbasket/workbasket.service';
import { WorkbasketDefinitionService } from 'app/services/workbasket-definition/workbasket-definition.service';
import { AlertService } from 'app/services/alert/alert.service';
import { ClassificationsService } from 'app/services/classifications/classifications.service';
import { ClassificationDefinitionService } from 'app/services/classification-definition/classification-definition.service';
import { DomainService } from 'app/services/domains/domain.service';

@Component({
selector: 'taskana-tree',
template: ''
})
class TreeComponent {
@Input() treeNodes;
}

describe('ClassificationListComponent', () => {
let component: ClassificationListComponent;
let fixture: ComponentFixture<ClassificationListComponent>;
const treeNodes: Array<TreeNode> = new Array(new TreeNode());
const classificationTypes: Map<string, string> = new Map<string, string>([['type1', 'type1'], ['type2', 'type2']])
let classificationsSpy, classificationsTypesSpy;
let classificationsService;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ClassificationListComponent, ImportExportComponent, SpinnerComponent],
declarations: [ClassificationListComponent, ImportExportComponent, SpinnerComponent, ClassificationTypesSelectorComponent,
TreeComponent, MapValuesPipe],
imports: [HttpClientModule],
providers: [
WorkbasketService, HttpClient, WorkbasketDefinitionService, AlertService, ClassificationService, DomainService
HttpClient, WorkbasketDefinitionService, AlertService, ClassificationsService, DomainService, ClassificationDefinitionService
]
})
.compileComponents();
Expand All @@ -28,6 +49,9 @@ describe('ClassificationListComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(ClassificationListComponent);
component = fixture.componentInstance;
classificationsService = TestBed.get(ClassificationsService);
classificationsSpy = spyOn(classificationsService, 'getClassifications').and.returnValue(Observable.of(treeNodes));
classificationsTypesSpy = spyOn(classificationsService, 'getClassificationTypes').and.returnValue(Observable.of(classificationTypes));
fixture.detectChanges();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,55 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs/Subscription';

import { ImportType } from 'app/models/import-type';
import { Classification } from 'app/models/classification';
import { TreeNode } from 'app/models/tree-node';

import { ClassificationsService } from 'app/services/classifications/classifications.service';

@Component({
selector: 'taskana-classification-list',
templateUrl: './classification-list.component.html',
styleUrls: ['./classification-list.component.scss']
selector: 'taskana-classification-list',
templateUrl: './classification-list.component.html',
styleUrls: ['./classification-list.component.scss']
})
export class ClassificationListComponent implements OnInit {
export class ClassificationListComponent implements OnInit, OnDestroy {


selectionToImport = ImportType.CLASSIFICATIONS;
requestInProgress = false;

classifications: Array<Classification> = [];
classificationsTypes: Map<string, string> = new Map();
classificationTypeSelected: string;
classificationServiceSubscription: Subscription;
classificationTypeServiceSubscription: Subscription;
constructor(private classificationService: ClassificationsService) {
}

ngOnInit() {
this.classificationServiceSubscription = this.classificationService.getClassifications()
.subscribe((classifications: Array<TreeNode>) => {
this.classifications = classifications;
this.classificationTypeServiceSubscription = this.classificationService.getClassificationTypes()
.subscribe((classificationsTypes: Map<string, string>) => {
this.classificationsTypes = classificationsTypes;
this.classificationTypeSelected = this.classifications[0].type;
});
});
}

selectionToImport = ImportType.CLASSIFICATIONS;
requestInProgress = false;
selectClassificationType(classificationTypeSelected: string) {
this.classificationService.getClassifications(true, classificationTypeSelected)
.subscribe((classifications: Array<TreeNode>) => {
this.classifications = classifications;
});
}

constructor() {
}
addClassification() { }
removeClassification() { }

ngOnInit() {
}
ngOnDestroy(): void {
if (this.classificationServiceSubscription) { this.classificationServiceSubscription.unsubscribe(); }
if (this.classificationTypeServiceSubscription) { this.classificationTypeServiceSubscription.unsubscribe(); }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
<button *ngIf="workbasketIdSelected" type="button" (click)="copyWorkbasket()" data-toggle="tooltip" title="copy" class="btn btn-default">
<span class="glyphicon glyphicon-copy" aria-hidden="true"></span>
</button>
<button *ngIf="workbasketIdSelected" type="button" data-toggle="tooltip" title="Remove distibution target" class="btn btn-default">
<span class="glyphicon glyphicon-erase" aria-hidden="true"></span>
</button>
<button *ngIf="workbasketIdSelected" type="button" (click)="removeWorkbasket()" data-toggle="tooltip" title="Remove" class="btn btn-default remove">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.list-group-item {
padding: 0px 15px;
padding: 5px 0px;
border: none;
}

.tab-align{
margin-bottom: 0px;
padding: 0px;

&>div{
margin: 6px 0px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { ErrorModalService } from 'app/services/errorModal/error-modal.service';
import { WorkbasketService } from 'app/services/workbasket/workbasket.service';
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
import { AlertService } from 'app/services/alert/alert.service';
import { ClassificationService } from 'app/services/classification/classification.service';
import { WorkbasketDefinitionService } from 'app/services/workbasket/workbasketDefinition.service';
import { ClassificationDefinitionService } from 'app/services/classification-definition/classification-definition.service';
import { WorkbasketDefinitionService } from 'app/services/workbasket-definition/workbasket-definition.service';
import { DomainService } from 'app/services/domains/domain.service';

@Component({
Expand All @@ -54,7 +54,7 @@ describe('WorkbasketListToolbarComponent', () => {
declarations: [WorkbasketListToolbarComponent, SortComponent,
FilterComponent, IconTypeComponent, DummyDetailComponent, MapValuesPipe, ImportExportComponent],
providers: [ErrorModalService, WorkbasketService, RequestInProgressService, AlertService,
ClassificationService, WorkbasketDefinitionService, DomainService]
ClassificationDefinitionService, WorkbasketDefinitionService, DomainService]
})
.compileComponents();
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<taskana-spinner [isRunning]="requestInProgress" class="centered-horizontally"></taskana-spinner>
<div>
<ul #wbList id="wb-list-container" class="list-group">
<li class="list-group-item no-border">
<li class="list-group-item no-space">
<div class="row"></div>
</li>
<li class="list-group-item" *ngFor="let workbasket of workbaskets" [class.active]="workbasket.workbasketId == selectedId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ li > div.row > dl:first-child {
margin-left: 10px;
}

.no-border {
.no-space {
border-top: none;
padding: 0px
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import { ImportExportComponent } from 'app/shared/import-export/import-export.co

import { RemoveNoneTypePipe } from 'app/pipes/removeNoneType/remove-none-type.pipe';
import { MapValuesPipe } from 'app/pipes/mapValues/map-values.pipe';
import { WorkbasketDefinitionService } from 'app/services/workbasket/workbasketDefinition.service';
import { ClassificationService } from 'app/services/classification/classification.service';
import { WorkbasketDefinitionService } from 'app/services/workbasket-definition/workbasket-definition.service';
import { ClassificationDefinitionService } from 'app/services/classification-definition/classification-definition.service';
import { DomainService } from 'app/services/domains/domain.service';

@Component({
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('WorkbasketListComponent', () => {
RouterTestingModule.withRoutes(routes)
],
providers: [WorkbasketService, ErrorModalService, RequestInProgressService, AlertService,
WorkbasketDefinitionService, OrientationService, DomainService, ClassificationService]
WorkbasketDefinitionService, OrientationService, DomainService, ClassificationDefinitionService]
})
.compileComponents();

Expand Down
Loading

0 comments on commit 2efa1c6

Please sign in to comment.