forked from geolba/tethys.frontend
Compare commits
2 Commits
master
...
opnSrchTst
Author | SHA1 | Date | |
---|---|---|---|
f4c6bdada5 | |||
c994642e5a |
|
@ -2,12 +2,12 @@
|
|||
// import debounce from 'lodash/debounce';
|
||||
// import { DatasetService } from "../../services/dataset.service";
|
||||
import DatasetService from "../../services/dataset.service";
|
||||
import { SolrSettings } from "@/models/solr";
|
||||
//import { SolrSettings } from "@/models/solr";
|
||||
// import { ref } from "vue";
|
||||
import { Component, Vue, Prop, Emit } from "vue-facing-decorator";
|
||||
// import { Prop, Emit } from "vue-property-decorator";
|
||||
import { Dataset, Suggestion, SearchType } from "@/models/dataset";
|
||||
import { SOLR_HOST, SOLR_CORE } from "@/constants";
|
||||
//import { SOLR_HOST, SOLR_CORE } from "@/constants";
|
||||
|
||||
@Component({
|
||||
name: "VsInput",
|
||||
|
@ -30,12 +30,12 @@ export default class VsInput extends Vue {
|
|||
private loading = false;
|
||||
private selectedIndex = -1;
|
||||
// private selectedDisplay = "";
|
||||
private solr: SolrSettings = {
|
||||
/*private solr: SolrSettings = {
|
||||
core: SOLR_CORE, //"rdr_data", // SOLR.core;
|
||||
host: SOLR_HOST, //"tethys.at",
|
||||
// core: "test_data", // SOLR.core;
|
||||
// host: "repository.geologie.ac.at",
|
||||
};
|
||||
};*/
|
||||
// private rdrAPI!: DatasetService;
|
||||
itemRefs!: Array<Element>;
|
||||
emits = ["filter"];
|
||||
|
@ -153,12 +153,25 @@ export default class VsInput extends Vue {
|
|||
}
|
||||
|
||||
private request(): void {
|
||||
DatasetService.searchTerm(this.display, this.solr.core, this.solr.host).subscribe({
|
||||
next: (res: Dataset[]) => this.dataHandler(res),
|
||||
error: (error: string) => this.errorHandler(error),
|
||||
complete: () => (this.loading = false),
|
||||
});
|
||||
const searchUrl = 'https://tethysbackend/opensearch.xml'; //i would guess ?
|
||||
const searchTerms = this.display;
|
||||
const searchQuery = searchUrl.replace('{searchTerms}', searchTerms);
|
||||
|
||||
fetch(searchQuery)
|
||||
.then((response) => response.text())
|
||||
.then((xml) => {
|
||||
// need XML parser library
|
||||
const data = parseResponse(xml);
|
||||
this.dataHandler(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.errorHandler(error);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private dataHandler(datasets: Dataset[]): void {
|
||||
this.results = datasets;
|
||||
|
|
|
@ -2,19 +2,16 @@
|
|||
// declare const EDGE_URL: string;
|
||||
declare const APP_URL: string;
|
||||
declare const VUE_APP_PORTAL: string;
|
||||
declare const SOLR_HOST: string;
|
||||
declare const SOLR_CORE: string;
|
||||
|
||||
|
||||
// const _EDGE_URL = EDGE_URL;
|
||||
// const _POINT_URL = POINT_URL;
|
||||
const _APP_URL = APP_URL;
|
||||
const _VUE_APP_PORTAL = VUE_APP_PORTAL;
|
||||
const _SOLR_HOST = SOLR_HOST;
|
||||
const _SOLR_CORE = SOLR_CORE;
|
||||
|
||||
|
||||
// export { _EDGE_URL as EDGE_URL };
|
||||
// export { _POINT_URL as POINT_URL };
|
||||
export { _APP_URL as APP_URL };
|
||||
export { _VUE_APP_PORTAL as VUE_APP_PORTAL };
|
||||
export { _SOLR_HOST as SOLR_HOST };
|
||||
export { _SOLR_CORE as SOLR_CORE };
|
||||
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
export interface SolrSettings {
|
||||
core: string;
|
||||
host: string;
|
||||
}
|
||||
|
||||
export class ActiveFilterCategories {
|
||||
// count: number;
|
||||
// language!: Array<string>;
|
||||
|
|
|
@ -85,8 +85,8 @@ module.exports = {
|
|||
new webpack.DefinePlugin({
|
||||
APP_URL: JSON.stringify(process.env.APP_URL),
|
||||
VUE_APP_PORTAL: JSON.stringify(process.env.VUE_APP_PORTAL),
|
||||
SOLR_HOST: JSON.stringify(process.env.SOLR_HOST),
|
||||
SOLR_CORE: JSON.stringify(process.env.SOLR_CORE),
|
||||
//SOLR_HOST: JSON.stringify(process.env.SOLR_HOST),
|
||||
//SOLR_CORE: JSON.stringify(process.env.SOLR_CORE),
|
||||
}),
|
||||
new NodePolyfillPlugin(),
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue
Block a user