mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
enable prefer-const rule for tslint, fix issues (#4409)
* enable prefer-const rule for tslint, fix issues * Update content-node-selector.component.spec.ts * Update content-node-selector.component.spec.ts * fix const * fix lint issues * update tests * update tests * update tests * fix code * fix page class
This commit is contained in:
committed by
Eugenio Romano
parent
26c5982a1a
commit
a7a48e8b2b
@@ -41,8 +41,8 @@ describe('ContentColumnList', () => {
|
||||
it('should register action', () => {
|
||||
spyOn(documentList.actions, 'push').and.callThrough();
|
||||
|
||||
let action = new ContentActionModel();
|
||||
let result = actionList.registerAction(action);
|
||||
const action = new ContentActionModel();
|
||||
const result = actionList.registerAction(action);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
expect(documentList.actions.push).toHaveBeenCalledWith(action);
|
||||
@@ -50,13 +50,13 @@ describe('ContentColumnList', () => {
|
||||
|
||||
it('should require document list instance to register action', () => {
|
||||
actionList = new ContentActionListComponent(null);
|
||||
let action = new ContentActionModel();
|
||||
const action = new ContentActionModel();
|
||||
expect(actionList.registerAction(action)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should require action instance to register', () => {
|
||||
spyOn(documentList.actions, 'push').and.callThrough();
|
||||
let result = actionList.registerAction(null);
|
||||
const result = actionList.registerAction(null);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
expect(documentList.actions.push).not.toHaveBeenCalled();
|
||||
|
@@ -58,14 +58,14 @@ describe('ContentAction', () => {
|
||||
it('should register within parent actions list', () => {
|
||||
spyOn(actionList, 'registerAction').and.stub();
|
||||
|
||||
let action = new ContentActionComponent(actionList, null, null);
|
||||
const action = new ContentActionComponent(actionList, null, null);
|
||||
action.ngOnInit();
|
||||
|
||||
expect(actionList.registerAction).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should setup and register model', () => {
|
||||
let action = new ContentActionComponent(actionList, null, null);
|
||||
const action = new ContentActionComponent(actionList, null, null);
|
||||
action.target = 'document';
|
||||
action.title = '<title>';
|
||||
action.icon = '<icon>';
|
||||
@@ -75,14 +75,14 @@ describe('ContentAction', () => {
|
||||
|
||||
expect(documentList.actions.length).toBe(1);
|
||||
|
||||
let model = documentList.actions[0];
|
||||
const model = documentList.actions[0];
|
||||
expect(model.target).toBe(action.target);
|
||||
expect(model.title).toBe(action.title);
|
||||
expect(model.icon).toBe(action.icon);
|
||||
});
|
||||
|
||||
it('should update visibility binding', () => {
|
||||
let action = new ContentActionComponent(actionList, null, null);
|
||||
const action = new ContentActionComponent(actionList, null, null);
|
||||
action.target = 'document';
|
||||
action.title = '<title>';
|
||||
action.icon = '<icon>';
|
||||
@@ -101,11 +101,11 @@ describe('ContentAction', () => {
|
||||
|
||||
it('should get action handler from document actions service', () => {
|
||||
|
||||
let handler = function () {
|
||||
const handler = function () {
|
||||
};
|
||||
spyOn(documentActions, 'getHandler').and.returnValue(handler);
|
||||
|
||||
let action = new ContentActionComponent(actionList, documentActions, null);
|
||||
const action = new ContentActionComponent(actionList, documentActions, null);
|
||||
action.target = 'document';
|
||||
action.handler = '<handler>';
|
||||
action.ngOnInit();
|
||||
@@ -113,16 +113,16 @@ describe('ContentAction', () => {
|
||||
expect(documentActions.getHandler).toHaveBeenCalledWith(action.handler);
|
||||
expect(documentList.actions.length).toBe(1);
|
||||
|
||||
let model = documentList.actions[0];
|
||||
const model = documentList.actions[0];
|
||||
expect(model.handler).toBe(handler);
|
||||
});
|
||||
|
||||
it('should get action handler from folder actions service', () => {
|
||||
let handler = function () {
|
||||
const handler = function () {
|
||||
};
|
||||
spyOn(folderActions, 'getHandler').and.returnValue(handler);
|
||||
|
||||
let action = new ContentActionComponent(actionList, null, folderActions);
|
||||
const action = new ContentActionComponent(actionList, null, folderActions);
|
||||
action.target = 'folder';
|
||||
action.handler = '<handler>';
|
||||
action.ngOnInit();
|
||||
@@ -130,7 +130,7 @@ describe('ContentAction', () => {
|
||||
expect(folderActions.getHandler).toHaveBeenCalledWith(action.handler);
|
||||
expect(documentList.actions.length).toBe(1);
|
||||
|
||||
let model = documentList.actions[0];
|
||||
const model = documentList.actions[0];
|
||||
expect(model.handler).toBe(handler);
|
||||
});
|
||||
|
||||
@@ -138,7 +138,7 @@ describe('ContentAction', () => {
|
||||
spyOn(folderActions, 'getHandler').and.stub();
|
||||
spyOn(documentActions, 'getHandler').and.stub();
|
||||
|
||||
let action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
const action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
action.handler = '<handler>';
|
||||
|
||||
action.ngOnInit();
|
||||
@@ -151,7 +151,7 @@ describe('ContentAction', () => {
|
||||
spyOn(folderActions, 'getHandler').and.stub();
|
||||
spyOn(documentActions, 'getHandler').and.stub();
|
||||
|
||||
let action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
const action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
action.handler = '<handler>';
|
||||
action.target = 'document';
|
||||
|
||||
@@ -165,7 +165,7 @@ describe('ContentAction', () => {
|
||||
spyOn(folderActions, 'getHandler').and.stub();
|
||||
spyOn(documentActions, 'getHandler').and.stub();
|
||||
|
||||
let action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
const action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
action.handler = '<handler>';
|
||||
action.target = 'folder';
|
||||
|
||||
@@ -178,7 +178,7 @@ describe('ContentAction', () => {
|
||||
it('should be case insensitive for document target', () => {
|
||||
spyOn(documentActions, 'getHandler').and.stub();
|
||||
|
||||
let action = new ContentActionComponent(actionList, documentActions, null);
|
||||
const action = new ContentActionComponent(actionList, documentActions, null);
|
||||
action.target = 'DoCuMeNt';
|
||||
action.handler = '<handler>';
|
||||
|
||||
@@ -189,7 +189,7 @@ describe('ContentAction', () => {
|
||||
it('should be case insensitive for folder target', () => {
|
||||
spyOn(folderActions, 'getHandler').and.stub();
|
||||
|
||||
let action = new ContentActionComponent(actionList, null, folderActions);
|
||||
const action = new ContentActionComponent(actionList, null, folderActions);
|
||||
action.target = 'FoLdEr';
|
||||
action.handler = '<handler>';
|
||||
|
||||
@@ -198,46 +198,46 @@ describe('ContentAction', () => {
|
||||
});
|
||||
|
||||
it('should use custom "execute" emitter', (done) => {
|
||||
let emitter = new EventEmitter();
|
||||
const emitter = new EventEmitter();
|
||||
|
||||
emitter.subscribe((e) => {
|
||||
expect(e.value).toBe('<obj>');
|
||||
done();
|
||||
});
|
||||
|
||||
let action = new ContentActionComponent(actionList, null, null);
|
||||
const action = new ContentActionComponent(actionList, null, null);
|
||||
action.target = 'document';
|
||||
action.execute = emitter;
|
||||
|
||||
action.ngOnInit();
|
||||
expect(documentList.actions.length).toBe(1);
|
||||
|
||||
let model = documentList.actions[0];
|
||||
const model = documentList.actions[0];
|
||||
model.execute('<obj>');
|
||||
});
|
||||
|
||||
it('should not find document action handler with missing service', () => {
|
||||
let action = new ContentActionComponent(actionList, null, null);
|
||||
const action = new ContentActionComponent(actionList, null, null);
|
||||
expect(action.getSystemHandler('document', 'name')).toBeNull();
|
||||
});
|
||||
|
||||
it('should not find folder action handler with missing service', () => {
|
||||
let action = new ContentActionComponent(actionList, null, null);
|
||||
const action = new ContentActionComponent(actionList, null, null);
|
||||
expect(action.getSystemHandler('folder', 'name')).toBeNull();
|
||||
});
|
||||
|
||||
it('should find document action handler via service', () => {
|
||||
let handler = <ContentActionHandler> function (obj: any, target?: any) {
|
||||
const handler = <ContentActionHandler> function (obj: any, target?: any) {
|
||||
};
|
||||
let action = new ContentActionComponent(actionList, documentActions, null);
|
||||
const action = new ContentActionComponent(actionList, documentActions, null);
|
||||
spyOn(documentActions, 'getHandler').and.returnValue(handler);
|
||||
expect(action.getSystemHandler('document', 'name')).toBe(handler);
|
||||
});
|
||||
|
||||
it('should find folder action handler via service', () => {
|
||||
let handler = <ContentActionHandler> function (obj: any, target?: any) {
|
||||
const handler = <ContentActionHandler> function (obj: any, target?: any) {
|
||||
};
|
||||
let action = new ContentActionComponent(actionList, null, folderActions);
|
||||
const action = new ContentActionComponent(actionList, null, folderActions);
|
||||
spyOn(folderActions, 'getHandler').and.returnValue(handler);
|
||||
expect(action.getSystemHandler('folder', 'name')).toBe(handler);
|
||||
});
|
||||
@@ -246,7 +246,7 @@ describe('ContentAction', () => {
|
||||
spyOn(folderActions, 'getHandler').and.stub();
|
||||
spyOn(documentActions, 'getHandler').and.stub();
|
||||
|
||||
let action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
const action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
|
||||
expect(action.getSystemHandler('unknown', 'name')).toBeNull();
|
||||
expect(folderActions.getHandler).not.toHaveBeenCalled();
|
||||
@@ -255,10 +255,10 @@ describe('ContentAction', () => {
|
||||
});
|
||||
|
||||
it('should wire model with custom event handler', async(() => {
|
||||
let action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
let file = new FileNode();
|
||||
const action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
const file = new FileNode();
|
||||
|
||||
let handler = new EventEmitter();
|
||||
const handler = new EventEmitter();
|
||||
handler.subscribe((e) => {
|
||||
expect(e.value).toBe(file);
|
||||
});
|
||||
@@ -270,7 +270,7 @@ describe('ContentAction', () => {
|
||||
}));
|
||||
|
||||
it('should allow registering model without handler', () => {
|
||||
let action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
const action = new ContentActionComponent(actionList, documentActions, folderActions);
|
||||
|
||||
spyOn(actionList, 'registerAction').and.callThrough();
|
||||
action.execute = null;
|
||||
@@ -282,7 +282,7 @@ describe('ContentAction', () => {
|
||||
});
|
||||
|
||||
it('should register on init', () => {
|
||||
let action = new ContentActionComponent(actionList, null, null);
|
||||
const action = new ContentActionComponent(actionList, null, null);
|
||||
spyOn(action, 'register').and.callThrough();
|
||||
|
||||
action.ngOnInit();
|
||||
|
@@ -43,11 +43,11 @@ describe('ContentColumnList', () => {
|
||||
});
|
||||
|
||||
it('should register column within parent document list', () => {
|
||||
let columns = documentList.data.getColumns();
|
||||
const columns = documentList.data.getColumns();
|
||||
expect(columns.length).toBe(0);
|
||||
|
||||
let column = <DataColumn> {};
|
||||
let result = columnList.registerColumn(column);
|
||||
const column = <DataColumn> {};
|
||||
const result = columnList.registerColumn(column);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
expect(columns.length).toBe(1);
|
||||
@@ -56,13 +56,13 @@ describe('ContentColumnList', () => {
|
||||
|
||||
it('should require document list instance to register action', () => {
|
||||
columnList = new ContentColumnListComponent(null, logService);
|
||||
let col = <DataColumn> {};
|
||||
const col = <DataColumn> {};
|
||||
expect(columnList.registerColumn(col)).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should require action instance to register', () => {
|
||||
spyOn(documentList.actions, 'push').and.callThrough();
|
||||
let result = columnList.registerColumn(null);
|
||||
const result = columnList.registerColumn(null);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
expect(documentList.actions.push).not.toHaveBeenCalled();
|
||||
|
@@ -39,7 +39,7 @@ export class ContentColumnListComponent {
|
||||
*/
|
||||
registerColumn(column: DataColumn): boolean {
|
||||
if (this.documentList && column) {
|
||||
let columns = this.documentList.data.getColumns();
|
||||
const columns = this.documentList.data.getColumns();
|
||||
columns.push(column);
|
||||
return true;
|
||||
}
|
||||
|
@@ -45,18 +45,18 @@ describe('ContentColumn', () => {
|
||||
it('should register model within parent column list', () => {
|
||||
spyOn(columnList, 'registerColumn').and.callThrough();
|
||||
|
||||
let column = new ContentColumnComponent(columnList, logService);
|
||||
const column = new ContentColumnComponent(columnList, logService);
|
||||
column.ngAfterContentInit();
|
||||
|
||||
expect(columnList.registerColumn).toHaveBeenCalled();
|
||||
|
||||
let columns = documentList.data.getColumns();
|
||||
const columns = documentList.data.getColumns();
|
||||
expect(columns.length).toBe(1);
|
||||
expect(columns[0]).toBe(column);
|
||||
});
|
||||
|
||||
it('should setup screen reader title for thumbnail column', () => {
|
||||
let column = new ContentColumnComponent(columnList, logService);
|
||||
const column = new ContentColumnComponent(columnList, logService);
|
||||
column.key = '$thumbnail';
|
||||
column.ngOnInit();
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('ContentColumn', () => {
|
||||
});
|
||||
|
||||
it('should register on init', () => {
|
||||
let column = new ContentColumnComponent(columnList, logService);
|
||||
const column = new ContentColumnComponent(columnList, logService);
|
||||
spyOn(column, 'register').and.callThrough();
|
||||
|
||||
column.ngAfterContentInit();
|
||||
|
@@ -107,7 +107,7 @@ describe('DocumentList', () => {
|
||||
it('should add the custom columns', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
let column = <DataColumn> {
|
||||
const column = <DataColumn> {
|
||||
title: 'title',
|
||||
key: 'source',
|
||||
cssClass: 'css',
|
||||
@@ -116,7 +116,7 @@ describe('DocumentList', () => {
|
||||
format: ''
|
||||
};
|
||||
|
||||
let columns = documentList.data.getColumns();
|
||||
const columns = documentList.data.getColumns();
|
||||
columns.push(column);
|
||||
|
||||
documentList.ngAfterContentInit();
|
||||
@@ -125,8 +125,8 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should call action\'s handler with node', () => {
|
||||
let node = new FileNode();
|
||||
let action = new ContentActionModel();
|
||||
const node = new FileNode();
|
||||
const action = new ContentActionModel();
|
||||
action.handler = () => {
|
||||
};
|
||||
|
||||
@@ -138,8 +138,8 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should call action\'s handler with node and permission', () => {
|
||||
let node = new FileNode();
|
||||
let action = new ContentActionModel();
|
||||
const node = new FileNode();
|
||||
const action = new ContentActionModel();
|
||||
action.handler = () => {
|
||||
};
|
||||
action.permission = 'fake-permission';
|
||||
@@ -151,8 +151,8 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should call action\'s execute with node if it is defined', () => {
|
||||
let node = new FileNode();
|
||||
let action = new ContentActionModel();
|
||||
const node = new FileNode();
|
||||
const action = new ContentActionModel();
|
||||
action.execute = () => {
|
||||
};
|
||||
spyOn(action, 'execute').and.stub();
|
||||
@@ -164,8 +164,8 @@ describe('DocumentList', () => {
|
||||
|
||||
it('should call action\'s execute only after the handler has been executed', () => {
|
||||
const deleteObservable: Subject<any> = new Subject<any>();
|
||||
let node = new FileNode();
|
||||
let action = new ContentActionModel();
|
||||
const node = new FileNode();
|
||||
const action = new ContentActionModel();
|
||||
action.handler = () => deleteObservable;
|
||||
action.execute = () => {
|
||||
};
|
||||
@@ -260,7 +260,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should not execute action without node provided', () => {
|
||||
let action = new ContentActionModel();
|
||||
const action = new ContentActionModel();
|
||||
action.handler = function () {
|
||||
};
|
||||
|
||||
@@ -270,15 +270,15 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should not give node actions for empty target', () => {
|
||||
let actions = documentList.getNodeActions(null);
|
||||
const actions = documentList.getNodeActions(null);
|
||||
expect(actions.length).toBe(0);
|
||||
});
|
||||
|
||||
it('should filter content actions for various targets', () => {
|
||||
let folderMenu = new ContentActionModel();
|
||||
const folderMenu = new ContentActionModel();
|
||||
folderMenu.target = 'folder';
|
||||
|
||||
let documentMenu = new ContentActionModel();
|
||||
const documentMenu = new ContentActionModel();
|
||||
documentMenu.target = 'document';
|
||||
|
||||
documentList.actions = [
|
||||
@@ -297,7 +297,7 @@ describe('DocumentList', () => {
|
||||
|
||||
it('should disable the action if there is no permission for the file and disableWithNoPermission true', () => {
|
||||
documentList.currentFolderId = 'fake-node-id';
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
disableWithNoPermission: true,
|
||||
permission: 'delete',
|
||||
target: 'document',
|
||||
@@ -308,9 +308,9 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: ['create', 'update'] } };
|
||||
const nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: ['create', 'update'] } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FileAction');
|
||||
expect(actions[0].disabled).toBe(true);
|
||||
@@ -382,7 +382,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should not disable the action if there is copy permission', () => {
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
disableWithNoPermission: true,
|
||||
permission: 'copy',
|
||||
target: 'document',
|
||||
@@ -393,9 +393,9 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: ['create', 'update'] } };
|
||||
const nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: ['create', 'update'] } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FileAction');
|
||||
expect(actions[0].disabled).toBeFalsy();
|
||||
@@ -403,7 +403,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should disable the action if there is no permission for the folder and disableWithNoPermission true', () => {
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
disableWithNoPermission: true,
|
||||
permission: 'delete',
|
||||
target: 'folder',
|
||||
@@ -414,9 +414,9 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFolder: true, name: 'xyz', allowableOperations: ['create', 'update'] } };
|
||||
const nodeFile = { entry: { isFolder: true, name: 'xyz', allowableOperations: ['create', 'update'] } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FolderAction');
|
||||
expect(actions[0].disabled).toBe(true);
|
||||
@@ -424,7 +424,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should not disable the action if there is the right permission for the file', () => {
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
disableWithNoPermission: true,
|
||||
permission: 'delete',
|
||||
target: 'document',
|
||||
@@ -435,16 +435,16 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: ['create', 'update', 'delete'] } };
|
||||
const nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: ['create', 'update', 'delete'] } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FileAction');
|
||||
expect(actions[0].disabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should not disable the action if there is the right permission for the folder', () => {
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
disableWithNoPermission: true,
|
||||
permission: 'delete',
|
||||
target: 'folder',
|
||||
@@ -455,16 +455,16 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFolder: true, name: 'xyz', allowableOperations: ['create', 'update', 'delete'] } };
|
||||
const nodeFile = { entry: { isFolder: true, name: 'xyz', allowableOperations: ['create', 'update', 'delete'] } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FolderAction');
|
||||
expect(actions[0].disabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should not disable the action if there are no permissions for the file and disable with no permission is false', () => {
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
permission: 'delete',
|
||||
target: 'document',
|
||||
title: 'FileAction',
|
||||
@@ -475,16 +475,16 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: null } };
|
||||
const nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: null } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FileAction');
|
||||
expect(actions[0].disabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should not disable the action if there are no permissions for the folder and disable with no permission is false', () => {
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
permission: 'delete',
|
||||
target: 'folder',
|
||||
title: 'FolderAction',
|
||||
@@ -495,16 +495,16 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFolder: true, name: 'xyz', allowableOperations: null } };
|
||||
const nodeFile = { entry: { isFolder: true, name: 'xyz', allowableOperations: null } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FolderAction');
|
||||
expect(actions[0].disabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should disable the action if there are no permissions for the file and disable with no permission is true', () => {
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
permission: 'delete',
|
||||
target: 'document',
|
||||
title: 'FileAction',
|
||||
@@ -515,9 +515,9 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: null } };
|
||||
const nodeFile = { entry: { isFile: true, name: 'xyz', allowableOperations: null } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FileAction');
|
||||
expect(actions[0].disabled).toBeDefined();
|
||||
@@ -525,7 +525,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should disable the action if there are no permissions for the folder and disable with no permission is true', () => {
|
||||
let documentMenu = new ContentActionModel({
|
||||
const documentMenu = new ContentActionModel({
|
||||
permission: 'delete',
|
||||
target: 'folder',
|
||||
title: 'FolderAction',
|
||||
@@ -536,9 +536,9 @@ describe('DocumentList', () => {
|
||||
documentMenu
|
||||
];
|
||||
|
||||
let nodeFile = { entry: { isFolder: true, name: 'xyz', allowableOperations: null } };
|
||||
const nodeFile = { entry: { isFolder: true, name: 'xyz', allowableOperations: null } };
|
||||
|
||||
let actions = documentList.getNodeActions(nodeFile);
|
||||
const actions = documentList.getNodeActions(nodeFile);
|
||||
expect(actions.length).toBe(1);
|
||||
expect(actions[0].title).toEqual('FolderAction');
|
||||
expect(actions[0].disabled).toBeDefined();
|
||||
@@ -546,7 +546,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should find no content actions', () => {
|
||||
let documentButton = new ContentActionModel();
|
||||
const documentButton = new ContentActionModel();
|
||||
documentButton.target = 'document';
|
||||
documentList.actions = [documentButton];
|
||||
|
||||
@@ -560,8 +560,8 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should emit nodeClick event', (done) => {
|
||||
let node = new FileNode();
|
||||
let disposableClick = documentList.nodeClick.subscribe((e) => {
|
||||
const node = new FileNode();
|
||||
const disposableClick = documentList.nodeClick.subscribe((e) => {
|
||||
expect(e.value).toBe(node);
|
||||
disposableClick.unsubscribe();
|
||||
done();
|
||||
@@ -570,7 +570,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should display folder content on click', () => {
|
||||
let node = new FolderNode('<display name>');
|
||||
const node = new FolderNode('<display name>');
|
||||
|
||||
spyOn(documentList, 'loadFolder').and.returnValue(Promise.resolve(true));
|
||||
|
||||
@@ -593,7 +593,7 @@ describe('DocumentList', () => {
|
||||
expect(documentList.navigate).toBe(true);
|
||||
spyOn(documentList, 'loadFolder').and.stub();
|
||||
|
||||
let node = new FileNode();
|
||||
const node = new FileNode();
|
||||
documentList.onNodeClick(node);
|
||||
|
||||
expect(documentList.loadFolder).not.toHaveBeenCalled();
|
||||
@@ -602,7 +602,7 @@ describe('DocumentList', () => {
|
||||
it('should not display folder content on click when navigation is off', () => {
|
||||
spyOn(documentList, 'loadFolder').and.stub();
|
||||
|
||||
let node = new FolderNode('<display name>');
|
||||
const node = new FolderNode('<display name>');
|
||||
documentList.navigate = false;
|
||||
documentList.onNodeClick(node);
|
||||
|
||||
@@ -610,7 +610,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should execute context action on callback', () => {
|
||||
let action = {
|
||||
const action = {
|
||||
node: {},
|
||||
model: {}
|
||||
};
|
||||
@@ -629,7 +629,7 @@ describe('DocumentList', () => {
|
||||
it('should subscribe to context action handler', () => {
|
||||
spyOn(documentList, 'loadFolder').and.stub();
|
||||
spyOn(documentList, 'contextActionCallback').and.stub();
|
||||
let value = {};
|
||||
const value = {};
|
||||
documentList.ngOnInit();
|
||||
documentList.contextActionHandler.next(value);
|
||||
expect(documentList.contextActionCallback).toHaveBeenCalledWith(value);
|
||||
@@ -650,8 +650,8 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should emit file preview event on single click', (done) => {
|
||||
let file = new FileNode();
|
||||
let disposablePreview = documentList.preview.subscribe((e) => {
|
||||
const file = new FileNode();
|
||||
const disposablePreview = documentList.preview.subscribe((e) => {
|
||||
expect(e.value).toBe(file);
|
||||
disposablePreview.unsubscribe();
|
||||
done();
|
||||
@@ -661,8 +661,8 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should emit file preview event on double click', (done) => {
|
||||
let file = new FileNode();
|
||||
let disposablePreview = documentList.preview.subscribe((e) => {
|
||||
const file = new FileNode();
|
||||
const disposablePreview = documentList.preview.subscribe((e) => {
|
||||
expect(e.value).toBe(file);
|
||||
disposablePreview.unsubscribe();
|
||||
done();
|
||||
@@ -672,7 +672,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should perform folder navigation on single click', () => {
|
||||
let folder = new FolderNode();
|
||||
const folder = new FolderNode();
|
||||
spyOn(documentList, 'navigateTo').and.stub();
|
||||
|
||||
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||
@@ -681,7 +681,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should perform folder navigation on double click', () => {
|
||||
let folder = new FolderNode();
|
||||
const folder = new FolderNode();
|
||||
spyOn(documentList, 'navigateTo').and.stub();
|
||||
|
||||
documentList.navigationMode = DocumentListComponent.DOUBLE_CLICK_NAVIGATION;
|
||||
@@ -690,7 +690,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should not perform folder navigation on double click when single mode', () => {
|
||||
let folder = new FolderNode();
|
||||
const folder = new FolderNode();
|
||||
spyOn(documentList, 'navigateTo').and.stub();
|
||||
|
||||
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||
@@ -700,7 +700,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should not perform folder navigation on double click when navigation off', () => {
|
||||
let folder = new FolderNode();
|
||||
const folder = new FolderNode();
|
||||
spyOn(documentList, 'navigateTo').and.stub();
|
||||
|
||||
documentList.navigate = false;
|
||||
@@ -711,8 +711,8 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should perform navigation for folder node only', () => {
|
||||
let folder = new FolderNode();
|
||||
let file = new FileNode();
|
||||
const folder = new FolderNode();
|
||||
const file = new FileNode();
|
||||
|
||||
spyOn(documentList, 'loadFolder').and.stub();
|
||||
|
||||
@@ -722,7 +722,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should perform navigation through corret linked folder', () => {
|
||||
let linkFolder = new FolderNode();
|
||||
const linkFolder = new FolderNode();
|
||||
linkFolder.entry.id = 'link-folder';
|
||||
linkFolder.entry.nodeType = 'app:folderlink';
|
||||
linkFolder.entry.properties['cm:destination'] = 'normal-folder';
|
||||
@@ -734,7 +734,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should require valid node for file preview', () => {
|
||||
let file = new FileNode();
|
||||
const file = new FileNode();
|
||||
file.entry = null;
|
||||
let called = false;
|
||||
|
||||
@@ -750,7 +750,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should require valid node for folder navigation', () => {
|
||||
let folder = new FolderNode();
|
||||
const folder = new FolderNode();
|
||||
folder.entry = null;
|
||||
spyOn(documentList, 'navigateTo').and.stub();
|
||||
|
||||
@@ -781,18 +781,18 @@ describe('DocumentList', () => {
|
||||
it('should require node to resolve context menu actions', () => {
|
||||
expect(documentList.getContextActions(null)).toBeNull();
|
||||
|
||||
let file = new FileNode();
|
||||
const file = new FileNode();
|
||||
file.entry = null;
|
||||
|
||||
expect(documentList.getContextActions(file)).toBeNull();
|
||||
});
|
||||
|
||||
it('should fetch context menu actions for a file node', () => {
|
||||
let actionModel: any = {};
|
||||
const actionModel: any = {};
|
||||
spyOn(documentList, 'getNodeActions').and.returnValue([actionModel]);
|
||||
|
||||
let file = new FileNode();
|
||||
let actions = documentList.getContextActions(file);
|
||||
const file = new FileNode();
|
||||
const actions = documentList.getContextActions(file);
|
||||
|
||||
expect(documentList.getNodeActions).toHaveBeenCalledWith(file);
|
||||
expect(actions.length).toBe(1);
|
||||
@@ -802,11 +802,11 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should fetch context menu actions for a folder node', () => {
|
||||
let actionModel: any = {};
|
||||
const actionModel: any = {};
|
||||
spyOn(documentList, 'getNodeActions').and.returnValue([actionModel]);
|
||||
|
||||
let folder = new FolderNode();
|
||||
let actions = documentList.getContextActions(folder);
|
||||
const folder = new FolderNode();
|
||||
const actions = documentList.getContextActions(folder);
|
||||
|
||||
expect(documentList.getNodeActions).toHaveBeenCalledWith(folder);
|
||||
expect(actions.length).toBe(1);
|
||||
@@ -818,19 +818,19 @@ describe('DocumentList', () => {
|
||||
it('should fetch no context menu actions for unknown type', () => {
|
||||
spyOn(documentList, 'getNodeActions').and.stub();
|
||||
|
||||
let node = new FileNode();
|
||||
const node = new FileNode();
|
||||
node.entry.isFile = false;
|
||||
node.entry.isFolder = false;
|
||||
|
||||
let actions = documentList.getContextActions(node);
|
||||
const actions = documentList.getContextActions(node);
|
||||
expect(actions).toBeNull();
|
||||
});
|
||||
|
||||
it('should return null value when no content actions found', () => {
|
||||
spyOn(documentList, 'getNodeActions').and.returnValue([]);
|
||||
|
||||
let file = new FileNode();
|
||||
let actions = documentList.getContextActions(file);
|
||||
const file = new FileNode();
|
||||
const actions = documentList.getContextActions(file);
|
||||
|
||||
expect(actions).toBeNull();
|
||||
expect(documentList.getNodeActions).toHaveBeenCalled();
|
||||
@@ -872,7 +872,7 @@ describe('DocumentList', () => {
|
||||
|
||||
it('should set row filter and reload contents if currentFolderId is set when setting rowFilter', () => {
|
||||
fixture.detectChanges();
|
||||
let filter = <RowFilter> {};
|
||||
const filter = <RowFilter> {};
|
||||
documentList.currentFolderId = 'id';
|
||||
spyOn(documentList.data, 'setFilter').and.callThrough();
|
||||
spyOn(documentListService, 'getFolder').and.callThrough();
|
||||
@@ -894,7 +894,7 @@ describe('DocumentList', () => {
|
||||
|
||||
it('should set image resolver for underlying adapter', () => {
|
||||
fixture.detectChanges();
|
||||
let resolver = <ImageResolver> {};
|
||||
const resolver = <ImageResolver> {};
|
||||
spyOn(documentList.data, 'setImageResolver').and.callThrough();
|
||||
|
||||
documentList.ngOnChanges({ imageResolver: new SimpleChange(null, resolver, true) });
|
||||
@@ -903,7 +903,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should emit [nodeClick] event on row click', () => {
|
||||
let node = new NodeMinimalEntry();
|
||||
const node = new NodeMinimalEntry();
|
||||
|
||||
spyOn(documentList, 'onNodeClick').and.callThrough();
|
||||
documentList.onNodeClick(node);
|
||||
@@ -911,7 +911,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should emit node-click DOM event', (done) => {
|
||||
let node = new NodeMinimalEntry();
|
||||
const node = new NodeMinimalEntry();
|
||||
|
||||
document.addEventListener('node-click', (customEvent: CustomEvent) => {
|
||||
done();
|
||||
@@ -921,7 +921,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should emit [nodeDblClick] event on row double-click', () => {
|
||||
let node = new NodeMinimalEntry();
|
||||
const node = new NodeMinimalEntry();
|
||||
|
||||
spyOn(documentList, 'onNodeDblClick').and.callThrough();
|
||||
documentList.onNodeDblClick(node);
|
||||
@@ -929,7 +929,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should emit node-dblclick DOM event', (done) => {
|
||||
let node = new NodeMinimalEntry();
|
||||
const node = new NodeMinimalEntry();
|
||||
|
||||
document.addEventListener('node-dblclick', (customEvent: CustomEvent) => {
|
||||
done();
|
||||
@@ -952,7 +952,7 @@ describe('DocumentList', () => {
|
||||
const error = { message: '{ "error": { "statusCode": 501 } }' };
|
||||
spyOn(documentListService, 'getFolder').and.returnValue(throwError(error));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe(error);
|
||||
disposableError.unsubscribe();
|
||||
done();
|
||||
@@ -975,7 +975,7 @@ describe('DocumentList', () => {
|
||||
const error = { message: '{ "error": { "statusCode": 403 } }' };
|
||||
spyOn(documentListService, 'getFolder').and.returnValue(throwError(error));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe(error);
|
||||
expect(documentList.noPermission).toBe(true);
|
||||
disposableError.unsubscribe();
|
||||
@@ -1020,7 +1020,7 @@ describe('DocumentList', () => {
|
||||
spyOn(documentListService, 'getFolder').and.returnValue(throwError(error));
|
||||
|
||||
documentList.loadFolder();
|
||||
let clickedFolderNode = new FolderNode('fake-folder-node');
|
||||
const clickedFolderNode = new FolderNode('fake-folder-node');
|
||||
documentList.onNodeDblClick(clickedFolderNode);
|
||||
|
||||
expect(documentList.noPermission).toBeTruthy();
|
||||
@@ -1049,7 +1049,7 @@ describe('DocumentList', () => {
|
||||
it('should emit error when fetch trashcan fails', (done) => {
|
||||
spyOn(apiService.nodesApi, 'getDeletedNodes').and.returnValue(Promise.reject('error'));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe('error');
|
||||
disposableError.unsubscribe();
|
||||
done();
|
||||
@@ -1070,7 +1070,7 @@ describe('DocumentList', () => {
|
||||
spyOn(apiService.getInstance().core.sharedlinksApi, 'findSharedLinks')
|
||||
.and.returnValue(Promise.reject('error'));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe('error');
|
||||
disposableError.unsubscribe();
|
||||
done();
|
||||
@@ -1089,7 +1089,7 @@ describe('DocumentList', () => {
|
||||
it('should emit error when fetch sites fails', (done) => {
|
||||
spyGetSites.and.returnValue(Promise.reject('error'));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe('error');
|
||||
disposableError.unsubscribe();
|
||||
done();
|
||||
@@ -1101,7 +1101,7 @@ describe('DocumentList', () => {
|
||||
it('should assure that sites have name property set', (done) => {
|
||||
fixture.detectChanges();
|
||||
|
||||
let disposableReady = documentList.ready.subscribe((page) => {
|
||||
const disposableReady = documentList.ready.subscribe((page) => {
|
||||
const entriesWithoutName = page.list.entries.filter((item) => !item.entry.name);
|
||||
expect(entriesWithoutName.length).toBe(0);
|
||||
disposableReady.unsubscribe();
|
||||
@@ -1114,7 +1114,7 @@ describe('DocumentList', () => {
|
||||
it('should assure that sites have name property set correctly', (done) => {
|
||||
fixture.detectChanges();
|
||||
|
||||
let disposableReady = documentList.ready.subscribe((page) => {
|
||||
const disposableReady = documentList.ready.subscribe((page) => {
|
||||
const wrongName = page.list.entries.filter((item) => (item.entry.name !== item.entry.title));
|
||||
expect(wrongName.length).toBe(0);
|
||||
disposableReady.unsubscribe();
|
||||
@@ -1136,7 +1136,7 @@ describe('DocumentList', () => {
|
||||
spyOn(apiService.getInstance().core.peopleApi, 'listSiteMembershipsForPerson')
|
||||
.and.returnValue(Promise.reject('error'));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe('error');
|
||||
disposableError.unsubscribe();
|
||||
done();
|
||||
@@ -1153,7 +1153,7 @@ describe('DocumentList', () => {
|
||||
documentList.loadFolderByNodeId('-mysites-');
|
||||
expect(peopleApi.listSiteMembershipsForPerson).toHaveBeenCalled();
|
||||
|
||||
let disposableReady = documentList.ready.subscribe((page) => {
|
||||
const disposableReady = documentList.ready.subscribe((page) => {
|
||||
const entriesWithoutName = page.list.entries.filter((item) => !item.entry.name);
|
||||
expect(entriesWithoutName.length).toBe(0);
|
||||
disposableReady.unsubscribe();
|
||||
@@ -1169,7 +1169,7 @@ describe('DocumentList', () => {
|
||||
documentList.loadFolderByNodeId('-mysites-');
|
||||
expect(peopleApi.listSiteMembershipsForPerson).toHaveBeenCalled();
|
||||
|
||||
let disposableReady = documentList.ready.subscribe((page) => {
|
||||
const disposableReady = documentList.ready.subscribe((page) => {
|
||||
const wrongName = page.list.entries.filter((item) => (item.entry.name !== item.entry.title));
|
||||
expect(wrongName.length).toBe(0);
|
||||
disposableReady.unsubscribe();
|
||||
@@ -1188,7 +1188,7 @@ describe('DocumentList', () => {
|
||||
it('should emit error when fetch favorites fails', (done) => {
|
||||
spyFavorite.and.returnValue(Promise.reject('error'));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe('error');
|
||||
disposableError.unsubscribe();
|
||||
done();
|
||||
@@ -1200,7 +1200,7 @@ describe('DocumentList', () => {
|
||||
it('should fetch recent', () => {
|
||||
const person = { entry: { id: 'person ' } };
|
||||
|
||||
let getPersonSpy = spyOn(apiService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(person));
|
||||
const getPersonSpy = spyOn(apiService.peopleApi, 'getPerson').and.returnValue(Promise.resolve(person));
|
||||
|
||||
documentList.loadFolderByNodeId('-recent-');
|
||||
|
||||
@@ -1210,7 +1210,7 @@ describe('DocumentList', () => {
|
||||
it('should emit error when fetch recent fails on getPerson call', (done) => {
|
||||
spyOn(apiService.peopleApi, 'getPerson').and.returnValue(Promise.reject('error'));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe('error');
|
||||
disposableError.unsubscribe();
|
||||
done();
|
||||
@@ -1222,7 +1222,7 @@ describe('DocumentList', () => {
|
||||
it('should emit error when fetch recent fails on search call', (done) => {
|
||||
spyOn(customResourcesService, 'loadFolderByNodeId').and.returnValue(throwError('error'));
|
||||
|
||||
let disposableError = documentList.error.subscribe((val) => {
|
||||
const disposableError = documentList.error.subscribe((val) => {
|
||||
expect(val).toBe('error');
|
||||
disposableError.unsubscribe();
|
||||
done();
|
||||
@@ -1297,7 +1297,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should reset the pagination when enter in a new folder', () => {
|
||||
let folder = new FolderNode();
|
||||
const folder = new FolderNode();
|
||||
documentList.navigationMode = DocumentListComponent.SINGLE_CLICK_NAVIGATION;
|
||||
documentList.updatePagination({
|
||||
maxItems: 10,
|
||||
|
@@ -334,7 +334,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
|
||||
getContextActions(node: NodeEntry) {
|
||||
if (node && node.entry) {
|
||||
let actions = this.getNodeActions(node);
|
||||
const actions = this.getNodeActions(node);
|
||||
if (actions && actions.length > 0) {
|
||||
return actions.map((currentAction: ContentActionModel) => {
|
||||
return {
|
||||
@@ -419,7 +419,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
this.data.setColumns(schema);
|
||||
}
|
||||
|
||||
let columns = this.data.getColumns();
|
||||
const columns = this.data.getColumns();
|
||||
if (!columns || columns.length === 0) {
|
||||
this.setupDefaultColumns(this._currentFolderId);
|
||||
}
|
||||
@@ -445,7 +445,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
|
||||
if (this.data) {
|
||||
if (changes.node && changes.node.currentValue) {
|
||||
let merge = this._pagination ? this._pagination.merge : false;
|
||||
const merge = this._pagination ? this._pagination.merge : false;
|
||||
|
||||
this.data.loadPage(changes.node.currentValue, merge);
|
||||
this.onDataReady(changes.node.currentValue);
|
||||
@@ -492,7 +492,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
return actions;
|
||||
}
|
||||
|
||||
let actionsByTarget = this.actions
|
||||
const actionsByTarget = this.actions
|
||||
.filter((entry) => {
|
||||
const isVisible = (typeof entry.visible === 'function')
|
||||
? entry.visible(node)
|
||||
@@ -653,7 +653,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
}
|
||||
|
||||
getSourceNodeWithPath(nodeId: string): Observable<NodeEntry> {
|
||||
let getSourceObservable = this.documentListService.getFolderNode(nodeId, this.includeFields);
|
||||
const getSourceObservable = this.documentListService.getFolderNode(nodeId, this.includeFields);
|
||||
|
||||
getSourceObservable.subscribe((nodeEntry: NodeEntry) => {
|
||||
this.folderNode = nodeEntry.entry;
|
||||
@@ -784,8 +784,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
|
||||
onShowRowContextMenu(event: DataCellEvent) {
|
||||
if (this.contextMenuActions) {
|
||||
let args = event.value;
|
||||
let node = (<ShareDataRow> args.row).node;
|
||||
const args = event.value;
|
||||
const node = (<ShareDataRow> args.row).node;
|
||||
if (node) {
|
||||
args.actions = this.getContextActions(node) || [];
|
||||
}
|
||||
@@ -794,8 +794,8 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
|
||||
onShowRowActionsMenu(event: DataCellEvent) {
|
||||
if (this.contentActions) {
|
||||
let args = event.value;
|
||||
let node = (<ShareDataRow> args.row).node;
|
||||
const args = event.value;
|
||||
const node = (<ShareDataRow> args.row).node;
|
||||
if (node) {
|
||||
args.actions = this.getNodeActions(node) || [];
|
||||
}
|
||||
@@ -804,9 +804,9 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
|
||||
onExecuteRowAction(event: DataRowActionEvent) {
|
||||
if (this.contentActions) {
|
||||
let args = event.value;
|
||||
let node = (<ShareDataRow> args.row).node;
|
||||
let action = (<ContentActionModel> args.action);
|
||||
const args = event.value;
|
||||
const node = (<ShareDataRow> args.row).node;
|
||||
const action = (<ContentActionModel> args.action);
|
||||
this.executeContentAction(node, action);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user