- feature request: autocomplete search also on the start page and on the dataset detail page

This commit is contained in:
Arno Kaimbacher 2022-01-12 16:02:54 +01:00
commit 3bd022bf54
10 changed files with 612 additions and 524 deletions

View file

@ -4,19 +4,23 @@ import { Prop } from "vue-property-decorator";
import DatasetService from "../../services/dataset.service";
import { Subscription } from "rxjs";
import moment from "moment";
import SimpleSearchComponent from "@/components/simple-search/simple-search-component.vue";
// import SimpleSearchComponent from "@/components/simple-search/simple-search-component.vue";
import VsInput from "@/components/vs-input/vs-input.vue";
import { Suggestion } from "@/models/dataset";
import { VUE_APP_PORTAL } from "@/constants";
@Options({
name: "DatasetDetailComponent",
components: {
SimpleSearchComponent,
VsInput,
},
})
export default class DatasetDetailComponent extends Vue {
@Prop()
datasetId!: number;
searchTerm: string | Suggestion = "";
private subscriptions: Array<Subscription> = [];
public dataset = {} as DbDataset;
private error = "";
@ -36,6 +40,20 @@ export default class DatasetDetailComponent extends Vue {
}
}
onSearch(suggestion: Suggestion | string): void {
let term;
if (typeof suggestion === "string") {
term = suggestion;
this.$router.push({ name: "Search", params: { display: term } });
} else if (suggestion instanceof Suggestion) {
term = suggestion.value;
this.$router.push({ name: "Search", params: { display: term, type: suggestion.type } });
}
// this.searchTerm = suggestion;
// this.$router.push({ name: "Search", params: { display: term, suggestion instanceof Suggestion ? ty} });
}
private getDataset(id: number): void {
const newSub = DatasetService.getDataset(id).subscribe(
(res: DbDataset) => {

View file

@ -37,7 +37,8 @@
</div>
</div>
</div> -->
<simple-search-component></simple-search-component>
<!-- <simple-search-component></simple-search-component> -->
<vs-input v-on:search-change="onSearch" v-bind:placeholder="'Enter your search term...'"></vs-input>
</div>
<section class="section" v-if="loaded">
<div class="container">
@ -232,9 +233,10 @@
<div class="column col-sm text-center">
<a target="_blank" href="https://www.re3data.org/repository/r3d100013400"><img src="@/assets/site/img/re3-data-logo-mono.jpg" alt="re3 data logo" /></a>
</div>
<!-- <div class="column col-sm text-center mobile-space">
<img src="@/assets/site/img/geosphere-austria-logo.jpg" class="pb-3" alt="logo geosphere austria" />
</div> -->
<a target="_blank" href="http://www.geologie.ac.at/">
<!-- <img src="@/assets/site/img/geosphere-austria-logo.jpg" class="pb-3" alt="logo geosphere austria" /> -->
<img src="@/assets/site/img/geologische-bundesanstalt-logo.jpg" alt="Geologische Bundesanstalt logo" />
</a>
<div class="column col-sm text-center">
<a target="_blank" href="https://www.base-search.net/Search/Results?q=coll:fttethysrdr&refid=dctablede">
<img src="@/assets/site/img/base-logo.gif" alt="logo base" />