mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
[ADF-1006] fix 'isEmpty' issue and code cleanup (#2053)
* fix 'isEmpty' issue and code cleanup * Update tsconfig.json
This commit is contained in:
parent
29ca8b5c5e
commit
012d62eb55
@ -27,6 +27,7 @@ import { DocumentListComponent } from './../document-list.component';
|
|||||||
export class ContentColumnListComponent {
|
export class ContentColumnListComponent {
|
||||||
|
|
||||||
constructor(private documentList: DocumentListComponent) {
|
constructor(private documentList: DocumentListComponent) {
|
||||||
|
console.log('ContentColumnListComponent is deprecated starting with 1.7.0 and may be removed in future versions. Use DataColumnListComponent instead.');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,9 @@ export class ContentColumnComponent implements OnInit, AfterContentInit, DataCol
|
|||||||
@Input('class')
|
@Input('class')
|
||||||
cssClass: string;
|
cssClass: string;
|
||||||
|
|
||||||
constructor(private list: ContentColumnListComponent) {}
|
constructor(private list: ContentColumnListComponent) {
|
||||||
|
console.log('ContentColumnComponent is deprecated starting with 1.7.0 and may be removed in future versions. Use DataColumnComponent instead.');
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!this.srTitle && this.key === '$thumbnail') {
|
if (!this.srTitle && this.key === '$thumbnail') {
|
||||||
|
@ -167,7 +167,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
|
|
||||||
constructor(private documentListService: DocumentListService,
|
constructor(private documentListService: DocumentListService,
|
||||||
private ngZone: NgZone,
|
private ngZone: NgZone,
|
||||||
private translateService: AlfrescoTranslationService,
|
translateService: AlfrescoTranslationService,
|
||||||
private el: ElementRef) {
|
private el: ElementRef) {
|
||||||
|
|
||||||
if (translateService) {
|
if (translateService) {
|
||||||
@ -263,7 +263,7 @@ export class DocumentListComponent implements OnInit, OnChanges, AfterContentIni
|
|||||||
}
|
}
|
||||||
|
|
||||||
isEmpty() {
|
isEmpty() {
|
||||||
return this.data.getRows().length === 0;
|
return !this.data || this.data.getRows().length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
isPaginationEnabled() {
|
isPaginationEnabled() {
|
||||||
|
@ -66,12 +66,26 @@ export class DocumentActionsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: for demo purposes only, will be removed during future revisions
|
// TODO: for demo purposes only, will be removed during future revisions
|
||||||
private handleStandardAction1(obj: any) {
|
/**
|
||||||
|
* @deprecated in 1.7.0
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @memberof DocumentActionsService
|
||||||
|
*/
|
||||||
|
private handleStandardAction1(/*obj: any*/) {
|
||||||
|
console.log('handleStandardAction1 is deprecated in 1.7.0 and will be removed in future versions');
|
||||||
window.alert('standard document action 1');
|
window.alert('standard document action 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: for demo purposes only, will be removed during future revisions
|
// TODO: for demo purposes only, will be removed during future revisions
|
||||||
private handleStandardAction2(obj: any) {
|
/**
|
||||||
|
* @deprecated in 1.7.0
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @memberof DocumentActionsService
|
||||||
|
*/
|
||||||
|
private handleStandardAction2(/*obj: any*/) {
|
||||||
|
console.log('handleStandardAction2 is deprecated in 1.7.0 and will be removed in future versions');
|
||||||
window.alert('standard document action 2');
|
window.alert('standard document action 2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +32,7 @@ describe('FolderActionsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should register custom action handler', () => {
|
it('should register custom action handler', () => {
|
||||||
let handler: ContentActionHandler = function (obj: any) {
|
let handler: ContentActionHandler = function () {};
|
||||||
};
|
|
||||||
service.setHandler('<key>', handler);
|
service.setHandler('<key>', handler);
|
||||||
expect(service.getHandler('<key>')).toBe(handler);
|
expect(service.getHandler('<key>')).toBe(handler);
|
||||||
});
|
});
|
||||||
@ -43,8 +42,7 @@ describe('FolderActionsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should be case insensitive for keys', () => {
|
it('should be case insensitive for keys', () => {
|
||||||
let handler: ContentActionHandler = function (obj: any) {
|
let handler: ContentActionHandler = function () {};
|
||||||
};
|
|
||||||
service.setHandler('<key>', handler);
|
service.setHandler('<key>', handler);
|
||||||
expect(service.getHandler('<KEY>')).toBe(handler);
|
expect(service.getHandler('<KEY>')).toBe(handler);
|
||||||
});
|
});
|
||||||
@ -69,8 +67,7 @@ describe('FolderActionsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set new handler only by key', () => {
|
it('should set new handler only by key', () => {
|
||||||
let handler: ContentActionHandler = function (obj: any) {
|
let handler: ContentActionHandler = function () {};
|
||||||
};
|
|
||||||
expect(service.setHandler(null, handler)).toBeFalsy();
|
expect(service.setHandler(null, handler)).toBeFalsy();
|
||||||
expect(service.setHandler('', handler)).toBeFalsy();
|
expect(service.setHandler('', handler)).toBeFalsy();
|
||||||
expect(service.setHandler('my-handler', handler)).toBeTruthy();
|
expect(service.setHandler('my-handler', handler)).toBeTruthy();
|
||||||
@ -122,7 +119,7 @@ describe('FolderActionsService', () => {
|
|||||||
const deleteObservale = service.getHandler('delete')(folderWithPermission, null, permission);
|
const deleteObservale = service.getHandler('delete')(folderWithPermission, null, permission);
|
||||||
|
|
||||||
expect(documentListService.deleteNode).toHaveBeenCalledWith(folder.entry.id);
|
expect(documentListService.deleteNode).toHaveBeenCalledWith(folder.entry.id);
|
||||||
expect(deleteObservale.subscribe).toBeDefined;
|
expect(deleteObservale.subscribe).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not delete the folder node if there is no delete permission', (done) => {
|
it('should not delete the folder node if there is no delete permission', (done) => {
|
||||||
|
@ -62,12 +62,27 @@ export class FolderActionsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: for demo purposes only, will be removed during future revisions
|
// TODO: for demo purposes only, will be removed during future revisions
|
||||||
private handleStandardAction1(document: any) {
|
/**
|
||||||
|
* @deprecated in 1.7.0
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @param {*} document
|
||||||
|
* @memberof FolderActionsService
|
||||||
|
*/
|
||||||
|
private handleStandardAction1(/*document: any*/) {
|
||||||
|
console.log('handleStandardAction1 is deprecated in 1.7.0 and will be removed in future versions');
|
||||||
window.alert('standard folder action 1');
|
window.alert('standard folder action 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: for demo purposes only, will be removed during future revisions
|
// TODO: for demo purposes only, will be removed during future revisions
|
||||||
private handleStandardAction2(document: any) {
|
/**
|
||||||
|
* @deprecated in 1.7.0
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
* @memberof FolderActionsService
|
||||||
|
*/
|
||||||
|
private handleStandardAction2(/*document: any*/) {
|
||||||
|
console.log('handleStandardAction1 is deprecated in 1.7.0 and will be removed in future versions');
|
||||||
window.alert('standard folder action 2');
|
window.alert('standard folder action 2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user