Compare commits

..

2 Commits

Author SHA1 Message Date
MAB
f4c6bdada5 request() 2023-10-18 10:45:31 +02:00
MAB
c994642e5a removed solr... 2023-10-18 10:39:58 +02:00
4 changed files with 27 additions and 22 deletions

View File

@ -2,12 +2,12 @@
// import debounce from 'lodash/debounce'; // import debounce from 'lodash/debounce';
// import { DatasetService } from "../../services/dataset.service"; // import { DatasetService } from "../../services/dataset.service";
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 { ref } from "vue";
import { Component, Vue, Prop, Emit } from "vue-facing-decorator"; import { Component, Vue, Prop, Emit } from "vue-facing-decorator";
// import { Prop, Emit } from "vue-property-decorator"; // import { Prop, Emit } from "vue-property-decorator";
import { Dataset, Suggestion, SearchType } from "@/models/dataset"; import { Dataset, Suggestion, SearchType } from "@/models/dataset";
import { SOLR_HOST, SOLR_CORE } from "@/constants"; //import { SOLR_HOST, SOLR_CORE } from "@/constants";
@Component({ @Component({
name: "VsInput", name: "VsInput",
@ -30,12 +30,12 @@ export default class VsInput extends Vue {
private loading = false; private loading = false;
private selectedIndex = -1; private selectedIndex = -1;
// private selectedDisplay = ""; // private selectedDisplay = "";
private solr: SolrSettings = { /*private solr: SolrSettings = {
core: SOLR_CORE, //"rdr_data", // SOLR.core; core: SOLR_CORE, //"rdr_data", // SOLR.core;
host: SOLR_HOST, //"tethys.at", host: SOLR_HOST, //"tethys.at",
// core: "test_data", // SOLR.core; // core: "test_data", // SOLR.core;
// host: "repository.geologie.ac.at", // host: "repository.geologie.ac.at",
}; };*/
// private rdrAPI!: DatasetService; // private rdrAPI!: DatasetService;
itemRefs!: Array<Element>; itemRefs!: Array<Element>;
emits = ["filter"]; emits = ["filter"];
@ -153,13 +153,26 @@ export default class VsInput extends Vue {
} }
private request(): void { private request(): void {
DatasetService.searchTerm(this.display, this.solr.core, this.solr.host).subscribe({ const searchUrl = 'https://tethysbackend/opensearch.xml'; //i would guess ?
next: (res: Dataset[]) => this.dataHandler(res), const searchTerms = this.display;
error: (error: string) => this.errorHandler(error), const searchQuery = searchUrl.replace('{searchTerms}', searchTerms);
complete: () => (this.loading = false),
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 { private dataHandler(datasets: Dataset[]): void {
this.results = datasets; this.results = datasets;
// this.$emit("search", this.display); // this.$emit("search", this.display);

View File

@ -2,19 +2,16 @@
// declare const EDGE_URL: string; // declare const EDGE_URL: string;
declare const APP_URL: string; declare const APP_URL: string;
declare const VUE_APP_PORTAL: string; declare const VUE_APP_PORTAL: string;
declare const SOLR_HOST: string;
declare const SOLR_CORE: string;
// const _EDGE_URL = EDGE_URL; // const _EDGE_URL = EDGE_URL;
// const _POINT_URL = POINT_URL; // const _POINT_URL = POINT_URL;
const _APP_URL = APP_URL; const _APP_URL = APP_URL;
const _VUE_APP_PORTAL = VUE_APP_PORTAL; const _VUE_APP_PORTAL = VUE_APP_PORTAL;
const _SOLR_HOST = SOLR_HOST;
const _SOLR_CORE = SOLR_CORE;
// export { _EDGE_URL as EDGE_URL }; // export { _EDGE_URL as EDGE_URL };
// export { _POINT_URL as POINT_URL }; // export { _POINT_URL as POINT_URL };
export { _APP_URL as APP_URL }; export { _APP_URL as APP_URL };
export { _VUE_APP_PORTAL as VUE_APP_PORTAL }; export { _VUE_APP_PORTAL as VUE_APP_PORTAL };
export { _SOLR_HOST as SOLR_HOST };
export { _SOLR_CORE as SOLR_CORE };

View File

@ -1,8 +1,3 @@
export interface SolrSettings {
core: string;
host: string;
}
export class ActiveFilterCategories { export class ActiveFilterCategories {
// count: number; // count: number;
// language!: Array<string>; // language!: Array<string>;

View File

@ -85,8 +85,8 @@ module.exports = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
APP_URL: JSON.stringify(process.env.APP_URL), APP_URL: JSON.stringify(process.env.APP_URL),
VUE_APP_PORTAL: JSON.stringify(process.env.VUE_APP_PORTAL), VUE_APP_PORTAL: JSON.stringify(process.env.VUE_APP_PORTAL),
SOLR_HOST: JSON.stringify(process.env.SOLR_HOST), //SOLR_HOST: JSON.stringify(process.env.SOLR_HOST),
SOLR_CORE: JSON.stringify(process.env.SOLR_CORE), //SOLR_CORE: JSON.stringify(process.env.SOLR_CORE),
}), }),
new NodePolyfillPlugin(), new NodePolyfillPlugin(),
], ],