Skip to content

Commit

Permalink
Merge pull request #47 from IGNF/datahub-ign-2905
Browse files Browse the repository at this point in the history
Datahub ign 2905
  • Loading branch information
mmohadIGN authored Jul 4, 2024
2 parents f1f0af2 + 2a50234 commit 558b969
Show file tree
Hide file tree
Showing 260 changed files with 7,271 additions and 3,497 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- name: Npm install
run: npm install
- name: npx build
run: npx nx build datahub --base-href=/catalogue/
run: npx nx build datahub --base-href=/catalogue/ --skip-nx-cache

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
Expand Down
118 changes: 118 additions & 0 deletions apps/datahub-e2e/src/e2e/organization-page.cy.ts
Original file line number Diff line number Diff line change
@@ -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('[data-test="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)
})
})
})
})
})
})
9 changes: 5 additions & 4 deletions apps/datahub-e2e/src/e2e/organizations.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())}`
)
})
})
})
Expand Down
131 changes: 98 additions & 33 deletions apps/datahub/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,63 +3,128 @@
class="selection:bg-primary-lightest selection:text-primary-darker"
>
<dsfr-header
[serviceTitle]="'catalogue.gouv.fr'"
[serviceTitle]="'cartes.gouv.fr'"
[logoLink]="'https://cartes.gouv.fr'"
[serviceTagline]="'Le service public des cartes et données du territoire'"
[menu]="[
{ label: 'carte.gouv.fr', link: 'https://cartes.gouv.fr', active: true },
{
label: 'Menu déroulant',
label: 'Commencer avec cartes.gouv',
subItems: [
{ label: 'Accès routerLink', routerLink: '/' },
{ label: 'Accès direct 3' }
{
label: 'Documentation',
link: 'https://cartes.gouv.fr/documentation'
},
{ label: 'Offre', link: 'https://cartes.gouv.fr/offre' },
{
label: 'Nous rejoindre',
link: 'https://cartes.gouv.fr/nous-rejoindre'
}
]
},
{ label: 'Catalogue', link: 'https://cartes.gouv.fr/catalogue' },
{ label: 'Cartes', link: 'https://cartes.gouv.fr/cartes' },
{ label: 'Actualités', link: 'https://cartes.gouv.fr/actualites' },
{
label: 'Menu déroulant 2',
link: '#',
subItems: [{ label: 'Accès routerLink' }, { label: 'Accès direct 3' }]
},
{
label: 'Menu déroulant 3',
link: '#',
label: 'Assistance',
subItems: [
{ label: 'Accès routerLink', target: '_self' },
{ label: 'Accès direct 3' }
{ label: 'Questions fréquentes', link: 'https://cartes.gouv.fr/faq' },
{ label: 'Nous écrire', link: 'https://cartes.gouv.fr/nous-ecrire' },
{
label: 'Niveau de service',
link: 'https://cartes.gouv.fr/niveau-de-service'
}
]
},
{ label: 'À propos', link: 'https://cartes.gouv.fr/a-propos' }
]"
[headerToolsLinks]="[
{
label: 'Accéder au Géoportail',
link: 'https://www.geoportail.gouv.fr/carte',
target: '_blank',
tooltipMessage: 'Accéder au Géoportail'
},
{
label: 'Mon compte',
icon: 'fr-btn--account',
link: 'https://cartes.gouv.fr/tableau-de-bord'
}
]"
(searchChange)="searchChange($event)"
(searchSelect)="searchSelect($event)"
(linkSelect)="linkSelect($event)"
(langChange)="langChange($event)"
></dsfr-header>
<router-outlet></router-outlet>
<dsfr-footer
[presentation]="'Ici on met un text de présentation'"
[presentation]="
'Cartes.gouv.fr est développé par l’Institut national de l’information géographique et forestière (IGN) et ses partenaires. Le site s’appuie sur la Géoplateforme, la nouvelle infrastructure publique, ouverte et collaborative des données géographiques.'
"
[institutionalLinks]="[
{ label: 'legifrance.gouv.fr', link: 'https://legifrance.gouv.fr' },
{ label: 'gouvernement.fr', link: 'https://gouvernement.fr' },
{ label: 'service-public.fr', link: 'https://service-public.fr' },
{ label: 'data.gouv.fr', link: 'https://data.gouv.fr' }
]"
[mandatoryLinks]="[
{
label: 'Accessibilité : ',
link: 'https://www.gouvernement.fr/accessibilite',
label: 'info.gouv.fr',
link: 'https://info.gouv.fr',
tooltipMessage: 'info.gouv.fr - ouvre une nouvelle fenêtre',
target: '_blank'
},
{ label: 'Mentions légales', link: '#' },
{
label: 'Données personnelles',
link: 'https://www.gouvernement.fr/donnees-personnelles-et-cookies',
label: 'service-public.fr',
link: 'https://service-public.fr',
tooltipMessage: 'service-public.fr- ouvre une nouvelle fenêtre',
target: '_blank'
},
{
label: 'legifrance.gouv.fr',
link: 'https://legifrance.gouv.fr',
tooltipMessage: 'legifrance.gouv.fr - ouvre une nouvelle fenêtre',
target: '_blank'
},
{
label: 'Gestion des cookies',
link: 'https://www.gouvernement.fr/donnees-personnelles-et-cookies',
label: 'data.gouv.fr',
link: 'https://data.gouv.fr',
tooltipMessage: 'data.gouv.fr - ouvre une nouvelle fenêtre',
target: '_blank'
}
]"
[partnersSub]="[]"
[mandatoryLinks]="[
{ label: 'Plan du site', link: 'https://cartes.gouv.fr/plan-du-site' },
{
label: 'Accessibilité: partiellement conforme',
link: 'https://cartes.gouv.fr/accessibilite'
},
{
label: 'Mentions légales',
link: 'https://cartes.gouv.fr/mentions-legales'
},
{
label: 'Données personnelles',
link: 'https://cartes.gouv.fr/donnees-personnelles'
}
]"
[partnerMain]="[]"
[partnersSub]="[
{
imagePath: 'assets/img/logo-ign.png',
imageAlt: 'IGN',
link: 'https://www.ign.fr'
},
{
imagePath: 'assets/img/logo-ministere-transformation.jpg',
imageAlt: 'MINISTÈRE DE LA TRANSFORMATION ET DE LA FONCTION PUBLIQUES',
link: 'https://www.transformation.gouv.fr/'
},
{
imagePath: 'assets/img/logo-ministere-ecologie.jpg',
imageAlt:
'MINISTÈRE DE LA TRANSITION ÉCOLOGIQUE ET DE LA COHÉSION DES TERRITOIRES',
link: 'https://www.ecologie.gouv.fr/'
},
{
imagePath: 'assets/img/logo-rf-cnig.jpg',
imageAlt: 'Conseil National de l’Information Géolocalisée',
link: 'https://cnig.gouv.fr/'
}
]"
[reboundLinks]="[]"
[license]="
'Sauf mention explicite de propriété intellectuelle détenue par
des tiers, les contenus de ce site sont proposés sous &#60;a href=&#34;https://github.com/etalab/licence-ouverte/blob/master/LO.md&#34; target=&#34;_blank&#34; title=&#34;licence etalab-2.0 - ouvre une nouvelle fenêtre&#34;&#62;licence etalab-2.0&#60;/a&#62;'
"
></dsfr-footer>
</div>
9 changes: 0 additions & 9 deletions apps/datahub/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,4 @@ export class AppComponent implements OnInit {
const favicon = getThemeConfig().FAVICON
if (favicon) ThemeService.setFavicon(favicon)
}

// methodes pour le header
searchChange(toggled: boolean): void {}

searchSelect(toggled: boolean): void {}

linkSelect(toggled: boolean): void {}

langChange(toggled: boolean): void {}
}
8 changes: 8 additions & 0 deletions apps/datahub/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -16,6 +17,7 @@ import {
DefaultRouterModule,
ROUTE_PARAMS,
ROUTER_ROUTE_DATASET,
ROUTER_ROUTE_ORGANIZATION,
ROUTER_ROUTE_SEARCH,
RouterService,
} from '@geonetwork-ui/feature/router'
Expand Down Expand Up @@ -94,6 +96,7 @@ import { MatTabsModule } from '@angular/material/tabs'
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 { MatButtonToggleModule } from '@angular/material/button-toggle'
import { DsfrHeaderModule } from '@edugouvfr/ngx-dsfr'
import { DsfrFooterModule } from '@edugouvfr/ngx-dsfr'
Expand Down Expand Up @@ -150,6 +153,7 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : []
searchStateId: 'mainSearch',
searchRouteComponent: SearchPageComponent,
recordRouteComponent: RecordPageComponent,
organizationRouteComponent: OrganizationPageComponent,
}),
FeatureRecordModule,
FeatureCatalogModule,
Expand Down Expand Up @@ -225,6 +229,10 @@ export const metaReducers: MetaReducer[] = !environment.production ? [] : []
},
},
{ provide: RECORD_URL_TOKEN, useValue: `${ROUTER_ROUTE_DATASET}/\${uuid}` },
{
provide: ORGANIZATION_PAGE_URL_TOKEN,
useValue: `${ROUTER_ROUTE_ORGANIZATION}/\${name}`,
},
{
provide: ORGANIZATION_URL_TOKEN,
useValue: `${ROUTER_ROUTE_SEARCH}?${ROUTE_PARAMS.PUBLISHER}=\${name}`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<header class="h-full px-5" [style.background]="backgroundCss">
<div class="container-lg mx-auto">
<!--<div class="container-lg mx-auto">
<datahub-navigation-menu
class="tabs flex justify-around font-medium -mx-5 sm:mx-0 sm:mt-0 inset-x-0 bottom-5"
[style.opacity]="-0.6 + expandRatio * 5"
></datahub-navigation-menu>
</div>
</div>-->
<div
class="container-lg h-full mx-auto flex flex-col-reverse justify-between sm:flex-col sm:justify-end"
>
Expand Down
Loading

0 comments on commit 558b969

Please sign in to comment.