mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: avoid errors in daia availability UI
This commit is contained in:
@@ -35,7 +35,7 @@ export class DaiaAvailabilityComponent
|
|||||||
extends DataDetailComponent
|
extends DataDetailComponent
|
||||||
implements OnInit
|
implements OnInit
|
||||||
{
|
{
|
||||||
holdings: SCDaiaHoldings[];
|
holdings: SCDaiaHoldings[] | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -68,8 +68,10 @@ export class DaiaAvailabilityComponent
|
|||||||
* Initialize
|
* Initialize
|
||||||
*/
|
*/
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
const uid = this.route.snapshot.paramMap.get('uid') || '';
|
const uid = this.route.snapshot.paramMap.get('uid');
|
||||||
await this.getAvailability(uid ?? '');
|
if (uid) {
|
||||||
|
await this.getAvailability(uid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<ion-card>
|
<ion-card>
|
||||||
<ion-card-header>{{
|
<ion-card-header>
|
||||||
'hebisSearch.daia.availability' | translate
|
{{ 'hebisSearch.daia.availability' | translate }}
|
||||||
}}</ion-card-header>
|
</ion-card-header>
|
||||||
<ion-card-content>
|
<ion-card-content>
|
||||||
<ng-container *ngFor="let holding of holdings">
|
<ng-container *ngFor="let holding of holdings">
|
||||||
<ion-label
|
<ion-label>
|
||||||
><a [href]="holding.href" target="_blank">{{
|
<a [href]="holding.href" target="_blank">
|
||||||
holding.label
|
{{ holding.label }}
|
||||||
}}</a></ion-label
|
</a>
|
||||||
>
|
</ion-label>
|
||||||
<ion-grid>
|
<ion-grid>
|
||||||
<ion-row *ngIf="holding.signature">
|
<ion-row *ngIf="holding.signature">
|
||||||
<ion-col size="3">{{
|
<ion-col size="3">{{
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"
|
"
|
||||||
>{{ holding.signature }}</ion-col
|
>{{ holding.signature }}</ion-col
|
||||||
>
|
>
|
||||||
<ion-col size="9" *ngIf="holding.available.service === 'openaccess'">
|
<ion-col size="9" *ngIf="holding.available?.service === 'openaccess'">
|
||||||
<a [href]="holding.available.href" target="_blank">{{
|
<a [href]="holding.available.href" target="_blank">{{
|
||||||
'hebisSearch.daia.ejournal' | translate
|
'hebisSearch.daia.ejournal' | translate
|
||||||
}}</a>
|
}}</a>
|
||||||
@@ -59,5 +59,11 @@
|
|||||||
</ion-row>
|
</ion-row>
|
||||||
</ion-grid>
|
</ion-grid>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
<ion-label *ngIf="!holdings">
|
||||||
|
{{ 'hebisSearch.daia.unavailableAvailability' | translate }}
|
||||||
|
</ion-label>
|
||||||
|
<ion-label *ngIf="holdings?.length === 0">
|
||||||
|
{{ 'hebisSearch.daia.unknownAvailability' | translate }}
|
||||||
|
</ion-label>
|
||||||
</ion-card-content>
|
</ion-card-content>
|
||||||
</ion-card>
|
</ion-card>
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ export class DaiaDataProvider extends DataProvider {
|
|||||||
* @param stAppsWebHttpClient TODO
|
* @param stAppsWebHttpClient TODO
|
||||||
* @param storageProvider TODO
|
* @param storageProvider TODO
|
||||||
* @param httpClient TODO
|
* @param httpClient TODO
|
||||||
* @param ConfigProvider TODO
|
* @param configProvider TODO
|
||||||
|
* @param logger TODO
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
stAppsWebHttpClient: StAppsWebHttpClient,
|
stAppsWebHttpClient: StAppsWebHttpClient,
|
||||||
@@ -71,7 +72,7 @@ export class DaiaDataProvider extends DataProvider {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAvailability(id: string): Promise<SCDaiaHoldings[]> {
|
async getAvailability(id: string): Promise<SCDaiaHoldings[] | undefined> {
|
||||||
if (this.backendUrl === environment.backend_url) {
|
if (this.backendUrl === environment.backend_url) {
|
||||||
try {
|
try {
|
||||||
const features = (await this.configProvider.getValue(
|
const features = (await this.configProvider.getValue(
|
||||||
@@ -81,11 +82,11 @@ export class DaiaDataProvider extends DataProvider {
|
|||||||
this.backendUrl = features.extern?.daia?.url;
|
this.backendUrl = features.extern?.daia?.url;
|
||||||
} else {
|
} else {
|
||||||
this.logger.error('Daia service url undefined');
|
this.logger.error('Daia service url undefined');
|
||||||
return [];
|
return undefined;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
return [];
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Promise(resolve =>
|
return new Promise(resolve =>
|
||||||
@@ -143,7 +144,8 @@ export class DaiaDataProvider extends DataProvider {
|
|||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
resolve([]);
|
// eslint-disable-next-line unicorn/no-useless-undefined
|
||||||
|
resolve(undefined);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -274,7 +274,9 @@
|
|||||||
"comment": "Kommentar",
|
"comment": "Kommentar",
|
||||||
"order": "Bestellen",
|
"order": "Bestellen",
|
||||||
"issn": "ISSN",
|
"issn": "ISSN",
|
||||||
"ejournal": "ejournal"
|
"ejournal": "ejournal",
|
||||||
|
"unknownAvailability": "Keine Information vorhanden",
|
||||||
|
"unavailableAvailability": "System nicht erreichbar"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
|||||||
@@ -274,7 +274,9 @@
|
|||||||
"comment": "Remark",
|
"comment": "Remark",
|
||||||
"order": "Request",
|
"order": "Request",
|
||||||
"issn": "ISSN",
|
"issn": "ISSN",
|
||||||
"ejournal": "ejournal"
|
"ejournal": "ejournal",
|
||||||
|
"unknownAvailability": "No information available",
|
||||||
|
"unavailableAvailability": "System unreachable"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"schedule": {
|
"schedule": {
|
||||||
|
|||||||
Reference in New Issue
Block a user