From adbbc1c152e63c8163374d248c3080bc86d5c4d1 Mon Sep 17 00:00:00 2001 From: Yasa-Nataliya <107834418+Yasa-Nataliya@users.noreply.github.com> Date: Tue, 16 May 2023 14:25:43 +0530 Subject: [PATCH] [ACS-4708] Implemented user initials (#3184) * added user initials * modified spec file * changes for config files * class name renamed * implemented the review comments --- .../context-submenus-ext.json | 65 ++++---- .../document-presets-ext.json | 65 ++++---- .../extensibility-configs/header-ext.json | 115 +++++++------- .../info-drawer-ext.json | 65 ++++---- .../info-drawer-no-tabs-ext.json | 65 ++++---- .../extensibility-configs/metadata-ext.json | 65 ++++---- .../extensibility-configs/viewer-ext.json | 65 ++++---- .../about/assets/about.plugin.json | 24 +-- .../aca-content/assets/app.extensions.json | 65 ++++---- .../aca-content/src/lib/aca-content.module.ts | 4 +- .../common/user-info/user-info.component.html | 13 +- .../common/user-info/user-info.component.scss | 25 +++ .../user-info/user-info.component.spec.ts | 87 +++++++---- .../common/user-info/user-info.component.ts | 26 ++-- .../lib/components/sidenav/sidenav.module.ts | 4 +- .../user-menu/user-menu.component.html | 9 ++ .../user-menu/user-menu.component.scss | 14 ++ .../user-menu/user-menu.component.spec.ts | 143 ++++++++++++++++++ .../sidenav/user-menu/user-menu.component.ts | 99 ++++++++++++ .../src/lib/ui/variables/variables.scss | 6 +- .../src/components/header/header.ts | 6 +- 21 files changed, 735 insertions(+), 295 deletions(-) create mode 100644 projects/aca-content/src/lib/components/common/user-info/user-info.component.scss create mode 100644 projects/aca-content/src/lib/components/sidenav/user-menu/user-menu.component.html create mode 100644 projects/aca-content/src/lib/components/sidenav/user-menu/user-menu.component.scss create mode 100644 projects/aca-content/src/lib/components/sidenav/user-menu/user-menu.component.spec.ts create mode 100644 projects/aca-content/src/lib/components/sidenav/user-menu/user-menu.component.ts diff --git a/e2e/resources/extensibility-configs/context-submenus-ext.json b/e2e/resources/extensibility-configs/context-submenus-ext.json index 9c7df193f..94bb45d02 100644 --- a/e2e/resources/extensibility-configs/context-submenus-ext.json +++ b/e2e/resources/extensibility-configs/context-submenus-ext.json @@ -46,39 +46,52 @@ "features": { "header": [ { - "id": "app.header.user", + "id": "app.header.notification-center", "type": "custom", - "component": "app.user", - "order": 100 + "component": "app.notification-center", + "order": 50 }, { "id": "app.header.more", - "type": "menu", + "type": "custom", "order": 10000, - "icon": "more_vert", + "component": "app.user.menu", "title": "APP.ACTIONS.MORE", - "children": [ - { - "id": "app.languagePicker", - "order": 100, - "type": "custom", - "component": "app.languagePicker" - }, - { - "id": "logout.separator", - "type": "separator", - "order": 199 - }, - { - "id": "app.logout", - "order": 200, - "type": "custom", - "component": "app.logout", - "rules": { - "visible": "app.canShowLogout" + "data": { + "items": [ + { + "id": "app.header.user", + "type": "custom", + "component": "app.user", + "order": 100 + }, + { + "id": "user.separator", + "type": "separator", + "order": 100 + }, + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker" + }, + { + "id": "logout.separator", + "type": "separator", + "order": 199 + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } } - } - ] + ] + } } ], "icons": [ diff --git a/e2e/resources/extensibility-configs/document-presets-ext.json b/e2e/resources/extensibility-configs/document-presets-ext.json index 3dcb66676..fc3ab4bbc 100644 --- a/e2e/resources/extensibility-configs/document-presets-ext.json +++ b/e2e/resources/extensibility-configs/document-presets-ext.json @@ -46,39 +46,52 @@ "features": { "header": [ { - "id": "app.header.user", + "id": "app.header.notification-center", "type": "custom", - "component": "app.user", - "order": 100 + "component": "app.notification-center", + "order": 50 }, { "id": "app.header.more", - "type": "menu", + "type": "custom", "order": 10000, - "icon": "more_vert", + "component": "app.user.menu", "title": "APP.ACTIONS.MORE", - "children": [ - { - "id": "app.languagePicker", - "order": 100, - "type": "custom", - "component": "app.languagePicker" - }, - { - "id": "logout.separator", - "type": "separator", - "order": 199 - }, - { - "id": "app.logout", - "order": 200, - "type": "custom", - "component": "app.logout", - "rules": { - "visible": "app.canShowLogout" + "data": { + "items": [ + { + "id": "app.header.user", + "type": "custom", + "component": "app.user", + "order": 100 + }, + { + "id": "user.separator", + "type": "separator", + "order": 100 + }, + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker" + }, + { + "id": "logout.separator", + "type": "separator", + "order": 199 + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } } - } - ] + ] + } } ], "icons": [ diff --git a/e2e/resources/extensibility-configs/header-ext.json b/e2e/resources/extensibility-configs/header-ext.json index fb9aa267b..5b5ea0efa 100644 --- a/e2e/resources/extensibility-configs/header-ext.json +++ b/e2e/resources/extensibility-configs/header-ext.json @@ -46,66 +46,79 @@ "features": { "header": [ { - "id": "app.header.user", + "id": "app.header.notification-center", "type": "custom", - "component": "app.user", - "order": 100 + "component": "app.notification-center", + "order": 50 }, { "id": "app.header.more", - "type": "menu", + "type": "custom", "order": 10000, - "icon": "more_vert", + "component": "app.user.menu", "title": "APP.ACTIONS.MORE", - "children": [ - { - "id": "app.languagePicker", - "order": 100, - "type": "custom", - "component": "app.languagePicker" - }, - { - "id": "logout.separator", - "type": "separator", - "order": 199 - }, - { - "id": "settings", - "title": "App settings", - "description": "Application settings", - "icon": "settings", - "disabled": true, - "order": 10, - "actions": { - "click": "app.actions.settings" + "data": { + "items": [ + { + "id": "app.header.user", + "type": "custom", + "component": "app.user", + "order": 100 }, - "rules": { - "visible": "app.navigation.isNotTrashcan" - } - }, - { - "id": "button", - "title": "New Button", - "description": "new button description", - "icon": "alarm_on", - "order": 20, - "actions": { - "click": "app.actions.settings" + { + "id": "user.separator", + "type": "separator", + "order": 100 }, - "rules": { - "visible": "app.navigation.isNotTrashcan" + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker" + }, + { + "id": "settings", + "title": "App settings", + "description": "Application settings", + "icon": "settings", + "disabled": true, + "order": 10, + "actions": { + "click": "app.actions.settings" + }, + "rules": { + "visible": "app.navigation.isNotTrashcan" + } + }, + { + "id": "button", + "title": "New Button", + "description": "new button description", + "icon": "alarm_on", + "order": 20, + "actions": { + "click": "app.actions.settings" + }, + "rules": { + "visible": "app.navigation.isNotTrashcan" + } + }, + { + "id": "logout.separator", + "type": "separator", + "order": 199 + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } } - }, - { - "id": "app.logout", - "order": 200, - "type": "custom", - "component": "app.logout", - "rules": { - "visible": "app.canShowLogout" - } - } - ] + ] + } } ], "icons": [ diff --git a/e2e/resources/extensibility-configs/info-drawer-ext.json b/e2e/resources/extensibility-configs/info-drawer-ext.json index 89da3b859..f03205721 100644 --- a/e2e/resources/extensibility-configs/info-drawer-ext.json +++ b/e2e/resources/extensibility-configs/info-drawer-ext.json @@ -46,39 +46,52 @@ "features": { "header": [ { - "id": "app.header.user", + "id": "app.header.notification-center", "type": "custom", - "component": "app.user", - "order": 100 + "component": "app.notification-center", + "order": 50 }, { "id": "app.header.more", - "type": "menu", + "type": "custom", "order": 10000, - "icon": "more_vert", + "component": "app.user.menu", "title": "APP.ACTIONS.MORE", - "children": [ - { - "id": "app.languagePicker", - "order": 100, - "type": "custom", - "component": "app.languagePicker" - }, - { - "id": "logout.separator", - "type": "separator", - "order": 199 - }, - { - "id": "app.logout", - "order": 200, - "type": "custom", - "component": "app.logout", - "rules": { - "visible": "app.canShowLogout" + "data": { + "items": [ + { + "id": "app.header.user", + "type": "custom", + "component": "app.user", + "order": 100 + }, + { + "id": "user.separator", + "type": "separator", + "order": 100 + }, + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker" + }, + { + "id": "logout.separator", + "type": "separator", + "order": 199 + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } } - } - ] + ] + } } ], "icons": [ diff --git a/e2e/resources/extensibility-configs/info-drawer-no-tabs-ext.json b/e2e/resources/extensibility-configs/info-drawer-no-tabs-ext.json index 0cd68e121..d50b8d784 100644 --- a/e2e/resources/extensibility-configs/info-drawer-no-tabs-ext.json +++ b/e2e/resources/extensibility-configs/info-drawer-no-tabs-ext.json @@ -46,39 +46,52 @@ "features": { "header": [ { - "id": "app.header.user", + "id": "app.header.notification-center", "type": "custom", - "component": "app.user", - "order": 100 + "component": "app.notification-center", + "order": 50 }, { "id": "app.header.more", - "type": "menu", + "type": "custom", "order": 10000, - "icon": "more_vert", + "component": "app.user.menu", "title": "APP.ACTIONS.MORE", - "children": [ - { - "id": "app.languagePicker", - "order": 100, - "type": "custom", - "component": "app.languagePicker" - }, - { - "id": "logout.separator", - "type": "separator", - "order": 199 - }, - { - "id": "app.logout", - "order": 200, - "type": "custom", - "component": "app.logout", - "rules": { - "visible": "app.canShowLogout" + "data": { + "items": [ + { + "id": "app.header.user", + "type": "custom", + "component": "app.user", + "order": 100 + }, + { + "id": "user.separator", + "type": "separator", + "order": 100 + }, + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker" + }, + { + "id": "logout.separator", + "type": "separator", + "order": 199 + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } } - } - ] + ] + } } ], "icons": [ diff --git a/e2e/resources/extensibility-configs/metadata-ext.json b/e2e/resources/extensibility-configs/metadata-ext.json index 31b94c3ec..ea508fdd5 100644 --- a/e2e/resources/extensibility-configs/metadata-ext.json +++ b/e2e/resources/extensibility-configs/metadata-ext.json @@ -46,39 +46,52 @@ "features": { "header": [ { - "id": "app.header.user", + "id": "app.header.notification-center", "type": "custom", - "component": "app.user", - "order": 100 + "component": "app.notification-center", + "order": 50 }, { "id": "app.header.more", - "type": "menu", + "type": "custom", "order": 10000, - "icon": "more_vert", + "component": "app.user.menu", "title": "APP.ACTIONS.MORE", - "children": [ - { - "id": "app.languagePicker", - "order": 100, - "type": "custom", - "component": "app.languagePicker" - }, - { - "id": "logout.separator", - "type": "separator", - "order": 199 - }, - { - "id": "app.logout", - "order": 200, - "type": "custom", - "component": "app.logout", - "rules": { - "visible": "app.canShowLogout" + "data": { + "items": [ + { + "id": "app.header.user", + "type": "custom", + "component": "app.user", + "order": 100 + }, + { + "id": "user.separator", + "type": "separator", + "order": 100 + }, + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker" + }, + { + "id": "logout.separator", + "type": "separator", + "order": 199 + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } } - } - ] + ] + } } ], "icons": [ diff --git a/e2e/resources/extensibility-configs/viewer-ext.json b/e2e/resources/extensibility-configs/viewer-ext.json index 0dc53e075..be6702d8e 100644 --- a/e2e/resources/extensibility-configs/viewer-ext.json +++ b/e2e/resources/extensibility-configs/viewer-ext.json @@ -46,39 +46,52 @@ "features": { "header": [ { - "id": "app.header.user", + "id": "app.header.notification-center", "type": "custom", - "component": "app.user", - "order": 100 + "component": "app.notification-center", + "order": 50 }, { "id": "app.header.more", - "type": "menu", + "type": "custom", "order": 10000, - "icon": "more_vert", + "component": "app.user.menu", "title": "APP.ACTIONS.MORE", - "children": [ - { - "id": "app.languagePicker", - "order": 100, - "type": "custom", - "component": "app.languagePicker" - }, - { - "id": "logout.separator", - "type": "separator", - "order": 199 - }, - { - "id": "app.logout", - "order": 200, - "type": "custom", - "component": "app.logout", - "rules": { - "visible": "app.canShowLogout" + "data": { + "items": [ + { + "id": "app.header.user", + "type": "custom", + "component": "app.user", + "order": 100 + }, + { + "id": "user.separator", + "type": "separator", + "order": 100 + }, + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker" + }, + { + "id": "logout.separator", + "type": "separator", + "order": 199 + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } } - } - ] + ] + } } ], "icons": [ diff --git a/projects/aca-content/about/assets/about.plugin.json b/projects/aca-content/about/assets/about.plugin.json index eb236cd91..35ffac149 100644 --- a/projects/aca-content/about/assets/about.plugin.json +++ b/projects/aca-content/about/assets/about.plugin.json @@ -27,18 +27,20 @@ "header": [ { "id": "app.header.more", - "children": [ - { - "id": "app.header.about", - "order": 100, - "title": "APP.BROWSE.ABOUT.TITLE", - "description": "APP.BROWSE.ABOUT.TITLE", - "icon": "info", - "actions": { - "click": "app.actions.about" + "data": { + "items": [ + { + "id": "app.header.about", + "order": 100, + "title": "APP.BROWSE.ABOUT.TITLE", + "description": "APP.BROWSE.ABOUT.TITLE", + "icon": "info", + "actions": { + "click": "app.actions.about" + } } - } - ] + ] + } } ] } diff --git a/projects/aca-content/assets/app.extensions.json b/projects/aca-content/assets/app.extensions.json index 5065c62a3..a39d32975 100644 --- a/projects/aca-content/assets/app.extensions.json +++ b/projects/aca-content/assets/app.extensions.json @@ -87,38 +87,45 @@ }, { "id": "app.header.more", - "type": "menu", + "type": "custom", "order": 10000, - "icon": "apps", + "component": "app.user.menu", "title": "APP.ACTIONS.MORE", - "children": [ - { - "id": "app.header.user", - "type": "custom", - "component": "app.user", - "order": 100 - }, - { - "id": "app.languagePicker", - "order": 100, - "type": "custom", - "component": "app.languagePicker" - }, - { - "id": "logout.separator", - "type": "separator", - "order": 199 - }, - { - "id": "app.logout", - "order": 200, - "type": "custom", - "component": "app.logout", - "rules": { - "visible": "app.canShowLogout" + "data": { + "items": [ + { + "id": "app.header.user", + "type": "custom", + "component": "app.user", + "order": 100 + }, + { + "id": "user.separator", + "type": "separator", + "order": 100 + }, + { + "id": "app.languagePicker", + "order": 100, + "type": "custom", + "component": "app.languagePicker" + }, + { + "id": "logout.separator", + "type": "separator", + "order": 199 + }, + { + "id": "app.logout", + "order": 200, + "type": "custom", + "component": "app.logout", + "rules": { + "visible": "app.canShowLogout" + } } - } - ] + ] + } } ], "icons": [ diff --git a/projects/aca-content/src/lib/aca-content.module.ts b/projects/aca-content/src/lib/aca-content.module.ts index ada701a0e..54a9d082f 100644 --- a/projects/aca-content/src/lib/aca-content.module.ts +++ b/projects/aca-content/src/lib/aca-content.module.ts @@ -118,6 +118,7 @@ import { UserInfoComponent } from './components/common/user-info/user-info.compo import { SidenavComponent } from './components/sidenav/sidenav.component'; import { ContentManagementService } from './services/content-management.service'; import { ShellLayoutComponent, SHELL_NAVBAR_MIN_WIDTH } from '@alfresco/adf-core/shell'; +import { UserMenuComponent } from './components/sidenav/user-menu/user-menu.component'; registerLocaleData(localeFr); registerLocaleData(localeDe); @@ -229,7 +230,8 @@ export class ContentServiceExtensionModule { 'app.languagePicker': LanguagePickerComponent, 'app.logout': LogoutComponent, 'app.user': UserInfoComponent, - 'app.notification-center': NotificationHistoryComponent + 'app.notification-center': NotificationHistoryComponent, + 'app.user.menu': UserMenuComponent }); extensions.setEvaluators({ diff --git a/projects/aca-content/src/lib/components/common/user-info/user-info.component.html b/projects/aca-content/src/lib/components/common/user-info/user-info.component.html index 7017c6af6..d3e115f5a 100644 --- a/projects/aca-content/src/lib/components/common/user-info/user-info.component.html +++ b/projects/aca-content/src/lib/components/common/user-info/user-info.component.html @@ -1,4 +1,9 @@ - +
diff --git a/projects/aca-content/src/lib/components/common/user-info/user-info.component.scss b/projects/aca-content/src/lib/components/common/user-info/user-info.component.scss new file mode 100644 index 000000000..1d168b2ec --- /dev/null +++ b/projects/aca-content/src/lib/components/common/user-info/user-info.component.scss @@ -0,0 +1,25 @@ +.aca-user-info { + display: flex; + height: 66px; + align-items: center; + + &-button { + border-radius: 90%; + height: 32px; + margin-right: 0; + min-width: 32px; + padding: 0; + font-weight: 700; + line-height: 32px; + text-align: center; + vertical-align: middle; + background: var(--theme-user-initials-background-color); + color: var(--theme-user-intials-text-color); + border: none; + } + + &-name-email { + line-height: 24px; + margin-left: 10px; + } +} diff --git a/projects/aca-content/src/lib/components/common/user-info/user-info.component.spec.ts b/projects/aca-content/src/lib/components/common/user-info/user-info.component.spec.ts index 2df6b9ec9..73e33247b 100644 --- a/projects/aca-content/src/lib/components/common/user-info/user-info.component.spec.ts +++ b/projects/aca-content/src/lib/components/common/user-info/user-info.component.spec.ts @@ -23,7 +23,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AuthenticationService } from '@alfresco/adf-core'; +import { AuthenticationService, IdentityUserService } from '@alfresco/adf-core'; import { PeopleContentService } from '@alfresco/adf-content-services'; import { UserInfoComponent } from './user-info.component'; import { AppTestingModule } from '../../../testing/app-testing.module'; @@ -34,7 +34,7 @@ describe('UserInfoComponent', () => { let fixture: ComponentFixture