+
No results found - Please change your search / filter criteria.
@@ -57,10 +59,12 @@ import {
Input,
Loading,
Pagination,
+ Autocomplete
} from "element-ui";
import lang from "element-ui/lib/locale/lang/en";
import locale from "element-ui/lib/locale";
import SearchFilters from "./SearchFilters";
+import SearchHistory from "./SearchHistory";
import DatasetCard from "./DatasetCard";
import EventBus from "./EventBus";
@@ -75,6 +79,7 @@ Vue.use(Icon);
Vue.use(Input);
Vue.use(Loading);
Vue.use(Pagination);
+Vue.use(Autocomplete);
// handleErrors: A custom fetch error handler to recieve messages from the server
// even when an error is found
@@ -106,7 +111,7 @@ var initial_state = {
};
export default {
- components: { SearchFilters, DatasetCard },
+ components: { SearchFilters, DatasetCard, SearchHistory },
name: "SideBarContent",
props: {
visible: {
@@ -207,11 +212,32 @@ export default {
this.searchInput = "";
this.resetPageNavigation();
this.searchAlgolia(this.filters, this.searchInput);
+ this.$refs.searchHistory.selectValue = 'Full search history'
},
searchEvent: function (event = false) {
if (event.keyCode === 13 || event instanceof MouseEvent) {
this.resetPageNavigation();
this.searchAlgolia(this.filters, this.searchInput);
+ this.$refs.searchHistory.selectValue = 'Full search history'
+ this.$refs.searchHistory.addSearchToHistory(this.filters, this.searchInput);
+ }
+ },
+ fetchSuggestions: function (queryString, callback) {
+ if (queryString.length > 0) {
+ this.algoliaClient
+ .search(getFilters(this.filters), queryString, 10, 1)
+ .then((searchData) => {
+ callback(
+ searchData.items.map((item) => {
+ return {
+ value: item.name,
+ label: item.name,
+ };
+ })
+ );
+ });
+ } else {
+ callback([]);
}
},
filterUpdate: function (filters) {
@@ -408,6 +434,11 @@ export default {
getAlgoliaFacets: async function(){
let facets = await this.algoliaClient.getAlgoliaFacets(facetPropPathMapping)
return facets;
+ },
+ searchHistorySearch: function(item){
+ this.searchInput = item.search;
+ this.filters = item.filters;
+ this.openSearch(item.filters, item.search);
}
},
mounted: function () {