Skip to content

Commit

Permalink
Clarify what we filter by
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Mar 7, 2024
1 parent 65056ac commit 9561db7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/Catalogs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ViewButtons class="mr-2" v-model="view" />
<SortButtons v-if="isComplete && catalogs.length > 1" v-model="sort" />
</header>
<SearchBox v-if="isComplete && catalogs.length > 1" class="mt-1 mb-1" v-model="searchTerm" :placeholder="$t('catalogs.filterByTitle')" />
<SearchBox v-if="isComplete && catalogs.length > 1" class="mt-1 mb-1" v-model="searchTerm" :placeholder="filterPlaceholder" />
<Pagination ref="topPagination" v-if="showPagination" :pagination="pagination" placement="top" @paginate="paginate" />
<b-alert v-if="searchTerm && catalogView.length === 0" variant="warning" show>{{ $t('catalogs.noMatches') }}</b-alert>
<section class="list">
Expand Down Expand Up @@ -102,6 +102,9 @@ export default {
isComplete() {
return !this.hasMore && !this.showPagination;
},
filterPlaceholder() {
return this.isComplete ? this.$t('catalogs.filterByTitleAndMore') : this.$t('catalogs.filterByTitle');
},
showPagination() {
// Check whether any pagination links are available
return Object.values(this.pagination).some(link => !!link);
Expand All @@ -118,15 +121,12 @@ export default {
if (this.searchTerm) {
catalogs = catalogs.filter(catalog => {
let haystack = [ catalog.title ];
if (catalog instanceof STAC) {
if (catalog instanceof STAC && this.isComplete) {
haystack.push(catalog.id);
if (Array.isArray(catalog.keywords)) {
haystack = haystack.concat(catalog.keywords);
}
}
else {
haystack.push(catalog.href);
}
return Utils.search(this.searchTerm, haystack);
});
}
Expand Down
1 change: 1 addition & 0 deletions src/locales/de/texts.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
},
"catalogs": {
"filterByTitle": "Kataloge anhand des Titels filtern",
"filterByTitleAndMore": "Kataloge anhand von Titel, Beschreibung oder Schlüsselwörtern filtern",
"loadMore": "Lade mehr...",
"noMatches": "Keiner der Kataloge entspricht den Suchkriterien."
},
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 @@ -47,6 +47,7 @@
},
"catalogs": {
"filterByTitle": "Filter catalogs by title",
"filterByTitleAndMore": "Filter catalogs by title, description or keywords",
"loadMore": "Load more...",
"noMatches": "No catalogs match the given search criteria."
},
Expand Down

0 comments on commit 9561db7

Please sign in to comment.