diff --git a/src/components/Catalogs.vue b/src/components/Catalogs.vue
index ae00e108d..0adeb4bfd 100644
--- a/src/components/Catalogs.vue
+++ b/src/components/Catalogs.vue
@@ -6,9 +6,19 @@
-
+
- {{ $t('catalogs.noMatches') }}
+ {{ $t('catalogs.noMatches') }}
@@ -39,7 +49,8 @@ export default {
Loading,
Pagination: () => import('./Pagination.vue'),
SearchBox: () => import('./SearchBox.vue'),
- SortButtons: () => import('./SortButtons.vue')
+ SortButtons: () => import('./SortButtons.vue'),
+ Multiselect: () => import('vue-multiselect')
},
mixins: [
ViewMixin
@@ -73,7 +84,8 @@ export default {
data() {
return {
searchTerm: '',
- sort: 0
+ sort: 0,
+ selectedKeywords: []
};
},
computed: {
@@ -109,25 +121,40 @@ export default {
// Check whether any pagination links are available
return Object.values(this.pagination).some(link => !!link);
},
+ allCatalogs() {
+ return this.catalogs.map(catalog => {
+ let stac = this.getStac(catalog);
+ return stac ? stac : catalog;
+ });
+ },
+ hasSearchCritera() {
+ return this.searchTerm || this.selectedKeywords.length > 0;
+ },
catalogView() {
if (this.hasMore) {
return this.catalogs;
}
- let catalogs = this.catalogs.map(catalog => {
- let stac = this.getStac(catalog);
- return stac ? stac : catalog;
- });
// Filter
- if (this.searchTerm) {
+ let catalogs = this.allCatalogs;
+ if (this.hasSearchCritera) {
catalogs = catalogs.filter(catalog => {
- let haystack = [ catalog.title ];
- if (catalog instanceof STAC && this.isComplete) {
- haystack.push(catalog.id);
- if (Array.isArray(catalog.keywords)) {
- haystack = haystack.concat(catalog.keywords);
+ if (this.selectedKeywords.length > 0 && catalog instanceof STAC && Array.isArray(catalog.keywords)) {
+ let hasKeywords = this.selectedKeywords.every(keyword => catalog.keywords.includes(keyword));
+ if (!hasKeywords) {
+ return false;
+ }
+ }
+ if (this.searchTerm) {
+ let haystack = [ catalog.title ];
+ if (catalog instanceof STAC && this.isComplete) {
+ haystack.push(catalog.id);
+ if (Array.isArray(catalog.keywords)) {
+ haystack = haystack.concat(catalog.keywords);
+ }
}
+ return Utils.search(this.searchTerm, haystack);
}
- return Utils.search(this.searchTerm, haystack);
+ return true;
});
}
// Sort
@@ -138,6 +165,22 @@ export default {
}
}
return catalogs;
+ },
+ allKeywords() {
+ if (!this.isComplete) {
+ return [];
+ }
+ let keywords = [];
+ for(let catalog of this.allCatalogs) {
+ if (catalog instanceof STAC && Array.isArray(catalog.keywords)) {
+ for(let keyword of catalog.keywords) {
+ if (!keywords.includes(keyword)) {
+ keywords.push(keyword);
+ }
+ }
+ }
+ }
+ return keywords.sort();
}
},
created() {
@@ -157,7 +200,26 @@ export default {
Utils.scrollTo(this.$refs.topPagination.$el);
}
this.$emit('paginate', link);
+ },
+ limitText(count) {
+ return this.$t("multiselect.andMore", {count});
}
}
};
+
+
diff --git a/src/components/SearchBox.vue b/src/components/SearchBox.vue
index 51fcf53dd..63aeb067c 100644
--- a/src/components/SearchBox.vue
+++ b/src/components/SearchBox.vue
@@ -42,13 +42,14 @@ export default {
\ No newline at end of file
+
diff --git a/src/components/SearchFilter.vue b/src/components/SearchFilter.vue
index c359eb8bc..9fa4a3eed 100644
--- a/src/components/SearchFilter.vue
+++ b/src/components/SearchFilter.vue
@@ -580,8 +580,6 @@ export default {
};
-
-