TSK-194-Add authorizations view component

This commit is contained in:
Martin Rojas Miguel Angel 2018-02-27 17:19:52 +01:00 committed by Holger Hagen
parent 23b78bbc3f
commit e8cdbd8632
21 changed files with 461 additions and 278 deletions

View File

@ -21,10 +21,10 @@ import { CategorieslistComponent } from './categorieslist/categorieslist.compone
import { CategoriestreeComponent } from './categoriestree/categoriestree.component'; import { CategoriestreeComponent } from './categoriestree/categoriestree.component';
import { CategoryeditorComponent } from './categoryeditor/categoryeditor.component'; import { CategoryeditorComponent } from './categoryeditor/categoryeditor.component';
import { CategoriesadministrationComponent } from './categoriesadministration/categoriesadministration.component'; import { CategoriesadministrationComponent } from './categoriesadministration/categoriesadministration.component';
import { WorkbasketAuthorizationComponent } from './workbasket-authorization/workbasket-authorization.component';
import { WorkbasketDistributiontargetsComponent } from './workbasket-distributiontargets/workbasket-distributiontargets.component'; import { WorkbasketDistributiontargetsComponent } from './workbasket-distributiontargets/workbasket-distributiontargets.component';
import { WorkbasketDetailsComponent } from './workbasket/details/workbasket-details.component'; import { WorkbasketDetailsComponent } from './workbasket/details/workbasket-details.component';
import { WorkbasketInformationComponent } from './workbasket/details/information/workbasket-information.component'; import { WorkbasketInformationComponent } from './workbasket/details/information/workbasket-information.component';
import { AuthorizationsComponent } from './workbasket/details/authorizations/authorizations.component';
import { NoAccessComponent } from './workbasket/noAccess/no-access.component'; import { NoAccessComponent } from './workbasket/noAccess/no-access.component';
import { SpinnerComponent } from './shared/spinner/spinner.component'; import { SpinnerComponent } from './shared/spinner/spinner.component';
import { FilterComponent } from './shared/filter/filter.component'; import { FilterComponent } from './shared/filter/filter.component';
@ -70,7 +70,7 @@ const DECLARATIONS = [
CategoriestreeComponent, CategoriestreeComponent,
CategoryeditorComponent, CategoryeditorComponent,
CategoriesadministrationComponent, CategoriesadministrationComponent,
WorkbasketAuthorizationComponent, AuthorizationsComponent,
WorkbasketDetailsComponent, WorkbasketDetailsComponent,
WorkbasketDistributiontargetsComponent, WorkbasketDistributiontargetsComponent,
MasterAndDetailComponent, MasterAndDetailComponent,

View File

@ -1,21 +1,27 @@
export class WorkbasketAuthorization { import { Links } from "./links";
id: string;
workbasketId: string;
userId: string;
groupId: string;
read: boolean;
open: boolean;
append: boolean;
transfer: boolean;
distribute: boolean;
constructor(id: string, export class WorkbasketAuthorization {
workbasketId: string, constructor(
userId: string, public accessItemId: string = '',
groupId: string, public workbasketId: string = '',
read: boolean, public accessId: string = '',
open: boolean, public permRead: boolean = false,
append: boolean, public permOpen: boolean = false,
transfer: boolean, public permAppend: boolean = false,
distribute: boolean) { } public permTransfer: boolean = false,
public permDistribute: boolean = false,
public permCustom1: boolean = false,
public permCustom2: boolean = false,
public permCustom3: boolean = false,
public permCustom4: boolean = false,
public permCustom5: boolean = false,
public permCustom6: boolean = false,
public permCustom7: boolean = false,
public permCustom8: boolean = false,
public permCustom9: boolean = false,
public permCustom10: boolean = false,
public permCustom11: boolean = false,
public permCustom12: boolean = false,
public links: Array<Links> = undefined
) { }
} }

View File

@ -3,23 +3,23 @@ import { Links } from './links';
export class Workbasket { export class Workbasket {
constructor( constructor(
public workbasketId: string, public workbasketId: string,
public created: string, public created: string = undefined,
public key: string, public key: string = undefined,
public domain: string, public domain: string = undefined,
public type: string, public type: string = undefined,
public modified: string, public modified: string = undefined,
public name: string, public name: string = undefined,
public description: string, public description: string = undefined,
public owner: string, public owner: string = undefined,
public custom1: string, public custom1: string = undefined,
public custom2: string, public custom2: string = undefined,
public custom3: string, public custom3: string = undefined,
public custom4: string, public custom4: string = undefined,
public orgLevel1: string, public orgLevel1: string = undefined,
public orgLevel2: string, public orgLevel2: string = undefined,
public orgLevel3: string, public orgLevel3: string = undefined,
public orgLevel4: string, public orgLevel4: string = undefined,
public links: Array<Links>){} public links: Array<Links> = undefined){}
public static equals(org: Workbasket, comp: Workbasket): boolean { public static equals(org: Workbasket, comp: Workbasket): boolean {
if (org.workbasketId !== comp.workbasketId) { return false; } if (org.workbasketId !== comp.workbasketId) { return false; }

View File

@ -95,7 +95,7 @@ export class WorkbasketService {
return this.httpClient.delete(environment.taskanaRestUrl + '/v1/workbaskets/' + id, this.httpOptions); return this.httpClient.delete(environment.taskanaRestUrl + '/v1/workbaskets/' + id, this.httpOptions);
} }
// GET // GET
getAllWorkBasketAuthorizations(id: String): Observable<WorkbasketAuthorization[]> { getWorkBasketAuthorizations(id: String): Observable<WorkbasketAuthorization[]> {
return this.httpClient.get<WorkbasketAuthorization[]>(environment.taskanaRestUrl + '/v1/workbaskets/' + id + '/authorizations', this.httpOptions); return this.httpClient.get<WorkbasketAuthorization[]>(environment.taskanaRestUrl + '/v1/workbaskets/' + id + '/authorizations', this.httpOptions);
} }
// POST // POST
@ -104,11 +104,11 @@ export class WorkbasketService {
} }
// PUT // PUT
updateWorkBasketAuthorization(workbasketAuthorization: WorkbasketAuthorization): Observable<WorkbasketAuthorization> { updateWorkBasketAuthorization(workbasketAuthorization: WorkbasketAuthorization): Observable<WorkbasketAuthorization> {
return this.httpClient.put<WorkbasketAuthorization>(environment.taskanaRestUrl + '/v1/workbaskets/authorizations/' + workbasketAuthorization.id, workbasketAuthorization, this.httpOptions) return this.httpClient.put<WorkbasketAuthorization>(environment.taskanaRestUrl + '/v1/workbaskets/authorizations/' + workbasketAuthorization.accessId, workbasketAuthorization, this.httpOptions)
} }
// DELETE // DELETE
deleteWorkBasketAuthorization(workbasketAuthorization: WorkbasketAuthorization) { deleteWorkBasketAuthorization(workbasketAuthorization: WorkbasketAuthorization) {
return this.httpClient.delete(environment.taskanaRestUrl + '/v1/workbaskets/authorizations/' + workbasketAuthorization.id, this.httpOptions); return this.httpClient.delete(environment.taskanaRestUrl + '/v1/workbaskets/authorizations/' + workbasketAuthorization.accessId, this.httpOptions);
} }
//#endregion //#endregion

View File

@ -1,98 +0,0 @@
<!-- <h2>Authorizations</h2>
<table class="table table-condensed table-hover">
<thead>
<th>ID</th>
<th>AccessID</th>
<th>READ</th>
<th>OPEN</th>
<th>APPEND</th>
<th>TRANSFER</th>
<th>DISTRIBUTE</th>
<th>Actions</th>
</thead>
<tr>
<td></td>
<td>
<input class="form-control" placeholder="AccessId" name="name" [(ngModel)]="workbasketAuthorization.accessId" required>
</td>
<td>
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permRead">
</td>
<td>
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permOpen">
</td>
<td>
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permAppend">
</td>
<td>
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permTransfer">
</td>
<td>
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permDistribute">
</td>
<td>
<button type="button" class="btn btn-default" aria-label="Left Align" (click)="onAdd()">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default" aria-label="Left Align" (click)="onClear()">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
</td>
</tr>
<tr *ngFor="let workbasketAuthorization of workbasketAuthorizations">
<td *ngIf="workbasketAuthorization.id != editing.id">{{ workbasketAuthorization.id }}</td>
<td *ngIf="workbasketAuthorization.id == editing.id">
<input class="form-control" placeholder="Id" name="editid" [(ngModel)]="editing.id" readonly>
</td>
<td *ngIf="workbasketAuthorization.id != editing.id">{{ workbasketAuthorization.accessId }}</td>
<td *ngIf="workbasketAuthorization.id == editing.id">
<input class="form-control" placeholder="AccessId" name="editAccessId" [(ngModel)]="editing.accessId">
</td>
<td *ngIf="workbasketAuthorization.id != editing.id">
<input type="checkbox" [checked]="workbasketAuthorization.permRead" disabled>
</td>
<td *ngIf="workbasketAuthorization.id == editing.id">
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permRead">
</td>
<td *ngIf="workbasketAuthorization.id != editing.id">
<input type="checkbox" [checked]="workbasketAuthorization.permOpen" disabled>
</td>
<td *ngIf="workbasketAuthorization.id == editing.id">
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permOpen">
</td>
<td *ngIf="workbasketAuthorization.id != editing.id">
<input type="checkbox" [checked]="workbasketAuthorization.permAppend" disabled>
</td>
<td *ngIf="workbasketAuthorization.id == editing.id">
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permAppend">
</td>
<td *ngIf="workbasketAuthorization.id != editing.id">
<input type="checkbox" [checked]="workbasketAuthorization.permTransfer" disabled>
</td>
<td *ngIf="workbasketAuthorization.id == editing.id">
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permTransfer">
</td>
<td *ngIf="workbasketAuthorization.id != editing.id">
<input type="checkbox" [checked]="workbasketAuthorization.permDistribute" disabled>
</td>
<td *ngIf="workbasketAuthorization.id == editing.id">
<input type="checkbox" [(ngModel)]="workbasketAuthorization.permDistribute">
</td>
<td *ngIf="workbasketAuthorization.id != editing.id">
<button type="button" class="btn btn-default" aria-label="Left Align" (click)="onEdit(workbasketAuthorization)">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default" aria-label="Left Align" (click)="onDelete(workbasketAuthorization)">
<span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
</button>
</td>
<td *ngIf="workbasketAuthorization.id == editing.id">
<button type="button" class="btn btn-default" aria-label="Left Align" (click)="onSave(workbasketAuthorization)">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default" aria-label="Left Align" (click)="onCancel(workbasketAuthorization)">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
</td>
</tr>
</table> -->

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { WorkbasketAuthorizationComponent } from './workbasket-authorization.component';
describe('WorkbasketAuthorizationComponent', () => {
let component: WorkbasketAuthorizationComponent;
let fixture: ComponentFixture<WorkbasketAuthorizationComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WorkbasketAuthorizationComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(WorkbasketAuthorizationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
xit('should be created', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,100 +0,0 @@
import { Component, OnInit, Input } from '@angular/core';
import { ActivatedRoute, Params } from '@angular/router';
import { WorkbasketService } from '../services/workbasket.service';
import { WorkbasketAuthorization } from '../model/workbasket-authorization';
import { WorkbasketSummary } from '../model/workbasketSummary';
@Component({
selector: 'app-workbasket-authorization',
templateUrl: './workbasket-authorization.component.html',
styleUrls: ['./workbasket-authorization.component.css']
})
export class WorkbasketAuthorizationComponent implements OnInit {
@Input()
workbasket: WorkbasketSummary;
// workbasketAuthorization: WorkbasketAuthorization = this.getEmptyObject();
// selected: WorkbasketAuthorization = this.getEmptyObject();
// editing: WorkbasketAuthorization = this.getEmptyObject();
// isEditing: boolean = false;
// constructor(private service: WorkbasketService, private route: ActivatedRoute) { }
// workbasketAuthorizations: WorkbasketAuthorization[];
ngOnInit() {
// this.route.params.switchMap((params: Params) => this.service.getAllWorkBasketAuthorizations(params['id']))
// .subscribe(resultList => {
// this.workbasketAuthorizations = resultList;
// });
}
// getEmptyObject() {
// return new WorkbasketAuthorization("", "", "", "", false, false, false, false, false);
// }
// onDelete(workbasket: WorkbasketAuthorization) {
// this.service.deleteWorkBasketAuthorization(workbasket).subscribe(result => {
// var index = this.workbasketAuthorizations.indexOf(workbasket);
// if (index > -1) {
// this.workbasketAuthorizations.splice(index, 1);
// }
// });
// }
// onAdd() {
// console.log(this.workbasketAuthorization);
// this.workbasketAuthorization.workbasketId = this.workbasket.id;
// this.service.createWorkBasketAuthorization(this.workbasketAuthorization).subscribe(result => {
// this.workbasketAuthorizations.push(result);
// this.onClear();
// });
// }
// onEdit(workbasketAuthorizations: WorkbasketAuthorization) {
// this.editing = { ...workbasketAuthorizations };
// this.isEditing = true;
// }
// onSelect(workbasketAuthorizations: WorkbasketAuthorization) {
// if (!this.isEditing) {
// this.selected = workbasketAuthorizations;
// }
// }
// onClear() {
// this.workbasketAuthorization.id = "";
// this.workbasketAuthorization.workbasketId = "";
// this.workbasketAuthorization.userId = "";
// this.workbasketAuthorization.groupId = "";
// this.workbasketAuthorization.read = false;
// this.workbasketAuthorization.open = false;
// this.workbasketAuthorization.append = false;
// this.workbasketAuthorization.transfer = false;
// this.workbasketAuthorization.distribute = false;
// }
// onSave() {
// if (this.isEditing) {
// this.service.updateWorkBasketAuthorization(this.editing).subscribe(result => {
// this.selected.id = result.id;
// this.selected.workbasketId = result.workbasketId;
// this.selected.userId = result.userId;
// this.selected.groupId = result.groupId;
// this.selected.read = result.read;
// this.selected.open = result.open;
// this.selected.append = result.append;
// this.selected.transfer = result.transfer;
// this.selected.distribute = result.distribute;
// });
// }
// this.isEditing = false;
// this.editing = this.getEmptyObject();
// }
// onCancel() {
// this.editing = this.getEmptyObject();
// this.isEditing = false;
// }
}

View File

@ -0,0 +1,171 @@
<taskana-spinner [isRunning]="requestInProgress" [isModal]="modalSpinner" class="centered-horizontally floating"></taskana-spinner>
<taskana-general-message-modal *ngIf="modalErrorMessage" [message]="modalErrorMessage" [title]="modalTitle" error="true"></taskana-general-message-modal>
<div *ngIf="workbasket" id="wb-information" class="panel panel-default">
<div class="panel-heading">
<div class="btn-group pull-right">
<button type="button" (click)="clear()" class="btn btn-default">Undo changes</button>
</div>
<h4 class="panel-header">{{workbasket.name}}</h4>
</div>
<div class="panel-body">
<table class="table table-striped table-center">
<thead>
<tr>
<th></th>
<th class="text-align">AccessID</th>
<th>Read</th>
<th>Open</th>
<th>Append</th>
<th>Transfer</th>
<th>Distribute</th>
<th>Custom1</th>
<th>Custom2</th>
<th>Custom3</th>
<th>Custom4</th>
<th>Custom5</th>
<th>Custom6</th>
<th>Custom7</th>
<th>Custom8</th>
<th>Custom9</th>
<th>Custom10</th>
<th>Custom11</th>
<th>Custom12</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<span class="input-group-btn">
<button type="button" (click)="addAuthorization()" class="btn btn-default">
<svg-icon class="green small" src="./assets/icons/wb-add.svg"></svg-icon>
</button>
</span>
</td>
<td class="text-align">
<div class="input-group">
<input type="text" class="form-control" id="au-add-work-basket" [(ngModel)]="newAuthorization.accessId" placeholder="Add authorization">
</div>
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permRead">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permOpen">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permAppend">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permTransfer">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permDistribute">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom1">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom2">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom3">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom4">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom5">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom6">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom7">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom8">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom9">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom10">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom11">
</td>
<td>
<input type="checkbox" [(ngModel)]="newAuthorization.permCustom12">
</td>
</tr>
<tr *ngFor="let authorization of authorizations; let index = index;">
<td>
<button type="button" *ngIf="!authorizationState[index]" (click)="remove(index)" data-toggle="tooltip" title="Remove" class="btn btn-default remove">
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
</button>
<button type="button" *ngIf="authorizationState[index]" (click)="save(index)" data-toggle="tooltip" title="Save" class="btn btn-default brown">
<span class="glyphicon glyphicon-floppy-remove" aria-hidden="true"></span>
</button>
</td>
<td class="text-align text-width">
<div class="input-group {{(authorizationsClone[index].accessId !== authorization.accessId)? 'has-warning': ''}}">
<input type="text" class="form-control"
(change)="checkAuthorizationState(index);" [(ngModel)]="authorization.accessId">
</div>
</td>
<td class ="{{(authorizationsClone[index].permRead !== authorization.permRead)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permRead">
</td>
<td class ="{{(authorizationsClone[index].permOpen !== authorization.permOpen)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permOpen">
</td>
<td class ="{{(authorizationsClone[index].permAppend !== authorization.permAppend)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permAppend">
</td>
<td class ="{{(authorizationsClone[index].permTransfer !== authorization.permTransfer)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permTransfer">
</td>
<td class ="{{(authorizationsClone[index].permDistribute !== authorization.permDistribute)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permDistribute">
</td>
<td class ="{{(authorizationsClone[index].permCustom1 !== authorization.permCustom1)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom1">
</td>
<td class ="{{(authorizationsClone[index].permCustom2 !== authorization.permCustom2)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom2">
</td>
<td class ="{{(authorizationsClone[index].permCustom3 !== authorization.permCustom3)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom3">
</td>
<td class ="{{(authorizationsClone[index].permCustom4 !== authorization.permCustom4)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom4">
</td>
<td class ="{{(authorizationsClone[index].permCustom5 !== authorization.permCustom5)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom5">
</td>
<td class ="{{(authorizationsClone[index].permCustom6 !== authorization.permCustom6)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom6">
</td>
<td class ="{{(authorizationsClone[index].permCustom7 !== authorization.permCustom7)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom7">
</td>
<td class ="{{(authorizationsClone[index].permCustom8 !== authorization.permCustom8)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom8">
</td>
<td class ="{{(authorizationsClone[index].permCustom9 !== authorization.permCustom9)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom9">
</td>
<td class ="{{(authorizationsClone[index].permCustom10 !== authorization.permCustom10)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom10">
</td>
<td class ="{{(authorizationsClone[index].permCustom11 !== authorization.permCustom11)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom11">
</td>
<td class ="{{(authorizationsClone[index].permCustom12 !== authorization.permCustom12)? 'has-changes': ''}}">
<input type="checkbox" (change)="checkAuthorizationState(index)" [(ngModel)]="authorization.permCustom12">
</td>
</tr>
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,15 @@
td > input[type="checkbox"] {
margin-top: 0px;
}
.panel-body {
overflow-x: auto;
}
.text-width{
min-width: 150px;
}
td {
&.has-changes {
border-bottom: 1px solid #f0ad4e;;
}
}

View File

@ -0,0 +1,44 @@
import { async, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { WorkbasketService } from '../../../services/workbasket.service';
import { FormsModule } from '@angular/forms';
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 { SpinnerComponent } from '../../../shared/spinner/spinner.component';
import { AlertService } from '../../../services/alert.service';
import { GeneralMessageModalComponent } from '../../../shared/general-message-modal/general-message-modal.component';
import { Links } from '../../../model/links';
import { Observable } from 'rxjs/Observable';
import { AuthorizationsComponent } from './authorizations.component';
import { WorkbasketAuthorization } from '../../../model/workbasket-authorization';
describe('AuthorizationsComponent', () => {
let component: AuthorizationsComponent;
let fixture: ComponentFixture<AuthorizationsComponent>;
let workbasketService;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [SpinnerComponent, AuthorizationsComponent, GeneralMessageModalComponent],
imports: [FormsModule, AngularSvgIconModule, HttpClientModule, HttpModule],
providers: [WorkbasketService, AlertService]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AuthorizationsComponent);
component = fixture.componentInstance;
component.workbasket = new Workbasket('1')
workbasketService = TestBed.get(WorkbasketService);
spyOn(workbasketService, 'getWorkBasketAuthorizations').and.returnValue(Observable.of(new Array<WorkbasketAuthorization>(new WorkbasketAuthorization())));
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,91 @@
import { Component, OnInit, Input } from '@angular/core';
import { Subscription } from 'rxjs';
import { Workbasket } from '../../../model/workbasket';
import { WorkbasketAuthorization } from '../../../model/workbasket-authorization';
import { WorkbasketService } from '../../../services/workbasket.service';
@Component({
selector: 'taskana-workbasket-authorizations',
templateUrl: './authorizations.component.html',
styleUrls: ['./authorizations.component.scss']
})
export class AuthorizationsComponent implements OnInit {
@Input()
workbasket: Workbasket;
authorizations: Array<WorkbasketAuthorization>;
authorizationsClone: Array<WorkbasketAuthorization>;
authorizationsResetClone: Array<WorkbasketAuthorization>;
newAuthorization: WorkbasketAuthorization = new WorkbasketAuthorization();
authorizationState: Array<boolean>;
requestInProgress: boolean = false;
modalSpinner: boolean = true;
modalTitle: string;
modalErrorMessage: string;
authorizationSubscription: Subscription;
constructor(private workbasketService: WorkbasketService) { }
ngOnInit() {
this.authorizationSubscription = this.workbasketService.getWorkBasketAuthorizations(this.workbasket.workbasketId).subscribe( (authorizations: Array<WorkbasketAuthorization>) =>{
this.authorizations = authorizations;
this.authorizationsClone = this.cloneAuthorizations(this.authorizations);
this.authorizationsResetClone = this.cloneAuthorizations(this.authorizations);
})
}
addAuthorization(){
this.authorizations.push({...this.newAuthorization});
this.authorizationsClone.push({...this.newAuthorization});
this.authorizationState.push(false);
this.newAuthorization = new WorkbasketAuthorization();
}
authorizationToggle(index: number) {
this.checkAuthorizationState(index);
}
clear() {
this.authorizations = this.cloneAuthorizations(this.authorizationsResetClone);
this.authorizationsClone = this.cloneAuthorizations(this.authorizationsResetClone);
}
remove(index: number) {
this.authorizations.splice(index,1);
this.authorizationsClone.splice(index,1);
}
save(index: number) {
}
private resetAuthorizationsState() {
this.authorizationState = new Array<boolean>(this.authorizations.length);
}
private checkAuthorizationState(index: number) {
this.authorizationState[index] = false;
Object.keys(this.authorizations[index]).forEach(key =>{
if(this.authorizations[index][key]!== this.authorizationsClone[index][key]){
this.authorizationState[index] = true;
return;
}
});
}
private cloneAuthorizations(inputAuthorization): Array<WorkbasketAuthorization>{
let authorizationClone = new Array<WorkbasketAuthorization>();
inputAuthorization.forEach(authorization => {
authorizationClone.push({... authorization});
});
this.resetAuthorizationsState();
return authorizationClone;
}
private ngOnDestroy(): void {
if (this.authorizationSubscription) { this.authorizationSubscription.unsubscribe(); }
}
}

View File

@ -56,8 +56,8 @@ describe('InformationComponent', () => {
})); }));
it('selectType should set workbasket.type to personal with 0 and group 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); component.workbasket = new Workbasket('id1');
expect(component.workbasket.type).toEqual(null); expect(component.workbasket.type).toEqual(undefined);
component.selectType(ICONTYPES.PERSONAL); component.selectType(ICONTYPES.PERSONAL);
expect(component.workbasket.type).toEqual('PERSONAL'); expect(component.workbasket.type).toEqual('PERSONAL');
component.selectType(ICONTYPES.GROUP); component.selectType(ICONTYPES.GROUP);

View File

@ -21,10 +21,10 @@
<workbasket-information [workbasket]="workbasket"></workbasket-information> <workbasket-information [workbasket]="workbasket"></workbasket-information>
</div> </div>
<div role="tabpanel" class="tab-pane inactive" id="authorizations"> <div role="tabpanel" class="tab-pane inactive" id="authorizations">
<!-- <app-workbasket-authorization [workbasket]="workbasket"></app-workbasket-authorization> --> <taskana-workbasket-authorizations [workbasket]="workbasket"></taskana-workbasket-authorizations>
</div> </div>
<div role="tabpanel" class="tab-pane inactive" id="distribution-targets"> <div role="tabpanel" class="tab-pane inactive" id="distribution-targets">
<!-- <app-workbasket-distributiontargets [workbasket]="workbasket"></app-workbasket-distributiontargets>--> <!-- <taskana-workbasket-distributiontargets [workbasket]="workbasket"></taskana-workbasket-distributiontargets>-->
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,8 +1,11 @@
.nav.nav-tabs { .nav.nav-tabs {
& > li { & > li {
& > a{ & > a {
min-height: 56px; min-height: 56px;
padding-top: 17px; padding-top: 17px;
&.has-changes{
border-bottom: solid #f0ad4e;
}
} }
&:first-child > a{ &:first-child > a{

View File

@ -2,6 +2,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { WorkbasketDetailsComponent } from './workbasket-details.component'; import { WorkbasketDetailsComponent } from './workbasket-details.component';
import { NoAccessComponent } from '../noAccess/no-access.component'; import { NoAccessComponent } from '../noAccess/no-access.component';
import { WorkbasketInformationComponent } from './information/workbasket-information.component'; import { WorkbasketInformationComponent } from './information/workbasket-information.component';
import { AuthorizationsComponent } from './authorizations/authorizations.component';
import { Workbasket } from 'app/model/workbasket'; import { Workbasket } from 'app/model/workbasket';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { SpinnerComponent } from '../../shared/spinner/spinner.component'; import { SpinnerComponent } from '../../shared/spinner/spinner.component';
@ -34,7 +35,7 @@ describe('WorkbasketDetailsComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports:[RouterTestingModule, FormsModule, AngularSvgIconModule, HttpClientModule, HttpModule], imports:[RouterTestingModule, FormsModule, AngularSvgIconModule, HttpClientModule, HttpModule],
declarations: [ WorkbasketDetailsComponent, NoAccessComponent, WorkbasketInformationComponent, SpinnerComponent, IconTypeComponent, MapValuesPipe, RemoveNoneTypePipe, AlertComponent, GeneralMessageModalComponent ], declarations: [ WorkbasketDetailsComponent, NoAccessComponent, WorkbasketInformationComponent, SpinnerComponent, IconTypeComponent, MapValuesPipe, RemoveNoneTypePipe, AlertComponent, GeneralMessageModalComponent, AuthorizationsComponent ],
providers:[WorkbasketService, MasterAndDetailService, PermissionService, AlertService] providers:[WorkbasketService, MasterAndDetailService, PermissionService, AlertService]
}) })
.compileComponents(); .compileComponents();
@ -50,7 +51,7 @@ describe('WorkbasketDetailsComponent', () => {
spyOn(masterAndDetailService, 'getShowDetail').and.returnValue(Observable.of(true)); spyOn(masterAndDetailService, 'getShowDetail').and.returnValue(Observable.of(true));
spyOn(workbasketService,'getSelectedWorkBasket').and.returnValue(Observable.of('id1')); spyOn(workbasketService,'getSelectedWorkBasket').and.returnValue(Observable.of('id1'));
spyOn(workbasketService,'getWorkBasketsSummary').and.returnValue(Observable.of(new Array<WorkbasketSummary>(new WorkbasketSummary('id1','','','','','','','','','','','',new Array<Links>( new Links('self', 'someurl')))))); spyOn(workbasketService,'getWorkBasketsSummary').and.returnValue(Observable.of(new Array<WorkbasketSummary>(new WorkbasketSummary('id1','','','','','','','','','','','',new Array<Links>( new Links('self', 'someurl'))))));
spyOn(workbasketService,'getWorkBasket').and.returnValue(Observable.of(new Workbasket('id1',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null))); spyOn(workbasketService,'getWorkBasket').and.returnValue(Observable.of(new Workbasket('id1')));
}); });
afterEach(() =>{ afterEach(() =>{
@ -70,7 +71,7 @@ describe('WorkbasketDetailsComponent', () => {
expect(component.workbasket).toBeUndefined(); expect(component.workbasket).toBeUndefined();
expect(debugElement.querySelector('app-no-access')).toBeTruthy; expect(debugElement.querySelector('app-no-access')).toBeTruthy;
component.workbasket = new Workbasket(null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null); component.workbasket = new Workbasket('id1');
fixture.detectChanges(); fixture.detectChanges();
expect(debugElement.querySelector('app-no-access')).toBeFalsy; expect(debugElement.querySelector('app-no-access')).toBeFalsy;
@ -80,7 +81,7 @@ describe('WorkbasketDetailsComponent', () => {
it('should show back button with classes "visible-xs visible-sm hidden" when showDetail property is true', () => { it('should show back button with classes "visible-xs visible-sm hidden" when showDetail property is true', () => {
component.workbasket = new Workbasket('id1',null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null); component.workbasket = new Workbasket('id1');
component.ngOnInit(); component.ngOnInit();
fixture.detectChanges(); fixture.detectChanges();
expect(debugElement.querySelector('.visible-xs.visible-sm.hidden > a').textContent).toBe('Back'); expect(debugElement.querySelector('.visible-xs.visible-sm.hidden > a').textContent).toBe('Back');

View File

@ -1,6 +1,6 @@
<div class = "workbasket-list-full-height"> <div class = "workbasket-list-full-height">
<ul id = "wb-list-container" class="list-group footer-space"> <ul id = "wb-list-container" class="list-group footer-space">
<li id="wb-action-toolbar" class="list-group-item"> <li id="wb-action-toolbar" class="list-group-item tab-align">
<div class="row"> <div class="row">
<div class="col-xs-9"> <div class="col-xs-9">
<button type="button" data-toggle="tooltip" title="Add" class="btn btn-default"> <button type="button" data-toggle="tooltip" title="Add" class="btn btn-default">

View File

@ -19,3 +19,7 @@ a > label{
.sortby-dropdown { .sortby-dropdown {
min-width: 200px; min-width: 200px;
} }
.tab-align{
padding-bottom: 12px;
}

View File

@ -88,10 +88,6 @@ export class WorkbasketListComponent implements OnInit {
this.newWorkbasket.key = ""; this.newWorkbasket.key = "";
} }
getEmptyObject() {
return new WorkbasketSummary("", "", "", "", "", "", "", "", "", "", "", "");
}
private performRequest(): void { private performRequest(): void {
this.requestInProgress = true; this.requestInProgress = true;
this.workbaskets = undefined; this.workbaskets = undefined;

View File

@ -91,6 +91,14 @@
} }
} }
.brown {
color: #f0ad4e;
& svg {
fill: #f0ad4e;
}
}
/* /*
*Remove bootstrap cols padding for master and detail component *Remove bootstrap cols padding for master and detail component
*/ */

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 16 16"
version="1.1"
id="SVGRoot"
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
sodipodi:docname="wb-add.svg">
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.627417"
inkscape:cx="15.742156"
inkscape:cy="7.3562861"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="2419"
inkscape:window-height="1414"
inkscape:window-x="2692"
inkscape:window-y="-9"
inkscape:window-maximized="1"
inkscape:grid-bbox="true" />
<defs
id="defs2298" />
<metadata
id="metadata2301">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1">
<path
inkscape:connector-curvature="0"
d="M 2.6728251,15.988396 2.5648339,15.883964 v -3.745116 l 0.134989,-0.23005 C 3.4355129,10.662444 4.8377113,8.3922173 4.8900195,8.3634611 4.9271414,8.343029 5.0503189,8.31957 5.1633722,8.3104891 L 5.3692305,8.2945975 5.3852607,6.279393 C 5.3970726,4.7401794 5.4105709,4.2482969 5.4409438,4.1968385 5.5430287,4.0227878 5.297518,4.0333821 9.338751,4.0333821 c 3.155368,0 3.731603,0.00681 3.805002,0.043891 0.18308,0.091566 0.178861,0.040864 0.188141,2.2248221 l 0.0084,2.007637 h 0.188141 c 0.21092,0 0.327349,0.040864 0.391469,0.1362136 0.06159,0.090809 1.999524,3.4303122 2.078831,3.5831752 0.0658,0.124862 0.06665,0.151348 0.05822,2.005367 l -0.0084,1.878991 -0.103773,0.09081 -0.103772,0.08929 H 2.7808163 Z m 8.9548339,-3.332692 c 0,-0.4601 0.03037,-0.591017 0.161986,-0.698474 l 0.09618,-0.0787 h 1.566717 c 0.984576,0 1.565872,-0.01063 1.565872,-0.03027 0,-0.04692 -1.613963,-2.8143247 -1.648553,-2.8256757 -0.01941,-0.00681 -0.03122,0.2898322 -0.03122,0.815011 0,0.4540457 -0.0092,0.8785777 -0.02025,0.9429007 -0.02447,0.142268 -0.158613,0.282265 -0.296133,0.308751 -0.117271,0.02271 -0.274196,-0.03481 -0.36447,-0.132429 -0.06243,-0.06811 -0.06412,-0.124107 -0.07931,-3.134427 l -0.01603,-3.0655627 -3.2076755,-0.00757 -3.2085203,-0.00908 -0.00843,3.0587519 c -0.00843,3.0511848 -0.00843,3.0595088 -0.074244,3.1457778 -0.1400512,0.183889 -0.4201534,0.193726 -0.5863586,0.02271 l -0.075932,-0.0787 -0.00928,-0.9383619 c -0.00674,-0.6659343 -0.019398,-0.9345776 -0.04471,-0.9270103 -0.028685,0.00983 -1.6806131,2.7015692 -1.7278593,2.8158372 -0.012655,0.03027 0.3113185,0.03859 1.5540609,0.03859 h 1.5692472 l 0.097023,0.0787 c 0.1307705,0.10746 0.161143,0.237616 0.161143,0.697715 v 0.39275 H 11.627659 V 12.654189 Z M 6.6271593,9.9949976 c -0.021092,-0.020426 -0.037965,-0.079458 -0.037965,-0.1324308 0,-0.052968 0.016873,-0.1119978 0.037965,-0.1324297 0.055683,-0.052968 5.3194107,-0.052968 5.3742497,0 0.04893,0.047673 0.04893,0.2171857 0,0.2648605 -0.05484,0.052968 -5.3185668,0.052968 -5.3742497,0 z M 6.660063,8.8765323 C 6.5672579,8.8137224 6.561352,8.633618 6.6507877,8.5867 c 0.084368,-0.043891 5.2426353,-0.043891 5.3278473,0 0.08858,0.046918 0.08352,0.2270226 -0.0092,0.2898323 -0.107145,0.072647 -5.2029828,0.072647 -5.3092866,0 z M 6.6271593,7.6263941 c -0.021092,-0.020432 -0.037965,-0.080215 -0.037965,-0.1324298 0,-0.052972 0.016873,-0.1119979 0.037965,-0.1324299 0.055683,-0.052972 5.3194107,-0.052972 5.3742497,0 0.04893,0.047675 0.04893,0.217185 0,0.2648597 -0.05484,0.052972 -5.3185668,0.052972 -5.3742497,0 z M 8.0040472,6.4383088 c -0.074244,-0.080971 -0.065807,-0.208104 0.018561,-0.2656164 0.061589,-0.042378 0.3037253,-0.047675 1.9910878,-0.047675 1.820665,0 1.923593,0.00303 1.974214,0.055999 0.06834,0.074161 0.06581,0.1982664 -0.0059,0.2618328 -0.05316,0.046162 -0.237074,0.051459 -1.9910869,0.051459 -1.8333198,0 -1.9370927,-0.00303 -1.9868698,-0.056755 z M 6.6406582,5.8692387 c -0.085212,-0.060539 -0.058214,-0.2398873 0.043871,-0.2890755 0.1054601,-0.051459 1.146563,-0.055242 1.2461173,-0.00454 0.1307706,0.066594 0.1577684,0.1959963 0.059058,0.2830216 -0.05062,0.043891 -0.1459569,0.050702 -0.6757887,0.050702 -0.455588,0 -0.632761,-0.010591 -0.6732577,-0.039351 z"
id="path1163"
/>
<path
inkscape:connector-curvature="0"
d="M 5.2904719,2.0269155 H 3.4417854 V 0.23956018 c 0,-0.0897337 -0.07525,-0.16248703 -0.1680624,-0.16248703 H 2.2653493 c -0.092812,0 -0.1680624,0.07275326 -0.1680624,0.16248703 V 2.0269155 H 0.24860074 c -0.0928128,0 -0.1680625,0.072754 -0.1680625,0.162487 v 0.9749212 c 0,0.089734 0.07524963,0.1624865 0.1680625,0.1624865 H 2.0972869 v 1.7873562 c 0,0.089734 0.07525,0.1624866 0.1680624,0.1624866 H 3.273723 c 0.092812,0 0.1680624,-0.072753 0.1680624,-0.1624866 V 3.3268102 h 1.8486865 c 0.092812,0 0.1680616,-0.072753 0.1680616,-0.1624865 V 2.1894025 c 0,-0.089733 -0.07525,-0.162487 -0.1680616,-0.162487 z"
id="path5"
/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB