From fe8c4596376d4cfd1c5eaeab186da4bead40d7f4 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 4 Jan 2019 11:50:51 +0000 Subject: [PATCH] use dynamic columns from ADF (#889) * upgrade to latest ADF 3.0.0 alpha * migrate to ADF column components * use dynamic column from ADF * fix e2e tests --- e2e/components/data-table/data-table.ts | 4 +- package-lock.json | 24 +-- package.json | 8 +- src/app/components/common/common.module.ts | 40 +--- .../dynamic-column.component.ts | 108 ---------- .../library-name-column.component.spec.ts | 102 --------- .../library-name-column.component.ts | 98 --------- .../library-role-column.component.spec.ts | 83 -------- .../library-role-column.component.ts | 65 ------ .../library-status-column.component.spec.ts | 32 --- .../library-status-column.component.ts | 63 ------ .../name-column/name-column.component.spec.ts | 32 --- .../name-column/name-column.component.ts | 73 ------- .../trashcan-name-column.component.spec.ts | 114 ----------- .../trashcan-name-column.component.ts | 95 --------- .../favorite-libraries.component.html | 160 +++++++++------ .../favorites/favorites.component.html | 131 ++++++------ src/app/components/files/files.component.html | 115 ++++++----- .../components/header/header.component.html | 9 +- .../libraries/libraries.component.html | 143 ++++++------- .../recent-files/recent-files.component.html | 125 ++++++------ .../search-libraries-results.component.html | 193 ++++++++++-------- .../shared-files/shared-files.component.html | 145 ++++++------- .../trashcan/trashcan.component.html | 138 +++++++------ src/app/extensions/core.extensions.module.ts | 12 +- src/app/extensions/extension.service.spec.ts | 16 +- .../ui/overrides/adf-document-list.theme.scss | 10 - src/assets/i18n/de.json | 6 - src/assets/i18n/en.json | 6 - src/assets/i18n/es.json | 6 - src/assets/i18n/fr.json | 6 - src/assets/i18n/it.json | 6 - src/assets/i18n/ja.json | 6 - src/assets/i18n/nb.json | 6 - src/assets/i18n/nl.json | 6 - src/assets/i18n/pt-BR.json | 6 - src/assets/i18n/ru.json | 6 - src/assets/i18n/zh-CN.json | 6 - 38 files changed, 664 insertions(+), 1540 deletions(-) delete mode 100644 src/app/components/common/dynamic-column/dynamic-column.component.ts delete mode 100644 src/app/components/common/library-name-column/library-name-column.component.spec.ts delete mode 100644 src/app/components/common/library-name-column/library-name-column.component.ts delete mode 100644 src/app/components/common/library-role-column/library-role-column.component.spec.ts delete mode 100644 src/app/components/common/library-role-column/library-role-column.component.ts delete mode 100644 src/app/components/common/library-status-column/library-status-column.component.spec.ts delete mode 100644 src/app/components/common/library-status-column/library-status-column.component.ts delete mode 100644 src/app/components/common/name-column/name-column.component.spec.ts delete mode 100644 src/app/components/common/name-column/name-column.component.ts delete mode 100644 src/app/components/common/trashcan-name-column/trashcan-name-column.component.spec.ts delete mode 100644 src/app/components/common/trashcan-name-column/trashcan-name-column.component.ts diff --git a/e2e/components/data-table/data-table.ts b/e2e/components/data-table/data-table.ts index 588c8b009..6907c0fb0 100755 --- a/e2e/components/data-table/data-table.ts +++ b/e2e/components/data-table/data-table.ts @@ -45,8 +45,8 @@ export class DataTable extends Component { selectedRow: '.adf-datatable-row.adf-is-selected', cell: '.adf-data-table-cell', locationLink: '.aca-location-link', - nameLink: '.dl-link', - libraryRole: 'app-library-role-column', + nameLink: '.adf-datatable-link', + libraryRole: 'adf-library-role-column', selectedIcon: '.mat-icon', diff --git a/package-lock.json b/package-lock.json index b5a458242..c4fe0c60a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,25 +5,25 @@ "requires": true, "dependencies": { "@alfresco/adf-content-services": { - "version": "3.0.0-beta5", - "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.0.0-beta5.tgz", - "integrity": "sha512-1U7/E0gt6RWPprqsFfQefmRtdSc1uS6WBnKbtUgNWmL0Gt2Vg22RnK2qYnUd+kWwmPnJ3XmLOniV4WK40AAaNA==", + "version": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c", + "resolved": "https://registry.npmjs.org/@alfresco/adf-content-services/-/adf-content-services-3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c.tgz", + "integrity": "sha512-lzR6pL/563J9IcSXR/X6p2lqFVMRADrnDglAHk4a1k58QBypfIFsmbLX8h9acMhAn/DydEgjQ6pXxLRuxoVLFg==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-core": { - "version": "3.0.0-beta5", - "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.0.0-beta5.tgz", - "integrity": "sha512-Cfk7ItQ68cRrti/p5HdGMlpEYlf78NrQrZTb9Wa5ZR8tvoWPZ5xrFPXPlYCVrKnDJjafB8AHwTFaJW+Y1Pl2kg==", + "version": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c", + "resolved": "https://registry.npmjs.org/@alfresco/adf-core/-/adf-core-3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c.tgz", + "integrity": "sha512-Dj+mef9GUpyn1eMM6ZgMDqEH+rAZxGb4Xgw01lbZA40XhW3lRqlkh1SwuTBSlNYN8RwTlNJVKb/nT9hpaR1Kag==", "requires": { "tslib": "^1.9.0" } }, "@alfresco/adf-extensions": { - "version": "3.0.0-beta5", - "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.0.0-beta5.tgz", - "integrity": "sha512-gPZ/ztqTKQIk0phLuH+6lMc2TROBAPcM5G0HHXeT442Cv/aqH79amDv3GqJlnIkPEOu+TKmA0awbUjB8QuE16w==", + "version": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c", + "resolved": "https://registry.npmjs.org/@alfresco/adf-extensions/-/adf-extensions-3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c.tgz", + "integrity": "sha512-gEaOWVUmG9OqmcNXjTJYk/IG7T6As4SGuHc3veCNPnikf41yrkQ86/eS4iIWuCC3z/dv+ejZT7x5PVRhAvuXBw==", "requires": { "tslib": "^1.9.0" } @@ -3000,9 +3000,9 @@ "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=" }, "alfresco-js-api": { - "version": "3.0.0-beta6", - "resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-3.0.0-beta6.tgz", - "integrity": "sha512-VADSYFmF+5d9tBRN6ZCEDOp2I29LdTI0AqDpKEoukcnwABsQUqUusGOA9tAi7QkGgHq2yDFV5OGTMxVdeeqRVw==", + "version": "3.0.0-beta7", + "resolved": "https://registry.npmjs.org/alfresco-js-api/-/alfresco-js-api-3.0.0-beta7.tgz", + "integrity": "sha512-gpIi2+zcSkkrccRJDxqFP0HrO525GdylGr3elLysmUQH1NMROWMGjbpcZbmQEsWR0eIunQPPxbvYq2lzwgomog==", "requires": { "event-emitter": "0.3.4", "superagent": "3.8.2" diff --git a/package.json b/package.json index 3bc309237..4efa9ee7b 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,9 @@ }, "private": true, "dependencies": { - "@alfresco/adf-content-services": "3.0.0-beta5", - "@alfresco/adf-core": "3.0.0-beta5", - "@alfresco/adf-extensions": "3.0.0-beta5", + "@alfresco/adf-content-services": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c", + "@alfresco/adf-core": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c", + "@alfresco/adf-extensions": "3.0.0-dd25467a98fad2898a2b71d07fa50bb175cea81c", "@angular/animations": "7.1.4", "@angular/cdk": "^7.2.0", "@angular/common": "7.1.4", @@ -53,7 +53,7 @@ "@ngrx/store": "^7.0.0", "@ngrx/store-devtools": "^7.0.0", "@ngx-translate/core": "^10.0.2", - "alfresco-js-api": "3.0.0-beta6", + "alfresco-js-api": "3.0.0-beta7", "core-js": "^2.5.7", "hammerjs": "2.0.8", "minimatch-browser": "^1.0.0", diff --git a/src/app/components/common/common.module.ts b/src/app/components/common/common.module.ts index 9dd9d1429..3742784ba 100644 --- a/src/app/components/common/common.module.ts +++ b/src/app/components/common/common.module.ts @@ -28,46 +28,24 @@ import { CommonModule } from '@angular/common'; import { GenericErrorComponent } from './generic-error/generic-error.component'; import { CoreModule } from '@alfresco/adf-core'; import { LocationLinkComponent } from './location-link/location-link.component'; -import { NameColumnComponent } from './name-column/name-column.component'; -import { LibraryNameColumnComponent } from './library-name-column/library-name-column.component'; -import { LibraryStatusColumnComponent } from './library-status-column/library-status-column.component'; -import { LibraryRoleColumnComponent } from './library-role-column/library-role-column.component'; -import { TrashcanNameColumnComponent } from './trashcan-name-column/trashcan-name-column.component'; -import { DynamicColumnComponent } from './dynamic-column/dynamic-column.component'; import { IconComponent } from './icon/icon.component'; import { MatIconModule } from '@angular/material'; +import { ExtensionsModule } from '@alfresco/adf-extensions'; @NgModule({ - imports: [CommonModule, CoreModule.forChild(), MatIconModule], - declarations: [ - GenericErrorComponent, - LocationLinkComponent, - NameColumnComponent, - LibraryNameColumnComponent, - LibraryStatusColumnComponent, - LibraryRoleColumnComponent, - TrashcanNameColumnComponent, - DynamicColumnComponent, - IconComponent + imports: [ + CommonModule, + CoreModule.forChild(), + MatIconModule, + ExtensionsModule ], + declarations: [GenericErrorComponent, LocationLinkComponent, IconComponent], exports: [ + ExtensionsModule, GenericErrorComponent, LocationLinkComponent, - NameColumnComponent, - LibraryNameColumnComponent, - LibraryStatusColumnComponent, - LibraryRoleColumnComponent, - TrashcanNameColumnComponent, - DynamicColumnComponent, IconComponent ], - entryComponents: [ - LocationLinkComponent, - NameColumnComponent, - LibraryNameColumnComponent, - LibraryStatusColumnComponent, - LibraryRoleColumnComponent, - TrashcanNameColumnComponent - ] + entryComponents: [LocationLinkComponent] }) export class AppCommonModule {} diff --git a/src/app/components/common/dynamic-column/dynamic-column.component.ts b/src/app/components/common/dynamic-column/dynamic-column.component.ts deleted file mode 100644 index 4ad17fae5..000000000 --- a/src/app/components/common/dynamic-column/dynamic-column.component.ts +++ /dev/null @@ -1,108 +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, - Input, - OnInit, - OnDestroy, - ViewChild, - ViewContainerRef, - ComponentRef, - ComponentFactoryResolver, - OnChanges, - SimpleChanges, - ViewEncapsulation, - ChangeDetectionStrategy -} from '@angular/core'; -import { ExtensionService } from '@alfresco/adf-extensions'; - -@Component({ - selector: 'app-dynamic-column', - template: ` - - `, - encapsulation: ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush, - host: { class: 'app-dynamic-column' }, - styles: [ - ` - .app-dynamic-column { - display: flex; - align-items: center; - } - ` - ] -}) -export class DynamicColumnComponent implements OnInit, OnChanges, OnDestroy { - @ViewChild('content', { read: ViewContainerRef }) - content: ViewContainerRef; - - @Input() - id: string; - - @Input() - context: any; - - private componentRef: ComponentRef; - - constructor( - private extensions: ExtensionService, - private componentFactoryResolver: ComponentFactoryResolver - ) {} - - ngOnInit() { - const componentType = this.extensions.getComponentById(this.id); - if (componentType) { - const factory = this.componentFactoryResolver.resolveComponentFactory( - componentType - ); - if (factory) { - this.content.clear(); - this.componentRef = this.content.createComponent(factory, 0); - this.updateInstance(); - } - } - } - - ngOnChanges(changes: SimpleChanges) { - if (changes.node) { - this.updateInstance(); - } - } - - ngOnDestroy() { - if (this.componentRef) { - this.componentRef.destroy(); - this.componentRef = null; - } - } - - private updateInstance() { - if (this.componentRef && this.componentRef.instance) { - this.componentRef.instance.context = this.context; - } - } -} diff --git a/src/app/components/common/library-name-column/library-name-column.component.spec.ts b/src/app/components/common/library-name-column/library-name-column.component.spec.ts deleted file mode 100644 index 47ddc872f..000000000 --- a/src/app/components/common/library-name-column/library-name-column.component.spec.ts +++ /dev/null @@ -1,102 +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 { LibraryNameColumnComponent } from './library-name-column.component'; -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { AppTestingModule } from '../../../testing/app-testing.module'; -import { NO_ERRORS_SCHEMA } from '@angular/core'; - -describe('LibraryNameColumnComponent', () => { - let fixture: ComponentFixture; - let component: LibraryNameColumnComponent; - let node; - - beforeEach(() => { - node = { - id: 'nodeId', - path: { - elements: [] - } - }; - }); - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [AppTestingModule], - declarations: [LibraryNameColumnComponent], - schemas: [NO_ERRORS_SCHEMA] - }); - - fixture = TestBed.createComponent(LibraryNameColumnComponent); - component = fixture.componentInstance; - }); - - describe('makeLibraryTooltip()', () => { - it('maps tooltip to description', () => { - node.description = 'description'; - const tooltip = component.makeLibraryTooltip(node); - - expect(tooltip).toBe(node.description); - }); - - it('maps tooltip to description', () => { - node.title = 'title'; - const tooltip = component.makeLibraryTooltip(node); - - expect(tooltip).toBe(node.title); - }); - - it('sets tooltip to empty string', () => { - const tooltip = component.makeLibraryTooltip(node); - - expect(tooltip).toBe(''); - }); - }); - - describe('makeLibraryTitle()', () => { - it('sets title with id when duplicate nodes title exists in list', () => { - node.title = 'title'; - - const rows = [ - { node: { entry: { id: 'some-id', title: 'title' } } } - ]; - - const title = component.makeLibraryTitle(node, rows); - expect(title).toContain('nodeId'); - }); - - it('sets title when no duplicate nodes title exists in list', () => { - node.title = 'title'; - - const rows = [ - { node: { entry: { id: 'some-id', title: 'title-some-id' } } } - ]; - - const title = component.makeLibraryTitle(node, rows); - - expect(title).toBe('title'); - }); - }); -}); diff --git a/src/app/components/common/library-name-column/library-name-column.component.ts b/src/app/components/common/library-name-column/library-name-column.component.ts deleted file mode 100644 index 8ebf3d3e4..000000000 --- a/src/app/components/common/library-name-column/library-name-column.component.ts +++ /dev/null @@ -1,98 +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, - ChangeDetectionStrategy, - ViewEncapsulation, - OnInit, - Input, - ElementRef -} from '@angular/core'; -import { MinimalNodeEntity } from 'alfresco-js-api'; -import { ShareDataRow } from '@alfresco/adf-content-services'; - -@Component({ - selector: 'app-library-name-column', - template: ` - - {{ displayText }} - - `, - changeDetection: ChangeDetectionStrategy.OnPush, - encapsulation: ViewEncapsulation.None, - host: { class: 'adf-datatable-cell dl-link app-library-name-column' } -}) -export class LibraryNameColumnComponent implements OnInit { - @Input() - context: any; - - displayTooltip: string; - displayText: string; - node: MinimalNodeEntity; - - constructor(private element: ElementRef) {} - - ngOnInit() { - this.node = this.context.row.node; - const rows: Array = this.context.data.rows || []; - if (this.node && this.node.entry) { - this.displayText = this.makeLibraryTitle(this.node.entry, rows); - this.displayTooltip = this.makeLibraryTooltip(this.node.entry); - } - } - - onClick() { - this.element.nativeElement.dispatchEvent( - new CustomEvent('name-click', { - bubbles: true, - detail: { - node: this.node - } - }) - ); - } - - makeLibraryTooltip(library: any): string { - const { description, title } = library; - - return description || title || ''; - } - - makeLibraryTitle(library: any, rows: Array): string { - const entries = rows.map((r: ShareDataRow) => r.node.entry); - const { title, id } = library; - - let isDuplicate = false; - - if (entries) { - isDuplicate = entries.some((entry: any) => { - return entry.id !== id && entry.title === title; - }); - } - - return isDuplicate ? `${title} (${id})` : `${title}`; - } -} diff --git a/src/app/components/common/library-role-column/library-role-column.component.spec.ts b/src/app/components/common/library-role-column/library-role-column.component.spec.ts deleted file mode 100644 index 5219430d0..000000000 --- a/src/app/components/common/library-role-column/library-role-column.component.spec.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 { LibraryRoleColumnComponent } from './library-role-column.component'; -import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { AppTestingModule } from '../../../testing/app-testing.module'; -import { NO_ERRORS_SCHEMA } from '@angular/core'; - -describe('LibraryNameColumnComponent', () => { - let fixture: ComponentFixture; - let component: LibraryRoleColumnComponent; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [AppTestingModule], - declarations: [LibraryRoleColumnComponent], - schemas: [NO_ERRORS_SCHEMA] - }); - - fixture = TestBed.createComponent(LibraryRoleColumnComponent); - component = fixture.componentInstance; - }); - - it('should render Manager', () => { - component.context = { row: { node: { entry: { role: 'SiteManager' } } } }; - fixture.detectChanges(); - expect(component.displayText).toBe('APP.SITES_ROLE.MANAGER'); - }); - - it('should render Collaborator', () => { - component.context = { - row: { node: { entry: { role: 'SiteCollaborator' } } } - }; - fixture.detectChanges(); - expect(component.displayText).toBe('APP.SITES_ROLE.COLLABORATOR'); - }); - - it('should render Contributor', () => { - component.context = { - row: { node: { entry: { role: 'SiteContributor' } } } - }; - fixture.detectChanges(); - expect(component.displayText).toBe('APP.SITES_ROLE.CONTRIBUTOR'); - }); - - it('should render Consumer', () => { - component.context = { - row: { node: { entry: { role: 'SiteConsumer' } } } - }; - fixture.detectChanges(); - expect(component.displayText).toBe('APP.SITES_ROLE.CONSUMER'); - }); - - it('should not render text for unknown', () => { - component.context = { - row: { node: { entry: { role: 'ROLE' } } } - }; - fixture.detectChanges(); - expect(component.displayText).toBe(''); - }); -}); diff --git a/src/app/components/common/library-role-column/library-role-column.component.ts b/src/app/components/common/library-role-column/library-role-column.component.ts deleted file mode 100644 index 194b2b12e..000000000 --- a/src/app/components/common/library-role-column/library-role-column.component.ts +++ /dev/null @@ -1,65 +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, OnInit, Input } from '@angular/core'; - -@Component({ - selector: 'app-library-role-column', - template: ` - - {{ displayText | translate }} - - ` -}) -export class LibraryRoleColumnComponent implements OnInit { - @Input() - context: any; - - displayText: string; - - ngOnInit() { - const node = this.context.row.node; - if (node && node.entry) { - const role: string = node.entry.role; - switch (role) { - case 'SiteManager': - this.displayText = 'APP.SITES_ROLE.MANAGER'; - break; - case 'SiteCollaborator': - this.displayText = 'APP.SITES_ROLE.COLLABORATOR'; - break; - case 'SiteContributor': - this.displayText = 'APP.SITES_ROLE.CONTRIBUTOR'; - break; - case 'SiteConsumer': - this.displayText = 'APP.SITES_ROLE.CONSUMER'; - break; - default: - this.displayText = ''; - break; - } - } - } -} diff --git a/src/app/components/common/library-status-column/library-status-column.component.spec.ts b/src/app/components/common/library-status-column/library-status-column.component.spec.ts deleted file mode 100644 index 5aad9e139..000000000 --- a/src/app/components/common/library-status-column/library-status-column.component.spec.ts +++ /dev/null @@ -1,32 +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 { LibraryStatusColumnComponent } from './library-status-column.component'; - -describe('LibraryStatusColumnComponent', () => { - it('should be defined', () => { - expect(LibraryStatusColumnComponent).toBeDefined(); - }); -}); diff --git a/src/app/components/common/library-status-column/library-status-column.component.ts b/src/app/components/common/library-status-column/library-status-column.component.ts deleted file mode 100644 index b7b688d8b..000000000 --- a/src/app/components/common/library-status-column/library-status-column.component.ts +++ /dev/null @@ -1,63 +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, Input, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-library-status-column', - template: ` - - {{ displayText | translate }} - - ` -}) -export class LibraryStatusColumnComponent implements OnInit { - @Input() - context: any; - - displayText: string; - - ngOnInit() { - const node = this.context.row.node; - if (node && node.entry) { - const visibility: string = node.entry.visibility; - - switch (visibility.toUpperCase()) { - case 'PUBLIC': - this.displayText = 'LIBRARY.VISIBILITY.PUBLIC'; - break; - case 'PRIVATE': - this.displayText = 'LIBRARY.VISIBILITY.PRIVATE'; - break; - case 'MODERATED': - this.displayText = 'LIBRARY.VISIBILITY.MODERATED'; - break; - default: - this.displayText = 'UNKNOWN'; - break; - } - } - } -} diff --git a/src/app/components/common/name-column/name-column.component.spec.ts b/src/app/components/common/name-column/name-column.component.spec.ts deleted file mode 100644 index daa82e385..000000000 --- a/src/app/components/common/name-column/name-column.component.spec.ts +++ /dev/null @@ -1,32 +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 { NameColumnComponent } from './name-column.component'; - -describe('NameColumnComponent', () => { - it('should be defined', () => { - expect(NameColumnComponent).toBeDefined(); - }); -}); diff --git a/src/app/components/common/name-column/name-column.component.ts b/src/app/components/common/name-column/name-column.component.ts deleted file mode 100644 index 9f328689e..000000000 --- a/src/app/components/common/name-column/name-column.component.ts +++ /dev/null @@ -1,73 +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, - Input, - OnInit, - ChangeDetectionStrategy, - ViewEncapsulation, - ElementRef -} from '@angular/core'; -import { MinimalNodeEntity } from 'alfresco-js-api'; - -@Component({ - selector: 'app-name-column', - template: ` - - {{ displayText }} - - `, - changeDetection: ChangeDetectionStrategy.OnPush, - encapsulation: ViewEncapsulation.None, - host: { class: 'adf-datatable-cell dl-link app-name-column' } -}) -export class NameColumnComponent implements OnInit { - @Input() - context: any; - - displayText: string; - node: MinimalNodeEntity; - - constructor(private element: ElementRef) {} - - ngOnInit() { - this.node = this.context.row.node; - if (this.node && this.node.entry) { - this.displayText = this.node.entry.name || this.node.entry.id; - } - } - - onClick() { - this.element.nativeElement.dispatchEvent( - new CustomEvent('name-click', { - bubbles: true, - detail: { - node: this.node - } - }) - ); - } -} diff --git a/src/app/components/common/trashcan-name-column/trashcan-name-column.component.spec.ts b/src/app/components/common/trashcan-name-column/trashcan-name-column.component.spec.ts deleted file mode 100644 index cfc7129c5..000000000 --- a/src/app/components/common/trashcan-name-column/trashcan-name-column.component.spec.ts +++ /dev/null @@ -1,114 +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 { TrashcanNameColumnComponent } from './trashcan-name-column.component'; - -describe('TrashcanNameColumnComponent', () => { - let component; - - beforeEach(() => { - component = new TrashcanNameColumnComponent(); - }); - - it('should set displayText for content files', () => { - const context = { - data: { rows: [] }, - row: { - node: { - entry: { - name: 'contentName', - nodeType: 'content' - } - } - } - }; - - component.context = context; - component.ngOnInit(); - - expect(component.displayText).toBe('contentName'); - }); - - it('should set displayText for library', () => { - const context = { - data: { - rows: [] - }, - row: { - node: { - entry: { - nodeType: 'st:site', - properties: { - 'cm:title': 'libraryTitle' - } - } - } - } - }; - - component.context = context; - component.ngOnInit(); - - expect(component.displayText).toBe('libraryTitle'); - }); - - it('should set custom displayText for libraries with same name', () => { - const context = { - data: { - rows: [ - { - node: { - entry: { - id: 'id1', - name: 'name1', - nodeType: 'st:site', - properties: { - 'cm:title': 'bogus' - } - } - } - } - ] - }, - row: { - node: { - entry: { - id: 'id2', - name: 'name1', - nodeType: 'st:site', - properties: { - 'cm:title': 'bogus' - } - } - } - } - }; - - component.context = context; - component.ngOnInit(); - - expect(component.displayText).toBe('bogus (name1)'); - }); -}); diff --git a/src/app/components/common/trashcan-name-column/trashcan-name-column.component.ts b/src/app/components/common/trashcan-name-column/trashcan-name-column.component.ts deleted file mode 100644 index 627c246fc..000000000 --- a/src/app/components/common/trashcan-name-column/trashcan-name-column.component.ts +++ /dev/null @@ -1,95 +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, - ChangeDetectionStrategy, - ViewEncapsulation, - OnInit, - Input -} from '@angular/core'; -import { ShareDataRow } from '@alfresco/adf-content-services'; -import { MinimalNodeEntity } from 'alfresco-js-api'; - -@Component({ - selector: 'app-trashcan-name-column', - template: ` - - {{ displayText }} - - - {{ displayText }} - - `, - changeDetection: ChangeDetectionStrategy.OnPush, - encapsulation: ViewEncapsulation.None, - host: { class: 'adf-datatable-cell app-trashcan-name-column' } -}) -export class TrashcanNameColumnComponent implements OnInit { - @Input() - context: any; - - isLibrary = false; - displayText: string; - displayTooltip: string; - node: MinimalNodeEntity; - - ngOnInit() { - this.node = this.context.row.node; - const rows: Array = this.context.data.rows || []; - - if (this.node && this.node.entry) { - this.isLibrary = this.node.entry.nodeType === 'st:site'; - - if (this.isLibrary) { - const { properties } = this.node.entry; - - this.displayText = this.makeLibraryTitle(this.node.entry, rows); - this.displayTooltip = - properties['cm:description'] || properties['cm:title']; - } else { - this.displayText = this.node.entry.name || this.node.entry.id; - } - } - } - - makeLibraryTitle(library: any, rows: Array): string { - const entries = rows.map((r: ShareDataRow) => r.node.entry); - const { id } = library; - const title = library.properties['cm:title']; - - let isDuplicate = false; - - if (entries) { - isDuplicate = entries.some((entry: any) => { - return entry.id !== id && entry.properties['cm:title'] === title; - }); - } - - return isDuplicate - ? `${library.properties['cm:title']} (${library.name})` - : `${library.properties['cm:title']}`; - } -} diff --git a/src/app/components/favorite-libraries/favorite-libraries.component.html b/src/app/components/favorite-libraries/favorite-libraries.component.html index b4be5c2ad..8e1f54227 100644 --- a/src/app/components/favorite-libraries/favorite-libraries.component.html +++ b/src/app/components/favorite-libraries/favorite-libraries.component.html @@ -1,75 +1,101 @@ + + + - - - + + - - + + + + + - - + +
+ + + + + + + + + + + + + + + + + - - - -
- + + + + + + + - - - - - - + + +
- - - - - - - - - - - - - - - - - - -
- - - -
- - -
-
\ No newline at end of file + + + diff --git a/src/app/components/favorites/favorites.component.html b/src/app/components/favorites/favorites.component.html index 79c1bcb55..86330b7b3 100644 --- a/src/app/components/favorites/favorites.component.html +++ b/src/app/components/favorites/favorites.component.html @@ -1,81 +1,84 @@ - - - + - - - - - + + + + +
- - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + + + + + + + - - +
-