diff --git a/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.html b/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.html index 7487ff5bf0..cf5229c4e4 100644 --- a/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.html +++ b/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.html @@ -1,5 +1,61 @@ -
-
+
+
+
+
+ Editor logo +
+
+
+ editor.sidebar.menu.editor +
+
+
+ + +
+ + + + + Log out + +
+
+
+ +
+ + + + Organization logo + {{ organisations[0].name }} + + +
diff --git a/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.spec.ts b/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.spec.ts index 08fcdb3314..362fb48249 100644 --- a/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.spec.ts +++ b/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.spec.ts @@ -6,11 +6,26 @@ import { ActivatedRoute } from '@angular/router' import { TranslateModule } from '@ngx-translate/core' import { DATASET_RECORDS } from '@geonetwork-ui/common/fixtures' import { RecordsRepositoryInterface } from '@geonetwork-ui/common/domain/repository/records-repository.interface' +import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface' +import { AvatarServiceInterface } from '@geonetwork-ui/api/repository' +import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' class RecordsRepositoryMock { getAllDrafts = jest.fn().mockReturnValue(of(DATASET_RECORDS)) } +class PlatformServiceMock { + getMe = jest.fn().mockReturnValue(of({ organisation: 'organisation' })) +} + +class AvatarServiceInterfaceMock { + getPlaceholder = () => of('http://placeholder.com') +} + +class OrganisationsServiceMock { + organisations$ = of([{ name: 'organisation' }]) +} + describe('SidebarComponent', () => { let component: SidebarComponent let fixture: ComponentFixture @@ -27,6 +42,18 @@ describe('SidebarComponent', () => { provide: RecordsRepositoryInterface, useClass: RecordsRepositoryMock, }, + { + provide: PlatformServiceInterface, + useClass: PlatformServiceMock, + }, + { + provide: AvatarServiceInterface, + useClass: AvatarServiceInterfaceMock, + }, + { + provide: OrganizationsServiceInterface, + useClass: OrganisationsServiceMock, + }, ], schemas: [NO_ERRORS_SCHEMA], }) diff --git a/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.ts b/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.ts index 4f9d569be7..0aeb4afca0 100644 --- a/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.ts +++ b/apps/metadata-editor/src/app/dashboard/sidebar/sidebar.component.ts @@ -1,7 +1,14 @@ import { CommonModule } from '@angular/common' -import { ChangeDetectionStrategy, Component } from '@angular/core' +import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core' import { TranslateModule } from '@ngx-translate/core' import { DashboardMenuComponent } from '../dashboard-menu/dashboard-menu.component' +import { PlatformServiceInterface } from '@geonetwork-ui/common/domain/platform.service.interface' +import { AvatarServiceInterface } from '@geonetwork-ui/api/repository' +import { LetDirective } from '@ngrx/component' +import { UiElementsModule } from '@geonetwork-ui/ui/elements' +import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' +import { Observable, combineLatest } from 'rxjs' +import { Organization } from '@geonetwork-ui/common/domain/model/record' @Component({ selector: 'md-editor-sidebar', @@ -9,6 +16,29 @@ import { DashboardMenuComponent } from '../dashboard-menu/dashboard-menu.compone styleUrls: ['./sidebar.component.css'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [DashboardMenuComponent, CommonModule, TranslateModule], + imports: [ + DashboardMenuComponent, + CommonModule, + TranslateModule, + LetDirective, + UiElementsModule, + ], }) -export class SidebarComponent {} +export class SidebarComponent implements OnInit { + public placeholder$ = this.avatarService.getPlaceholder() + organisations$: Observable + + constructor( + public platformService: PlatformServiceInterface, + private avatarService: AvatarServiceInterface, + public organisationsService: OrganizationsServiceInterface + ) {} + + ngOnInit(): void { + this.organisations$ = combineLatest( + this.organisationsService.organisations$, + this.platformService.getMe(), + (orgs, me) => orgs.filter((org) => org.name === me?.organisation) + ) + } +} diff --git a/apps/metadata-editor/src/assets/editor-logo.svg b/apps/metadata-editor/src/assets/editor-logo.svg new file mode 100644 index 0000000000..a20169b45b --- /dev/null +++ b/apps/metadata-editor/src/assets/editor-logo.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/apps/metadata-editor/src/assets/system-shut.svg b/apps/metadata-editor/src/assets/system-shut.svg new file mode 100644 index 0000000000..ce81ac10de --- /dev/null +++ b/apps/metadata-editor/src/assets/system-shut.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/libs/ui/elements/src/lib/user-preview/user-preview.component.html b/libs/ui/elements/src/lib/user-preview/user-preview.component.html index 327eefbf84..361fa66a73 100644 --- a/libs/ui/elements/src/lib/user-preview/user-preview.component.html +++ b/libs/ui/elements/src/lib/user-preview/user-preview.component.html @@ -1,6 +1,6 @@