diff --git a/admin/src/app/app.module.ts b/admin/src/app/app.module.ts index 82f9ce105..6b95d3ef6 100644 --- a/admin/src/app/app.module.ts +++ b/admin/src/app/app.module.ts @@ -27,6 +27,7 @@ import { WorkbasketInformationComponent } from './workbasket/details/information import { NoAccessComponent } from './workbasket/noAccess/no-access.component'; import { SpinnerComponent } from './shared/spinner/spinner.component'; import { FilterComponent } from './shared/filter/filter.component'; +import { IconTypeComponent } from './shared/type-icon/icon-type.component'; //Shared import { MasterAndDetailComponent} from './shared/masterAndDetail/master-and-detail.component'; @@ -44,7 +45,7 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http'; * Pipes */ import { MapValuesPipe } from './pipes/map-values.pipe'; - +import { RemoveNoneTypePipe } from './pipes/remove-none-type'; const MODULES = [ BrowserModule, @@ -72,7 +73,9 @@ const DECLARATIONS = [ NoAccessComponent, SpinnerComponent, FilterComponent, - MapValuesPipe + IconTypeComponent, + MapValuesPipe, + RemoveNoneTypePipe ]; @NgModule({ diff --git a/admin/src/app/pipes/remove-none-type.ts b/admin/src/app/pipes/remove-none-type.ts new file mode 100644 index 000000000..f13b7b22b --- /dev/null +++ b/admin/src/app/pipes/remove-none-type.ts @@ -0,0 +1,16 @@ +import {Pipe, PipeTransform} from '@angular/core'; + +@Pipe({name: 'removeNoneType'}) +export class RemoveNoneTypePipe implements PipeTransform { + transform(value: any): Object[] { + let returnArray = []; + value.forEach((entry) => { + if(entry.key !== 'NONE') + returnArray.push({ + key: entry.key, + value: entry.value + }); + }); + return returnArray; + } +} \ No newline at end of file diff --git a/admin/src/app/shared/filter/filter.component.html b/admin/src/app/shared/filter/filter.component.html index 903e912c3..c0535a270 100644 --- a/admin/src/app/shared/filter/filter.component.html +++ b/admin/src/app/shared/filter/filter.component.html @@ -1,24 +1,16 @@
@@ -28,7 +20,7 @@
@@ -47,5 +39,5 @@ -
+
\ No newline at end of file diff --git a/admin/src/app/shared/filter/filter.component.scss b/admin/src/app/shared/filter/filter.component.scss index dd7fb54bc..802c319e2 100644 --- a/admin/src/app/shared/filter/filter.component.scss +++ b/admin/src/app/shared/filter/filter.component.scss @@ -1,4 +1,3 @@ - .dropdown-menu-users { &>li{ margin-bottom: 5px; diff --git a/admin/src/app/shared/filter/filter.component.spec.ts b/admin/src/app/shared/filter/filter.component.spec.ts index fbb09379b..983057166 100644 --- a/admin/src/app/shared/filter/filter.component.spec.ts +++ b/admin/src/app/shared/filter/filter.component.spec.ts @@ -3,8 +3,9 @@ import { FormsModule } from '@angular/forms'; import { AngularSvgIconModule } from 'angular-svg-icon'; import { HttpClientModule } from '@angular/common/http'; import { HttpModule } from '@angular/http'; - +import { IconTypeComponent } from '../type-icon/icon-type.component'; import { FilterComponent, FilterModel } from './filter.component'; +import { MapValuesPipe } from '../../pipes/map-values.pipe'; describe('FilterComponent', () => { let component: FilterComponent, @@ -14,7 +15,7 @@ describe('FilterComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FilterComponent ], + declarations: [ FilterComponent, IconTypeComponent, MapValuesPipe ], imports: [AngularSvgIconModule, FormsModule, HttpClientModule, HttpModule ] }) .compileComponents(); diff --git a/admin/src/app/shared/filter/filter.component.ts b/admin/src/app/shared/filter/filter.component.ts index 44ca685ba..6ca1c14af 100644 --- a/admin/src/app/shared/filter/filter.component.ts +++ b/admin/src/app/shared/filter/filter.component.ts @@ -1,4 +1,5 @@ import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; +import { IconTypeComponent, ICONTYPES } from '../type-icon/icon-type.component' export class FilterModel { type:string; @@ -22,8 +23,10 @@ export class FilterModel { }) export class FilterComponent{ - constructor() { } - + constructor() { + this.allTypes = IconTypeComponent.allTypes; + } + allTypes: Map; filter: FilterModel = new FilterModel(); @Input() @@ -32,8 +35,8 @@ export class FilterComponent{ @Output() performFilter = new EventEmitter(); - selectType(type: number){ - this.filter.type = type === 0 ? 'PERSONAL': type === 1? 'GROUP': ''; + selectType(type: ICONTYPES){ + this.filter.type = type; } clear(){ diff --git a/admin/src/app/shared/type-icon/icon-type.component.html b/admin/src/app/shared/type-icon/icon-type.component.html new file mode 100644 index 000000000..3de1783c1 --- /dev/null +++ b/admin/src/app/shared/type-icon/icon-type.component.html @@ -0,0 +1,2 @@ + +
diff --git a/admin/src/app/shared/type-icon/icon-type.component.scss b/admin/src/app/shared/type-icon/icon-type.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/admin/src/app/shared/type-icon/icon-type.component.spec.ts b/admin/src/app/shared/type-icon/icon-type.component.spec.ts new file mode 100644 index 000000000..ae63eff33 --- /dev/null +++ b/admin/src/app/shared/type-icon/icon-type.component.spec.ts @@ -0,0 +1,28 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { AngularSvgIconModule } from 'angular-svg-icon'; +import { HttpClientModule } from '@angular/common/http'; +import { HttpModule } from '@angular/http'; +import { IconTypeComponent } from './icon-type.component'; + +describe('IconTypeComponent', () => { + let component: IconTypeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + imports:[AngularSvgIconModule,HttpClientModule, HttpModule], + declarations: [ IconTypeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(IconTypeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/admin/src/app/shared/type-icon/icon-type.component.ts b/admin/src/app/shared/type-icon/icon-type.component.ts new file mode 100644 index 000000000..09382f111 --- /dev/null +++ b/admin/src/app/shared/type-icon/icon-type.component.ts @@ -0,0 +1,36 @@ +import { Component, OnInit, Input } from '@angular/core'; + + +export enum ICONTYPES { + NONE = 'NONE', + PERSONAL = 'PERSONAL', + GROUP = 'GROUP', + CLEARANCE = 'CLEARANCE', + TOPIC = 'TOPIC' +} + + +@Component({ + selector: 'taskana-icon-type', + templateUrl: './icon-type.component.html', + styleUrls: ['./icon-type.component.scss'] +}) +export class IconTypeComponent implements OnInit { + + public static get allTypes(): Map { return new Map([['NONE', 'None'], ['PERSONAL', 'Personal'], ['GROUP', 'Group'], ['CLEARANCE', 'Clearance'], ['TOPIC', 'Topic']])}; + + constructor() { } + + @Input() + type: ICONTYPES = ICONTYPES.PERSONAL; + + @Input() + selected: boolean = false; + + @Input() + tooltip: boolean = false; + + ngOnInit() { + } + +} diff --git a/admin/src/app/workbasket/details/information/workbasket-information.component.html b/admin/src/app/workbasket/details/information/workbasket-information.component.html index 2fe0f14c1..64fa925a3 100644 --- a/admin/src/app/workbasket/details/information/workbasket-information.component.html +++ b/admin/src/app/workbasket/details/information/workbasket-information.component.html @@ -20,14 +20,16 @@ diff --git a/admin/src/app/workbasket/details/information/workbasket-information.component.spec.ts b/admin/src/app/workbasket/details/information/workbasket-information.component.spec.ts index 2ac3f058c..0a0f31e9f 100644 --- a/admin/src/app/workbasket/details/information/workbasket-information.component.spec.ts +++ b/admin/src/app/workbasket/details/information/workbasket-information.component.spec.ts @@ -6,28 +6,29 @@ import { AngularSvgIconModule } from 'angular-svg-icon'; import { HttpClientModule } from '@angular/common/http'; import { HttpModule, JsonpModule } from '@angular/http'; import { Workbasket } from 'app/model/workbasket'; +import { ICONTYPES, IconTypeComponent } from '../../../shared/type-icon/icon-type.component'; +import { MapValuesPipe } from '../../../pipes/map-values.pipe'; +import { RemoveNoneTypePipe } from '../../../pipes/remove-none-type'; + describe('InformationComponent', () => { let component: WorkbasketInformationComponent; let fixture: ComponentFixture; let debugElement; - + beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ WorkbasketInformationComponent ], + declarations: [ WorkbasketInformationComponent, IconTypeComponent, MapValuesPipe, RemoveNoneTypePipe], imports:[FormsModule, AngularSvgIconModule, HttpClientModule, HttpModule], providers:[WorkbasketService] }) .compileComponents(); - })); - - beforeEach(() => { fixture = TestBed.createComponent(WorkbasketInformationComponent); component = fixture.componentInstance; debugElement = fixture.debugElement.nativeElement; - }); + })); afterEach(() =>{ document.body.removeChild(debugElement); @@ -49,13 +50,13 @@ describe('InformationComponent', () => { })); - it('selectType should set workbasket.type to personal with 0 and multiple in other case', () => { + it('selectType should set workbasket.type to personal with 0 and group in other case', () => { component.workbasket = new Workbasket(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null); expect(component.workbasket.type).toEqual(null); - component.selectType(0); + component.selectType(ICONTYPES.PERSONAL); expect(component.workbasket.type).toEqual('PERSONAL'); - component.selectType(1); - expect(component.workbasket.type).toEqual('MULTIPLE'); + component.selectType(ICONTYPES.GROUP); + expect(component.workbasket.type).toEqual('GROUP'); }); }); diff --git a/admin/src/app/workbasket/details/information/workbasket-information.component.ts b/admin/src/app/workbasket/details/information/workbasket-information.component.ts index 215169efe..7b90aede0 100644 --- a/admin/src/app/workbasket/details/information/workbasket-information.component.ts +++ b/admin/src/app/workbasket/details/information/workbasket-information.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, Input, Output } from '@angular/core'; import { Workbasket } from '../../../model/workbasket'; import { WorkbasketService } from '../../../services/workbasketservice.service'; +import { IconTypeComponent, ICONTYPES } from '../../../shared/type-icon/icon-type.component'; @Component({ selector: 'workbasket-information', @@ -11,13 +12,15 @@ export class WorkbasketInformationComponent implements OnInit { @Input() workbasket: Workbasket; - - constructor(private service: WorkbasketService) { } + allTypes: Map; + constructor(private service: WorkbasketService) { + this.allTypes = IconTypeComponent.allTypes; + } ngOnInit() { } - selectType(type: number){ - this.workbasket.type = type === 0 ? 'PERSONAL': 'MULTIPLE'; + selectType(type: ICONTYPES){ + this.workbasket.type = type; } } diff --git a/admin/src/app/workbasket/details/workbasket-details.component.spec.ts b/admin/src/app/workbasket/details/workbasket-details.component.spec.ts index 009392b9d..cdb6ea34c 100644 --- a/admin/src/app/workbasket/details/workbasket-details.component.spec.ts +++ b/admin/src/app/workbasket/details/workbasket-details.component.spec.ts @@ -5,6 +5,9 @@ import { WorkbasketInformationComponent } from './information/workbasket-informa import { Workbasket } from 'app/model/workbasket'; import { Observable } from 'rxjs/Observable'; import { SpinnerComponent } from '../../shared/spinner/spinner.component'; +import { ICONTYPES, IconTypeComponent } from '../../shared/type-icon/icon-type.component'; +import { MapValuesPipe } from '../../pipes/map-values.pipe'; +import { RemoveNoneTypePipe } from '../../pipes/remove-none-type'; import { WorkbasketService } from '../../services/workbasketservice.service'; import { MasterAndDetailService } from '../../services/master-and-detail.service'; @@ -26,7 +29,7 @@ describe('WorkbasketDetailsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ imports:[RouterTestingModule, FormsModule, AngularSvgIconModule, HttpClientModule, HttpModule], - declarations: [ WorkbasketDetailsComponent, NoAccessComponent, WorkbasketInformationComponent, SpinnerComponent ], + declarations: [ WorkbasketDetailsComponent, NoAccessComponent, WorkbasketInformationComponent, SpinnerComponent, IconTypeComponent, MapValuesPipe, RemoveNoneTypePipe ], providers:[WorkbasketService, MasterAndDetailService, PermissionService] }) .compileComponents(); diff --git a/admin/src/app/workbasket/list/workbasket-list.component.html b/admin/src/app/workbasket/list/workbasket-list.component.html index 02614208e..e73586f47 100644 --- a/admin/src/app/workbasket/list/workbasket-list.component.html +++ b/admin/src/app/workbasket/list/workbasket-list.component.html @@ -63,7 +63,9 @@
  • -
    +
    + +
    {{workbasket.name}} ({{workbasket.key}})
    diff --git a/admin/src/app/workbasket/list/workbasket-list.component.spec.ts b/admin/src/app/workbasket/list/workbasket-list.component.spec.ts index a0fc3733c..3ed224500 100644 --- a/admin/src/app/workbasket/list/workbasket-list.component.spec.ts +++ b/admin/src/app/workbasket/list/workbasket-list.component.spec.ts @@ -10,8 +10,11 @@ import { Router, Routes } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; import { Observable } from 'rxjs/Observable'; import { SpinnerComponent } from '../../shared/spinner/spinner.component'; -import { MapValuesPipe } from '../../pipes/map-values.pipe'; import { FilterModel } from '../../shared/filter/filter.component'; +import { IconTypeComponent } from '../../shared/type-icon/icon-type.component'; +import { RemoveNoneTypePipe } from '../../pipes/remove-none-type'; +import { MapValuesPipe } from '../../pipes/map-values.pipe'; + @Component({ selector: 'dummy-detail', @@ -30,7 +33,7 @@ export class FilterComponent { } const workbasketSummary: WorkbasketSummary[] = [ new WorkbasketSummary("1", "key1", "NAME1", "description 1", "owner 1", "", "", "PERSONAL", "", "", "", ""), - new WorkbasketSummary("2", "key2", "NAME2", "description 2", "owner 2", "", "", "MULTIPLE", "", "", "", "") + new WorkbasketSummary("2", "key2", "NAME2", "description 2", "owner 2", "", "", "GROUP", "", "", "", "") ]; @@ -47,7 +50,7 @@ describe('WorkbasketListComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ WorkbasketListComponent, DummyDetailComponent, MapValuesPipe, SpinnerComponent, FilterComponent], + declarations: [ WorkbasketListComponent, DummyDetailComponent, MapValuesPipe, SpinnerComponent, FilterComponent, RemoveNoneTypePipe, IconTypeComponent], imports:[ AngularSvgIconModule, HttpModule, diff --git a/admin/src/assets/_site.scss b/admin/src/assets/_site.scss index 416ff3200..984d34d09 100644 --- a/admin/src/assets/_site.scss +++ b/admin/src/assets/_site.scss @@ -247,3 +247,7 @@ li > div.row > dl { taskana-spinner.centered-horizontally > div { margin-top: calc(50vh - 250px); } + +.vertical-align{ + vertical-align: middle; +} \ No newline at end of file diff --git a/admin/src/assets/icons/clearance.svg b/admin/src/assets/icons/clearance.svg new file mode 100644 index 000000000..c0c882ed5 --- /dev/null +++ b/admin/src/assets/icons/clearance.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/src/assets/icons/topic.svg b/admin/src/assets/icons/topic.svg new file mode 100644 index 000000000..39ece78a4 --- /dev/null +++ b/admin/src/assets/icons/topic.svg @@ -0,0 +1 @@ + \ No newline at end of file