TSK-24: minor cleanup

This commit is contained in:
Mustapha Zorgati 2018-10-02 06:39:48 -04:00 committed by Jose Ignacio Recuerda Cambil
parent 8116c89d7e
commit 9bb6cc77ec
5 changed files with 22 additions and 19 deletions

View File

@ -1,7 +1,7 @@
import {Links} from 'app/models/links'; import {Links} from 'app/models/links';
export class Classification { export class Classification {
constructor(public classificationId: string = undefined, constructor(public classificationId: string = undefined, // newly created classifications don't have an id yet.
public key: string = undefined, public key: string = undefined,
public category: string = undefined, public category: string = undefined,
public type: string = undefined, public type: string = undefined,

View File

@ -5,7 +5,6 @@ import {Injectable} from '@angular/core';
import {environment} from 'environments/environment'; import {environment} from 'environments/environment';
import {TaskResource} from 'app/workplace/models/task-resource'; import {TaskResource} from 'app/workplace/models/task-resource';
import {Direction} from 'app/models/sorting'; import {Direction} from 'app/models/sorting';
import {Workbasket} from 'app/models/workbasket';
@Injectable() @Injectable()
export class TaskService { export class TaskService {
@ -92,7 +91,7 @@ export class TaskService {
} }
createTask(task: Task): Observable<Task> { createTask(task: Task): Observable<Task> {
return this.httpClient.post<Task>(`${this.url}`, task); return this.httpClient.post<Task>(this.url, task);
} }
private getTaskQueryParameters(basketId: string, private getTaskQueryParameters(basketId: string,

View File

@ -1,11 +1,12 @@
import {Injectable} from '@angular/core'; import { Injectable } from '@angular/core';
import {Observable, Subject} from 'rxjs/index'; import { Observable, Subject } from 'rxjs';
import {Workbasket} from 'app/models/workbasket'; import { Workbasket } from 'app/models/workbasket';
@Injectable() @Injectable()
export class WorkplaceService { export class WorkplaceService {
currentWorkbasket: Workbasket = undefined; // necessary because the TaskdetailsComponent is not always initialized when the first workbasket was selected.
workbasketSelectedSource = new Subject<Workbasket>(); currentWorkbasket: Workbasket;
private workbasketSelectedSource = new Subject<Workbasket>();
workbasketSelectedStream = this.workbasketSelectedSource.asObservable(); workbasketSelectedStream = this.workbasketSelectedSource.asObservable();
selectWorkbasket(workbasket: Workbasket) { selectWorkbasket(workbasket: Workbasket) {

View File

@ -35,16 +35,19 @@
title="Save"> title="Save">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span> <span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span>
</button> </button>
<button type="button" title="Open task to work on it" class="btn btn-default" aria-label="Left Align" <ng-container *ngIf="currentId != 'new-task'">
[disabled]="workOnTaskDisabled()" (click)="openTask()"> <button type="button" title="Open task to work on it" class="btn btn-default" aria-label="Left Align"
<span class="glyphicon glyphicon-new-window" aria-hidden="true"></span> [disabled]="workOnTaskDisabled()" (click)="openTask()">
</button> <span class="glyphicon glyphicon-new-window" aria-hidden="true"></span>
<button type="button" (click)="resetTask()" class="btn btn-default" data-toggle="tooltip" title="Undo Changes"> </button>
<span class="glyphicon glyphicon-repeat blue" aria-hidden="true"></span> <button type="button" (click)="resetTask()" class="btn btn-default" data-toggle="tooltip" title="Undo Changes">
</button> <span class="glyphicon glyphicon-repeat blue" aria-hidden="true"></span>
<button type="button" title="Delete Task" class="btn btn-default remove" (click)="deleteTask()"> </button>
<span class="glyphicon glyphicon-remove"></span> <button type="button" title="Delete Task" class="btn btn-default remove"
</button> (click)="deleteTask()">
<span class="glyphicon glyphicon-remove"></span>
</button>
</ng-container>
</div> </div>
<h4 class="panel-header">{{task.name}}&nbsp; <h4 class="panel-header">{{task.name}}&nbsp;
<span *ngIf="!task.taskId" class="badge warning"> {{'Creating Task'}}</span> <span *ngIf="!task.taskId" class="badge warning"> {{'Creating Task'}}</span>

View File

@ -49,6 +49,7 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
}); });
this.routeSubscription = this.route.params.subscribe(params => { this.routeSubscription = this.route.params.subscribe(params => {
this.currentId = params['id']; this.currentId = params['id'];
// redirect if user enters through a deep-link
if (!this.currentWorkbasket && this.currentId === 'new-task') { if (!this.currentWorkbasket && this.currentId === 'new-task') {
this.router.navigate(['']); this.router.navigate(['']);
} }
@ -69,7 +70,6 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
if (this.currentId === 'new-task') { if (this.currentId === 'new-task') {
this.requestInProgress = false; this.requestInProgress = false;
this.task = new Task(undefined, new ObjectReference(), this.currentWorkbasket); this.task = new Task(undefined, new ObjectReference(), this.currentWorkbasket);
this.cloneTask();
} else { } else {
this.taskService.getTask(this.currentId).subscribe(task => { this.taskService.getTask(this.currentId).subscribe(task => {
this.requestInProgress = false; this.requestInProgress = false;