From 304878c711d4d717dd4120220bc967eae354f7de Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Wed, 1 Jun 2022 13:16:54 +0200 Subject: [PATCH] - linting sytax corrections --- src/components/map/map.component.ts | 2 +- src/models/oai.ts | 5 +++++ src/models/pagination.ts | 9 +++++++++ src/services/dataset.service.ts | 12 ++++++------ src/views/search-view/search-view-component.ts | 3 ++- 5 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 src/models/pagination.ts diff --git a/src/components/map/map.component.ts b/src/components/map/map.component.ts index 9a0e1fa..106fc3c 100644 --- a/src/components/map/map.component.ts +++ b/src/components/map/map.component.ts @@ -71,7 +71,7 @@ export default class MapComponent extends Vue { // this.onMapInitializedEvent.emit(this.mapId); this.addBaseMap(); - const newSubs = DatasetService.getOAI().subscribe( + const newSubs = DatasetService.getOaiDatasets().subscribe( (res: Array) => { this.tethys = res; const bottomPane: HTMLElement = this.map.createPane("bottom"); diff --git a/src/models/oai.ts b/src/models/oai.ts index 9eef317..094b217 100644 --- a/src/models/oai.ts +++ b/src/models/oai.ts @@ -9,3 +9,8 @@ export interface OaiDataset { east: number; west: number; } + +export interface OaiPerson { + contributorName: string; + creatorName: string; +} diff --git a/src/models/pagination.ts b/src/models/pagination.ts new file mode 100644 index 0000000..8f20702 --- /dev/null +++ b/src/models/pagination.ts @@ -0,0 +1,9 @@ +import { Dataset } from "./dataset"; + +export interface Pagination { + total: number; + per_page?: number; + current_page: number; + last_page?: number; + data: Array; +} diff --git a/src/services/dataset.service.ts b/src/services/dataset.service.ts index 1da9136..3f6bfd5 100644 --- a/src/services/dataset.service.ts +++ b/src/services/dataset.service.ts @@ -9,7 +9,7 @@ import { VUE_APP_PORTAL } from "@/constants"; // import { deserialize, instanceToInstance } from "class-transformer"; import { deserialize } from "class-transformer"; // import { OAI_DATASETS } from "./mock-oai-datasets"; -import { OaiDataset } from "@/models/oai"; +import { OaiDataset, OaiPerson } from "@/models/oai"; import xml2js from "xml2js"; class DatasetService { @@ -162,7 +162,7 @@ class DatasetService { const path = "/api/sitelinks/" + year; const base = host + path; - const documents = api.get>(base); + const documents: Observable = api.get>(base); // this.messageService.add('HeroService: fetched heroes'); return documents; } @@ -178,7 +178,7 @@ class DatasetService { return dataset; } - public getOAI(): Observable { + public getOaiDatasets(): Observable { const apiUrl = "https://data.tethys.at/oai?verb=ListRecords&metadataPrefix=oai_datacite"; const oaiDatasets = api.get(apiUrl).pipe( map( @@ -237,8 +237,8 @@ class DatasetService { let creator = ""; if (dc.creators.creator instanceof Array) { - dc.creators.creator.forEach((person: any) => { - creator += person.creatorName._ + "; "; + dc.creators.creator.forEach((person: OaiPerson) => { + creator += person.creatorName + "; "; }); } else { creator += dc.creators.creator.creatorName._; @@ -247,7 +247,7 @@ class DatasetService { let contributor = ""; if (dc.contributors) { if (dc.contributors.contributor instanceof Array) { - dc.contributors.contributor.forEach((person: any) => { + dc.contributors.contributor.forEach((person: OaiPerson) => { contributor += person.contributorName + "; "; }); } else { diff --git a/src/views/search-view/search-view-component.ts b/src/views/search-view/search-view-component.ts index f4e76f0..afe4946 100644 --- a/src/views/search-view/search-view-component.ts +++ b/src/views/search-view/search-view-component.ts @@ -11,6 +11,7 @@ import { Suggestion, Dataset, SearchType } from "@/models/dataset"; import { SolrResponse, FacetFields, FacetItem, FacetResults, FacetInstance } from "@/models/headers"; import { ActiveFilterCategories } from "@/models/solr"; import { SOLR_HOST, SOLR_CORE } from "@/constants"; +import { Pagination } from "@/models/pagination"; @Options({ name: "SearchViewComponent", @@ -35,7 +36,7 @@ export default class SearchViewComponent extends Vue { searchTerm: string | Suggestion = ""; // activeFilterCategories: Object = {}; activeFilterCategories: ActiveFilterCategories = new ActiveFilterCategories(); // = new Array(); - pagination: any = { + pagination: Pagination = { total: 0, per_page: 2, current_page: 0,