Skip to content

Commit

Permalink
Show better message for empty results that occur when following a nex…
Browse files Browse the repository at this point in the history
…t link. #426
  • Loading branch information
m-mohr committed Apr 15, 2024
1 parent 3fa785f commit 9047872
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/locales/de/texts.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
"matches": "enthält etwa",
"metaDescription": "Durchsuche die angebotenen Daten von {title}.",
"modifyCriteria": "Bitte die Suchkriterien ändern.",
"noFurtherItemsFound": "Keine weiteren Elemente verfügbar.",
"noItemsFound": "Keine Elemente gefunden für die angegebenen Filter.",
"noOptions": "Noch nichts eingegeben",
"notEqualTo": "entspricht nicht",
Expand Down
1 change: 1 addition & 0 deletions src/locales/en/texts.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
"matches": "matches",
"metaDescription": "Search through the data offering of {title}.",
"modifyCriteria": "Please modify the search criteria.",
"noFurtherItemsFound": "No further items available.",
"noItemsFound": "No items found for the given filters.",
"noOptions": "Nothing entered yet",
"notEqualTo": "not equal to",
Expand Down
8 changes: 8 additions & 0 deletions src/views/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<b-alert v-if="error" variant="error" show>{{ error }}</b-alert>
<Loading v-else-if="!data && loading" fill top />
<b-alert v-else-if="data === null" variant="info" show>{{ $t('search.modifyCriteria') }}</b-alert>
<b-alert v-else-if="results.length === 0 && noFurtherItems" variant="info" show>{{ $t('search.noFurtherItemsFound') }}</b-alert>
<b-alert v-else-if="results.length === 0" variant="warning" show>{{ $t('search.noItemsFound') }}</b-alert>
<template v-else>
<div id="search-map" v-if="itemCollection">
Expand Down Expand Up @@ -184,6 +185,13 @@ export default {
pageDescription() {
let title = STAC.getDisplayTitle([this.collectionLink, this.parentLink, this.root], this.catalogTitle);
return this.$t('search.metaDescription', {title});
},
noFurtherItems() {
// Ideally this would be dertmined by the prev link, but it's not required
// so we check whether our current link has a next rel type which indicates
// that it's a subsequent page. On the first pages the link rel type would be
// "search" (or "prev" or "first"). This only works for forward navigation.
return this.link.rel === 'next';
}
},
watch:{
Expand Down

0 comments on commit 9047872

Please sign in to comment.