- remove coding warnings

- search page styling
This commit is contained in:
Arno Kaimbacher 2021-12-10 11:57:19 +01:00
parent 8c5094f91a
commit 81153061ac
9 changed files with 349 additions and 304 deletions

573
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@
"@fortawesome/fontawesome-free": "^5.15.4",
"@openfonts/open-sans_all": "^1.44.2",
"axios": "^0.24.0",
"class-transformer": "^0.4.0",
"class-transformer": "^0.5.1",
"core-js": "^3.6.5",
"qs": "^6.10.1",
"rxjs": "^6.6.0",

View File

@ -1,4 +1,4 @@
import axios, { AxiosRequestConfig, AxiosInstance, AxiosPromise } from "axios";
import axios, { AxiosRequestConfig, AxiosInstance } from "axios";
const initialization = (config: AxiosRequestConfig): AxiosInstance => {
//axios.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest";

View File

@ -1,6 +1,6 @@
import { Options, Vue } from "vue-class-component";
import { Watch } from "vue-property-decorator";
import { RouteLocation } from "vue-router";
// import { RouteLocation } from "vue-router";
import HelloWorld from "./components/HelloWorld/HelloWorld.vue";
import HomeViewComponent from "./views/home-view/home-view-component.vue";
import HelpViewComponent from "./views/map-view/help-view-component.vue";
@ -71,7 +71,8 @@ export default class App extends Vue {
}
@Watch("$route")
protected oRouteChangedChanged(to: RouteLocation, from: RouteLocation): any {
protected oRouteChangedChanged(): void {
//(to: RouteLocation, from: RouteLocation): void {
// console.log("setting " + from.path + " to " + to.path);
this.active = false;
}

View File

@ -71,7 +71,7 @@ export default class VsInput extends Vue {
const suggestions = new Array<Suggestion>();
this.results.forEach((dataset) => {
const del = dataset.title_output?.toLowerCase();
// const del = dataset.title_output?.toLowerCase();
if (dataset.title_output.toLowerCase().includes(this.display.toLowerCase())) {
const title = dataset.title_output;
// if (!suggestion["titles"].find((value) => value === title)) {

View File

@ -6,15 +6,15 @@
<!-- <span>Author: {{ document.identifier.join(', ') }}</span> -->
<!-- <span v-for="(author,index) in document.author" :key="index">{{ author }}; </span> -->
<!-- <span>'https://doi.org/' + {{ document.identifier[0] }}</span> -->
<a target="_blank" v-bind:href="'https://doi.org/' + document.identifier[0]"> {{ "https://doi.org/" + document.identifier[0] }} </a>&nbsp;
<span v-if="document.author && document.author.length > 0">{{ document.author[0] }}</span>
<a target="_blank" v-bind:href="'https://doi.org/' + document.identifier[0]"> {{ "https://doi.org/" + document.identifier[0] + " &#10148;" }} </a>&nbsp;
<span class="disabled" v-if="document.author && document.author.length > 0">{{ document.author[0] }}</span>
</p>
<span class="label label-info" data-container="div" data-title="Publication date">
<!-- <span class="label label-info" data-container="div" data-title="Publication date">
{{ convert(document.server_date_published) }}
</span>
<span class="label label-default ng-binding">{{ document.doctype }}</span>
<span v-if="openAccessLicences.includes(document.licence)" class="label label-success titlecase">Open Access</span>
<span v-if="openAccessLicences.includes(document.licence)" class="label label-success titlecase">Open Access</span> -->
<h4>
<a
@ -36,18 +36,23 @@
</p> -->
<p class="clamped clamped-2">
<span class="disabled" data-container="div" data-title="Publication date">
{{ convert(document.server_date_published) + ":&nbsp;" }}
</span>
<span class="text">
Abstract: {{ document.abstract_output }}
{{ document.abstract_output }}
<span class="ellipsis">...</span>
<span class="fill"></span>
</span>
</p>
<p>
<span>Licence: {{ document.licence }}</span>
<span class="label"><i class="fas fa-file"></i> {{ document.doctype }}</span>
<!-- <span>Licence: {{ document.licence }}</span> -->
<span v-if="openAccessLicences.includes(document.licence)" class="label titlecase"><i class="fas fa-lock-open"></i> Open Access</span>
</p>
<span class="label label-keyword titlecase" v-for="(item, index) in document.subject" :key="index"> #{{ item }} </span>
<!-- <span class="label label-keyword titlecase" v-for="(item, index) in document.subject" :key="index"> #{{ item }} </span> -->
</div>
</div>
</div>
@ -108,7 +113,8 @@ export default VsResults;
color: #fff;
border-radius: 0.25em;
margin-right: 1.25em;
/* margin-left: 10px; */
text-transform: uppercase;
font-weight: normal;
}
/* .record-elem .h4, record-elem h4 {
font-size: 18px;
@ -154,6 +160,14 @@ export default VsResults;
color: #000;
font-size: 14px;
}
.record-elem p span.disabled {
color: #7e7e7e;
// color: lightgray;
pointer-events: none;
}
.record-elem p span i {
color: #336699;
}
.post {
position: relative;

View File

@ -1,4 +1,3 @@
// import http from "@/http-common";
import api from "../api/api";
import { Observable } from "rxjs";
import { map } from "rxjs/operators";
@ -23,14 +22,14 @@ class DatasetService {
//var dismaxFields = "title^3 abstract^2 subject^1";
const qfFields = "title^3 author^2 subject^1";
let params = "fl=" + fields;
// if (term == "*%3A*") { // *:
// params += "&defType=edismax&wt=json&indent=on"; //edismax
// } else {
params += "&defType=edismax&qf=" + qfFields + "&wt=json&indent=on"; //dismax
// }
// let params = "fl=" + fields;
// // if (term == "*%3A*") { // *:
// // params += "&defType=edismax&wt=json&indent=on"; //edismax
// // } else {
// params += "&defType=edismax&qf=" + qfFields + "&wt=json&indent=on"; //dismax
// // }
const query = "&q=" + term + "*";
// const query = "&q=" + term + "*";
// const apiU = base + params + query;
const q_params = {
@ -109,7 +108,7 @@ class DatasetService {
}
// filterFields += '"]';
}
const query = "&sort=server_date_published desc" + "&q=" + term;
// const query = "&sort=server_date_published desc" + "&q=" + term;
// const api =
// base + params + limit + start + query + filterFields + facetFields;
@ -140,7 +139,7 @@ class DatasetService {
return stations;
}
getYears(): Observable<string[]> {
public getYears(): Observable<string[]> {
// const heroes = of(HEROES);
const host = "https:" + VUE_APP_PORTAL;
const path = "/api/years";
@ -151,7 +150,7 @@ class DatasetService {
return years;
}
getDocuments(year: string): Observable<Array<DbDataset>> {
public getDocuments(year: string): Observable<Array<DbDataset>> {
const host = "https:" + VUE_APP_PORTAL;
const path = "/api/sitelinks/" + year;
const base = host + path;

View File

@ -5,5 +5,5 @@ import { Options, Vue } from "vue-class-component";
name: "HelpViewComponent",
})
export default class HelpViewComponent extends Vue {
results: Array<any> = [];
// results: Array<any> = [];
}

View File

@ -1,4 +1,4 @@
import { Observable, Subscription } from "rxjs";
import { Subscription } from "rxjs";
import { Options, Vue } from "vue-class-component";
import DatasetService from "../../services/dataset.service";
import { DbDataset } from "@/models/dataset";
@ -19,21 +19,21 @@ export default class SitelinkViewComponent extends Vue {
// // this.rdrAPI = new DatasetService();
// }
beforeMount() {
beforeMount(): void {
// this.rdrAPI = new DatasetService();
this.getYears();
}
getYears() {
getYears(): void {
const newSubs: Subscription = DatasetService.getYears().subscribe(
(res: string[]) => this.dataHandler(res),
(error: any) => this.errorHandler(error),
(error: string) => this.errorHandler(error),
() => newSubs.unsubscribe(),
);
// this.subscriptions.push(newSubs);
}
beforeUnmount() {
beforeUnmount(): void {
//unsunscribe to ensure no memory leaks
// this.subscription.unsubscribe();
for (const subs of this.subscriptions) {
@ -41,13 +41,13 @@ export default class SitelinkViewComponent extends Vue {
}
}
select(year: string) {
select(year: string): void {
this.selected = year;
const newSubs = DatasetService.getDocuments(year).subscribe(
(res: Array<DbDataset>) => {
this.datasets = res;
},
(error: any) => this.errorHandler(error),
(error: string) => this.errorHandler(error),
);
this.subscriptions.push(newSubs);
}
@ -57,7 +57,7 @@ export default class SitelinkViewComponent extends Vue {
this.years = res;
}
private errorHandler(err: any): void {
private errorHandler(err: string): void {
this.error = err;
// this.loading = false;
}