forked from geolba/tethys.frontend
Compare commits
2 Commits
4ab1cd69b6
...
f4c6bdada5
Author | SHA1 | Date | |
---|---|---|---|
f4c6bdada5 | |||
c994642e5a |
|
@ -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);
|
||||||
|
|
|
@ -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 };
|
|
||||||
|
|
|
@ -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>;
|
||||||
|
|
|
@ -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(),
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user