mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-13282: Fixing save preferences on service tasks (#8476)
* AAE-13282: Fixing save preferences on service tasks * AAE-13282: Removing comments
This commit is contained in:
@@ -157,6 +157,9 @@ export abstract class BaseTaskListCloudComponent<T = unknown> extends DataTableS
|
||||
if (changes['sorting']) {
|
||||
this.formatSorting(changes['sorting'].currentValue);
|
||||
}
|
||||
if (changes['appName']) {
|
||||
this.retrieveTasksPreferences();
|
||||
}
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@@ -165,7 +168,8 @@ export abstract class BaseTaskListCloudComponent<T = unknown> extends DataTableS
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
private retrieveTasksPreferences(): void {
|
||||
this.isLoading = true;
|
||||
this.cloudPreferenceService.getPreferences(this.appName).pipe(
|
||||
take(1),
|
||||
map((preferences => {
|
||||
@@ -194,8 +198,16 @@ export abstract class BaseTaskListCloudComponent<T = unknown> extends DataTableS
|
||||
}
|
||||
|
||||
this.createDatatableSchema();
|
||||
this.createColumns();
|
||||
this.isLoading = false;
|
||||
}, (error) => {
|
||||
this.error.emit(error);
|
||||
this.isLoading = false;
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
ngAfterContentInit(): void {
|
||||
this.retrieveTasksPreferences();
|
||||
}
|
||||
|
||||
isListEmpty(): boolean {
|
||||
|
@@ -130,15 +130,9 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(emptyList));
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(component.isLoading).toBe(true);
|
||||
let loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
expect(loadingContent.nativeElement).toBeDefined();
|
||||
expect(component.isLoading).toBe(false);
|
||||
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
|
||||
loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
const loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
expect(loadingContent).toBeFalsy();
|
||||
|
||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
||||
@@ -150,15 +144,13 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(component.isLoading).toBe(true);
|
||||
let loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
expect(loadingContent.nativeElement).toBeDefined();
|
||||
expect(component.isLoading).toBe(false);
|
||||
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.isLoading).toBe(false);
|
||||
loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
const loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
expect(loadingContent).toBeFalsy();
|
||||
|
||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
||||
|
@@ -52,7 +52,6 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
|
||||
this.requestNode = this.createRequestNode();
|
||||
|
||||
if (this.requestNode.appName || this.requestNode.appName === '') {
|
||||
this.isLoading = true;
|
||||
|
||||
combineLatest([
|
||||
this.serviceTaskListCloudService.getServiceTaskByRequest(this.requestNode),
|
||||
@@ -63,7 +62,6 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
|
||||
([tasks]) => {
|
||||
this.rows = tasks.list.entries;
|
||||
this.success.emit(tasks);
|
||||
this.isLoading = false;
|
||||
this.pagination.next(tasks.list.pagination);
|
||||
}, (error) => {
|
||||
this.error.emit(error);
|
||||
|
@@ -160,15 +160,13 @@ describe('TaskListCloudComponent', () => {
|
||||
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(emptyList));
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(component.isLoading).toBe(true);
|
||||
let loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
expect(loadingContent.nativeElement).toBeDefined();
|
||||
expect(component.isLoading).toBe(false);
|
||||
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
|
||||
loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
const loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
expect(loadingContent).toBeFalsy();
|
||||
|
||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
||||
@@ -180,15 +178,13 @@ describe('TaskListCloudComponent', () => {
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(component.isLoading).toBe(true);
|
||||
let loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
expect(loadingContent.nativeElement).toBeDefined();
|
||||
expect(component.isLoading).toBe(false);
|
||||
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.isLoading).toBe(false);
|
||||
loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
const loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||
expect(loadingContent).toBeFalsy();
|
||||
|
||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
||||
|
Reference in New Issue
Block a user