mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACA-4071] [ADW-Cloud]Task header takes too much to be loaded after claiming a task (#6294)
* [ACA-4071] [ADW-Cloud]Task header takes too much to be loaded after claiming a task * * Fixed comment * * Fixed comment
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<mat-card *ngIf="isTaskValid()" class="adf-card-container">
|
<mat-card *ngIf="isTaskValid()" class="adf-card-container">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<adf-card-view
|
<adf-card-view
|
||||||
*ngIf="properties; else loadingTemplate"
|
*ngIf="!isLoading; else loadingTemplate"
|
||||||
[properties]="properties"
|
[properties]="properties"
|
||||||
[editable]="isTaskEditable()"
|
[editable]="isTaskEditable()"
|
||||||
[displayClearAction]="displayDateClearAction">
|
[displayClearAction]="displayDateClearAction">
|
||||||
|
@@ -210,8 +210,8 @@ describe('TaskHeaderCloudComponent', () => {
|
|||||||
expect(taskCloudService.updateTask).toHaveBeenCalled();
|
expect(taskCloudService.updateTask).toHaveBeenCalled();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should show loading spinner when properties are not loaded', () => {
|
it('should show spinner before loading task details', () => {
|
||||||
component.properties = null;
|
component.isLoading = true;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const loading = fixture.debugElement.query(By.css('.adf-task-header-loading'));
|
const loading = fixture.debugElement.query(By.css('.adf-task-header-loading'));
|
||||||
expect(loading).toBeTruthy();
|
expect(loading).toBeTruthy();
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, EventEmitter, Output, OnDestroy, OnChanges, OnInit } from '@angular/core';
|
import { Component, Input, EventEmitter, Output, OnDestroy, OnChanges, OnInit } from '@angular/core';
|
||||||
import { takeUntil, concatMap, catchError } from 'rxjs/operators';
|
import { takeUntil, concatMap, catchError, finalize } from 'rxjs/operators';
|
||||||
import { Subject, of, forkJoin } from 'rxjs';
|
import { Subject, of, forkJoin } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
CardViewDateItemModel,
|
CardViewDateItemModel,
|
||||||
@@ -76,6 +76,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
dateTimeFormat: string;
|
dateTimeFormat: string;
|
||||||
dateLocale: string;
|
dateLocale: string;
|
||||||
displayDateClearAction = false;
|
displayDateClearAction = false;
|
||||||
|
isLoading = true;
|
||||||
|
|
||||||
private onDestroy$ = new Subject<boolean>();
|
private onDestroy$ = new Subject<boolean>();
|
||||||
|
|
||||||
@@ -113,6 +114,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadTaskDetailsById(appName: string, taskId: string) {
|
loadTaskDetailsById(appName: string, taskId: string) {
|
||||||
|
this.isLoading = true;
|
||||||
this.taskCloudService.getTaskById(appName, taskId).pipe(
|
this.taskCloudService.getTaskById(appName, taskId).pipe(
|
||||||
concatMap((task) =>
|
concatMap((task) =>
|
||||||
forkJoin(
|
forkJoin(
|
||||||
@@ -120,7 +122,8 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
this.taskCloudService.getCandidateUsers(this.appName, this.taskId),
|
this.taskCloudService.getCandidateUsers(this.appName, this.taskId),
|
||||||
this.taskCloudService.getCandidateGroups(this.appName, this.taskId)
|
this.taskCloudService.getCandidateGroups(this.appName, this.taskId)
|
||||||
)
|
)
|
||||||
)
|
),
|
||||||
|
finalize(() => (this.isLoading = false))
|
||||||
).subscribe(([taskDetails, candidateUsers, candidateGroups]) => {
|
).subscribe(([taskDetails, candidateUsers, candidateGroups]) => {
|
||||||
this.taskDetails = taskDetails;
|
this.taskDetails = taskDetails;
|
||||||
this.candidateGroups = candidateGroups.map((user) => <CardViewArrayItem> { icon: 'group', value: user });
|
this.candidateGroups = candidateGroups.map((user) => <CardViewArrayItem> { icon: 'group', value: user });
|
||||||
@@ -131,7 +134,9 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
|||||||
this.refreshData();
|
this.refreshData();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(err) => this.error.emit(err));
|
(err) => {
|
||||||
|
this.error.emit(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private initDefaultProperties() {
|
private initDefaultProperties() {
|
||||||
|
Reference in New Issue
Block a user