Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Upgrade]: Upgrade gn-ui & add filters and sharing options #98

Merged
merged 4 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,27 @@ import { DatasetDistribution } from 'geonetwork-ui/libs/common/domain/src/lib/mo
export class DatasetVisualisationComponent {
@Input() displayMap: boolean
@Input() displayData: boolean
selectedTabIndex = 0
selectedView: string

selectedLink$ = new BehaviorSubject<DatasetDistribution>(null)

constructor(public mdViewFacade: MdViewFacade) {}
constructor(public mdViewFacade: MdViewFacade) {
this.selectedView = this.displayMap ? 'map' : 'table'
}

onTabIndexChange(index: number): void {
this.selectedTabIndex = index
let view
switch (index) {
case 1:
view = 'table'
break
case 2:
view = 'chart'
cmoinier marked this conversation as resolved.
Show resolved Hide resolved
break
default:
view = 'map'
}
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.e77c0f8c",
"rxjs": "~7.8.0",
"tippy.js": "^6.3.7",
"tslib": "^2.3.0",
Expand Down
12 changes: 12 additions & 0 deletions resources/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,15 @@ input[type='checkbox'] {
.mat-mdc-tab:not(.mdc-tab--stacked) {
@apply h-9 !important;
}
/* TO REMOVE once the component is extended */
gn-ui-copy-text-button div input {
@apply bg-white rounded-l !important;
cmoinier marked this conversation as resolved.
Show resolved Hide resolved
}

gn-ui-copy-text-button div button {
@apply rounded-r !important;
}

gn-ui-copy-text-button div textarea {
@apply bg-white rounded-l !important;
}
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
Loading