Revision 58874
Added by Konstantina Galouni about 4 years ago
metrics.component.ts | ||
---|---|---|
45 | 45 |
class="charts uk-visible-toggle" tabindex="-1" uk-slider> |
46 | 46 |
<ul class="uk-slider-items uk-child-width-1-1"> |
47 | 47 |
<li #element> |
48 |
<i-frame *ngIf="metrics.totalViews > 0 && viewsFrameUrl" |
|
49 |
[width]="element.offsetWidth" [height]="200" |
|
48 |
<!-- [width]="element.offsetWidth"--> |
|
49 |
<i-frame *ngIf="metricsClicked && metrics.totalViews > 0 && viewsFrameUrl" |
|
50 |
[height]="200" |
|
50 | 51 |
[url]=viewsFrameUrl> |
51 | 52 |
</i-frame> |
52 | 53 |
</li> |
53 | 54 |
<li #element> |
54 |
<i-frame *ngIf="metrics.totalDownloads > 0 && downloadsFrameUrl" |
|
55 |
[width]="element.offsetWidth" [height]="200" |
|
55 |
<!-- [width]="element.offsetWidth"--> |
|
56 |
<i-frame *ngIf="metricsClicked && metrics.totalDownloads > 0 && downloadsFrameUrl" |
|
57 |
[height]="200" |
|
56 | 58 |
[url]=downloadsFrameUrl> |
57 | 59 |
</i-frame> |
58 | 60 |
</li> |
... | ... | |
164 | 166 |
public errorCodes: ErrorCodes; |
165 | 167 |
private sub: Subscription; |
166 | 168 |
private timeouts: any[] = []; |
167 |
|
|
169 |
|
|
170 |
public metricsClicked: boolean = false; |
|
171 |
|
|
168 | 172 |
public status: number; |
169 | 173 |
public state: number = -1; |
170 | 174 |
|
... | ... | |
173 | 177 |
|
174 | 178 |
ngOnInit() { |
175 | 179 |
this.errorCodes = new ErrorCodes(); |
176 |
this.status = this.errorCodes.LOADING; |
|
177 |
this.getMetrics(); |
|
180 |
if (typeof document !== 'undefined') { |
|
181 |
this.status = this.errorCodes.LOADING; |
|
182 |
this.getMetrics(); |
|
183 |
} |
|
178 | 184 |
} |
179 | 185 |
|
180 | 186 |
ngOnDestroy() { |
181 |
this.sub.unsubscribe(); |
|
187 |
if(this.sub) { |
|
188 |
this.sub.unsubscribe(); |
|
189 |
} |
|
182 | 190 |
} |
183 | 191 |
|
184 | 192 |
public get total(): number { |
... | ... | |
225 | 233 |
|
226 | 234 |
|
227 | 235 |
public toggle(event) { |
236 |
this.metricsClicked = true; |
|
237 |
|
|
228 | 238 |
event.stopPropagation(); |
229 | 239 |
if(this.state !== -1) { |
230 | 240 |
this.timeouts.forEach(timeout => { |
Also available in: Unified diff
[Trunk | Library]:
1. src/assets/common-assets/common/custom.css: Add 'font-display: swap;' in '@font-face' css rules - improve performance.
2. dataProvider.component.html & organizations.component.html & project.component.html & resultLanding.component.html: Add check if 'indexUpdateDate' is initialized.
3. dataProvider.component.ts & organization.component.ts & project.component.ts & resultLanding.component.ts:
Initialize 'indexUpdateDate' and tabs counts only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance.
4. resultLanding.component.ts: Get "provenanceActionVocabulary" and "altMetrics" only if "typeof document !== 'undefined'" (javascript is enabled) - improve performance.
5. organization.component.ts: [Bug fix] Get 'indexUpdateDate' from service (not properties) if available.
6. project.component.ts: [Bug fix] Call 'getProjectInfo()' only once (was called twice).
7. project.service.ts: [Bug fix] Add check for rels.rel.to.class=="hasParticipant" (when not array).
8. metrics.component.ts: Get metrics if "typeof document !== 'undefined'" (javascript is enabled) | Show charts only if user clicked on metrics badge | Do not set "width" for <i-frame> elements.
9. iframe.component.ts: Add case when only height is sent as input.
10. searchDataProviders.component.ts & searchOrganizations.component.ts: [Bug fix] Set "firstLoad" to false after getting results (was asking refine filters in paging too).
11. search-tab.component.ts: [Bug fix]: In method "getEntityName()" add cases when 'entityType "project"' and 'entityType "dataprovider"' and fix case when 'entityType == "result"'.
12. navigationBar.component.ts: [Bug fix] Do not initialize navbar inside route.queryParams subscription - !!! check it carefully when deployed in all portals !!! .