mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3940] Fix Parent Name property in Task Header Cloud component (#4201)
* [ADF-3940] Fix Parent Name property in Task Header Cloud component * [ADF-3940] Add back missing default value for parent name item
This commit is contained in:
committed by
Eugenio Romano
parent
15d898f0a7
commit
08c9b6d117
@@ -23,7 +23,6 @@ import {
|
|||||||
CardViewBaseItemModel,
|
CardViewBaseItemModel,
|
||||||
TranslationService,
|
TranslationService,
|
||||||
AppConfigService,
|
AppConfigService,
|
||||||
CardViewMapItemModel,
|
|
||||||
UpdateNotification,
|
UpdateNotification,
|
||||||
CardViewUpdateService,
|
CardViewUpdateService,
|
||||||
StorageService
|
StorageService
|
||||||
@@ -59,16 +58,18 @@ export class TaskHeaderCloudComponent implements OnInit {
|
|||||||
unclaim: EventEmitter<any> = new EventEmitter<any>();
|
unclaim: EventEmitter<any> = new EventEmitter<any>();
|
||||||
|
|
||||||
taskDetails: TaskDetailsCloudModel = new TaskDetailsCloudModel();
|
taskDetails: TaskDetailsCloudModel = new TaskDetailsCloudModel();
|
||||||
properties: CardViewItem [];
|
properties: CardViewItem[];
|
||||||
inEdit: boolean = false;
|
inEdit: boolean = false;
|
||||||
|
parentTaskName: string;
|
||||||
private currentUser: string;
|
private currentUser: string;
|
||||||
|
|
||||||
constructor(private taskHeaderCloudService: TaskHeaderCloudService,
|
constructor(
|
||||||
private translationService: TranslationService,
|
private taskHeaderCloudService: TaskHeaderCloudService,
|
||||||
private appConfig: AppConfigService,
|
private translationService: TranslationService,
|
||||||
private cardViewUpdateService: CardViewUpdateService,
|
private appConfig: AppConfigService,
|
||||||
private storage: StorageService) {
|
private cardViewUpdateService: CardViewUpdateService,
|
||||||
}
|
private storage: StorageService
|
||||||
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.loadCurrentBpmUserId();
|
this.loadCurrentBpmUserId();
|
||||||
@@ -86,11 +87,15 @@ export class TaskHeaderCloudComponent implements OnInit {
|
|||||||
this.taskHeaderCloudService.getTaskById(appName, taskId).subscribe(
|
this.taskHeaderCloudService.getTaskById(appName, taskId).subscribe(
|
||||||
(taskDetails) => {
|
(taskDetails) => {
|
||||||
this.taskDetails = taskDetails;
|
this.taskDetails = taskDetails;
|
||||||
this.refreshData();
|
if (this.taskDetails.parentTaskId) {
|
||||||
|
this.loadParentName(this.taskDetails.parentTaskId);
|
||||||
|
} else {
|
||||||
|
this.refreshData();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private initDefaultProperties(parentInfoMap) {
|
private initDefaultProperties() {
|
||||||
return [
|
return [
|
||||||
new CardViewTextItemModel(
|
new CardViewTextItemModel(
|
||||||
{
|
{
|
||||||
@@ -140,13 +145,12 @@ export class TaskHeaderCloudComponent implements OnInit {
|
|||||||
key: 'created'
|
key: 'created'
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
new CardViewMapItemModel(
|
new CardViewTextItemModel(
|
||||||
{
|
{
|
||||||
label: 'ADF_CLOUD_TASK_HEADER.PROPERTIES.PARENT_NAME',
|
label: 'ADF_CLOUD_TASK_HEADER.PROPERTIES.PARENT_NAME',
|
||||||
value: parentInfoMap,
|
value: this.parentTaskName,
|
||||||
key: 'parentName',
|
|
||||||
default: this.translationService.instant('ADF_CLOUD_TASK_HEADER.PROPERTIES.PARENT_NAME_DEFAULT'),
|
default: this.translationService.instant('ADF_CLOUD_TASK_HEADER.PROPERTIES.PARENT_NAME_DEFAULT'),
|
||||||
clickable: this.isReadOnlyMode()
|
key: 'parentName'
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
new CardViewTextItemModel(
|
new CardViewTextItemModel(
|
||||||
@@ -159,7 +163,7 @@ export class TaskHeaderCloudComponent implements OnInit {
|
|||||||
new CardViewDateItemModel(
|
new CardViewDateItemModel(
|
||||||
{
|
{
|
||||||
label: 'ADF_CLOUD_TASK_HEADER.PROPERTIES.END_DATE',
|
label: 'ADF_CLOUD_TASK_HEADER.PROPERTIES.END_DATE',
|
||||||
value: this.taskDetails.claimedDate,
|
value: '',
|
||||||
key: 'endDate'
|
key: 'endDate'
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@@ -188,7 +192,7 @@ export class TaskHeaderCloudComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
refreshData() {
|
refreshData() {
|
||||||
if (this.taskDetails) {
|
if (this.taskDetails) {
|
||||||
const defaultProperties = this.initDefaultProperties(this.getParentInfo());
|
const defaultProperties = this.initDefaultProperties();
|
||||||
const filteredProperties: string[] = this.appConfig.get('adf-cloud-task-header.presets.properties');
|
const filteredProperties: string[] = this.appConfig.get('adf-cloud-task-header.presets.properties');
|
||||||
this.properties = defaultProperties.filter((cardItem) => this.isValidSelection(filteredProperties, cardItem));
|
this.properties = defaultProperties.filter((cardItem) => this.isValidSelection(filteredProperties, cardItem));
|
||||||
}
|
}
|
||||||
@@ -209,14 +213,18 @@ export class TaskHeaderCloudComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getParentInfo() {
|
private loadParentName(taskId) {
|
||||||
if (this.taskDetails.processInstanceId && this.taskDetails.processDefinitionId) {
|
this.taskHeaderCloudService.getTaskById(this.appName, taskId)
|
||||||
return new Map([[this.taskDetails.processInstanceId, this.taskDetails.processDefinitionId]]);
|
.subscribe(
|
||||||
}
|
(taskDetails) => {
|
||||||
|
this.parentTaskName = taskDetails.name;
|
||||||
|
this.refreshData();
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
isCompleted() {
|
isCompleted() {
|
||||||
return this.taskDetails && this.taskDetails.status === 'completed';
|
return this.taskDetails && this.taskDetails.status === 'completed';
|
||||||
}
|
}
|
||||||
|
|
||||||
isTaskClaimable(): boolean {
|
isTaskClaimable(): boolean {
|
||||||
|
Reference in New Issue
Block a user