diff --git a/e2e/suites/actions/toolbar-multiple-selection.test.ts b/e2e/suites/actions/toolbar-multiple-selection.test.ts
index 56c67ac1d..a717626db 100755
--- a/e2e/suites/actions/toolbar-multiple-selection.test.ts
+++ b/e2e/suites/actions/toolbar-multiple-selection.test.ts
@@ -135,11 +135,6 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
- .then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
- })
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
@@ -154,11 +149,6 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1, folder2])
- .then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
- })
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
@@ -171,13 +161,39 @@ describe('Toolbar actions - multiple selection : ', () => {
.then(() => dataTable.clearSelection());
});
+ it('should display View action when at least one file selected', async () => {
+ await dataTable.selectMultipleItems([folder1, file1, folder2]);
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'Action is not displayed');
+ });
+
+ it('should not display View action when only folders selected', async () => {
+ await dataTable.selectMultipleItems([folder1, folder2]);
+ expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'Action is displayed');
+ });
+
+ it('should display Download action for selected items', async () => {
+ await dataTable.selectMultipleItems([folder1, file1, folder2]);
+ expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Action is not displayed');
+ });
+
+ it('should not display Download action for empty selection', async () => {
+ await dataTable.selectMultipleItems([folder1, file1, folder2]);
+ await dataTable.clearSelection();
+ expect(toolbar.actions.isButtonPresent('Download')).toBe(false, 'Action is displayed');
+ });
+
+ it('should display Edit action when at least one folder selected', async () => {
+ await dataTable.selectMultipleItems([folder1, file1, folder2]);
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, 'Action is not displayed');
+ });
+
+ it('should not display Edit action if no folders selected', async () => {
+ await dataTable.selectMultipleItems([file1, file2]);
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Action is displayed');
+ });
+
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([file1, file2, folder1, folder2])
- .then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
- })
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
@@ -228,7 +244,7 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1Admin, file2Admin])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'View not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
@@ -247,9 +263,9 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1Admin, folder2Admin])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
+ expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, 'Edit is not displayed');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
@@ -266,9 +282,9 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'View is not displayed');
+ expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, 'Edit is not displayed');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
@@ -295,7 +311,7 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1Admin, file2Admin])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'View is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
@@ -314,16 +330,16 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1Admin, folder2Admin])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
+ expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
- expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed for selected files`);
- expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed for selected files`);
- expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed for selected files`);
- expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed for selected files`);
+ expect(menu.isMenuItemPresent('Copy')).toBe(true, `Copy is not displayed`);
+ expect(menu.isMenuItemPresent('Delete')).toBe(false, `Delete is displayed`);
+ expect(menu.isMenuItemPresent('Move')).toBe(false, `Move is displayed`);
+ expect(menu.isMenuItemPresent('Favorite')).toBe(true, `Favorite is not displayed`);
})
// .then(() => browser.$('body').click())
.then(() => browser.actions().mouseMove(browser.$('body'), { x: 0, y: 0 }).click().perform())
@@ -333,9 +349,9 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([file1Admin, file2Admin, folder1Admin, folder2Admin])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'View is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
@@ -369,7 +385,7 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'View is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
})
@@ -404,9 +420,9 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'View is not displayed');
+ expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
@@ -439,9 +455,9 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple files are selected', () => {
dataTable.selectMultipleItems([file1, file2])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'View is not displayed');
+ expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
@@ -458,9 +474,9 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when multiple folders are selected', () => {
dataTable.selectMultipleItems([folder1, folder2])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed');
+ expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed');
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, 'Edit is not displayed');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
@@ -477,9 +493,9 @@ describe('Toolbar actions - multiple selection : ', () => {
it('correct actions appear when both files and folders are selected', () => {
dataTable.selectMultipleItems([file1, file2, folder1, folder2])
.then(() => {
- expect(toolbar.actions.isButtonPresent('View')).toBe(false, 'View is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('View')).toBe(true, 'View is not displayed');
expect(toolbar.actions.isButtonPresent('Download')).toBe(true, 'Download is not displayed for selected files');
- expect(toolbar.actions.isButtonPresent('Edit')).toBe(false, 'Edit is displayed for selected files');
+ expect(toolbar.actions.isButtonPresent('Edit')).toBe(true, 'Edit is not displayed');
})
.then(() => toolbar.actions.openMoreMenu())
.then(menu => {
diff --git a/package-lock.json b/package-lock.json
index 944545eca..76829abc0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,11 +5,11 @@
"requires": true,
"dependencies": {
"@alfresco/adf-content-services": {
- "version": "2.4.0-beta10",
- "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-2.4.0-beta10.tgz",
- "integrity": "sha512-uBHkDrp60oeen770MjCh8aCFZm/g8nOIdilruB26EXaj9KOE3ZJ2ptGrHVGf51qrWRyDjnne/dwKvHW2O+kxvA==",
+ "version": "2.4.0-24b573b08f3a072327efefc0196bd949cbca3766",
+ "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-2.4.0-24b573b08f3a072327efefc0196bd949cbca3766.tgz",
+ "integrity": "sha512-5B/JHEsCdvksEP16TyS5yHtOT/zCOLj7uHS8lqGhu7Z20Cj5K7RTBwco4flTh3T8OSyoUBzdmp3HQgfqJk/QrQ==",
"requires": {
- "@alfresco/adf-core": "2.4.0-beta10",
+ "@alfresco/adf-core": "2.4.0-24b573b08f3a072327efefc0196bd949cbca3766",
"@angular/animations": "5.1.1",
"@angular/cdk": "5.0.1",
"@angular/common": "5.1.1",
@@ -24,7 +24,7 @@
"@angular/platform-browser-dynamic": "5.1.1",
"@angular/router": "5.1.1",
"@ngx-translate/core": "9.1.1",
- "alfresco-js-api": "2.4.0-beta9",
+ "alfresco-js-api": "2.4.0-fed4e011ee70eb36b5e2015859e719153d70b6c2",
"chart.js": "2.5.0",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
@@ -40,15 +40,6 @@
"zone.js": "0.8.14"
},
"dependencies": {
- "alfresco-js-api": {
- "version": "2.4.0-beta9",
- "resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-2.4.0-beta9.tgz",
- "integrity": "sha512-4SlaFerEucx+Gnusf4dwhEfrCvwWTKBxJm1kwe7eoKnPJO0I6B/Zx1I/Dkvvw4GVqO2f5WYoab+XGQSdMNyOng==",
- "requires": {
- "event-emitter": "0.3.4",
- "superagent": "3.8.2"
- }
- },
"core-js": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz",
@@ -70,9 +61,9 @@
}
},
"@alfresco/adf-core": {
- "version": "2.4.0-beta10",
- "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-2.4.0-beta10.tgz",
- "integrity": "sha512-w8W6Uv9QfLOWojF+2zpvnjlYsAhJErawc77rIFPROQIN81nibSQ8Y6Xm3NdsrCz2drlrKbx5XD8yzia+2QKeyw==",
+ "version": "2.4.0-24b573b08f3a072327efefc0196bd949cbca3766",
+ "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-2.4.0-24b573b08f3a072327efefc0196bd949cbca3766.tgz",
+ "integrity": "sha512-vDC4Wz+j6uSEMzdZUhy5xB0Sm63brb360o+uiPXs0uMyL9agMEh5wUPAl4Zfic0alnlww8OGADA8r6sFwb7HhQ==",
"requires": {
"@angular/animations": "5.1.1",
"@angular/cdk": "5.0.1",
@@ -88,7 +79,7 @@
"@angular/platform-browser-dynamic": "5.1.1",
"@angular/router": "5.1.1",
"@ngx-translate/core": "9.1.1",
- "alfresco-js-api": "2.4.0-beta9",
+ "alfresco-js-api": "2.4.0-fed4e011ee70eb36b5e2015859e719153d70b6c2",
"chart.js": "2.5.0",
"core-js": "2.4.1",
"hammerjs": "2.0.8",
@@ -104,15 +95,6 @@
"zone.js": "0.8.14"
},
"dependencies": {
- "alfresco-js-api": {
- "version": "2.4.0-beta9",
- "resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-2.4.0-beta9.tgz",
- "integrity": "sha512-4SlaFerEucx+Gnusf4dwhEfrCvwWTKBxJm1kwe7eoKnPJO0I6B/Zx1I/Dkvvw4GVqO2f5WYoab+XGQSdMNyOng==",
- "requires": {
- "event-emitter": "0.3.4",
- "superagent": "3.8.2"
- }
- },
"core-js": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz",
@@ -674,9 +656,9 @@
"integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo="
},
"alfresco-js-api": {
- "version": "2.4.0-beta9",
- "resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-2.4.0-beta9.tgz",
- "integrity": "sha512-4SlaFerEucx+Gnusf4dwhEfrCvwWTKBxJm1kwe7eoKnPJO0I6B/Zx1I/Dkvvw4GVqO2f5WYoab+XGQSdMNyOng==",
+ "version": "2.4.0-fed4e011ee70eb36b5e2015859e719153d70b6c2",
+ "resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-2.4.0-fed4e011ee70eb36b5e2015859e719153d70b6c2.tgz",
+ "integrity": "sha512-HWA2zLbuRTi1mjIoaEW2ZSWKMDfOWcYOgplFZovQgXUOaFZuPJH1AQ7RbImq/G5/NKwe9AJSUAnkg5vpuKEBTg==",
"requires": {
"event-emitter": "0.3.4",
"superagent": "3.8.2"
@@ -2400,9 +2382,9 @@
"dev": true
},
"cookiejar": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.1.tgz",
- "integrity": "sha1-Qa1XsbVVlR7BcUEqgZQrHoIA00o="
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz",
+ "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA=="
},
"copy-concurrently": {
"version": "1.0.5",
diff --git a/package.json b/package.json
index 2799ebc8f..ff5d8ffcd 100644
--- a/package.json
+++ b/package.json
@@ -25,8 +25,8 @@
},
"private": true,
"dependencies": {
- "@alfresco/adf-content-services": "2.4.0-beta10",
- "@alfresco/adf-core": "2.4.0-beta10",
+ "@alfresco/adf-content-services": "2.4.0-24b573b08f3a072327efefc0196bd949cbca3766",
+ "@alfresco/adf-core": "2.4.0-24b573b08f3a072327efefc0196bd949cbca3766",
"@angular/animations": "5.1.1",
"@angular/cdk": "5.0.1",
"@angular/common": "5.1.1",
@@ -48,7 +48,7 @@
"@ngrx/store-devtools": "^5.2.0",
"@ngstack/electron": "0.1.0",
"@ngx-translate/core": "9.1.1",
- "alfresco-js-api": "2.4.0-beta9",
+ "alfresco-js-api": "2.4.0-fed4e011ee70eb36b5e2015859e719153d70b6c2",
"core-js": "2.5.3",
"cspell": "^2.1.12",
"hammerjs": "2.0.8",
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 8776393e8..46bf6cfe1 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -62,7 +62,6 @@ import { NodeMoveDirective } from './common/directives/node-move.directive';
import { NodeRestoreDirective } from './common/directives/node-restore.directive';
import { NodePermanentDeleteDirective } from './common/directives/node-permanent-delete.directive';
import { NodeUnshareDirective } from './common/directives/node-unshare.directive';
-import { NodeInfoDirective } from './common/directives/node-info.directive';
import { NodeVersionsDirective } from './common/directives/node-versions.directive';
import { VersionManagerDialogAdapterComponent } from './components/versions-dialog/version-manager-dialog-adapter.component';
import { BrowsingFilesService } from './common/services/browsing-files.service';
@@ -77,6 +76,7 @@ import { SortingPreferenceKeyDirective } from './directives/sorting-preference-k
import { INITIAL_STATE } from './store/states/app.state';
import { appReducer } from './store/reducers/app.reducer';
+import { InfoDrawerComponent } from './components/info-drawer/info-drawer.component';
@NgModule({
@@ -127,12 +127,12 @@ import { appReducer } from './store/reducers/app.reducer';
NodeRestoreDirective,
NodePermanentDeleteDirective,
NodeUnshareDirective,
- NodeInfoDirective,
NodeVersionsDirective,
VersionManagerDialogAdapterComponent,
SearchComponent,
SettingsComponent,
- SortingPreferenceKeyDirective
+ SortingPreferenceKeyDirective,
+ InfoDrawerComponent
],
providers: [
{ provide: AppConfigService, useClass: HybridAppConfigService },
diff --git a/src/app/common/directives/node-info.directive.spec.ts b/src/app/common/directives/node-info.directive.spec.ts
deleted file mode 100644
index 5b9784615..000000000
--- a/src/app/common/directives/node-info.directive.spec.ts
+++ /dev/null
@@ -1,121 +0,0 @@
-/*!
- * @license
- * Alfresco Example Content Application
- *
- * Copyright (C) 2005 - 2018 Alfresco Software Limited
- *
- * This file is part of the Alfresco Example Content Application.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-
-import { Component } from '@angular/core';
-import { ComponentFixture, TestBed, async, fakeAsync, tick } from '@angular/core/testing';
-import { AlfrescoApiService, CoreModule } from '@alfresco/adf-core';
-import { NodeInfoDirective } from './node-info.directive';
-
-@Component({
- template: '
'
-})
-class TestComponent {
- selection;
-}
-
-describe('NodeInfoDirective', () => {
- let fixture: ComponentFixture;
- let component: TestComponent;
- let apiService: AlfrescoApiService;
- let nodeService;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- imports: [
- CoreModule
- ],
- declarations: [
- TestComponent,
- NodeInfoDirective
- ]
- });
-
- fixture = TestBed.createComponent(TestComponent);
- component = fixture.componentInstance;
- apiService = TestBed.get(AlfrescoApiService);
- }));
-
- beforeEach(() => {
- nodeService = apiService.getInstance().nodes;
-
- spyOn(nodeService, 'getNodeInfo').and.returnValue(Promise.resolve({
- entry: { name: 'borg' }
- }));
- });
-
- it('should not get node info onInit when selection is empty', () => {
- component.selection = [];
-
- fixture.detectChanges();
-
- expect(nodeService.getNodeInfo).not.toHaveBeenCalled();
- });
-
- it('should get node info onInit when selection is not empty', () => {
- component.selection = [{ entry: { id: 'id' } }];
-
- fixture.detectChanges();
-
- expect(nodeService.getNodeInfo).toHaveBeenCalled();
- });
-
- it('should not get node info on event when selection is empty', () => {
- component.selection = [];
-
- fixture.detectChanges();
-
- document.dispatchEvent(new CustomEvent('click'));
-
- expect(nodeService.getNodeInfo).not.toHaveBeenCalled();
- });
-
- it('should get node info on event from selection', () => {
- component.selection = [{ entry: { id: 'id' } }];
-
- fixture.detectChanges();
-
- document.dispatchEvent(new CustomEvent('click'));
-
- expect(nodeService.getNodeInfo).toHaveBeenCalledWith('id', { include: [ 'allowableOperations' ] });
- });
-
-
- it('should get node info of last entry when selecting multiple nodes', fakeAsync(() => {
- component.selection = [
- { entry: { id: 'id1', isFile: true } },
- { entry: { id: 'id2', isFile: true } },
- { entry: { id: 'id3', isFile: true } }
- ];
-
- fixture.detectChanges();
-
- document.dispatchEvent(new CustomEvent('click'));
-
- fixture.detectChanges();
- tick();
-
- expect(nodeService.getNodeInfo).toHaveBeenCalledWith('id3', { include: [ 'allowableOperations' ] });
- }));
-});
diff --git a/src/app/common/directives/node-info.directive.ts b/src/app/common/directives/node-info.directive.ts
deleted file mode 100644
index 0ecd2ea1e..000000000
--- a/src/app/common/directives/node-info.directive.ts
+++ /dev/null
@@ -1,83 +0,0 @@
-/*!
- * @license
- * Alfresco Example Content Application
- *
- * Copyright (C) 2005 - 2018 Alfresco Software Limited
- *
- * This file is part of the Alfresco Example Content Application.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * The Alfresco Example Content Application is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- */
-
-import { Directive, HostListener, Input, Output, EventEmitter, OnInit } from '@angular/core';
-import { AlfrescoApiService } from '@alfresco/adf-core';
-import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
-
-@Directive({
- selector: '[acaNodeInfo]',
- exportAs: 'nodeInfo'
-})
-
-export class NodeInfoDirective implements OnInit {
- // tslint:disable-next-line:no-input-rename
- @Input('acaNodeInfo') selection: MinimalNodeEntity[];
- @Output() changed: EventEmitter = new EventEmitter();
- @Output() error: EventEmitter = new EventEmitter();
-
- node: MinimalNodeEntryEntity;
- loading: boolean = null;
-
- @HostListener('document:node-click', ['$event'])
- onClick(event) {
- this.getNodeInfo();
- }
-
- constructor(private apiService: AlfrescoApiService) {}
-
- ngOnInit() {
- this.getNodeInfo();
- }
-
- getNodeInfo() {
- if (!this.selection.length) {
- this.node = null;
- this.loading = false;
- this.changed.emit(null);
- return;
- }
-
- const node = this.selection[this.selection.length - 1];
-
- if (node) {
- this.loading = true;
-
- this.apiService.getInstance().nodes
- .getNodeInfo((node.entry).nodeId || node.entry.id, {
- include: ['allowableOperations']
- })
- .then((data: MinimalNodeEntryEntity) => {
- this.node = data;
- this.changed.emit(data);
- this.loading = false;
- })
- .catch(() => {
- this.error.emit();
- this.loading = false;
- });
- }
- }
-}
diff --git a/src/app/common/directives/node-permanent-delete.directive.spec.ts b/src/app/common/directives/node-permanent-delete.directive.spec.ts
index 755f632b4..989f78f79 100644
--- a/src/app/common/directives/node-permanent-delete.directive.spec.ts
+++ b/src/app/common/directives/node-permanent-delete.directive.spec.ts
@@ -31,6 +31,7 @@ import { AlfrescoApiService, TranslationService, NotificationService, CoreModule
import { NodePermanentDeleteDirective } from './node-permanent-delete.directive';
import { MatDialogModule, MatDialog } from '@angular/material';
+import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@Component({
template: ``
@@ -53,6 +54,7 @@ describe('NodePermanentDeleteDirective', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
+ NoopAnimationsModule,
CoreModule,
MatDialogModule
],
@@ -69,7 +71,10 @@ describe('NodePermanentDeleteDirective', () => {
directiveInstance = element.injector.get(NodePermanentDeleteDirective);
dialog = TestBed.get(MatDialog);
+
alfrescoService = TestBed.get(AlfrescoApiService);
+ alfrescoService.reset();
+
translation = TestBed.get(TranslationService);
notificationService = TestBed.get(NotificationService);
});
diff --git a/src/app/common/directives/node-restore.directive.spec.ts b/src/app/common/directives/node-restore.directive.spec.ts
index 9a7c55708..2b9af8b3b 100644
--- a/src/app/common/directives/node-restore.directive.spec.ts
+++ b/src/app/common/directives/node-restore.directive.spec.ts
@@ -33,7 +33,7 @@ import { Observable } from 'rxjs/Rx';
import { AlfrescoApiService, TranslationService, NotificationService, CoreModule } from '@alfresco/adf-core';
import { NodeRestoreDirective } from './node-restore.directive';
-import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@Component({
template: ``
@@ -57,7 +57,7 @@ describe('NodeRestoreDirective', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
- BrowserAnimationsModule,
+ NoopAnimationsModule,
RouterTestingModule,
CoreModule
],
@@ -74,6 +74,8 @@ describe('NodeRestoreDirective', () => {
directiveInstance = element.injector.get(NodeRestoreDirective);
alfrescoService = TestBed.get(AlfrescoApiService);
+ alfrescoService.reset();
+
translation = TestBed.get(TranslationService);
notificationService = TestBed.get(NotificationService);
router = TestBed.get(Router);
diff --git a/src/app/common/directives/node-versions.directive.ts b/src/app/common/directives/node-versions.directive.ts
index 93c209f35..6b8551dab 100644
--- a/src/app/common/directives/node-versions.directive.ts
+++ b/src/app/common/directives/node-versions.directive.ts
@@ -26,7 +26,7 @@
import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/core';
import { TranslationService, NotificationService, AlfrescoApiService } from '@alfresco/adf-core';
-import { MinimalNodeEntity } from 'alfresco-js-api';
+import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
import { VersionManagerDialogAdapterComponent } from '../../components/versions-dialog/version-manager-dialog-adapter.component';
import { MatDialog } from '@angular/material';
@@ -38,7 +38,7 @@ export class NodeVersionsDirective {
// tslint:disable-next-line:no-input-rename
@Input('acaNodeVersions')
- selection: MinimalNodeEntity[];
+ node: MinimalNodeEntity;
@Output()
nodeVersionError: EventEmitter = new EventEmitter();
@@ -55,17 +55,23 @@ export class NodeVersionsDirective {
private translation: TranslationService
) {}
- onManageVersions() {
- const contentEntry = this.selection[0].entry;
- const nodeId = (contentEntry).nodeId;
-
- this.apiService.getInstance().nodes.getNodeInfo(nodeId || contentEntry.id, {
- include: ['allowableOperations']
- }).then(entry => this.openVersionManagerDialog(entry));
+ async onManageVersions() {
+ if (this.node && this.node.entry) {
+ let entry = this.node.entry;
+ if (entry.nodeId) {
+ entry = await this.apiService.nodesApi.getNodeInfo(
+ entry.nodeId,
+ { include: ['allowableOperations'] }
+ );
+ this.openVersionManagerDialog(entry);
+ } else {
+ this.openVersionManagerDialog(entry);
+ }
+ }
}
- openVersionManagerDialog(contentEntry) {
+ openVersionManagerDialog(contentEntry: MinimalNodeEntryEntity) {
if (contentEntry.isFile) {
this.dialog.open(
VersionManagerDialogAdapterComponent,
diff --git a/src/app/components/favorites/favorites.component.html b/src/app/components/favorites/favorites.component.html
index 9d6bc4283..5d7e66bea 100644
--- a/src/app/components/favorites/favorites.component.html
+++ b/src/app/components/favorites/favorites.component.html
@@ -3,39 +3,37 @@
-
+