diff --git a/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.html b/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.html index 2d9c6d26ca4..56e20bf55f5 100644 --- a/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.html +++ b/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.html @@ -3,27 +3,27 @@
{{ 'clarin.license.all-page.title' | translate }}
-
{{ clarinLicense.name }}
+
{{ clarinLicense?.name }}
{{'clarin.license.all-page.source' | translate}}
-
{{ clarinLicense.definition }}
+
{{ clarinLicense?.definition }}
{{'clarin.license.all-page.labels' | translate}}
- - {{clarinLicense.clarinLicenseLabel.title}} + + {{clarinLicense?.clarinLicenseLabel?.title}} - - {{clarinLicenseLabel.title}} + {{clarinLicenseLabel?.title}}
{{'clarin.license.all-page.extra-information' | translate}}
- {{'clarin.license.all-page.extra-information.default' | translate}} + {{'clarin.license.all-page.extra-information.default' | translate}} - {{requiredInformation?.value}} diff --git a/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.ts b/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.ts index ca6cd99cb07..b122dc16f82 100644 --- a/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.ts +++ b/src/app/clarin-licenses/clarin-all-licenses-page/clarin-all-licenses-page.component.ts @@ -4,6 +4,8 @@ import { ClarinLicense } from '../../core/shared/clarin/clarin-license.model'; import { ClarinLicenseDataService } from '../../core/data/clarin/clarin-license-data.service'; import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators'; import { FindListOptions } from '../../core/data/find-list-options.model'; +import { ClarinLicenseRequiredInfo } from '../../core/shared/clarin/clarin-license.resource-type'; +import { ClarinLicenseRequiredInfoSerializer } from '../../core/shared/clarin/clarin-license-required-info-serializer'; @Component({ selector: 'ds-clarin-all-licenses-page', @@ -68,4 +70,16 @@ export class ClarinAllLicensesPageComponent implements OnInit { return pubLicenseArray.concat(acaResLicenseArray); } + /** + * ClarinLicense has RequiredInfo stored as string in the database, convert this string value into + * list of ClarinLicenseRequiredInfo objects. + */ + public getRequiredInfo(clarinLicense: ClarinLicense): ClarinLicenseRequiredInfo[] { + let requiredInfo = clarinLicense.requiredInfo; + if (typeof requiredInfo === 'string') { + requiredInfo = ClarinLicenseRequiredInfoSerializer.Deserialize(requiredInfo); + } + return requiredInfo; + } + } diff --git a/src/app/core/shared/clarin/clarin-license-required-info-serializer.ts b/src/app/core/shared/clarin/clarin-license-required-info-serializer.ts index 48d43c3df85..f887ca35693 100644 --- a/src/app/core/shared/clarin/clarin-license-required-info-serializer.ts +++ b/src/app/core/shared/clarin/clarin-license-required-info-serializer.ts @@ -30,7 +30,7 @@ export const ClarinLicenseRequiredInfoSerializer = { return requiredInfoString; }, - Deserialize(requiredInfoString: string): string[] { + Deserialize(requiredInfoString: string): ClarinLicenseRequiredInfo[] { const requiredInfoArray = requiredInfoString.split(','); if (isEmpty(requiredInfoArray)) { return []; diff --git a/src/app/core/shared/clarin/clarin-license.model.ts b/src/app/core/shared/clarin/clarin-license.model.ts index 0ba9661d0ac..d121fdaf9a6 100644 --- a/src/app/core/shared/clarin/clarin-license.model.ts +++ b/src/app/core/shared/clarin/clarin-license.model.ts @@ -57,7 +57,7 @@ export class ClarinLicense extends ListableObject implements HALResource { * The requiredInfo of this Clarin License object */ @autoserializeAs(ClarinLicenseRequiredInfoSerializer) - requiredInfo: string; + requiredInfo: any; /** * The non extended clarinLicenseLabel of this Clarin License object. Clarin License could have only one diff --git a/src/app/shared/view-mode-switch/view-mode-switch.component.ts b/src/app/shared/view-mode-switch/view-mode-switch.component.ts index 95f35abf175..7c844437545 100644 --- a/src/app/shared/view-mode-switch/view-mode-switch.component.ts +++ b/src/app/shared/view-mode-switch/view-mode-switch.component.ts @@ -58,7 +58,7 @@ export class ViewModeSwitchComponent implements OnInit, OnDestroy { */ ngOnInit(): void { if (isEmpty(this.viewModeList)) { - this.viewModeList = [ViewMode.ListElement, ViewMode.GridElement]; + this.viewModeList = [ViewMode.ListElement]; } this.sub = this.searchService.getViewMode().pipe(