Merge pull request #37 from MLengl/TSK-52

Tsk 52 - Illigal ArgumentException
This commit is contained in:
Holger Hagen 2017-11-27 12:19:28 +01:00 committed by GitHub
commit 2d5ca63c67
27 changed files with 144 additions and 104 deletions

View File

@ -66,7 +66,6 @@ public class TaskanaProducersTest {
}
Assert.assertEquals(1, resultCount);
}
@ -86,7 +85,5 @@ public class TaskanaProducersTest {
}
Assert.assertEquals(0, resultCount);
}
}

View File

@ -20,9 +20,7 @@ import java.util.List;
public class ClassificationServiceImpl implements ClassificationService {
private static final String ID_PREFIX_CLASSIFICATION = "CLI";
public static final Date CURRENT_CLASSIFICATIONS_VALID_UNTIL = Date.valueOf("9999-12-31");
private ClassificationMapper classificationMapper;
private TaskanaEngine taskanaEngine;
private TaskanaEngineImpl taskanaEngineImpl;
@ -61,8 +59,6 @@ public class ClassificationServiceImpl implements ClassificationService {
}
}
@Override
public void addClassification(Classification classification) {
try {
@ -134,7 +130,6 @@ public class ClassificationServiceImpl implements ClassificationService {
}
@Override
public List<Classification> getAllClassificationsWithId(String id, String domain) {
try {
@ -148,24 +143,22 @@ public class ClassificationServiceImpl implements ClassificationService {
@Override
public Classification getClassification(String id, String domain) {
Classification classification = null;
try {
taskanaEngineImpl.openConnection();
Classification result = null;
Classification classification = classificationMapper.findByIdAndDomain(id, domain, CURRENT_CLASSIFICATIONS_VALID_UNTIL);
if (classification == null) {
return classificationMapper.findByIdAndDomain(id, "", CURRENT_CLASSIFICATIONS_VALID_UNTIL);
if (domain == null) {
classification = classificationMapper.findByIdAndDomain(id, "", CURRENT_CLASSIFICATIONS_VALID_UNTIL);
} else {
return classification;
classification = classificationMapper.findByIdAndDomain(id, domain, CURRENT_CLASSIFICATIONS_VALID_UNTIL);
}
} finally {
taskanaEngineImpl.returnConnection();
}
return classification;
}
@Override
public ClassificationQuery createClassificationQuery() {
return new ClassificationQueryImpl(taskanaEngine);
}
}

View File

@ -3,6 +3,7 @@ package pro.taskana.impl;
import java.util.List;
import org.apache.ibatis.session.RowBounds;
import pro.taskana.TaskanaEngine;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.model.Task;

View File

@ -1,16 +1,24 @@
package pro.taskana.model.mappings;
import org.apache.ibatis.annotations.*;
import pro.taskana.model.Classification;
import java.sql.Date;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import pro.taskana.model.Classification;
/**
* This class is the mybatis mapping of classifications.
*/
public interface ClassificationMapper {
String VALID_UNTIL = "9999-12-31";
@Select("SELECT ID, PARENT_CLASSIFICATION_ID, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, VALID_FROM, VALID_UNTIL "
+ "FROM CLASSIFICATION "
+ "WHERE ID = #{id}"
@ -39,6 +47,33 @@ public interface ClassificationMapper {
@Result(property = "validUntil", column = "VALID_UNTIL")})
Classification findByIdAndDomain(@Param("id") String id, @Param("domain") String domain, @Param("valid_until")Date validUntil);
@Select("SELECT ID, PARENT_CLASSIFICATION_ID, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, VALID_FROM, VALID_UNTIL "
+ "FROM CLASSIFICATION "
+ "WHERE ID = #{id} "
+ "AND VALID_UNTIL = '" + VALID_UNTIL + "'")
@Results({@Result(property = "id", column = "ID"),
@Result(property = "parentClassificationId", column = "PARENT_CLASSIFICATION_ID"),
@Result(property = "category", column = "CATEGORY"),
@Result(property = "type", column = "TYPE"),
@Result(property = "domain", column = "DOMAIN"),
@Result(property = "isValidInDomain", column = "VALID_IN_DOMAIN"),
@Result(property = "created", column = "CREATED"),
@Result(property = "name", column = "NAME"),
@Result(property = "description", column = "DESCRIPTION"),
@Result(property = "priority", column = "PRIORITY"),
@Result(property = "serviceLevel", column = "SERVICE_LEVEL"),
@Result(property = "custom1", column = "CUSTOM_1"),
@Result(property = "custom2", column = "CUSTOM_2"),
@Result(property = "custom3", column = "CUSTOM_3"),
@Result(property = "custom4", column = "CUSTOM_4"),
@Result(property = "custom5", column = "CUSTOM_5"),
@Result(property = "custom6", column = "CUSTOM_6"),
@Result(property = "custom7", column = "CUSTOM_7"),
@Result(property = "custom8", column = "CUSTOM_8"),
@Result(property = "validFrom", column = "VALID_FROM"),
@Result(property = "validUntil", column = "VALID_UNTIL")})
Classification findById(@Param("id") String id);
@Insert("INSERT INTO CLASSIFICATION (ID, PARENT_CLASSIFICATION_ID, CATEGORY, TYPE, DOMAIN, VALID_IN_DOMAIN, CREATED, NAME, DESCRIPTION, PRIORITY, SERVICE_LEVEL, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, VALID_FROM, VALID_UNTIL) VALUES (#{classification.id}, #{classification.parentClassificationId}, #{classification.category}, #{classification.type}, #{classification.domain}, #{classification.isValidInDomain}, #{classification.created}, #{classification.name}, #{classification.description}, #{classification.priority}, #{classification.serviceLevel}, #{classification.custom1}, #{classification.custom2}, #{classification.custom3}, #{classification.custom4}, #{classification.custom5}, #{classification.custom6}, #{classification.custom7}, #{classification.custom8}, #{classification.validFrom}, #{classification.validUntil})")
void insert(@Param("classification") Classification classification);
@ -74,6 +109,5 @@ public interface ClassificationMapper {
@Result(property = "validFrom", column = "VALID_FROM"),
@Result(property = "validUntil", column = "VALID_UNTIL")})
List<Classification> getAllClassificationsWithId(@Param("id") String id, @Param("domain") String domain);
}

View File

@ -20,7 +20,8 @@ import java.util.List;
public interface QueryMapper {
String OBJECTREFERENCEMAPPER_FINDBYID = "pro.taskana.model.mappings.ObjectReferenceMapper.findById";
String CLASSIFICATION_FINDBYID = "pro.taskana.model.mappings.ClassificationMapper.findByIdAndDomain";
String CLASSIFICATION_FINDBYIDANDDOMAIN = "pro.taskana.model.mappings.ClassificationMapper.findByIdAndDomain";
String CLASSIFICATION_FINDBYID = "pro.taskana.model.mappings.ClassificationMapper.findById";
@Select("<script>SELECT t.ID, t.CREATED, t.CLAIMED, t.COMPLETED, t.MODIFIED, t.PLANNED, t.DUE, t.NAME, t.DESCRIPTION, t.PRIORITY, t.STATE, t.CLASSIFICATION_ID, t.WORKBASKETID, t.OWNER, t.PRIMARY_OBJ_REF_ID, t.IS_READ, t.IS_TRANSFERRED, t.CUSTOM_1, t.CUSTOM_2, t.CUSTOM_3, t.CUSTOM_4, t.CUSTOM_5, t.CUSTOM_6, t.CUSTOM_7, t.CUSTOM_8, t.CUSTOM_9, t.CUSTOM_10 "
+ "FROM TASK t "

View File

@ -15,7 +15,7 @@ import java.util.Map;
public interface TaskMapper {
String OBJECTREFERENCEMAPPER_FINDBYID = "pro.taskana.model.mappings.ObjectReferenceMapper.findById";
String CLASSIFICATION_FINDBYID = "pro.taskana.model.mappings.ClassificationMapper.findByIdAndDomain";
String CLASSIFICATION_FINDBYID = "pro.taskana.model.mappings.ClassificationMapper.findById";
@Select("SELECT ID, CREATED, CLAIMED, COMPLETED, MODIFIED, PLANNED, DUE, NAME, DESCRIPTION, PRIORITY, STATE, CLASSIFICATION_ID, WORKBASKETID, OWNER, PRIMARY_OBJ_REF_ID, IS_READ, IS_TRANSFERRED, CUSTOM_ATTRIBUTES, CUSTOM_1, CUSTOM_2, CUSTOM_3, CUSTOM_4, CUSTOM_5, CUSTOM_6, CUSTOM_7, CUSTOM_8, CUSTOM_9, CUSTOM_10 "
+ "FROM TASK "

View File

@ -42,7 +42,6 @@ public class ClassificationServiceImplTest {
@Mock
TaskanaEngineImpl taskanaEngineImpl;
@Test
public void testAddClassification() {
doNothing().when(classificationMapper).insert(any());

View File

@ -54,6 +54,4 @@ public class DBCleaner {
LOGGER.error(errorWriter.toString());
}
}
}

View File

@ -20,23 +20,34 @@ public class ClassificationController {
@Autowired
private ClassificationService classificationService;
@RequestMapping
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<List<Classification>> getClassifications() {
try {
List<Classification> classificationTree = classificationService.getClassificationTree();
return ResponseEntity.status(HttpStatus.CREATED).body(classificationTree);
return ResponseEntity.status(HttpStatus.OK).body(classificationTree);
} catch (Exception e) {
return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
}
}
@RequestMapping(value = "/{classificationId}")
public Classification getClassification(@PathVariable String classificationId) {
return classificationService.getClassification(classificationId, "");
@RequestMapping(value = "/{classificationId}", method = RequestMethod.GET)
public ResponseEntity<Classification> getClassification(@PathVariable String classificationId) {
try {
Classification classification = classificationService.getClassification(classificationId, "");
return ResponseEntity.status(HttpStatus.OK).body(classification);
} catch(Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
@RequestMapping(value = "/{classificationId}/{domain}")
public Classification getClassification(@PathVariable String classificationId, @PathVariable String domain) {
return classificationService.getClassification(classificationId, domain);
@RequestMapping(value = "/{classificationId}/{domain}", method = RequestMethod.GET)
public ResponseEntity<Classification> getClassification(@PathVariable String classificationId, @PathVariable String domain) {
try {
Classification classification = classificationService.getClassification(classificationId, domain);
return ResponseEntity.status(HttpStatus.OK).body(classification);
} catch(Exception e) {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
@RequestMapping(method = RequestMethod.POST)
@ -58,5 +69,4 @@ public class ClassificationController {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
}

View File

@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import pro.taskana.TaskService;
import pro.taskana.exceptions.NotAuthorizedException;
import pro.taskana.exceptions.TaskNotFoundException;
@ -42,7 +43,6 @@ public class TaskController {
// get all
return ResponseEntity.status(HttpStatus.OK).body(taskLogic.getAll());
}
return ResponseEntity.status(HttpStatus.OK).body(taskLogic.inspectPrams(params));
} catch (NotAuthorizedException e) {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();

View File

@ -59,7 +59,6 @@ public class WorkbasketController {
} else {
return workbasketService.getWorkbaskets();
}
}
@RequestMapping(value = "/{workbasketid}")

View File

@ -1,9 +1,9 @@
INSERT INTO CLASSIFICATION VALUES ('1', '', 'EXTERN', 'BRIEF','nova-domain', TRUE, CURRENT_TIMESTAMP, 'ROOT', 'DESC', 1, 'P1D', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES ('2', '1','MANUELL', 'BRIEF', 'nova-domain', TRUE, CURRENT_TIMESTAMP, 'CHILD', 'DESC', 1, 'P1D', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES ('3', '1','MASCHINELL', 'BRIEF', 'nova-domain', FALSE, CURRENT_TIMESTAMP, 'ANOTHER CHILD', 'DESC', 1, 'P2D', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES ('4', '2','PROZESS', 'EXCEL-SHEET', 'nova-domain', TRUE, CURRENT_TIMESTAMP, 'GRANDCHILD', 'DESC', 1, 'P1DT4H12S', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES ('1', '', 'EXTERN', 'BRIEF','nova-domain', TRUE, CURRENT_TIMESTAMP, 'ROOT', 'DESC', 1, 'P1D', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, '9999-12-31');
INSERT INTO CLASSIFICATION VALUES ('2', '1','MANUELL', 'BRIEF', 'nova-domain', TRUE, CURRENT_TIMESTAMP, 'CHILD', 'DESC', 1, 'P1D', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, '9999-12-31');
INSERT INTO CLASSIFICATION VALUES ('3', '1','MASCHINELL', 'BRIEF', '', FALSE, CURRENT_TIMESTAMP, 'ANOTHER CHILD', 'DESC', 1, 'P2D', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, '9999-12-31');
INSERT INTO CLASSIFICATION VALUES ('4', '2','PROZESS', 'EXCEL-SHEET', '', TRUE, CURRENT_TIMESTAMP, 'GRANDCHILD', 'DESC', 1, 'P1DT4H12S', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, '9999-12-31');
INSERT INTO CLASSIFICATION VALUES('13', '3', 'MANUELL', '', 'nova-domain', TRUE, CURRENT_TIMESTAMP, 'ANOTHER GRANDCHILD', 'DESC', 3, 'P3DT12H', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES('14', '4', 'MANUELL', '', 'nova-domain', FALSE, CURRENT_TIMESTAMP, 'BIG GRANDCHILD', 'DESC', 2, 'P2DT12H', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES('13', '3', 'MANUELL', '', '', TRUE, CURRENT_TIMESTAMP, 'ANOTHER GRANDCHILD', 'DESC', 3, 'P3DT12H', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES('14', '4', 'MANUELL', '', '', FALSE, CURRENT_TIMESTAMP, 'BIG GRANDCHILD', 'DESC', 2, 'P2DT12H', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES('15', '3', 'PROZESS', 'MINDMAP', 'nova-domain', FALSE, CURRENT_TIMESTAMP, 'SMALL GRANDCHILD', 'DESC', 4, 'P5DT12H', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
INSERT INTO CLASSIFICATION VALUES('16', '4', 'MANUELL', '', 'nova-domain', TRUE, CURRENT_TIMESTAMP, 'NO GRANDCHILD', 'DESC', 3, 'P3DT', 'custom 1', 'custom 2', 'custom 3', 'custom 4', 'custom 5', 'custom 6', 'custom 7', 'custom 8', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

View File

@ -15,11 +15,11 @@ export class Task {
workbasket: string;
owner: string;
static create(data){
static create(data) {
return new Task(data);
}
constructor(data){
constructor(data) {
this.id = data.id;
this.created = data.created;
this.claimed = data.claimed;

View File

@ -1,6 +1,5 @@
export class Workbasket {
id: string;
tenant_id: string;
created: string;
modified: string;
name: string;

View File

@ -2,7 +2,6 @@ import { Injectable } from '@angular/core';
@Injectable()
export class DataService {
workbasketId: string;
workbasketName: string;
}

View File

@ -12,38 +12,40 @@ export class RestConnectorService {
constructor(private http: Http) { }
getAllWorkBaskets(): Observable<Workbasket[]> {
return this.http.get(environment.taskanaRestUrl + "/v1/workbaskets?requiredPermission=OPEN", this.createAuthorizationHeader())
return this.http.get(environment.taskanaRestUrl + '/v1/workbaskets?requiredPermission=OPEN', this.createAuthorizationHeader())
.map(res => res.json());
}
findTaskWithWorkbaskets(basketName: string): Observable<Task[]> {
return this.http.get(environment.taskanaRestUrl + "/v1/tasks?workbasketid=" + basketName + "&state=READY&state=CLAIMED", this.createAuthorizationHeader())
return this.http.get(environment.taskanaRestUrl + '/v1/tasks?workbasketid='
+ basketName + '&state=READY&state=CLAIMED', this.createAuthorizationHeader())
.map(res => res.json());
}
getTask(id: string): Observable<Task> {
return this.http.get(environment.taskanaRestUrl + "/v1/tasks/" + id, this.createAuthorizationHeader())
return this.http.get(environment.taskanaRestUrl + '/v1/tasks/' + id, this.createAuthorizationHeader())
.map(res => res.json());
}
completeTask(id: string): Observable<Task> {
return this.http.post(environment.taskanaRestUrl + "/v1/tasks/" + id + "/complete", "", this.createAuthorizationHeader())
return this.http.post(environment.taskanaRestUrl + '/v1/tasks/' + id + '/complete', '', this.createAuthorizationHeader())
.map(res => res.json());
}
claimTask(id: string): Observable<Task> {
return this.http.post(environment.taskanaRestUrl + "/v1/tasks/" + id + "/claim", "test", this.createAuthorizationHeader())
return this.http.post(environment.taskanaRestUrl + '/v1/tasks/' + id + '/claim', 'test', this.createAuthorizationHeader())
.map(res => res.json());
}
transferTask(taskId: string, workbasketId: string) {
return this.http.post(environment.taskanaRestUrl + "/v1/tasks/" + taskId + "/transfer/" + workbasketId, "", this.createAuthorizationHeader())
return this.http.post(environment.taskanaRestUrl + '/v1/tasks/' + taskId
+ '/transfer/' + workbasketId, '', this.createAuthorizationHeader())
.map(res => res.json());
}
private createAuthorizationHeader() {
let headers: Headers = new Headers();
headers.append("Authorization", "Basic TWF4OnRlc3Q=");
const headers: Headers = new Headers();
headers.append('Authorization', 'Basic TWF4OnRlc3Q=');
return new RequestOptions({ headers: headers });
}

View File

@ -1,9 +1,11 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<p>
<a class="navbar-brand" href="#">
<p>{{ task?.name }}</p>
{{ task?.name }}
</a>
</p>
</div>
<ul class="nav navbar-nav navbar-right">
<li><input class="form-control" auto-complete [(ngModel)]="workbasket" [source]="autoCompleteData" placeholder="Transfer ..." style="margin-top:10px;"/></li>

View File

@ -14,7 +14,7 @@ import { SafeResourceUrl, DomSanitizer} from '@angular/platform-browser';
export class TaskComponent implements OnInit {
task: Task = null;
link: SafeResourceUrl = this.sanitizer.bypassSecurityTrustResourceUrl("https://duckduckgo.com/?q=");
link: SafeResourceUrl = this.sanitizer.bypassSecurityTrustResourceUrl('https://duckduckgo.com/?q=');
autoCompleteData: string[] = new Array;
workbasket: string = null;
workbasketId: string;
@ -22,18 +22,20 @@ export class TaskComponent implements OnInit {
private sub: any;
constructor(private restConnectorService:RestConnectorService, private route:ActivatedRoute, private router:Router, private sanitizer: DomSanitizer) { }
constructor(private restConnectorService: RestConnectorService,
private route: ActivatedRoute, private router: Router,
private sanitizer: DomSanitizer) { }
ngOnInit() {
let id = this.route.snapshot.params['id'];
const id = this.route.snapshot.params['id'];
this.restConnectorService.getTask(id).subscribe(
t => {
this.task = t;
this.link = this.sanitizer.bypassSecurityTrustResourceUrl("https://duckduckgo.com/?q=" + this.task.name );
this.link = this.sanitizer.bypassSecurityTrustResourceUrl('https://duckduckgo.com/?q=' + this.task.name );
this.restConnectorService.getAllWorkBaskets().subscribe( w => {
this.workbaskets = w;
this.workbaskets.forEach(workbasket => {
if(workbasket.id != this.task.workbasket) {
if (workbasket.id !== this.task.workbasket) {
this.autoCompleteData.push(workbasket.name);
}
});
@ -42,9 +44,9 @@ export class TaskComponent implements OnInit {
}
transferTask() {
if(this.workbasket) {
if (this.workbasket) {
this.workbaskets.forEach(workbasket => {
if (workbasket.name == this.workbasket) {
if (workbasket.name === this.workbasket) {
this.workbasketId = workbasket.id;
}
});

View File

@ -16,4 +16,4 @@
<p><b>Type:</b> {{ task.type }}</p>
<p><b>Workbasket:</b> {{ task.workbasket }}</p>
</div>
<div>
</div>

View File

@ -16,5 +16,4 @@ export class TaskdetailsComponent implements OnInit {
ngOnInit() {
}
}

View File

@ -1,11 +1,13 @@
<table class="table table-hover">
<thead>
<tr>
<th class="clickable" (click)="orderTasks('id')">ID</th>
<th class="clickable" (click)="orderTasks('name')">Name</th>
<th class="clickable" (click)="orderTasks('due')">Due Date</th>
<th class="clickable" (click)="orderTasks('priority')">Priority</th>
<th class="clickable" (click)="orderTasks('state')">State</th>
<th>Actions</th>
</tr>
</thead>
<tr *ngFor="let task of tasks">
<td>{{ task.id }}</td>

View File

@ -17,7 +17,7 @@ export class TasklistComponent implements OnInit {
@Input() tasks: Task[];
constructor(private restConnectorService:RestConnectorService, private router:Router) {
constructor(private restConnectorService: RestConnectorService, private router: Router) {
this.columnForOrdering = 'id'; // default: order tasks by id
}
@ -28,7 +28,7 @@ export class TasklistComponent implements OnInit {
this.task.next(task);
}
orderTasks(column:string) {
orderTasks(column: string) {
this.columnForOrdering = column;
}

View File

@ -1,9 +1,9 @@
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<p>Taskana Workplace</p>
</a>
<p>
<a class="navbar-brand" href="#">Taskana Workplace</a>
</p>
</div>
<ul class="nav navbar-nav navbar-right">
<li><a [href]="adminUrl">Admin</a></li>

View File

@ -18,11 +18,11 @@ export class TasksComponent {
@Input()
task: Task;
loadTasks(tasks: Task[]){
loadTasks(tasks: Task[]) {
this.tasks = tasks;
}
selectTask(task: Task){
selectTask(task: Task) {
this.task = task;
}

View File

@ -7,15 +7,18 @@ import { Task } from '../model/task';
})
export class OrderTasksByPipe implements PipeTransform {
transform(value:Task[], column:string) {
if(value === null) return null;
transform(value: Task[], column: string) {
if (value === null) { return null; }
value.sort((a, b) => {
if(typeof a[column] === 'string') return _compareString(a[column], b[column]);
else return _compareNumber(a[column], b[column]);
if (typeof a[column] === 'string') {
return _compareString(a[column], b[column]);
} else {
return _compareNumber(a[column], b[column]);
}
});
return value;
function _compareString(a:string, b:string): number {
function _compareString(a: string, b: string): number {
if (a.toLowerCase() < b.toLowerCase()) {
return -1;
} else if (a.toLowerCase() > b.toLowerCase()) {
@ -25,7 +28,7 @@ export class OrderTasksByPipe implements PipeTransform {
}
}
function _compareNumber(a:number, b:number): number {
function _compareNumber(a: number, b: number): number {
return _compareString(a.toString(), b.toString());
}
}

View File

@ -27,16 +27,16 @@ export class SelectorComponent implements OnInit {
this.autoCompleteData.push(workbasket.name);
});
});
if(this.dataService.workbasketId) {
if (this.dataService.workbasketId) {
this.getTasks(this.dataService.workbasketId);
this.result = this.dataService.workbasketName;
}
}
searchBasket() {
if(this.workbaskets) {
if (this.workbaskets) {
this.workbaskets.forEach(workbasket => {
if (workbasket.name == this.result) {
if (workbasket.name === this.result) {
this.resultId = workbasket.id;
}
});