diff --git a/src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/cris-layout-metadata-box.component.ts b/src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/cris-layout-metadata-box.component.ts index 109458c4e24..f0d3166dad0 100644 --- a/src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/cris-layout-metadata-box.component.ts +++ b/src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/cris-layout-metadata-box.component.ts @@ -36,7 +36,7 @@ export class CrisLayoutMetadataBoxComponent extends CrisLayoutBoxModelComponent subs: Subscription[] = []; constructor( - public cd: ChangeDetectorRef, + public cdr: ChangeDetectorRef, protected translateService: TranslateService, @Inject('boxProvider') public boxProvider: CrisLayoutBox, @Inject('itemProvider') public itemProvider: Item @@ -55,6 +55,7 @@ export class CrisLayoutMetadataBoxComponent extends CrisLayoutBoxModelComponent */ setMetadataComponents(metadatacomponents: MetadataBoxConfiguration) { this.metadataBoxConfiguration = metadatacomponents; + this.cdr.detectChanges(); } /** diff --git a/src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metrics/cris-layout-metrics-box.component.ts b/src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metrics/cris-layout-metrics-box.component.ts index 20d28855e79..4356141256d 100644 --- a/src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metrics/cris-layout-metrics-box.component.ts +++ b/src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metrics/cris-layout-metrics-box.component.ts @@ -1,4 +1,4 @@ -import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; +import { Component, Inject, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core'; import { BehaviorSubject, Subscription } from 'rxjs'; import { TranslateService } from '@ngx-translate/core'; @@ -13,6 +13,7 @@ import { ItemDataService } from '../../../../../core/data/item-data.service'; import { CrisLayoutBox, MetricsBoxConfiguration, } from '../../../../../core/layout/models/box.model'; import { Item } from '../../../../../core/shared/item.model'; import { CrisLayoutMetricRow } from '../../../../../core/layout/models/tab.model'; +import { isPlatformBrowser } from '@angular/common'; /** * This component renders the metadata boxes of items @@ -54,7 +55,8 @@ export class CrisLayoutMetricsBoxComponent extends CrisLayoutBoxModelComponent i protected itemService: ItemDataService, protected translateService: TranslateService, @Inject('boxProvider') public boxProvider: CrisLayoutBox, - @Inject('itemProvider') public itemProvider: Item + @Inject('itemProvider') public itemProvider: Item, + @Inject(PLATFORM_ID) protected platformId: Object ) { super(translateService, boxProvider, itemProvider); } @@ -62,17 +64,19 @@ export class CrisLayoutMetricsBoxComponent extends CrisLayoutBoxModelComponent i ngOnInit() { super.ngOnInit(); - this.metricsBoxConfiguration = this.box.configuration as MetricsBoxConfiguration; - this.subs.push( - this.itemService.getMetrics(this.item.uuid).pipe(getFirstSucceededRemoteDataPayload()) - .subscribe((result) => { - const matchingMetrics = this.metricsComponentService.getMatchingMetrics( - result.page, - this.metricsBoxConfiguration.maxColumns, - this.metricsBoxConfiguration.metrics - ); - this.metricRows.next(matchingMetrics); - })); + if (isPlatformBrowser(this.platformId)) { + this.metricsBoxConfiguration = this.box.configuration as MetricsBoxConfiguration; + this.subs.push( + this.itemService.getMetrics(this.item.uuid).pipe(getFirstSucceededRemoteDataPayload()) + .subscribe((result) => { + const matchingMetrics = this.metricsComponentService.getMatchingMetrics( + result.page, + this.metricsBoxConfiguration.maxColumns, + this.metricsBoxConfiguration.metrics + ); + this.metricRows.next(matchingMetrics); + })); + } } /** diff --git a/src/app/shared/object-list/metric-donuts/metric-donuts.component.html b/src/app/shared/object-list/metric-donuts/metric-donuts.component.html index 539c0839236..f6621ab77b6 100644 --- a/src/app/shared/object-list/metric-donuts/metric-donuts.component.html +++ b/src/app/shared/object-list/metric-donuts/metric-donuts.component.html @@ -1,5 +1,5 @@