TSK-1338: Workplace now displays tasks of workbasket, when a task is selected

This commit is contained in:
Tristan Eisermann 2020-07-27 18:56:12 +02:00 committed by Tristan2357
parent 6ae65b1d21
commit 31cd7af0ce
5 changed files with 47 additions and 75 deletions

View File

@ -68,9 +68,9 @@ export class TaskListToolbarComponent implements OnInit {
});
this.taskService.getSelectedTask().subscribe((t) => {
if (!this.resultName) {
this.resultName = t.workbasketSummaryResource.name;
this.resultId = t.workbasketSummaryResource.workbasketId;
this.currentBasket = t.workbasketSummaryResource;
this.resultName = t.workbasketSummary.name;
this.resultId = t.workbasketSummary.workbasketId;
this.currentBasket = t.workbasketSummary;
this.workplaceService.selectWorkbasket(this.currentBasket);
this.workbasketSelected = true;
}

View File

@ -1,18 +1,7 @@
import {
Component,
OnInit,
Input,
ChangeDetectionStrategy,
Output,
EventEmitter,
SimpleChanges,
OnChanges,
ChangeDetectorRef
} from '@angular/core';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Task } from 'app/workplace/models/task';
import { TaskanaDate } from 'app/shared/util/taskana.date';
import { WorkplaceService } from 'app/workplace/services/workplace.service';
import { Router, ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
@Component({
selector: 'taskana-task-list',

View File

@ -1,16 +1,15 @@
import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { Task } from 'app/workplace/models/task';
import { TaskService } from 'app/workplace/services/task.service';
import { Subscription } from 'rxjs';
import { Subject } from 'rxjs';
import { Sorting } from 'app/shared/models/sorting';
import { Workbasket } from 'app/shared/models/workbasket';
import { Filter } from 'app/shared/models/filter';
import { WorkplaceService } from 'app/workplace/services/workplace.service';
import { TaskanaQueryParameters } from 'app/shared/util/query-parameters';
import { OrientationService } from 'app/shared/services/orientation/orientation.service';
import { Orientation } from 'app/shared/models/orientation';
import { Page } from 'app/shared/models/page';
import { map } from 'rxjs/operators';
import { takeUntil } from 'rxjs/operators';
import { ObjectReference } from '../../models/object-reference';
import { Search } from '../task-list-toolbar/task-list-toolbar.component';
import { NotificationService } from '../../../shared/services/notifications/notification.service';
@ -43,57 +42,58 @@ export class TaskMasterComponent implements OnInit, OnDestroy {
objectReference: ObjectReference;
selectedSearchType: Search = Search.byWorkbasket;
destroy$ = new Subject();
@ViewChild('wbToolbar', { static: true })
private toolbarElement: ElementRef;
private taskChangeSubscription: Subscription;
private taskDeletedSubscription: Subscription;
private taskAddedSubscription: Subscription;
private workbasketChangeSubscription: Subscription;
private orientationSubscription: Subscription;
private objectReferenceSubscription: Subscription;
constructor(
private taskService: TaskService,
private workplaceService: WorkplaceService,
private notificationsService: NotificationService,
private orientationService: OrientationService
) {
this.taskChangeSubscription = this.taskService.taskChangedStream.subscribe((task) => {
) {}
ngOnInit() {
this.taskService
.getSelectedTask()
.pipe(takeUntil(this.destroy$))
.subscribe((task: Task) => {
if (!this.currentBasket) {
this.selectedId = task.taskId;
this.currentBasket = task.workbasketSummary;
this.getTasks();
}
if (!task) {
this.selectedId = '';
}
});
this.orientationService
.getOrientation()
.pipe(takeUntil(this.destroy$))
.subscribe(() => {
this.refreshWorkbasketList();
});
this.taskService.taskChangedStream.pipe(takeUntil(this.destroy$)).subscribe((task) => {
this.getTasks();
this.selectedId = task ? task.taskId : '';
});
this.workbasketChangeSubscription = this.workplaceService.workbasketSelectedStream.subscribe((workbasket) => {
this.workplaceService.workbasketSelectedStream.pipe(takeUntil(this.destroy$)).subscribe((workbasket) => {
this.currentBasket = workbasket;
if (this.selectedSearchType === Search.byWorkbasket) {
this.getTasks();
}
});
this.objectReferenceSubscription = this.workplaceService.objectReferenceSelectedStream.subscribe(
(objectReference) => {
this.objectReference = objectReference;
delete this.currentBasket;
if (objectReference) {
this.getTasks();
}
this.workplaceService.objectReferenceSelectedStream.pipe(takeUntil(this.destroy$)).subscribe((objectReference) => {
this.objectReference = objectReference;
delete this.currentBasket;
if (objectReference) {
this.getTasks();
}
);
}
ngOnInit() {
this.taskService.getSelectedTask().subscribe((task) => {
if (!this.currentBasket) {
this.selectedId = task.taskId;
this.currentBasket = task.workbasketSummaryResource;
}
if (!task) {
this.selectedId = '';
}
});
this.orientationSubscription = this.orientationService.getOrientation().subscribe((orientation: Orientation) => {
this.refreshWorkbasketList();
});
}
@ -153,6 +153,7 @@ export class TaskMasterComponent implements OnInit, OnDestroy {
this.objectReference ? this.objectReference.type : '',
this.objectReference ? this.objectReference.value : ''
)
.pipe(takeUntil(this.destroy$))
.subscribe((taskResource) => {
this.requestInProgress = false;
if (taskResource.tasks && taskResource.tasks.length > 1) {
@ -167,23 +168,7 @@ export class TaskMasterComponent implements OnInit, OnDestroy {
}
ngOnDestroy(): void {
if (this.taskChangeSubscription) {
this.taskChangeSubscription.unsubscribe();
}
if (this.taskDeletedSubscription) {
this.taskDeletedSubscription.unsubscribe();
}
if (this.workbasketChangeSubscription) {
this.workbasketChangeSubscription.unsubscribe();
}
if (this.taskAddedSubscription) {
this.taskAddedSubscription.unsubscribe();
}
if (this.orientationSubscription) {
this.orientationSubscription.unsubscribe();
}
if (this.objectReferenceSubscription) {
this.objectReferenceSubscription.unsubscribe();
}
this.destroy$.next();
this.destroy$.complete();
}
}

View File

@ -58,9 +58,7 @@ export class TaskComponent implements OnInit, OnDestroy {
this.requestInProgress = false;
this.workbaskets = workbaskets.workbaskets;
const index = this.workbaskets.findIndex(
(workbasket) => workbasket.name === this.task.workbasketSummaryResource.name
);
const index = this.workbaskets.findIndex((workbasket) => workbasket.name === this.task.workbasketSummary.name);
if (index !== -1) {
this.workbaskets.splice(index, 1);
}

View File

@ -6,7 +6,7 @@ export class Task {
constructor(
public taskId: string,
public primaryObjRef: ObjectReference = new ObjectReference(),
public workbasketSummaryResource?: Workbasket,
public workbasketSummary?: Workbasket,
public classificationSummary?: ClassificationSummary,
public businessProcessId?: string,
public parentBusinessProcessId?: string,
@ -25,8 +25,8 @@ export class Task {
public read?: boolean,
public transferred?: boolean,
public priority?: number,
public customAttributes: Array<CustomAttribute> = [],
public callbackInfo: Array<CustomAttribute> = [],
public customAttributes: CustomAttribute[] = [],
public callbackInfo: CustomAttribute[] = [],
public custom1?: string,
public custom2?: string,
public custom3?: string,