[ACA-20] Favorite Libraries (#789)

* libraries submenu config

* fix item id

* favorite libraries columns

* libraries submenu text

* columns text

* submenu schema

* submenu routes

* role column component

* favorite libraries list api

* register favorite libraries presets

* favorite libraries list component

* register role column component

* dl custom node list is library route

* empty state message icon

* remove custom id

* merge subscriptions

* adapt to child route

* fix component selector

* revert to favorite library route

* sidenav main links font weight

* libraries children contants

* library expand panel method

* update e2e

* libraries children columns consistency

* isLibrary workaround for custom node list

* update isLibrary evaluator

* update e2e

* lint

* Update src/assets/app.extensions.json

Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com>

* Update src/app/extensions/extension.service.ts

Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com>

* Update src/app/extensions/extension.service.ts

Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com>

* Update src/app/extensions/extension.service.ts

Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com>

* Update src/app/extensions/extension.service.ts

Co-Authored-By: pionnegru <pionnegru@users.noreply.github.com>

* use correct preset

* update e2e

* update page titles values

* find child active link

* fix expected value

* update expected

* role column tests

* check if menu is expanded
This commit is contained in:
Cilibiu Bogdan
2018-11-09 15:53:51 +02:00
committed by Denys Vuika
parent 76fe33d734
commit 4a420cc9f9
25 changed files with 655 additions and 37 deletions

View File

@@ -31,6 +31,7 @@ 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';
@@ -42,6 +43,7 @@ import { DynamicColumnComponent } from './dynamic-column/dynamic-column.componen
NameColumnComponent,
LibraryNameColumnComponent,
LibraryStatusColumnComponent,
LibraryRoleColumnComponent,
TrashcanNameColumnComponent,
DynamicColumnComponent
],
@@ -51,6 +53,7 @@ import { DynamicColumnComponent } from './dynamic-column/dynamic-column.componen
NameColumnComponent,
LibraryNameColumnComponent,
LibraryStatusColumnComponent,
LibraryRoleColumnComponent,
TrashcanNameColumnComponent,
DynamicColumnComponent
],
@@ -59,6 +62,7 @@ import { DynamicColumnComponent } from './dynamic-column/dynamic-column.componen
NameColumnComponent,
LibraryNameColumnComponent,
LibraryStatusColumnComponent,
LibraryRoleColumnComponent,
TrashcanNameColumnComponent
]
})

View File

@@ -0,0 +1,83 @@
/*!
* @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 <http://www.gnu.org/licenses/>.
*/
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<LibraryRoleColumnComponent>;
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('');
});
});

View File

@@ -0,0 +1,65 @@
/*!
* @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 <http://www.gnu.org/licenses/>.
*/
import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-library-role-column',
template: `
<span title="{{ displayText | translate }}">
{{ displayText | translate }}
</span>
`
})
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;
}
}
}
}