#129 Improve document list reload behaviour

This commit is contained in:
Denys Vuika
2016-06-23 11:26:24 +01:00
parent 6379079e82
commit 4208de703a
5 changed files with 15 additions and 10 deletions

View File

@@ -38,7 +38,7 @@ describe('ContentAction', () => {
beforeEach(() => {
let alfrescoServiceMock = new AlfrescoServiceMock();
documentList = new DocumentList(alfrescoServiceMock);
documentList = new DocumentList(alfrescoServiceMock, null);
actionList = new ContentActionList(documentList);
});

View File

@@ -34,7 +34,7 @@ describe('ContentColumnList', () => {
beforeEach(() => {
let alfrescoServiceMock = new AlfrescoServiceMock();
documentList = new DocumentList(alfrescoServiceMock);
documentList = new DocumentList(alfrescoServiceMock, null);
columnList = new ContentColumnList(documentList);
});

View File

@@ -34,7 +34,7 @@ describe('ContentColumn', () => {
beforeEach(() => {
let alfrescoServiceMock = new AlfrescoServiceMock();
documentList = new DocumentList(alfrescoServiceMock);
documentList = new DocumentList(alfrescoServiceMock, null);
columnList = new ContentColumnList(documentList);
});

View File

@@ -36,7 +36,7 @@ describe('DocumentList', () => {
beforeEach(() => {
alfrescoServiceMock = new AlfrescoServiceMock();
documentList = new DocumentList(alfrescoServiceMock);
documentList = new DocumentList(alfrescoServiceMock, null);
eventMock = {
preventDefault: function () {
@@ -105,7 +105,7 @@ describe('DocumentList', () => {
});
it('should return no thumbnail url without service', () => {
let list = new DocumentList(null);
let list = new DocumentList(null, null);
let node = new MinimalNodeEntity();
expect(list.getThumbnailUrl(node)).toBeNull();
});

View File

@@ -24,7 +24,8 @@ import {
AfterContentInit,
AfterViewChecked,
OnChanges,
TemplateRef
TemplateRef,
NgZone
} from '@angular/core';
import { DatePipe } from '@angular/common';
import { Subject } from 'rxjs/Rx';
@@ -120,7 +121,9 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit,
contextActionHandler: Subject<any> = new Subject();
constructor(private alfrescoService: AlfrescoService) {}
constructor(
private alfrescoService: AlfrescoService,
private ngZone: NgZone) {}
getContextActions(node: MinimalNodeEntity) {
if (node && node.entry) {
@@ -320,9 +323,11 @@ export class DocumentList implements OnInit, AfterViewChecked, AfterContentInit,
}
reload() {
if (this.currentFolderPath) {
this.displayFolderContent(this.currentFolderPath);
}
this.ngZone.run(() => {
if (this.currentFolderPath) {
this.displayFolderContent(this.currentFolderPath);
}
});
}
/**