mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[ADF-5004] [CardViewTextItemComponent] Provide a way to have an icon for the clickable items (#5270)
* [ADF-5004] [CardViewTextItemComponent] Provide a way to have an icon for the clickable items. * * FIxed failing unit tests* Modified task-details tests and add few more.
This commit is contained in:
committed by
Maurizio Vitale
parent
e806e97c75
commit
5068cbf539
@@ -16,6 +16,8 @@
|
||||
*/
|
||||
|
||||
import { Component, Input, EventEmitter, Output, OnDestroy, OnChanges, OnInit } from '@angular/core';
|
||||
import { takeUntil, concatMap } from 'rxjs/operators';
|
||||
import { Subject, of, forkJoin } from 'rxjs';
|
||||
import {
|
||||
CardViewDateItemModel,
|
||||
CardViewItem,
|
||||
@@ -31,9 +33,7 @@ import {
|
||||
import { TaskDetailsCloudModel, TaskStatus } from '../../start-task/models/task-details-cloud.model';
|
||||
import { Router } from '@angular/router';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
import { Subject } from 'rxjs';
|
||||
import { NumericFieldValidator } from '../../../validators/numeric-field.validator';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-task-header',
|
||||
@@ -63,6 +63,8 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
taskDetails: TaskDetailsCloudModel = {};
|
||||
candidateUsers: string[] = [];
|
||||
candidateGroups: string[] = [];
|
||||
properties: CardViewItem[];
|
||||
inEdit: boolean = false;
|
||||
parentTaskName: string;
|
||||
@@ -107,10 +109,19 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
loadTaskDetailsById(appName: string, taskId: string): any {
|
||||
this.taskCloudService.getTaskById(appName, taskId).subscribe(
|
||||
(taskDetails) => {
|
||||
loadTaskDetailsById(appName: string, taskId: string) {
|
||||
this.taskCloudService.getTaskById(appName, taskId).pipe(
|
||||
concatMap((task) =>
|
||||
forkJoin(
|
||||
of(task),
|
||||
this.taskCloudService.getCandidateUsers(this.appName, this.taskId),
|
||||
this.taskCloudService.getCandidateGroups(this.appName, this.taskId)
|
||||
)
|
||||
)
|
||||
).subscribe(([taskDetails, candidateUsers, candidateGroups]) => {
|
||||
this.taskDetails = taskDetails;
|
||||
this.candidateGroups = candidateGroups;
|
||||
this.candidateUsers = candidateUsers;
|
||||
if (this.taskDetails.parentTaskId) {
|
||||
this.loadParentName(`${this.taskDetails.parentTaskId}`);
|
||||
} else {
|
||||
@@ -222,7 +233,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
new CardViewArrayItemModel(
|
||||
{
|
||||
label: 'ADF_CLOUD_TASK_HEADER.PROPERTIES.CANDIDATE_USERS',
|
||||
value: this.taskCloudService.getCandidateUsers(this.appName, this.taskId),
|
||||
value: of(this.candidateUsers),
|
||||
key: 'candidateUsers',
|
||||
icon: 'person',
|
||||
default: this.translationService.instant('ADF_CLOUD_TASK_HEADER.PROPERTIES.CANDIDATE_USERS_DEFAULT'),
|
||||
@@ -232,7 +243,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
new CardViewArrayItemModel(
|
||||
{
|
||||
label: 'ADF_CLOUD_TASK_HEADER.PROPERTIES.CANDIDATE_GROUPS',
|
||||
value: this.taskCloudService.getCandidateGroups(this.appName, this.taskId),
|
||||
value: of(this.candidateGroups),
|
||||
key: 'candidateGroups',
|
||||
icon: 'group',
|
||||
default: this.translationService.instant('ADF_CLOUD_TASK_HEADER.PROPERTIES.CANDIDATE_GROUPS_DEFAULT'),
|
||||
@@ -299,7 +310,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
}
|
||||
|
||||
isClickable(): boolean {
|
||||
const states: TaskStatus[] = ['ASSIGNED', 'CREATED', 'SUSPENDED'];
|
||||
const states: TaskStatus[] = ['ASSIGNED', 'CREATED'];
|
||||
return states.includes(this.taskDetails.status);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user