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']) {
|
if (changes['sorting']) {
|
||||||
this.formatSorting(changes['sorting'].currentValue);
|
this.formatSorting(changes['sorting'].currentValue);
|
||||||
}
|
}
|
||||||
|
if (changes['appName']) {
|
||||||
|
this.retrieveTasksPreferences();
|
||||||
|
}
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +168,8 @@ export abstract class BaseTaskListCloudComponent<T = unknown> extends DataTableS
|
|||||||
this.onDestroy$.complete();
|
this.onDestroy$.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterContentInit() {
|
private retrieveTasksPreferences(): void {
|
||||||
|
this.isLoading = true;
|
||||||
this.cloudPreferenceService.getPreferences(this.appName).pipe(
|
this.cloudPreferenceService.getPreferences(this.appName).pipe(
|
||||||
take(1),
|
take(1),
|
||||||
map((preferences => {
|
map((preferences => {
|
||||||
@@ -194,8 +198,16 @@ export abstract class BaseTaskListCloudComponent<T = unknown> extends DataTableS
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.createDatatableSchema();
|
this.createDatatableSchema();
|
||||||
}
|
this.createColumns();
|
||||||
);
|
this.isLoading = false;
|
||||||
|
}, (error) => {
|
||||||
|
this.error.emit(error);
|
||||||
|
this.isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterContentInit(): void {
|
||||||
|
this.retrieveTasksPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
isListEmpty(): boolean {
|
isListEmpty(): boolean {
|
||||||
|
@@ -130,15 +130,9 @@ describe('ServiceTaskListCloudComponent', () => {
|
|||||||
spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(emptyList));
|
spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(emptyList));
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(component.isLoading).toBe(true);
|
expect(component.isLoading).toBe(false);
|
||||||
let loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
|
||||||
expect(loadingContent.nativeElement).toBeDefined();
|
|
||||||
|
|
||||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
const loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||||
component.ngOnChanges({ appName });
|
|
||||||
fixture.detectChanges();
|
|
||||||
|
|
||||||
loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
|
||||||
expect(loadingContent).toBeFalsy();
|
expect(loadingContent).toBeFalsy();
|
||||||
|
|
||||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
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);
|
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(component.isLoading).toBe(true);
|
expect(component.isLoading).toBe(false);
|
||||||
let loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
|
||||||
expect(loadingContent.nativeElement).toBeDefined();
|
|
||||||
|
|
||||||
component.ngOnChanges({ appName });
|
component.ngOnChanges({ appName });
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(component.isLoading).toBe(false);
|
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();
|
expect(loadingContent).toBeFalsy();
|
||||||
|
|
||||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
||||||
|
@@ -52,7 +52,6 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
|
|||||||
this.requestNode = this.createRequestNode();
|
this.requestNode = this.createRequestNode();
|
||||||
|
|
||||||
if (this.requestNode.appName || this.requestNode.appName === '') {
|
if (this.requestNode.appName || this.requestNode.appName === '') {
|
||||||
this.isLoading = true;
|
|
||||||
|
|
||||||
combineLatest([
|
combineLatest([
|
||||||
this.serviceTaskListCloudService.getServiceTaskByRequest(this.requestNode),
|
this.serviceTaskListCloudService.getServiceTaskByRequest(this.requestNode),
|
||||||
@@ -63,7 +62,6 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent {
|
|||||||
([tasks]) => {
|
([tasks]) => {
|
||||||
this.rows = tasks.list.entries;
|
this.rows = tasks.list.entries;
|
||||||
this.success.emit(tasks);
|
this.success.emit(tasks);
|
||||||
this.isLoading = false;
|
|
||||||
this.pagination.next(tasks.list.pagination);
|
this.pagination.next(tasks.list.pagination);
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.error.emit(error);
|
this.error.emit(error);
|
||||||
|
@@ -160,15 +160,13 @@ describe('TaskListCloudComponent', () => {
|
|||||||
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(emptyList));
|
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(emptyList));
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(component.isLoading).toBe(true);
|
expect(component.isLoading).toBe(false);
|
||||||
let loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
|
||||||
expect(loadingContent.nativeElement).toBeDefined();
|
|
||||||
|
|
||||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||||
component.ngOnChanges({ appName });
|
component.ngOnChanges({ appName });
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
const loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
||||||
expect(loadingContent).toBeFalsy();
|
expect(loadingContent).toBeFalsy();
|
||||||
|
|
||||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
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);
|
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(component.isLoading).toBe(true);
|
expect(component.isLoading).toBe(false);
|
||||||
let loadingContent = fixture.debugElement.query(By.css('mat-progress-spinner'));
|
|
||||||
expect(loadingContent.nativeElement).toBeDefined();
|
|
||||||
|
|
||||||
component.ngOnChanges({ appName });
|
component.ngOnChanges({ appName });
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(component.isLoading).toBe(false);
|
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();
|
expect(loadingContent).toBeFalsy();
|
||||||
|
|
||||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
||||||
|
Reference in New Issue
Block a user