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';
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 category: string = undefined,
public type: string = undefined,

View File

@ -5,7 +5,6 @@ import {Injectable} from '@angular/core';
import {environment} from 'environments/environment';
import {TaskResource} from 'app/workplace/models/task-resource';
import {Direction} from 'app/models/sorting';
import {Workbasket} from 'app/models/workbasket';
@Injectable()
export class TaskService {
@ -92,7 +91,7 @@ export class TaskService {
}
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,

View File

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

View File

@ -35,16 +35,19 @@
title="Save">
<span class="glyphicon glyphicon-floppy-save" aria-hidden="true"></span>
</button>
<button type="button" title="Open task to work on it" class="btn btn-default" aria-label="Left Align"
[disabled]="workOnTaskDisabled()" (click)="openTask()">
<span class="glyphicon glyphicon-new-window" aria-hidden="true"></span>
</button>
<button type="button" (click)="resetTask()" class="btn btn-default" data-toggle="tooltip" title="Undo Changes">
<span class="glyphicon glyphicon-repeat blue" aria-hidden="true"></span>
</button>
<button type="button" title="Delete Task" class="btn btn-default remove" (click)="deleteTask()">
<span class="glyphicon glyphicon-remove"></span>
</button>
<ng-container *ngIf="currentId != 'new-task'">
<button type="button" title="Open task to work on it" class="btn btn-default" aria-label="Left Align"
[disabled]="workOnTaskDisabled()" (click)="openTask()">
<span class="glyphicon glyphicon-new-window" aria-hidden="true"></span>
</button>
<button type="button" (click)="resetTask()" class="btn btn-default" data-toggle="tooltip" title="Undo Changes">
<span class="glyphicon glyphicon-repeat blue" aria-hidden="true"></span>
</button>
<button type="button" title="Delete Task" class="btn btn-default remove"
(click)="deleteTask()">
<span class="glyphicon glyphicon-remove"></span>
</button>
</ng-container>
</div>
<h4 class="panel-header">{{task.name}}&nbsp;
<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.currentId = params['id'];
// redirect if user enters through a deep-link
if (!this.currentWorkbasket && this.currentId === 'new-task') {
this.router.navigate(['']);
}
@ -69,7 +70,6 @@ export class TaskdetailsComponent implements OnInit, OnDestroy {
if (this.currentId === 'new-task') {
this.requestInProgress = false;
this.task = new Task(undefined, new ObjectReference(), this.currentWorkbasket);
this.cloneTask();
} else {
this.taskService.getTask(this.currentId).subscribe(task => {
this.requestInProgress = false;