[Library | Trunk]: Metrics: Fix a bug with iframe width.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58719 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-05-19 14:12:10 +00:00
parent d1521f8802
commit 0fff8485a9
2 changed files with 11 additions and 10 deletions

View File

@ -10,7 +10,7 @@
margin-top: 20px;
margin-left: 20px;
width: 350px;
z-index: 1;
z-index: 3;
}
.metrics .widget:after {

View File

@ -1,4 +1,4 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {Component, Input, Output, EventEmitter, ChangeDetectorRef} from '@angular/core';
import {Metrics} from '../../../utils/entities/metrics';
import {MetricsService} from '../../../services/metrics.service';
import {ErrorCodes} from '../../../utils/properties/errorCodes';
@ -43,16 +43,16 @@ import {animate, state, style, transition, trigger} from "@angular/animations";
<div *ngIf="(metrics.totalViews > 0 && viewsFrameUrl) || (metrics.totalDownloads > 0 && downloadsFrameUrl)"
[@charts]="state.toString()"
class="charts uk-visible-toggle" tabindex="-1" uk-slider>
<ul class="uk-slider-items uk-child-width-1-1 uk-grid">
<li>
<ul class="uk-slider-items uk-child-width-1-1">
<li #element>
<i-frame *ngIf="metrics.totalViews > 0 && viewsFrameUrl"
[width]="325" [height]="200"
[width]="element.offsetWidth" [height]="200"
[url]=viewsFrameUrl>
</i-frame>
</li>
<li>
<li #element>
<i-frame *ngIf="metrics.totalDownloads > 0 && downloadsFrameUrl"
[width]="325" [height]="200"
[width]="element.offsetWidth" [height]="200"
[url]=downloadsFrameUrl>
</i-frame>
</li>
@ -168,7 +168,7 @@ export class MetricsComponent {
public status: number;
public state: number = -1;
constructor(private _metricsService: MetricsService) {
constructor(private metricsService: MetricsService, private cdr: ChangeDetectorRef) {
}
ngOnInit() {
@ -186,9 +186,10 @@ export class MetricsComponent {
}
private getMetrics() {
this.sub = this._metricsService.getMetrics(this.id, this.entityType, this.properties).subscribe(
this.sub = this.metricsService.getMetrics(this.id, this.entityType, this.properties).subscribe(
data => {
this.metrics = data;
this.cdr.detectChanges();
this.status = this.errorCodes.DONE;
this.metricsResults.emit({
totalViews: this.metrics.totalViews,
@ -197,7 +198,6 @@ export class MetricsComponent {
});
},
err => {
console.log(err);
if (err.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
} else if (err.status == '500') {
@ -247,6 +247,7 @@ export class MetricsComponent {
}, 300));
}, 100));
}
this.cdr.detectChanges();
}
public getKeys(map) {