mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-4100] use ADF user info component (#1762)
* use adf user info * delete old unit test * remove e2e * fix lint
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
import { browser } from 'protractor';
|
||||
import { AdminActions, APP_ROUTES, LoginPage, BrowsingPage, Utils, navigate } from '@alfresco/aca-testing-shared';
|
||||
import { AdminActions, APP_ROUTES, LoginPage, Utils, navigate } from '@alfresco/aca-testing-shared';
|
||||
|
||||
describe('Login', () => {
|
||||
const loginPage = new LoginPage();
|
||||
@@ -101,14 +101,6 @@ describe('Login', () => {
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
});
|
||||
|
||||
it(`[C213108] displays user's name in header`, async () => {
|
||||
const { userInfo } = new BrowsingPage(APP_ROUTES.PERSONAL_FILES).header;
|
||||
const { username, firstName, lastName } = johnDoe;
|
||||
|
||||
await loginPage.loginWith(username);
|
||||
expect(await userInfo.fullName.getText()).toEqual(`${firstName} ${lastName}`);
|
||||
});
|
||||
|
||||
it(`[C213096] logs in with user having username containing "@"`, async () => {
|
||||
await loginPage.loginWith(testUser);
|
||||
expect(await browser.getCurrentUrl()).toContain(APP_ROUTES.PERSONAL_FILES);
|
||||
|
@@ -721,68 +721,6 @@ describe('AppExtensionService', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('userActions', () => {
|
||||
it('should load user actions from the config', () => {
|
||||
applyConfig({
|
||||
$id: 'test',
|
||||
$name: 'test',
|
||||
$version: '1.0.0',
|
||||
$license: 'MIT',
|
||||
$vendor: 'Good company',
|
||||
$runtime: '1.5.0',
|
||||
features: {
|
||||
userActions: [
|
||||
{
|
||||
id: 'aca:toolbar/separator-1',
|
||||
order: 1,
|
||||
type: ContentActionType.separator,
|
||||
title: 'action1'
|
||||
},
|
||||
{
|
||||
id: 'aca:toolbar/separator-2',
|
||||
order: 2,
|
||||
type: ContentActionType.separator,
|
||||
title: 'action2'
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
expect(service.userActions.length).toBe(2);
|
||||
});
|
||||
|
||||
it('should sort user actions by order', () => {
|
||||
applyConfig({
|
||||
$id: 'test',
|
||||
$name: 'test',
|
||||
$version: '1.0.0',
|
||||
$license: 'MIT',
|
||||
$vendor: 'Good company',
|
||||
$runtime: '1.5.0',
|
||||
features: {
|
||||
userActions: [
|
||||
{
|
||||
id: 'aca:toolbar/action-2',
|
||||
order: 2,
|
||||
type: ContentActionType.button,
|
||||
title: 'action2'
|
||||
},
|
||||
{
|
||||
id: 'aca:toolbar/action-1',
|
||||
order: 1,
|
||||
type: ContentActionType.button,
|
||||
title: 'action1'
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
const actions = service.getUserActions();
|
||||
expect(actions[0].id).toBe('aca:toolbar/action-1');
|
||||
expect(actions[1].id).toBe('aca:toolbar/action-2');
|
||||
});
|
||||
});
|
||||
|
||||
describe('getHeaderActions', () => {
|
||||
it('should load user actions from the config', () => {
|
||||
applyConfig({
|
||||
|
@@ -74,7 +74,6 @@ export class AppExtensionService implements RuleContext {
|
||||
sidebarActions: Array<ContentActionRef> = [];
|
||||
contentMetadata: any;
|
||||
viewerRules: ViewerRules = {};
|
||||
userActions: Array<ContentActionRef> = [];
|
||||
settingGroups: Array<SettingsGroupRef> = [];
|
||||
|
||||
documentListPresets: {
|
||||
@@ -150,7 +149,6 @@ export class AppExtensionService implements RuleContext {
|
||||
this.createActions = this.loader.getElements<ContentActionRef>(config, 'features.create');
|
||||
this.navbar = this.loadNavBar(config);
|
||||
this.sidebarTabs = this.loader.getElements<SidebarTabRef>(config, 'features.sidebar.tabs');
|
||||
this.userActions = this.loader.getContentActions(config, 'features.userActions');
|
||||
this.contentMetadata = this.loadContentMetadata(config);
|
||||
|
||||
this.documentListPresets = {
|
||||
@@ -416,10 +414,6 @@ export class AppExtensionService implements RuleContext {
|
||||
return this.getAllowedActions(this.contextMenuActions);
|
||||
}
|
||||
|
||||
getUserActions(): Array<ContentActionRef> {
|
||||
return this.userActions.filter((action) => this.filterVisible(action)).sort(sortByOrder);
|
||||
}
|
||||
|
||||
getSettingsGroups(): Array<SettingsGroupRef> {
|
||||
return this.settingGroups.filter((group) => this.filterVisible(group));
|
||||
}
|
||||
|
@@ -54,7 +54,6 @@ import { AppSidenavModule } from './components/sidenav/sidenav.module';
|
||||
import { AppPermissionsModule } from './components/permissions/permissions.module';
|
||||
import { AppCommonModule } from './components/common/common.module';
|
||||
import { AppLayoutModule } from './components/layout/layout.module';
|
||||
import { AppCurrentUserModule } from './components/current-user/current-user.module';
|
||||
import { AppSearchInputModule } from './components/search/search-input.module';
|
||||
import { DocumentListCustomComponentsModule } from './components/dl-custom-components/document-list-custom-components.module';
|
||||
import { AppSearchResultsModule } from './components/search/search-results.module';
|
||||
@@ -124,7 +123,6 @@ registerLocaleData(localeSv);
|
||||
AppLoginModule,
|
||||
AppCommonModule,
|
||||
AppLayoutModule,
|
||||
AppCurrentUserModule,
|
||||
DirectivesModule,
|
||||
ContextMenuModule,
|
||||
AppInfoDrawerModule,
|
||||
|
@@ -1,22 +0,0 @@
|
||||
<div title="{{ (profile$ | async)?.id }}">
|
||||
<div class="current-user__full-name">{{ (profile$ | async)?.userName }}</div>
|
||||
<button
|
||||
mat-icon-button
|
||||
[attr.aria-label]="
|
||||
'AVATAR.ACCESSIBILITY.AVATAR_BUTTON_ARIA_LABEL' | translate
|
||||
"
|
||||
class="current-user__avatar am-avatar"
|
||||
[matMenuTriggerFor]="userMenu"
|
||||
>
|
||||
{{ (profile$ | async)?.initials }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<mat-menu #userMenu="matMenu" [overlapTrigger]="false">
|
||||
<ng-container *ngFor="let actionRef of actions; trackBy: trackByActionId">
|
||||
<app-user-menu-item
|
||||
[actionRef]="actionRef"
|
||||
color="default"
|
||||
></app-user-menu-item>
|
||||
</ng-container>
|
||||
</mat-menu>
|
@@ -1,97 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 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 { CurrentUserComponent } from './current-user.component';
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppState, SetUserProfileAction } from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
|
||||
describe('CurrentUserComponent', () => {
|
||||
let fixture: ComponentFixture<CurrentUserComponent>;
|
||||
let component: CurrentUserComponent;
|
||||
let appExtensionService;
|
||||
let store: Store<AppState>;
|
||||
const person = {
|
||||
entry: {
|
||||
id: 'user-id',
|
||||
firstName: 'Test',
|
||||
lastName: 'User',
|
||||
email: 'user@email.com',
|
||||
enabled: true,
|
||||
isAdmin: false,
|
||||
userName: 'user-name'
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule],
|
||||
declarations: [CurrentUserComponent],
|
||||
providers: [AppExtensionService],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(CurrentUserComponent);
|
||||
appExtensionService = TestBed.inject(AppExtensionService);
|
||||
store = TestBed.inject(Store);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
it('should get profile data', (done) => {
|
||||
const expectedProfile = {
|
||||
firstName: 'Test',
|
||||
lastName: 'User',
|
||||
userName: 'Test User',
|
||||
isAdmin: true,
|
||||
id: 'user-id',
|
||||
groups: []
|
||||
};
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
store.dispatch(new SetUserProfileAction({ person: person.entry, groups: [] }));
|
||||
|
||||
component.profile$.subscribe((profile: any) => {
|
||||
expect(profile).toEqual(jasmine.objectContaining(expectedProfile));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should set menu actions', () => {
|
||||
const actions: any[] = [
|
||||
{
|
||||
id: 'action-id'
|
||||
}
|
||||
];
|
||||
spyOn(appExtensionService, 'getUserActions').and.returnValue(actions);
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.actions).toBe(actions);
|
||||
});
|
||||
});
|
@@ -1,44 +0,0 @@
|
||||
@mixin aca-current-user-theme($theme) {
|
||||
$background: map-get($theme, background);
|
||||
$am-avatar-size: 35px;
|
||||
|
||||
.aca-current-user {
|
||||
position: relative;
|
||||
color: mat-color($background, card);
|
||||
line-height: 20px;
|
||||
|
||||
.am-avatar {
|
||||
margin-left: 9px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
width: $am-avatar-size;
|
||||
height: $am-avatar-size;
|
||||
line-height: $am-avatar-size;
|
||||
font-size: 1em;
|
||||
text-align: center;
|
||||
color: inherit;
|
||||
border-radius: 100%;
|
||||
background-color: mat-color($background, card, 0.12);
|
||||
}
|
||||
|
||||
.current-user__full-name {
|
||||
max-width: 100px;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: inline-block;
|
||||
height: 18px;
|
||||
font-size: 14px;
|
||||
line-height: 1.43;
|
||||
letter-spacing: -0.3px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
@media screen and ($mat-small) {
|
||||
.current-user__full-name {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 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, ViewEncapsulation, OnInit } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ProfileState, ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { AppStore, getUserProfile } from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
selector: 'aca-current-user',
|
||||
templateUrl: './current-user.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: { class: 'aca-current-user' }
|
||||
})
|
||||
export class CurrentUserComponent implements OnInit {
|
||||
profile$: Observable<ProfileState>;
|
||||
actions: Array<ContentActionRef> = [];
|
||||
|
||||
constructor(private store: Store<AppStore>, private extensions: AppExtensionService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.profile$ = this.store.select(getUserProfile);
|
||||
this.actions = this.extensions.getUserActions();
|
||||
}
|
||||
|
||||
trackByActionId(_: number, action: ContentActionRef) {
|
||||
return action.id;
|
||||
}
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 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 { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { ExtensionsModule } from '@alfresco/adf-extensions';
|
||||
import { CurrentUserComponent } from './current-user.component';
|
||||
import { UserMenuItemComponent } from './user-menu-item.component';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, CoreModule.forChild(), RouterModule, ExtensionsModule],
|
||||
declarations: [CurrentUserComponent, UserMenuItemComponent],
|
||||
exports: [CurrentUserComponent, UserMenuItemComponent]
|
||||
})
|
||||
export class AppCurrentUserModule {}
|
@@ -1,36 +0,0 @@
|
||||
<div class="aca-user-actions-menu">
|
||||
<ng-container [ngSwitch]="actionRef.type">
|
||||
<ng-container *ngSwitchCase="'menu'">
|
||||
<button mat-menu-item [id]="actionRef.id" [matMenuTriggerFor]="childMenu">
|
||||
<span>{{ actionRef.title | translate }}</span>
|
||||
</button>
|
||||
|
||||
<mat-menu #childMenu="matMenu">
|
||||
<ng-container
|
||||
*ngFor="let child of actionRef.children; trackBy: trackById"
|
||||
>
|
||||
<app-user-menu-item [actionRef]="child"></app-user-menu-item>
|
||||
</ng-container>
|
||||
</mat-menu>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngSwitchCase="'separator'">
|
||||
<mat-divider></mat-divider>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngSwitchCase="'custom'">
|
||||
<adf-dynamic-component [id]="actionRef.component"></adf-dynamic-component>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngSwitchDefault>
|
||||
<button
|
||||
mat-menu-item
|
||||
color="primary"
|
||||
[id]="actionRef.id"
|
||||
(click)="runAction()"
|
||||
>
|
||||
<span>{{ actionRef.title | translate }}</span>
|
||||
</button>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
</div>
|
@@ -1,118 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 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 { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { UserMenuItemComponent } from './user-menu-item.component';
|
||||
import { TranslateModule, TranslateLoader, TranslateFakeLoader } from '@ngx-translate/core';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
|
||||
describe('UserMenuItemComponent', () => {
|
||||
let fixture: ComponentFixture<UserMenuItemComponent>;
|
||||
let component: UserMenuItemComponent;
|
||||
let appExtensionService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
AppTestingModule,
|
||||
TranslateModule.forRoot({
|
||||
loader: { provide: TranslateLoader, useClass: TranslateFakeLoader }
|
||||
})
|
||||
],
|
||||
declarations: [UserMenuItemComponent],
|
||||
providers: [AppExtensionService],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(UserMenuItemComponent);
|
||||
appExtensionService = TestBed.inject(AppExtensionService);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should render button action', () => {
|
||||
component.actionRef = {
|
||||
id: 'action-button',
|
||||
title: 'Test Button',
|
||||
actions: {
|
||||
click: 'TEST_EVENT'
|
||||
}
|
||||
} as ContentActionRef;
|
||||
fixture.detectChanges();
|
||||
|
||||
const buttonElement = fixture.nativeElement.querySelector('#action-button');
|
||||
expect(buttonElement).not.toBe(null);
|
||||
});
|
||||
|
||||
it('should render menu action', () => {
|
||||
component.actionRef = {
|
||||
type: 'menu',
|
||||
id: 'action-menu',
|
||||
title: 'Test Button',
|
||||
actions: {
|
||||
click: 'TEST_EVENT'
|
||||
}
|
||||
} as ContentActionRef;
|
||||
fixture.detectChanges();
|
||||
|
||||
const menuElement = fixture.nativeElement.querySelector('#action-menu');
|
||||
expect(menuElement).not.toBe(null);
|
||||
});
|
||||
|
||||
it('should render custom action', () => {
|
||||
component.actionRef = {
|
||||
type: 'custom',
|
||||
id: 'action-custom',
|
||||
component: 'custom-component'
|
||||
} as ContentActionRef;
|
||||
fixture.detectChanges();
|
||||
|
||||
const componentElement = fixture.nativeElement.querySelector('#custom-component');
|
||||
expect(componentElement).not.toBe(null);
|
||||
});
|
||||
|
||||
it('should run defined action', () => {
|
||||
spyOn(appExtensionService, 'runActionById');
|
||||
|
||||
component.actionRef = {
|
||||
id: 'action-button',
|
||||
title: 'Test Button',
|
||||
actions: {
|
||||
click: 'TEST_EVENT'
|
||||
}
|
||||
} as ContentActionRef;
|
||||
fixture.detectChanges();
|
||||
|
||||
const buttonElement = fixture.nativeElement.querySelector('#action-button');
|
||||
buttonElement.dispatchEvent(new MouseEvent('click'));
|
||||
expect(appExtensionService.runActionById).toHaveBeenCalledWith('TEST_EVENT');
|
||||
});
|
||||
});
|
@@ -1,58 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Alfresco Example Content Application
|
||||
*
|
||||
* Copyright (C) 2005 - 2020 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, Input, ViewEncapsulation } from '@angular/core';
|
||||
import { ContentActionRef } from '@alfresco/adf-extensions';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-menu-item',
|
||||
templateUrl: 'user-menu-item.component.html',
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
host: { class: 'app-user-menu-item' }
|
||||
})
|
||||
export class UserMenuItemComponent {
|
||||
@Input()
|
||||
actionRef: ContentActionRef;
|
||||
|
||||
constructor(private extensions: AppExtensionService) {}
|
||||
|
||||
runAction() {
|
||||
if (this.hasClickAction(this.actionRef)) {
|
||||
this.extensions.runActionById(this.actionRef.actions.click);
|
||||
}
|
||||
}
|
||||
|
||||
private hasClickAction(actionRef: ContentActionRef): boolean {
|
||||
if (actionRef && actionRef.actions && actionRef.actions.click) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
trackById(_: number, obj: { id: string }) {
|
||||
return obj.id;
|
||||
}
|
||||
}
|
@@ -27,12 +27,11 @@ import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { AppHeaderComponent } from './header.component';
|
||||
import { AppCurrentUserModule } from '../current-user/current-user.module';
|
||||
import { AppSearchInputModule } from '../search/search-input.module';
|
||||
import { AppToolbarModule } from '../toolbar/toolbar.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, CoreModule.forChild(), AppCurrentUserModule, AppSearchInputModule, AppToolbarModule],
|
||||
imports: [CommonModule, CoreModule.forChild(), AppSearchInputModule, AppToolbarModule],
|
||||
declarations: [AppHeaderComponent],
|
||||
exports: [AppHeaderComponent]
|
||||
})
|
||||
|
@@ -23,7 +23,7 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { CoreModule, AuthGuardEcm } from '@alfresco/adf-core';
|
||||
import { CoreModule, AuthGuardEcm, UserInfoComponent } from '@alfresco/adf-core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { APP_INITIALIZER, ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { AppLayoutComponent } from '../components/layout/app-layout/app-layout.component';
|
||||
@@ -52,7 +52,6 @@ import { ToggleSharedComponent } from '../components/common/toggle-shared/toggle
|
||||
import { ViewNodeComponent } from '../components/toolbar/view-node/view-node.component';
|
||||
import { LanguagePickerComponent } from '../components/common/language-picker/language-picker.component';
|
||||
import { LogoutComponent } from '../components/common/logout/logout.component';
|
||||
import { CurrentUserComponent } from '../components/current-user/current-user.component';
|
||||
import { AppExtensionService, ExtensionsDataLoaderGuard } from '@alfresco/aca-shared';
|
||||
import { PreviewComponent } from '../components/preview/preview.component';
|
||||
|
||||
@@ -109,7 +108,7 @@ export class CoreExtensionsModule {
|
||||
'app.toolbar.viewNode': ViewNodeComponent,
|
||||
'app.languagePicker': LanguagePickerComponent,
|
||||
'app.logout': LogoutComponent,
|
||||
'app.user': CurrentUserComponent
|
||||
'app.user': UserInfoComponent
|
||||
});
|
||||
|
||||
extensions.setAuthGuards({
|
||||
|
@@ -4,7 +4,6 @@
|
||||
@import '../components/sidenav/sidenav.component.theme';
|
||||
@import '../components/search/search-input/search-input.component.theme';
|
||||
@import '../components/search/search-results-row/search-results-row.component.scss';
|
||||
@import '../components/current-user/current-user.component.theme';
|
||||
@import '../components/permissions/permission-manager/permission-manager.component.theme';
|
||||
@import '../components/context-menu/context-menu.component.theme';
|
||||
@import '../components/dl-custom-components/name-column/name-column.component.scss';
|
||||
@@ -41,7 +40,6 @@ $warn: map-get($custom-theme, warn);
|
||||
@include aca-node-versions-dialog-theme($theme);
|
||||
@include snackbar-theme($theme);
|
||||
@include sidenav-component-theme($theme);
|
||||
@include aca-current-user-theme($theme);
|
||||
@include aca-context-menu-theme($theme);
|
||||
@include aca-custom-name-column-theme($theme);
|
||||
@include app-create-from-template-theme($theme);
|
||||
|
Reference in New Issue
Block a user