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-content>
|
||||
<adf-card-view
|
||||
*ngIf="properties; else loadingTemplate"
|
||||
*ngIf="!isLoading; else loadingTemplate"
|
||||
[properties]="properties"
|
||||
[editable]="isTaskEditable()"
|
||||
[displayClearAction]="displayDateClearAction">
|
||||
|
@@ -210,8 +210,8 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
expect(taskCloudService.updateTask).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should show loading spinner when properties are not loaded', () => {
|
||||
component.properties = null;
|
||||
it('should show spinner before loading task details', () => {
|
||||
component.isLoading = true;
|
||||
fixture.detectChanges();
|
||||
const loading = fixture.debugElement.query(By.css('.adf-task-header-loading'));
|
||||
expect(loading).toBeTruthy();
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
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 {
|
||||
CardViewDateItemModel,
|
||||
@@ -76,6 +76,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
dateTimeFormat: string;
|
||||
dateLocale: string;
|
||||
displayDateClearAction = false;
|
||||
isLoading = true;
|
||||
|
||||
private onDestroy$ = new Subject<boolean>();
|
||||
|
||||
@@ -113,6 +114,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
}
|
||||
|
||||
loadTaskDetailsById(appName: string, taskId: string) {
|
||||
this.isLoading = true;
|
||||
this.taskCloudService.getTaskById(appName, taskId).pipe(
|
||||
concatMap((task) =>
|
||||
forkJoin(
|
||||
@@ -120,7 +122,8 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
this.taskCloudService.getCandidateUsers(this.appName, this.taskId),
|
||||
this.taskCloudService.getCandidateGroups(this.appName, this.taskId)
|
||||
)
|
||||
)
|
||||
),
|
||||
finalize(() => (this.isLoading = false))
|
||||
).subscribe(([taskDetails, candidateUsers, candidateGroups]) => {
|
||||
this.taskDetails = taskDetails;
|
||||
this.candidateGroups = candidateGroups.map((user) => <CardViewArrayItem> { icon: 'group', value: user });
|
||||
@@ -131,7 +134,9 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
|
||||
this.refreshData();
|
||||
}
|
||||
},
|
||||
(err) => this.error.emit(err));
|
||||
(err) => {
|
||||
this.error.emit(err);
|
||||
});
|
||||
}
|
||||
|
||||
private initDefaultProperties() {
|
||||
|
Reference in New Issue
Block a user