Skip to content

Commit

Permalink
feat: add new filters and sharing options
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Jul 15, 2024
1 parent 3b1f50f commit 75c4380
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 43 deletions.
9 changes: 2 additions & 7 deletions apps/datahub-e2e/src/e2e/dataset.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,6 @@ describe('datasets', () => {
})

it('should display the sharing tool', () => {
cy.get('mel-datahub-dataset-visualisation')
.find('.mat-mdc-tab-labels')
.children('div')
.eq(2)
.click()
cy.get('gn-ui-data-view-share').should('be.visible')
})
})
Expand Down Expand Up @@ -291,15 +286,15 @@ describe('datasets', () => {

describe('Navigation', () => {
describe('With a query on', () => {
beforeEach(() => cy.visit('/search?publisher=Barbie%20Inc.'))
beforeEach(() => cy.visit('/search?organization=Barbie%20Inc.'))
it('should return to the search page with the previous query on', () => {
cy.get('mel-datahub-results-card-search').first().click()

cy.get('mel-datahub-dataset-header')
.find('mel-datahub-button')
.first()
.click()
cy.url().should('include', '/search?publisher=Barbie%20Inc.')
cy.url().should('include', '/search?organization=Barbie%20Inc.')
})
})
describe('Without a query on', () => {
Expand Down
3 changes: 3 additions & 0 deletions apps/datahub/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ import { MelDatahubDropdownRangeComponent } from './search/search-filters/mel-da
searchStateId: 'mainSearch',
searchRouteComponent: SearchPageComponent,
recordRouteComponent: DatasetPageComponent,
// reusing the search component for the organization route since MEL
// does not have org routes but param is compulsory
organizationRouteComponent: SearchPageComponent,
}),
],
providers: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div
class="flex flex-col gap-64 lg:gap-60"
[ngClass]="{ 'pb-40': selectedTabIndex !== 2 }"
class="flex flex-col"
[ngClass]="selectedView === 'map' ? 'gap-40' : 'gap-52'"
>
<div
class="flex flex-col gap-8 overflow-visible sm:pt-5 mb-16"
Expand Down Expand Up @@ -56,7 +56,10 @@
</mat-tab>
</mat-tab-group>
</div>
@if(selectedTabIndex === 2) {
<gn-ui-data-view-share class="hidden sm:block"></gn-ui-data-view-share>
@if(displayData || displayMap) {
<gn-ui-data-view-share
class="hidden sm:block"
[viewType]="selectedView"
></gn-ui-data-view-share>
}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,25 @@ import { DatasetDistribution } from 'geonetwork-ui/libs/common/domain/src/lib/mo
export class DatasetVisualisationComponent {
@Input() displayMap: boolean
@Input() displayData: boolean
selectedTabIndex = 0
selectedView = 'map'

selectedLink$ = new BehaviorSubject<DatasetDistribution>(null)

constructor(public mdViewFacade: MdViewFacade) {}

onTabIndexChange(index: number): void {
this.selectedTabIndex = index
let view
switch (index) {
case 0:
view = 'map'
break
case 1:
view = 'table'
break
default:
view = 'chart'
}
this.selectedView = view
setTimeout(() => {
window.dispatchEvent(new Event('resize'))
}, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import { RouterFacade } from 'geonetwork-ui'

marker('mel.datahub.search.filters.topic')
marker('mel.datahub.search.filters.categoryKeyword')
marker('mel.datahub.search.filters.publisher')
marker('mel.datahub.search.filters.organization')
marker('mel.datahub.search.filters.publicationYear')
marker('mel.datahub.search.filters.license')
marker('mel.datahub.search.filters.qualityScore')
marker('mel.datahub.search.filters.territories')
marker('mel.datahub.search.filters.producerOrg')
marker('mel.datahub.search.filters.publisherOrg')

@Component({
selector: 'mel-datahub-search-filters',
Expand All @@ -21,7 +23,7 @@ export class SearchFiltersComponent {
displayCount = 3
searchConfig = [
'topic',
'publisher',
'organization',
'publicationYear',
'license',
'qualityScore',
Expand Down
50 changes: 25 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@ngx-translate/core": "^15.0.0",
"@nx/angular": "17.3.2",
"@vendure/ngx-translate-extract": "^9.0.3",
"geonetwork-ui": "^2.4.0-dev.e1bb65c4",
"geonetwork-ui": "^2.4.0-dev.71a43b38",
"rxjs": "~7.8.0",
"tippy.js": "^6.3.7",
"tslib": "^2.3.0",
Expand Down
4 changes: 3 additions & 1 deletion resources/translations/en_MEL.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"mel.datahub.search.filters.maxValue": "",
"mel.datahub.search.filters.minValue": "",
"mel.datahub.search.filters.more": "",
"mel.datahub.search.filters.organization": "",
"mel.datahub.search.filters.producerOrg": "",
"mel.datahub.search.filters.publicationYear": "",
"mel.datahub.search.filters.publisher": "",
"mel.datahub.search.filters.publisherOrg": "",
"mel.datahub.search.filters.qualityScore": "",
"mel.datahub.search.filters.range.from": "",
"mel.datahub.search.filters.range.to": "",
Expand Down
4 changes: 3 additions & 1 deletion resources/translations/fr_MEL.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"mel.datahub.search.filters.maxValue": "Valeur maximale",
"mel.datahub.search.filters.minValue": "Valeur minimale",
"mel.datahub.search.filters.more": "Plus de filtres",
"mel.datahub.search.filters.organization": "Organisation",
"mel.datahub.search.filters.producerOrg": "Producteur",
"mel.datahub.search.filters.publicationYear": "Date",
"mel.datahub.search.filters.publisher": "Producteur",
"mel.datahub.search.filters.publisherOrg": "Distributeur",
"mel.datahub.search.filters.qualityScore": "Score de qualité",
"mel.datahub.search.filters.range.from": "De :",
"mel.datahub.search.filters.range.to": "Jusqu'à :",
Expand Down

0 comments on commit 75c4380

Please sign in to comment.