forked from geolba/tethys.frontend
- search detail page
This commit is contained in:
parent
66651135fa
commit
6cb6f178a9
4 changed files with 299 additions and 34 deletions
|
@ -1,3 +1,5 @@
|
|||
import moment from "moment";
|
||||
|
||||
export interface Dataset {
|
||||
abstract_additional: Array<string>;
|
||||
abstract_output: string;
|
||||
|
@ -32,34 +34,71 @@ export enum SearchType {
|
|||
}
|
||||
|
||||
export class DbDataset {
|
||||
public id!: number;
|
||||
public url!: string;
|
||||
public contributing_corporation!: string;
|
||||
public creating_corporation!: string;
|
||||
public publisher_name!: string;
|
||||
public embargo_date!: string;
|
||||
public publish_id!: number;
|
||||
public project_id!: number;
|
||||
public type!: string;
|
||||
public language!: string;
|
||||
public server_state!: string;
|
||||
public belongs_to_bibliography!: boolean;
|
||||
public created_at!: string;
|
||||
public server_date_modified!: string;
|
||||
public server_date_published!: string;
|
||||
public account_id!: number;
|
||||
public editor_id!: number;
|
||||
public reviewer_id!: number;
|
||||
public preferred_reviewer!: number;
|
||||
public preferred_reviewer_email!: string;
|
||||
public reject_editor_note!: string;
|
||||
public reject_reviewer_note!: string;
|
||||
public reviewer_note_visible!: string;
|
||||
public titles!: Array<Title>;
|
||||
public abstracts!: Array<Abstract>;
|
||||
public authors!: Array<Author>;
|
||||
public contributors!: Array<Author>;
|
||||
public user!: Person;
|
||||
// public id!: number;
|
||||
// public url!: string;
|
||||
// public contributing_corporation!: string;
|
||||
// public creating_corporation!: string;
|
||||
// public publisher_name!: string;
|
||||
// public embargo_date!: string;
|
||||
// public publish_id!: number;
|
||||
// public project_id!: number;
|
||||
// public type!: string;
|
||||
// public language!: string;
|
||||
// public server_state!: string;
|
||||
// public belongs_to_bibliography!: boolean;
|
||||
// public created_at!: string;
|
||||
// public server_date_modified!: string;
|
||||
// public server_date_published!: string;
|
||||
// public account_id!: number;
|
||||
// public editor_id!: number;
|
||||
// public reviewer_id!: number;
|
||||
// public preferred_reviewer!: number;
|
||||
// public preferred_reviewer_email!: string;
|
||||
// public reject_editor_note!: string;
|
||||
// public reject_reviewer_note!: string;
|
||||
// public reviewer_note_visible!: string;
|
||||
// public titles!: Array<Title>;
|
||||
// public abstracts!: Array<Abstract>;
|
||||
// public authors!: Array<Author>;
|
||||
// public contributors!: Array<Author>;
|
||||
// public user!: Person;
|
||||
// public subjects!: Array<Subject>;
|
||||
|
||||
constructor(
|
||||
public id: string,
|
||||
public url: string,
|
||||
public contributing_corporation: string,
|
||||
public creating_corporation: string,
|
||||
public publisher_name: string,
|
||||
public embargo_date: string,
|
||||
public publish_id: number,
|
||||
public project_id: number,
|
||||
public type: string,
|
||||
public language: string,
|
||||
public server_state: string,
|
||||
public belongs_to_bibliography: boolean,
|
||||
public created_at: string,
|
||||
public server_date_modified: string,
|
||||
public server_date_published: string,
|
||||
public account_id: number,
|
||||
public editor_id: number,
|
||||
public reviewer_id: number,
|
||||
public preferred_reviewer: number,
|
||||
public preferred_reviewer_email: string,
|
||||
public reject_editor_note: string,
|
||||
public reject_reviewer_note: string,
|
||||
public reviewer_note_visible: string,
|
||||
public titles: Array<Title>,
|
||||
public abstracts: Array<Abstract>,
|
||||
public authors: Array<Author>,
|
||||
public contributors: Array<Author>,
|
||||
public user: Person,
|
||||
public subjects: Array<Subject>,
|
||||
public licenses: Array<License>,
|
||||
public files: Array<DbFile>,
|
||||
private coverage?: Coverage,
|
||||
public project?: Project,
|
||||
) {}
|
||||
|
||||
public hasTranslatedAbstract(): boolean {
|
||||
if (this.abstracts.some((e) => e.type === "Translated")) {
|
||||
|
@ -85,6 +124,38 @@ export class DbDataset {
|
|||
}
|
||||
}
|
||||
|
||||
public hasContributors(): boolean {
|
||||
if (this.contributors.length > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public hasLicenses(): boolean {
|
||||
if (this.licenses.length > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public hasEmbargoPassed(): boolean {
|
||||
const embargoDate = moment(this.embargo_date);
|
||||
if (embargoDate == null) {
|
||||
return true;
|
||||
}
|
||||
const todayDate = moment.now();
|
||||
// Embargo has passed on the day after the specified date
|
||||
|
||||
if (embargoDate.isBefore(todayDate)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
// return ($embargoDate->lessThan($now));
|
||||
}
|
||||
|
||||
public get MainAbstract(): Nullable<Abstract> {
|
||||
return this.abstracts.find((e) => e.type === AbstractType.Abstract);
|
||||
}
|
||||
|
@ -100,6 +171,21 @@ export class DbDataset {
|
|||
public get MethodsAbtract(): Nullable<Abstract> {
|
||||
return this.abstracts.find((e) => e.type === AbstractType.Methods);
|
||||
}
|
||||
|
||||
public get Coverage(): string {
|
||||
if (this.coverage != undefined) {
|
||||
const xMin = this.coverage.x_min;
|
||||
const xMax = this.coverage.x_max;
|
||||
const yMin = this.coverage.y_min;
|
||||
const yMax = this.coverage.y_max;
|
||||
return `SOUTH-BOUND LATITUDE: ${xMin},
|
||||
* WEST-BOUND LONGITUDE: ${yMin},
|
||||
* NORTH-BOUND LATITUDE: ${xMax},
|
||||
* EAST-BOUND LONGITUDE: ${yMax}`;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
type Nullable<T> = T | undefined;
|
||||
|
||||
|
@ -144,3 +230,62 @@ export interface Person {
|
|||
last_name: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface Subject {
|
||||
id: number;
|
||||
language: string;
|
||||
type: string;
|
||||
value: string;
|
||||
external_key: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface Coverage {
|
||||
x_min: string;
|
||||
x_max: string;
|
||||
y_min: string;
|
||||
y_max: string;
|
||||
}
|
||||
|
||||
export interface License {
|
||||
id: number;
|
||||
active: boolean;
|
||||
comment_internal?: string;
|
||||
desc_markup?: string;
|
||||
desc_text?: string;
|
||||
language: string;
|
||||
link_licence: string;
|
||||
link_logo?: string;
|
||||
link_sign?: string;
|
||||
mime_type: string;
|
||||
name_long: string; // "Creative Commons Attribution 4.0 International (CC BY 4.0)"
|
||||
name: string; // "CC-BY-4.0"
|
||||
pod_allowed: boolean;
|
||||
sort_order: number;
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
id: number;
|
||||
label: string; // "ALLG_FACHLICH"
|
||||
name: string; // "Allgemein fachliche Arbeiten"
|
||||
description: string; // "Allgemein fachlich interdisziplinäre Arbeiten"
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface DbFile {
|
||||
id: number;
|
||||
document_id: number;
|
||||
path_name: string;
|
||||
label: string;
|
||||
comment?: string;
|
||||
mime_type: string;
|
||||
language?: string;
|
||||
file_size: bigint;
|
||||
visible_in_frontdoor: boolean;
|
||||
visible_in_oai: boolean;
|
||||
sort_order: Int16Array;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue