TSK-489 Fix application general bugs.

This commit is contained in:
Martin Rojas Miguel Angel 2018-05-23 12:34:17 +02:00 committed by Holger Hagen
parent e61fdbb5a5
commit 28eac68162
12 changed files with 62 additions and 14 deletions

View File

@ -9,7 +9,6 @@
"outDir": "dist", "outDir": "dist",
"assets": [ "assets": [
"assets", "assets",
"taskana.ico",
"environments/data-sources" "environments/data-sources"
], ],
"index": "index.html", "index": "index.html",

View File

@ -6,11 +6,14 @@
<li *ngFor="let pageNumber of workbasketsResource?.page?.totalPages | <li *ngFor="let pageNumber of workbasketsResource?.page?.totalPages |
spreadNumber: workbasketsResource?.page?.number: maxPagesAvailable: workbasketsResource?.page?.totalPages"> spreadNumber: workbasketsResource?.page?.number: maxPagesAvailable: workbasketsResource?.page?.totalPages">
<a *ngIf="pageNumber + 1 !== workbasketsResource?.page?.number" (click)="changeToPage(pageNumber+1)">{{pageNumber + 1}}</a> <a *ngIf="pageNumber + 1 !== workbasketsResource?.page?.number" (click)="changeToPage(pageNumber+1)">{{pageNumber + 1}}</a>
<a *ngIf="pageNumber + 1 === workbasketsResource?.page?.number" class="pagination"> <a *ngIf="pageNumber + 1 === workbasketsResource?.page?.number" class="pagination">
<input [(ngModel)]="pageSelected" (keyup.enter)="changeToPage(pageSelected)" type="text" (blur)="changeToPage(pageSelected)"> <input [(ngModel)]="pageSelected" (keyup.enter)="changeToPage(pageSelected)" type="text" (blur)="changeToPage(pageSelected)">
</a> </a>
</li> </li>
<li> <li>
<a (click)="changeToPage(workbasketsResource?.page.totalPages)" aria-label="Last">Last</a> <a (click)="changeToPage(workbasketsResource?.page.totalPages)" aria-label="Last">Last</a>
</li> </li>
</ul> </ul>
<span class="footer pull-right">
<i [innerHTML]="getPagesTextToShow()"></i>
</span>

View File

@ -1,3 +1,7 @@
$blue: #66afe9;
.pagination{
margin: 15px 0 0 0;
}
a.pagination{ a.pagination{
width: 35px; width: 35px;
height: 35px; height: 35px;
@ -13,7 +17,7 @@ a.pagination{
border: none; border: none;
outline: none; outline: none;
&:focus{ &:focus{
border-color: #66afe9; border-color: $blue;
outline: 0; outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
@ -25,3 +29,8 @@ ul.pagination{
cursor: pointer; cursor: pointer;
overflow: hidden; overflow: hidden;
} }
.footer{
margin: 5px 5px 0 0;
color: $blue;
}

View File

@ -94,4 +94,19 @@ describe('PaginationComponent', () => {
}); });
it('should getPagesTextToShow return 7 of 13 with size < totalElements', () => {
component.workbasketsResource = new WorkbasketSummaryResource(undefined, undefined, new Page(7, 13, 3, 2));
expect(component.getPagesTextToShow()).toBe('7 of 13 workbaskets');
});
it('should getPagesTextToShow return 6 of 6 with size > totalElements', () => {
component.workbasketsResource = new WorkbasketSummaryResource(undefined, undefined, new Page(7, 6, 3, 2));
expect(component.getPagesTextToShow()).toBe('6 of 6 workbaskets');
});
it('should getPagesTextToShow return of with totalElements = 0', () => {
component.workbasketsResource = new WorkbasketSummaryResource(undefined, undefined, new Page(7, 0, 0, 0));
expect(component.getPagesTextToShow()).toBe('0 of 0 workbaskets');
});
}); });

View File

@ -37,4 +37,16 @@ export class PaginationComponent implements OnInit, OnChanges {
this.previousPageSelected = page; this.previousPageSelected = page;
} }
} }
getPagesTextToShow(): string {
if (!this.workbasketsResource) {
return '';
}
let text = this.workbasketsResource.page.totalElements + '';
if (this.workbasketsResource.page && this.workbasketsResource.page.totalElements &&
this.workbasketsResource.page.totalElements >= this.workbasketsResource.page.size) {
text = this.workbasketsResource.page.size + '';
}
return `${text} of ${this.workbasketsResource.page.totalElements} workbaskets`;
}
} }

View File

@ -36,7 +36,7 @@
<ul class="nav"> <ul class="nav">
<svg-icon class="logo white visible-xs" src="./assets/icons/logo.svg"></svg-icon> <svg-icon class="logo white visible-xs" src="./assets/icons/logo.svg"></svg-icon>
<h2 class="navbar-brand no-margin logo visible-xs"> {{title}}</h2> <h2 class="navbar-brand no-margin logo visible-xs"> {{title}}</h2>
<button type="button" class="btn btn-default logout navbar-toggle show pull-right" data-toggle="tooltip" title="logout" (click)="logout()" aria-expanded="true" <button type="button" class="btn btn-default logout navbar-toggle logout show pull-right" data-toggle="tooltip" title="logout" (click)="logout()" aria-expanded="true"
aria-controls="logout"> aria-controls="logout">
<span class="glyphicon glyphicon-share white"></span> <span class="glyphicon glyphicon-share white"></span>
</button> </button>

View File

@ -9,7 +9,12 @@ $selected-border-color: #22a39f;
} }
.navbar-toggle{ .navbar-toggle{
margin-right: 0px; margin: 5px 0px;
font-size: 20px;
&.logout{
font-size: 20px;
padding: 12px 12px 0 0;
}
} }
button.navbar-toggle:hover > span{ button.navbar-toggle:hover > span{
@ -68,7 +73,6 @@ h2.navbar-brand{
} }
} }
.nav-content{ .nav-content{
margin-top: 5px; margin-top: 5px;
} }

View File

@ -72,7 +72,8 @@ describe('NavBarComponent', () => {
expect(component).toBeTruthy(); expect(component).toBeTruthy();
}); });
it(`should have as title 'Administration'`, (() => { it(`should have as title ''`, (() => {
expect(navBar.title).toEqual('Administration'); expect(navBar.title).toEqual('');
})); }));
}); });

View File

@ -28,10 +28,13 @@ export class NavBarComponent implements OnInit, OnDestroy {
selectedRoute = ''; selectedRoute = '';
route: string; route: string;
title = '';
titleAdministration = 'Administration'; titleAdministration = 'Administration';
titleWorkbaskets = 'Workbaskets';
titleClassifications = 'Classifications';
titleMonitor = 'Monitor'; titleMonitor = 'Monitor';
titleWorkplace = 'Workplace'; titleWorkplace = 'Workplace';
title = 'Administration';
showNavbar = false; showNavbar = false;
domains: Array<string> = []; domains: Array<string> = [];
selectedDomain: string; selectedDomain: string;
@ -87,8 +90,10 @@ export class NavBarComponent implements OnInit, OnDestroy {
} }
private setTitle(value: string = 'workbaskets') { private setTitle(value: string = 'workbaskets') {
if (value.indexOf('workbaskets') === 0 || value.indexOf('classifications') === 0) { if (value.indexOf('workbaskets') === 0) {
this.title = this.titleAdministration; this.title = this.titleWorkbaskets;
} else if (value.indexOf('classifications') === 0) {
this.title = this.titleClassifications;
} else if (value.indexOf('monitor') === 0) { } else if (value.indexOf('monitor') === 0) {
this.title = this.titleMonitor; this.title = this.titleMonitor;
} else if (value.indexOf('workplace') === 0) { } else if (value.indexOf('workplace') === 0) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View File

@ -3,10 +3,10 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Administration</title> <title>Taskana</title>
<base href="/"> <base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="./logo.ico"> <link rel="icon" type="image/x-icon" href="assets/icons/taskana.png">
</head> </head>
<body> <body>
<taskana-root></taskana-root> <taskana-root></taskana-root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB