diff --git a/apps/datahub-e2e/src/e2e/organization-page.cy.ts b/apps/datahub-e2e/src/e2e/organization-page.cy.ts new file mode 100644 index 0000000000..d51ddce896 --- /dev/null +++ b/apps/datahub-e2e/src/e2e/organization-page.cy.ts @@ -0,0 +1,118 @@ +import 'cypress-real-events' + +describe('organizations', () => { + beforeEach(() => { + cy.visit('organization/Barbie%20Inc.') + + // aliases + cy.get('gn-ui-navigation-button').as('backButton') + cy.get('[data-test="organizationHeaderName"]').as('organizationHeaderName') + cy.get('[data-test="organizationHeaderWebsiteLink"]').as( + 'organizationHeaderWebsiteLink' + ) + cy.get('[data-test="organizationDescription"]').as( + 'organizationDescription' + ) + cy.get('gn-ui-max-lines').contains('Read more').as('readMoreButton') + cy.get('[data-test="organizationLogo"]').as('organizationLogo') + cy.get('[data-test="organizationDatasetCount"]').as( + 'organizationDatasetCount' + ) + cy.get('[data-test="organizationEmail"]').as('organizationEmail') + cy.get('[orgPageLasPubDat]').as('orgPageLasPubDat') + cy.get('[data-test="orgDetailsSearchAllBtn"]').as('orgDetailsSearchAllBtn') + }) + + describe('general display', () => { + describe('header', () => { + describe('back button', () => { + beforeEach(() => { + cy.visit('organisations') + cy.visit('organization/Barbie%20Inc.') + }) + + it('back button goes to the previous visited page', () => { + cy.get('@backButton').click() + cy.url().should('include', '/organisations') + }) + }) + + it('should display the organization name', () => { + cy.get('@organizationHeaderName').should('contain', 'Barbie Inc.') + }) + + it('should display the organization website link', () => { + cy.get('@organizationHeaderWebsiteLink') + .should('be.visible') + .should('have.attr', 'href', 'https://www.barbie-inc.com/') + .and('have.attr', 'target', '_blank') + }) + }) + + describe('details', () => { + describe('left column', () => { + it('should display the organization description', () => { + cy.get('@organizationDescription').should('be.visible') + }) + + it('click on read more should expand the organization description', () => { + let initialDescription + let newDescription + + cy.get('@organizationDescription').then((firstDescription) => { + initialDescription = firstDescription + cy.get('@readMoreButton').trigger('click') + cy.get('@organizationDescription').then((secondDescription) => { + newDescription = secondDescription + expect(newDescription).to.not.equal(initialDescription) + }) + }) + }) + }) + + describe('right column', () => { + it('should display the organization logo', () => { + cy.get('@organizationLogo').should('be.visible') + }) + + it('should display the organization dataset count', () => { + cy.get('@organizationDatasetCount').should('be.visible') + }) + + it('a click on the organization dataset count should open the dataset search page filtered on the organization', () => { + cy.get('@organizationDatasetCount').then(($link) => { + const url = $link.prop('href') + cy.wrap($link).click() + + cy.url().should('eq', url) + }) + }) + + it('should display the organization email', () => { + cy.get('@organizationEmail') + .should('be.visible') + .and('have.attr', 'href', 'mailto:contact@barbie-inc.com') + }) + }) + + describe('last published datasets', () => { + it('should display the last published datasets', () => { + cy.get('@orgPageLasPubDat').should('be.visible') + }) + + it('should display the search all button', () => { + cy.get('@orgDetailsSearchAllBtn').should('be.visible') + }) + + it('a click on the search all button should open the dataset search page filtered on the organization', () => { + cy.get('@orgDetailsSearchAllBtn').then(($link) => { + const url = $link.prop('href') + cy.wrap($link).click() + + cy.url().should('eq', url) + }) + }) + }) + }) + }) +}) diff --git a/apps/datahub-e2e/src/e2e/organizations.cy.ts b/apps/datahub-e2e/src/e2e/organizations.cy.ts index b39da4ca39..ded2dc026d 100644 --- a/apps/datahub-e2e/src/e2e/organizations.cy.ts +++ b/apps/datahub-e2e/src/e2e/organizations.cy.ts @@ -77,14 +77,15 @@ describe('organizations', () => { }) describe('list features', () => { - it('should search with a filter on the selected org on click', () => { + it('should open the organization page', () => { cy.get('@organizationsName') .eq(10) .then(($clickedName) => { cy.get('@organizations').eq(10).click() - cy.url() - .should('include', 'publisher=') - .and('include', encodeURIComponent($clickedName.text().trim())) + cy.url().should( + 'contain', + `organization/${encodeURIComponent($clickedName.text().trim())}` + ) }) }) }) diff --git a/apps/datahub/src/app/app.module.ts b/apps/datahub/src/app/app.module.ts index 534338f09d..0c69562559 100644 --- a/apps/datahub/src/app/app.module.ts +++ b/apps/datahub/src/app/app.module.ts @@ -5,6 +5,7 @@ import { BrowserModule } from '@angular/platform-browser' import { Router, RouterModule } from '@angular/router' import { FeatureCatalogModule, + ORGANIZATION_PAGE_URL_TOKEN, ORGANIZATION_URL_TOKEN, } from '@geonetwork-ui/feature/catalog' import { @@ -94,7 +95,6 @@ import { UiWidgetsModule } from '@geonetwork-ui/ui/widgets' import { RecordUserFeedbacksComponent } from './record/record-user-feedbacks/record-user-feedbacks.component' import { LetDirective } from '@ngrx/component' import { OrganizationPageComponent } from './organization/organization-page/organization-page.component' -import { ORGANIZATION_PAGE_URL_TOKEN } from '../../../../libs/feature/catalog/src/lib/organization-url.token' export const metaReducers: MetaReducer[] = !environment.production ? [] : [] diff --git a/apps/datahub/src/app/organization/organization-details/organization-details.component.css b/apps/datahub/src/app/organization/organization-details/organization-details.component.css index e69de29bb2..c0d50f2d1c 100644 --- a/apps/datahub/src/app/organization/organization-details/organization-details.component.css +++ b/apps/datahub/src/app/organization/organization-details/organization-details.component.css @@ -0,0 +1,15 @@ +.list-page-dot { + width: 6px; + height: 6px; + border-radius: 6px; + position: relative; +} + +.list-page-dot:after { + content: ''; + position: absolute; + left: -7px; + top: -7px; + width: 20px; + height: 20px; +} diff --git a/apps/datahub/src/app/organization/organization-details/organization-details.component.html b/apps/datahub/src/app/organization/organization-details/organization-details.component.html index 9ef5da0aef..abd22432ce 100644 --- a/apps/datahub/src/app/organization/organization-details/organization-details.component.html +++ b/apps/datahub/src/app/organization/organization-details/organization-details.component.html @@ -2,9 +2,6 @@
@@ -81,7 +73,7 @@ " > - Search all + organization.lastPublishedDatasets.searchAllButton
@@ -111,7 +104,7 @@ >
+
+ +
@@ -132,9 +139,9 @@ - + >
diff --git a/apps/datahub/src/app/organization/organization-details/organization-details.component.spec.ts b/apps/datahub/src/app/organization/organization-details/organization-details.component.spec.ts index 6e4d6078ac..59e74c471d 100644 --- a/apps/datahub/src/app/organization/organization-details/organization-details.component.spec.ts +++ b/apps/datahub/src/app/organization/organization-details/organization-details.component.spec.ts @@ -52,10 +52,6 @@ class OrganisationsServiceMock { } const anOrganizationWithManyDatasets: Organization = ORGANISATIONS_FIXTURE[0] -const anOrganizationWithOnlyOneDataset: Organization = { - ...ORGANISATIONS_FIXTURE[0], - recordCount: 1, -} const oneDataset = [DATASET_RECORDS[0]] const manyDatasets = DATASET_RECORDS.concat(DATASET_RECORDS[0]) @@ -204,14 +200,9 @@ describe('OrganizationDetailsComponent', () => { organizationIsLoading.next(true) fixture.detectChanges() - const organizationDetailsLastPublishedDatasetsPreviousNextButtons = - getHTMLElement( - 'organizationDetailsLastPublishedDatasetsPreviousNextButtons' - ) + const orgDetailsNavBtn = getHTMLElement('orgDetailsNavBtn') - expect( - organizationDetailsLastPublishedDatasetsPreviousNextButtons - ).toBeFalsy() + expect(orgDetailsNavBtn).toBeFalsy() }) it('should not be displayed organization is loaded but has no pagination', () => { @@ -219,14 +210,9 @@ describe('OrganizationDetailsComponent', () => { totalPages.next(1) fixture.detectChanges() - const organizationDetailsLastPublishedDatasetsPreviousNextButtons = - getHTMLElement( - 'organizationDetailsLastPublishedDatasetsPreviousNextButtons' - ) + const orgDetailsNavBtn = getHTMLElement('orgDetailsNavBtn') - expect( - organizationDetailsLastPublishedDatasetsPreviousNextButtons - ).toBeFalsy() + expect(orgDetailsNavBtn).toBeFalsy() }) it('should be displayed if organization is loadded and have pagination', () => { @@ -234,39 +220,29 @@ describe('OrganizationDetailsComponent', () => { totalPages.next(10) fixture.detectChanges() - const organizationDetailsLastPublishedDatasetsPreviousNextButtons = - getHTMLElement( - 'organizationDetailsLastPublishedDatasetsPreviousNextButtons' - ) + const orgDetailsNavBtn = getHTMLElement('orgDetailsNavBtn') - expect( - organizationDetailsLastPublishedDatasetsPreviousNextButtons - ).toBeTruthy() + expect(orgDetailsNavBtn).toBeTruthy() }) it('should call paginate from the facade if button is clicked', () => { const initialPageNumber = currentPage.getValue() const nextPageNumber = initialPageNumber + 1 - const organizationDetailsLastPublishedDatasetsPreviousNextButtons = - getHTMLElement( - 'organizationDetailsLastPublishedDatasetsPreviousNextButtons' - ) + const orgDetailsNavBtn = getHTMLElement('orgDetailsNavBtn') - const nextButton = - organizationDetailsLastPublishedDatasetsPreviousNextButtons?.querySelector( - '[data-test="nextButton"]' - ) as HTMLElement + const nextButton = orgDetailsNavBtn?.querySelector( + '[data-test="nextButton"]' + ) as HTMLElement ;(nextButton?.firstChild as HTMLElement).click() fixture.detectChanges() expect(searchFacade.paginate).toHaveBeenCalledWith(nextPageNumber) - const previousButton = - organizationDetailsLastPublishedDatasetsPreviousNextButtons?.querySelector( - '[data-test="previousButton"]' - ) as HTMLElement + const previousButton = orgDetailsNavBtn?.querySelector( + '[data-test="previousButton"]' + ) as HTMLElement ;(previousButton?.firstChild as HTMLElement).click() fixture.detectChanges() @@ -276,20 +252,13 @@ describe('OrganizationDetailsComponent', () => { describe('Search all button', () => { it('should send to the search page filtered on the correct organization', () => { - const organizationDetailsLastPublishedDatasetsSearchAllButton = - getHTMLElement( - 'organizationDetailsLastPublishedDatasetsSearchAllButton' - ) - - expect( - organizationDetailsLastPublishedDatasetsSearchAllButton - ).toBeTruthy() - - expect( - organizationDetailsLastPublishedDatasetsSearchAllButton?.getAttribute( - 'href' - ) - ).toEqual( + const orgDetailsSearchAllBtn = getHTMLElement( + 'orgDetailsSearchAllBtn' + ) + + expect(orgDetailsSearchAllBtn).toBeTruthy() + + expect(orgDetailsSearchAllBtn?.getAttribute('href')).toEqual( `/${ROUTER_ROUTE_SEARCH}?publisher=${encodeURIComponent( anOrganizationWithManyDatasets.name )}` @@ -300,21 +269,19 @@ describe('OrganizationDetailsComponent', () => { describe('Last published datasets', () => { it('should display the datasets properly', () => { - const organizationPageLastPublishedDatasets = getHTMLElement( + const orgPageLastPublishedDatasets = getHTMLElement( 'organizationPageLastPublishedDatasets' ) - expect(organizationPageLastPublishedDatasets).toBeTruthy() - expect(organizationPageLastPublishedDatasets?.children.length).toEqual( + expect(orgPageLastPublishedDatasets).toBeTruthy() + expect(orgPageLastPublishedDatasets?.children.length).toEqual( desiredPageSize ) results.next(oneDataset) fixture.detectChanges() - expect(organizationPageLastPublishedDatasets?.children.length).toEqual( - 1 - ) + expect(orgPageLastPublishedDatasets?.children.length).toEqual(1) }) }) }) diff --git a/apps/datahub/src/app/organization/organization-details/organization-details.component.ts b/apps/datahub/src/app/organization/organization-details/organization-details.component.ts index 23ab3fd7a2..0a0a538e99 100644 --- a/apps/datahub/src/app/organization/organization-details/organization-details.component.ts +++ b/apps/datahub/src/app/organization/organization-details/organization-details.component.ts @@ -4,11 +4,13 @@ import { ChangeDetectorRef, Component, Input, + OnChanges, OnDestroy, OnInit, + SimpleChanges, ViewChild, } from '@angular/core' -import { AsyncPipe, NgForOf, NgIf } from '@angular/common' +import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common' import { CatalogRecord, Organization, @@ -32,12 +34,20 @@ import { } from '@geonetwork-ui/ui/elements' import { UiSearchModule } from '@geonetwork-ui/ui/search' import { SearchFacade } from '@geonetwork-ui/feature/search' -import { Observable, of, Subscription, switchMap } from 'rxjs' +import { + BehaviorSubject, + combineLatest, + Observable, + of, + Subscription, + switchMap, +} from 'rxjs' import { UiDatavizModule } from '@geonetwork-ui/ui/dataviz' import { RouterLink } from '@angular/router' import { ROUTER_ROUTE_SEARCH } from '@geonetwork-ui/feature/router' import { OrganizationsServiceInterface } from '@geonetwork-ui/common/domain/organizations.service.interface' import { UiWidgetsModule } from '@geonetwork-ui/ui/widgets' +import { startWith } from 'rxjs/operators' @Component({ selector: 'datahub-organization-details', @@ -63,15 +73,19 @@ import { UiWidgetsModule } from '@geonetwork-ui/ui/widgets' UiDatavizModule, RouterLink, UiWidgetsModule, + NgClass, ], }) export class OrganizationDetailsComponent - implements OnInit, AfterViewInit, OnDestroy + implements OnInit, AfterViewInit, OnDestroy, OnChanges { protected readonly Error = Error protected readonly ErrorType = ErrorType + protected readonly ROUTER_ROUTE_SEARCH = ROUTER_ROUTE_SEARCH - @Input() organization: Organization + protected get pages() { + return new Array(this.totalPages).fill(0).map((_, i) => i + 1) + } lastPublishedDatasets$: Observable = of([]) @@ -84,6 +98,11 @@ export class OrganizationDetailsComponent isFirstPage = this.currentPage === 1 isLastPage = false + organizationHasChanged$ = new BehaviorSubject(undefined) + + @Input() organization: Organization + @Input() paginationContainerClass = 'w-full bottom-0 top-auto' + @ViewChild(BlockListComponent) list: BlockListComponent constructor( @@ -95,19 +114,30 @@ export class OrganizationDetailsComponent ngOnInit(): void { this.searchFacade.setPageSize(3) - this.lastPublishedDatasets$ = this.organizationsService - .getFiltersForOrgs([this.organization]) - .pipe( - switchMap((filters) => { - return this.searchFacade - .setFilters(filters) - .setSortBy(['desc', 'changeDate']).results$ - }) - ) + this.lastPublishedDatasets$ = this.organizationHasChanged$.pipe( + startWith([]), + switchMap(() => { + return this.organizationsService + .getFiltersForOrgs([this.organization]) + .pipe( + switchMap((filters) => { + return this.searchFacade + .setFilters(filters) + .setSortBy(['desc', 'changeDate']).results$ + }) + ) + }) + ) this.manageSubscriptions() } + ngOnChanges(changes: SimpleChanges): void { + if (changes['organization']) { + this.organizationHasChanged$.next() + } + } + ngAfterViewInit() { // this is required to show the pagination correctly this.changeDetector.detectChanges() @@ -129,38 +159,33 @@ export class OrganizationDetailsComponent } } - private manageSubscriptions() { - this.subscriptions$.add( - this.searchFacade.isLoading$.subscribe( - (isOrganizationsLoading) => - (this.isOrganizationsLoading = isOrganizationsLoading) - ) - ) - - this.subscriptions$.add( - this.searchFacade.totalPages$.subscribe( - (totalPages) => (this.totalPages = totalPages) - ) - ) - - this.subscriptions$.add( - this.searchFacade.isBeginningOfResults$.subscribe( - (isBeginningOfResults) => (this.isFirstPage = isBeginningOfResults) - ) - ) - - this.subscriptions$.add( - this.searchFacade.isEndOfResults$.subscribe( - (isEndOfResults) => (this.isLastPage = isEndOfResults) - ) - ) + goToPage(page: number) { + this.searchFacade.paginate(page) + } + private manageSubscriptions() { this.subscriptions$.add( - this.searchFacade.currentPage$.subscribe( - (currentPage) => (this.currentPage = currentPage) + combineLatest([ + this.searchFacade.isLoading$, + this.searchFacade.totalPages$, + this.searchFacade.isBeginningOfResults$, + this.searchFacade.isEndOfResults$, + this.searchFacade.currentPage$, + ]).subscribe( + ([ + isOrganizationsLoading, + totalPages, + isBeginningOfResults, + isEndOfResults, + currentPage, + ]) => { + this.isOrganizationsLoading = isOrganizationsLoading + this.totalPages = totalPages + this.isFirstPage = isBeginningOfResults + this.isLastPage = isEndOfResults + this.currentPage = currentPage + } ) ) } - - protected readonly ROUTER_ROUTE_SEARCH = ROUTER_ROUTE_SEARCH } diff --git a/apps/datahub/src/app/organization/header-organization/organization-header.component.css b/apps/datahub/src/app/organization/organization-header/organization-header.component.css similarity index 100% rename from apps/datahub/src/app/organization/header-organization/organization-header.component.css rename to apps/datahub/src/app/organization/organization-header/organization-header.component.css diff --git a/apps/datahub/src/app/organization/header-organization/organization-header.component.html b/apps/datahub/src/app/organization/organization-header/organization-header.component.html similarity index 95% rename from apps/datahub/src/app/organization/header-organization/organization-header.component.html rename to apps/datahub/src/app/organization/organization-header/organization-header.component.html index 9c16ff9bc0..932e97d0c7 100644 --- a/apps/datahub/src/app/organization/header-organization/organization-header.component.html +++ b/apps/datahub/src/app/organization/organization-header/organization-header.component.html @@ -22,6 +22,7 @@
@@ -41,6 +42,7 @@

{ - const orgName = user.organization + const orgName = user.organisation const org = orgs.find((org) => org.name === orgName) const logoUrl = org?.logoUrl?.toString() const recordCount = org?.recordCount const userList = allUsers.filter( - (user) => user.organization === orgName + (user) => user.organisation === orgName ) const userCount = userList.length return { diff --git a/libs/feature/catalog/src/lib/organisations/organisations.component.spec.ts b/libs/feature/catalog/src/lib/organisations/organisations.component.spec.ts index 70e97b09b7..138e62fdeb 100644 --- a/libs/feature/catalog/src/lib/organisations/organisations.component.spec.ts +++ b/libs/feature/catalog/src/lib/organisations/organisations.component.spec.ts @@ -4,6 +4,7 @@ import { DebugElement, EventEmitter, Input, + NO_ERRORS_SCHEMA, Output, } from '@angular/core' import { ComponentFixture, TestBed } from '@angular/core/testing' @@ -27,8 +28,8 @@ class OrganisationsFilterMockComponent { template: '
', }) class OrganisationPreviewMockComponent { - @Input() organisation: Organization - @Output() clickedOrganisation = new EventEmitter() + @Input() organization: Organization + @Output() clickedOrganization = new EventEmitter() } @Component({ @@ -85,6 +86,7 @@ describe('OrganisationsComponent', () => { useClass: OrganisationsServiceMock, }, ], + schemas: [NO_ERRORS_SCHEMA], }) .overrideComponent(OrganisationsComponent, { set: { changeDetection: ChangeDetectionStrategy.Default }, @@ -118,10 +120,10 @@ describe('OrganisationsComponent', () => { .map((debugElement) => debugElement.componentInstance) }) it('should pass first organisation (sorted by name-asc) to first ui preview component', () => { - expect(orgPreviewComponents[0].organisation.name).toEqual('A Data Org') + expect(orgPreviewComponents[0].organization.name).toEqual('A Data Org') }) it('should pass 6th organisation (sorted by name-asc) on page to 6th ui preview component', () => { - expect(orgPreviewComponents[5].organisation.name).toEqual('E Data Org') + expect(orgPreviewComponents[5].organization.name).toEqual('E Data Org') }) }) describe('pass params to ui pagination component', () => { @@ -152,13 +154,13 @@ describe('OrganisationsComponent', () => { expect(paginationComponentDE.componentInstance.currentPage).toEqual(2) }) it('should pass first organisation of second page (sorted by name-asc) to first ui preview component', () => { - expect(orgPreviewComponents[0].organisation.name).toEqual( + expect(orgPreviewComponents[0].organization.name).toEqual( 'é Data Org' ) }) it('should pass last organisation of second page (sorted by name-asc) to last ui preview component', () => { expect( - orgPreviewComponents[orgPreviewComponents.length - 1].organisation + orgPreviewComponents[orgPreviewComponents.length - 1].organization .name ).toEqual('J Data Org') }) @@ -193,12 +195,12 @@ describe('OrganisationsComponent', () => { expect(organisations[0]).toEqual(ORGANISATIONS_FIXTURE[5]) }) it('should pass organisation with max recordCount to first preview component', () => { - expect(orgPreviewComponents[0].organisation).toEqual( + expect(orgPreviewComponents[0].organization).toEqual( ORGANISATIONS_FIXTURE[5] ) }) it('should pass organisation with 6th highest recordCount to 6th preview component', () => { - expect(orgPreviewComponents[5].organisation).toEqual( + expect(orgPreviewComponents[5].organization).toEqual( ORGANISATIONS_FIXTURE[3] ) }) diff --git a/libs/feature/router/src/lib/default/router.service.spec.ts b/libs/feature/router/src/lib/default/router.service.spec.ts index bfae57c838..02e1736354 100644 --- a/libs/feature/router/src/lib/default/router.service.spec.ts +++ b/libs/feature/router/src/lib/default/router.service.spec.ts @@ -3,18 +3,24 @@ import { Router } from '@angular/router' import { RouterService } from './router.service' import { ROUTER_CONFIG } from './router.config' +import { ROUTER_ROUTE_ORGANIZATION } from './constants' const SearchRouteComponent = { name: 'searchRoute', } const RecordRouteComponent = { - name: 'recordhRoute', + name: 'recordRoute', +} + +const OrganizationRouteComponent = { + name: 'organizationRoute', } const routerConfigMock = { searchStateId: 'main', searchRouteComponent: SearchRouteComponent, recordRouteComponent: RecordRouteComponent, + organizationRouteComponent: OrganizationRouteComponent, } const RouterMock = { resetConfig: jest.fn(), @@ -37,10 +43,16 @@ const expectedRoutes = [ }, { component: { - name: 'recordhRoute', + name: 'recordRoute', }, path: 'dataset/:metadataUuid', }, + { + path: `${ROUTER_ROUTE_ORGANIZATION}/:name`, + component: { + name: 'organizationRoute', + }, + }, ] describe('RouterService', () => { let service: RouterService diff --git a/libs/ui/elements/src/lib/error/error.component.html b/libs/ui/elements/src/lib/error/error.component.html index 0b0c302281..83bafc539f 100644 --- a/libs/ui/elements/src/lib/error/error.component.html +++ b/libs/ui/elements/src/lib/error/error.component.html @@ -8,11 +8,11 @@
face question_mark + >question_mark + question_mark + >question_mark +
search.error.couldNotReachApi
@@ -36,12 +36,11 @@
computer question_mark + >question_mark +
search.error.organizationHasNoDataset
-
computer question_mark + >question_mark +
search.error.recordNotFound diff --git a/libs/ui/elements/src/lib/related-record-card/related-record-card.component.html b/libs/ui/elements/src/lib/related-record-card/related-record-card.component.html index 932c405b23..85fb920c14 100644 --- a/libs/ui/elements/src/lib/related-record-card/related-record-card.component.html +++ b/libs/ui/elements/src/lib/related-record-card/related-record-card.component.html @@ -1,5 +1,5 @@ diff --git a/libs/ui/elements/src/lib/related-record-card/related-record-card.component.ts b/libs/ui/elements/src/lib/related-record-card/related-record-card.component.ts index f883b3c31b..c166ea575d 100644 --- a/libs/ui/elements/src/lib/related-record-card/related-record-card.component.ts +++ b/libs/ui/elements/src/lib/related-record-card/related-record-card.component.ts @@ -1,4 +1,4 @@ -import { Component, ChangeDetectionStrategy, Input } from '@angular/core' +import { ChangeDetectionStrategy, Component, Input } from '@angular/core' import { CatalogRecord } from '@geonetwork-ui/common/domain/model/record' @Component({ @@ -8,5 +8,26 @@ import { CatalogRecord } from '@geonetwork-ui/common/domain/model/record' changeDetection: ChangeDetectionStrategy.OnPush, }) export class RelatedRecordCardComponent { + private readonly baseClasses: string + @Input() record: CatalogRecord + @Input() extraClass = '' + + constructor() { + this.baseClasses = [ + 'w-72', + 'h-96', + 'overflow-hidden', + 'rounded-lg', + 'bg-white', + 'cursor-pointer', + 'block', + 'hover:-translate-y-2 ', + 'duration-[180ms]', + ].join(' ') + } + + get classList() { + return `${this.baseClasses} ${this.extraClass}` + } } diff --git a/libs/ui/layout/src/lib/max-lines/max-lines.component.spec.ts b/libs/ui/layout/src/lib/max-lines/max-lines.component.spec.ts index dc28d6869c..075b5aae7c 100644 --- a/libs/ui/layout/src/lib/max-lines/max-lines.component.spec.ts +++ b/libs/ui/layout/src/lib/max-lines/max-lines.component.spec.ts @@ -4,6 +4,13 @@ import { MaxLinesComponent } from './max-lines.component' import { Component, importProvidersFrom } from '@angular/core' import { TranslateModule } from '@ngx-translate/core' +// Mock implementation of ResizeObserver +class ResizeObserverMock { + observe = jest.fn() + unobserve = jest.fn() + disconnect = jest.fn() +} + @Component({ template: ` @@ -22,10 +29,12 @@ describe('MaxLinesComponent', () => { let maxLinesComponent: MaxLinesComponent beforeEach(() => { + ;(window as any).ResizeObserver = ResizeObserverMock + TestBed.configureTestingModule({ - imports: [TranslateModule.forRoot()], + imports: [TranslateModule.forRoot(), MaxLinesComponent], providers: [importProvidersFrom(TranslateModule.forRoot())], - declarations: [MaxLinesComponent, TestHostComponent], + declarations: [TestHostComponent], }) fixture = TestBed.createComponent(TestHostComponent) hostComponent = fixture.componentInstance diff --git a/libs/ui/layout/src/lib/max-lines/max-lines.component.stories.ts b/libs/ui/layout/src/lib/max-lines/max-lines.component.stories.ts index c93ce310e2..1a811f97ab 100644 --- a/libs/ui/layout/src/lib/max-lines/max-lines.component.stories.ts +++ b/libs/ui/layout/src/lib/max-lines/max-lines.component.stories.ts @@ -10,7 +10,7 @@ import { TranslateModule } from '@ngx-translate/core' import { TRANSLATE_DEFAULT_CONFIG, UtilI18nModule, -} from '../../../../../util/i18n/src' +} from '@geonetwork-ui/util/i18n' import { importProvidersFrom } from '@angular/core' export default { diff --git a/support-services/docker-entrypoint-initdb.d/dump b/support-services/docker-entrypoint-initdb.d/dump index 0a433c68ec..f1f88acdff 100644 Binary files a/support-services/docker-entrypoint-initdb.d/dump and b/support-services/docker-entrypoint-initdb.d/dump differ diff --git a/translations/de.json b/translations/de.json index 51ea7ea43e..4c9ce7518d 100644 --- a/translations/de.json +++ b/translations/de.json @@ -245,6 +245,7 @@ "organization.details.mailContact": "", "organization.datasets": "", "organization.lastPublishedDatasets": "", + "organization.lastPublishedDatasets.searchAllButton": "", "pagination.nextPage": "Nächste Seite", "pagination.page": "Seite", "pagination.pageOf": "von", diff --git a/translations/en.json b/translations/en.json index c9c3eff5dd..5185304379 100644 --- a/translations/en.json +++ b/translations/en.json @@ -245,6 +245,7 @@ "organization.details.mailContact": "Contact by email", "organization.datasets": "Datasets", "organization.lastPublishedDatasets": "Last published datasets", + "organization.lastPublishedDatasets.searchAllButton": "Search all", "pagination.nextPage": "Next page", "pagination.page": "page", "pagination.pageOf": "of", diff --git a/translations/es.json b/translations/es.json index 6905a25102..dbe76de9a3 100644 --- a/translations/es.json +++ b/translations/es.json @@ -245,6 +245,7 @@ "organization.details.mailContact": "", "organization.datasets": "", "organization.lastPublishedDatasets": "", + "organization.lastPublishedDatasets.searchAllButton": "", "pagination.nextPage": "", "pagination.page": "", "pagination.pageOf": "", diff --git a/translations/fr.json b/translations/fr.json index 90b6272333..c5a3da4df3 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -245,6 +245,7 @@ "organization.details.mailContact": "Contacter par mail", "organization.datasets": "Données", "organization.lastPublishedDatasets": "Dernières données publiées", + "organization.lastPublishedDatasets.searchAllButton": "Rechercher tous", "pagination.nextPage": "Page suivante", "pagination.page": "page", "pagination.pageOf": "sur", diff --git a/translations/it.json b/translations/it.json index 88b55b64bb..20b32b8dc2 100644 --- a/translations/it.json +++ b/translations/it.json @@ -245,6 +245,7 @@ "organization.details.mailContact": "", "organization.datasets": "", "organization.lastPublishedDatasets": "", + "organization.lastPublishedDatasets.searchAllButton": "", "pagination.nextPage": "Pagina successiva", "pagination.page": "pagina", "pagination.pageOf": "di", diff --git a/translations/nl.json b/translations/nl.json index 837e08bd73..cf2b3874ee 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -245,6 +245,7 @@ "organization.details.mailContact": "", "organization.datasets": "", "organization.lastPublishedDatasets": "", + "organization.lastPublishedDatasets.searchAllButton": "", "pagination.nextPage": "", "pagination.page": "", "pagination.pageOf": "", diff --git a/translations/pt.json b/translations/pt.json index d79183c173..f948c12994 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -245,6 +245,7 @@ "organization.details.mailContact": "", "organization.datasets": "", "organization.lastPublishedDatasets": "", + "organization.lastPublishedDatasets.searchAllButton": "", "pagination.nextPage": "", "pagination.page": "", "pagination.pageOf": "", diff --git a/translations/sk.json b/translations/sk.json index 4c601e5da3..fbf29cc5a4 100644 --- a/translations/sk.json +++ b/translations/sk.json @@ -245,6 +245,7 @@ "organization.details.mailContact": "", "organization.datasets": "", "organization.lastPublishedDatasets": "", + "organization.lastPublishedDatasets.searchAllButton": "", "pagination.nextPage": "Ďalšia stránka", "pagination.page": "strana", "pagination.pageOf": "z",