Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@ export class GnResultsListComponent extends BaseComponent {
onMdClick(metadata: CatalogRecord) {
if (this.catalogUrl) {
const landingPage = this.catalogUrl.replace(
/{uuid}/,
/{uuid}/g,
metadata.uniqueIdentifier
)
window.open(landingPage, '_blank').focus()
const newWindow = window.open(landingPage, '_blank')
if (newWindow) {
newWindow.focus()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
api-url="https://www.geocat.ch/geonetwork/srv/api"
metadata-language="current"
text-language="de"
open-on-search="https://www.geocat.ch/geonetwork/srv/ger/catalog.search#/search?any=${search}"
open-on-select="https://www.geocat.ch/geonetwork/srv/ger/catalog.search#/metadata/${uuid}"
></gn-search-input>
</div>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<script src="gn-wc.js"></script>
<gn-search-input
api-url="https://www.geo2france.fr/geonetwork/srv/api"
open-on-search="https://www.geo2france.fr/datahub/search?q=${search}"
open-on-select="https://www.geo2france.fr/datahub/dataset/${uuid}"
></gn-search-input>
</div>
</header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,33 @@ import { CatalogRecord } from '@geonetwork-ui/common/domain/model/record'
})
export class GnSearchInputComponent extends BaseComponent {
@Input() forceTrackPosition = ''
@Input() openOnSearch: string
@Input() openOnSelect: string
@Input({ alias: 'open-on-search' }) openOnSearch: string
@Input({ alias: 'open-on-select' }) openOnSelect: string
@Input() placeholder?: string
@ViewChild('searchInput') searchInput: FuzzySearchComponent

search(any: string) {
if (this.openOnSearch) {
const landingPage = this.openOnSearch.replace(/\$\{search}/, any)
window.open(landingPage, '_self').focus()
this.searchInput?.autocomplete?.triggerRef?.closePanel()
const searchTerm = encodeURIComponent(any)
const landingPage = this.openOnSearch
.replace(/\$\{search}/g, searchTerm)
.replace(/\$\{q}/g, searchTerm)

window.location.href = landingPage
}
}

select(record: CatalogRecord) {
if (this.openOnSelect) {
const landingPage = this.openOnSelect.replace(
/\$\{uuid}/,
record.uniqueIdentifier
)
window.open(landingPage, '_self').focus()
this.searchInput?.autocomplete?.triggerRef?.closePanel()
const searchTerm = encodeURIComponent(record.title)
const landingPage = this.openOnSelect
.replace(/\$\{uuid}/g, record.uniqueIdentifier)
.replace(/\$\{search}/g, searchTerm)
.replace(/\$\{q}/g, searchTerm)

window.location.href = landingPage
}
}
}
Loading