[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 !!! .


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58874 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-06-10 11:05:59 +00:00
parent 0c7953b710
commit c20391f3fc
15 changed files with 128 additions and 72 deletions

View File

@ -483,7 +483,7 @@
<div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by OpenAIRE Open Research Graph</span>
<span class="uk-text-baseline uk-text-muted">
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
. Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
</span>
</div>

View File

@ -154,13 +154,15 @@ export class DataProviderComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if(lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
} else if(this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
}
});
if (typeof document !== 'undefined') {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
}
});
}
//this.getDivContents();
this.getPageContents();
this.updateUrl(data.envSpecific.baseLink + this._router.url);
@ -252,7 +254,9 @@ export class DataProviderComponent {
} else {
this.aggregationStatusIsInitialized = true;
}
this.initTabs();
if (typeof document !== 'undefined') {
this.initTabs();
}
this.showTabs = true;
this.updateTitle(this.dataProviderInfo.title.name);
this.updateDescription("Content provider, " + this.dataProviderInfo.title.name);

View File

@ -45,14 +45,16 @@ import {animate, state, style, transition, trigger} from "@angular/animations";
class="charts uk-visible-toggle" tabindex="-1" uk-slider>
<ul class="uk-slider-items uk-child-width-1-1">
<li #element>
<i-frame *ngIf="metrics.totalViews > 0 && viewsFrameUrl"
[width]="element.offsetWidth" [height]="200"
<!-- [width]="element.offsetWidth"-->
<i-frame *ngIf="metricsClicked && metrics.totalViews > 0 && viewsFrameUrl"
[height]="200"
[url]=viewsFrameUrl>
</i-frame>
</li>
<li #element>
<i-frame *ngIf="metrics.totalDownloads > 0 && downloadsFrameUrl"
[width]="element.offsetWidth" [height]="200"
<!-- [width]="element.offsetWidth"-->
<i-frame *ngIf="metricsClicked && metrics.totalDownloads > 0 && downloadsFrameUrl"
[height]="200"
[url]=downloadsFrameUrl>
</i-frame>
</li>
@ -164,7 +166,9 @@ export class MetricsComponent {
public errorCodes: ErrorCodes;
private sub: Subscription;
private timeouts: any[] = [];
public metricsClicked: boolean = false;
public status: number;
public state: number = -1;
@ -173,12 +177,16 @@ export class MetricsComponent {
ngOnInit() {
this.errorCodes = new ErrorCodes();
this.status = this.errorCodes.LOADING;
this.getMetrics();
if (typeof document !== 'undefined') {
this.status = this.errorCodes.LOADING;
this.getMetrics();
}
}
ngOnDestroy() {
this.sub.unsubscribe();
if(this.sub) {
this.sub.unsubscribe();
}
}
public get total(): number {
@ -225,6 +233,8 @@ export class MetricsComponent {
public toggle(event) {
this.metricsClicked = true;
event.stopPropagation();
if(this.state !== -1) {
this.timeouts.forEach(timeout => {

View File

@ -253,7 +253,7 @@
<div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by OpenAIRE Open Research Graph</span>
<span class="uk-text-baseline uk-text-muted">
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
. Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
</span>
</div>

View File

@ -21,6 +21,7 @@ import {HelperService} from "../../utils/helper/helper.service";
import {Location} from "@angular/common";
import {FetchResearchResults} from "../../utils/fetchEntitiesClasses/fetchResearchResults.class";
import {FetchDataproviders} from "../../utils/fetchEntitiesClasses/fetchDataproviders.class";
import {IndexInfoService} from "../../utils/indexInfo.service";
@Component({
selector: 'organization',
@ -124,7 +125,8 @@ export class OrganizationComponent {
private _router: Router,
private helper: HelperService,
private seoService: SEOService,
private _location: Location) {
private _location: Location,
private indexInfoService: IndexInfoService) {
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
@ -137,8 +139,14 @@ export class OrganizationComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
if (typeof document !== 'undefined') {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
}
});
}
//this.getDivContents();
this.getPageContents();
@ -330,8 +338,12 @@ export class OrganizationComponent {
this.piwiksub = this._piwikService.trackView(this.properties, this.organizationInfo.title.name, this.piwikSiteId).subscribe();
}
var refineFields: string [] = ["funder"];
this.getTotalResearchResults();
this.getTotalDataproviders();
if (typeof document !== 'undefined') {
this.getTotalResearchResults();
this.getTotalDataproviders();
}
this.fetchProjects.getResultsForOrganizations(this.organizationId, "", 1, this.searchNumber, refineFields, this.properties);
this.showLoading = false;
}

View File

@ -689,7 +689,7 @@
<div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by OpenAIRE Open Research Graph</span>
<span class="uk-text-baseline uk-text-muted">
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
. Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
</span>
</div>

View File

@ -152,13 +152,15 @@ export class ProjectComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if(lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
} else if(this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
}
});
if (typeof document !== 'undefined') {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
}
});
}
//this.getDivContents();
this.getPageContents();
this.updateUrl(data.envSpecific.baseLink + this._router.url);
@ -251,12 +253,15 @@ export class ProjectComponent {
}
actionsAfterLoadId() {
this.getProjectInfo(this.projectId);
//this.getProjectInfo(this.projectId);
//this.searchPublications();
this.fetchPublications.getNumForEntity("publication", "project", this.projectId, this.properties);
this.fetchDatasets.getNumForEntity("dataset", "project", this.projectId, this.properties);
this.fetchSoftware.getNumForEntity("software", "project", this.projectId, this.properties);
this.fetchOrps.getNumForEntity("other", "project", this.projectId, this.properties);
if (typeof document !== 'undefined') {
this.fetchPublications.getNumForEntity("publication", "project", this.projectId, this.properties);
this.fetchDatasets.getNumForEntity("dataset", "project", this.projectId, this.properties);
this.fetchSoftware.getNumForEntity("software", "project", this.projectId, this.properties);
this.fetchOrps.getNumForEntity("other", "project", this.projectId, this.properties);
}
}
ngOnDestroy() {

View File

@ -179,22 +179,25 @@ export class ProjectService {
let id: string = "";
if(!Array.isArray(data[2])) {
if(data[2].hasOwnProperty("legalshortname")) {
if(data[2].hasOwnProperty("to") && data[2]['to'].class == "hasParticipant") {
if (data[2].hasOwnProperty("legalshortname")) {
acronym = data[2].legalshortname;
}
if(data[2].hasOwnProperty("legalname")) {
if (data[2].hasOwnProperty("legalname")) {
name = data[2].legalname;
}
if(!acronym && !name){
if (!acronym && !name) {
// acronym is displayed with link and name only in tooltip
acronym = "[no title available]";
}
if(data[2].hasOwnProperty("to")) {
id = data[2]['to'].content;
if (data[2].hasOwnProperty("to")) {
id = data[2]['to'].content;
}
this.projectInfo.organizations.push({"acronym": acronym, "name": name, "id": id});
}
} else {
for(let i=0; i<data[2].length; i++) {
if(data[2][i].hasOwnProperty("to") && data[2][i]['to'].class == "hasParticipant") {

View File

@ -468,7 +468,7 @@
<div class="uk-width-2-3@m uk-width-1-2">
<img src="assets/common-assets/graph.svg" style="opacity: 0.4">
<span class="uk-margin-small-left uk-text-baseline uk-text-muted">Powered by OpenAIRE Open Research Graph</span>
<span class="uk-text-baseline uk-text-muted">
<span *ngIf="indexUpdateDate" class="uk-text-baseline uk-text-muted">
. Last update of records in OpenAIRE: {{indexUpdateDate | date: 'MMM dd, yyyy'}}
</span>
</div>

View File

@ -116,13 +116,15 @@ export class ResultLandingComponent {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
}
});
if (typeof document !== 'undefined') {
this.indexInfoService.getLastIndexDate(this.properties).subscribe(lastIndexUpdate => {
if (lastIndexUpdate) {
this.indexUpdateDate = new Date(lastIndexUpdate);
} else if (this.properties.lastIndexUpdate) {
this.indexUpdateDate = new Date(this.properties.lastIndexUpdate);
}
});
}
//this.getDivContents();
this.getPageContents();
this.updateUrl(data.envSpecific.baseLink + this._router.url);
@ -248,15 +250,19 @@ export class ResultLandingComponent {
this.showLoading = true;
this.resultLandingInfo = null;
this._resultLaningService.getProvenanceActionVocabulary(this.properties).subscribe(
provenanceActionVocabulary => {
this.getResultLandingInfo(provenanceActionVocabulary);
}, err => {
this.getResultLandingInfo(null);
this.handleError("Error getting provenance action vocabulary for " + this.type + " with id: " + this.id, err);
}
);
if (typeof document !== 'undefined') {
this._resultLaningService.getProvenanceActionVocabulary(this.properties).subscribe(
provenanceActionVocabulary => {
this.getResultLandingInfo(provenanceActionVocabulary);
}, err => {
this.getResultLandingInfo(null);
this.handleError("Error getting provenance action vocabulary for " + this.type + " with id: " + this.id, err);
}
);
} else {
this.getResultLandingInfo(null);
}
}
@ -325,13 +331,15 @@ export class ResultLandingComponent {
});
}
this.bioentitiesNum = bioentitiesNum;
if (this.resultLandingInfo.identifiers != undefined && this.resultLandingInfo.identifiers.has('doi')) {
this.doi = this.resultLandingInfo.identifiers.get('doi')[0];
this.metricsService.hasAltMetrics(this.properties.altMetricsAPIURL, this.doi).subscribe(hasAltMetrics => {
this.hasAltMetrics = hasAltMetrics;
}, error => {
this.hasAltMetrics = false;
});
if(typeof document !== 'undefined') {
if (this.resultLandingInfo.identifiers != undefined && this.resultLandingInfo.identifiers.has('doi')) {
this.doi = this.resultLandingInfo.identifiers.get('doi')[0];
this.metricsService.hasAltMetrics(this.properties.altMetricsAPIURL, this.doi).subscribe(hasAltMetrics => {
this.hasAltMetrics = hasAltMetrics;
}, error => {
this.hasAltMetrics = false;
});
}
}
this.showLoading = false;
this.setActiveTab();

View File

@ -40,6 +40,7 @@ import {DatasourcesHelperClass} from "./searchUtils/datasourcesHelper.class";
[sort]="false">
</new-search-page>
<!-- [filters]="filters"-->
`
})
@ -129,6 +130,7 @@ export class SearchDataProvidersComponent {
// console.log(this.refineFields)
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
firstLoad = false;
});
}
ngOnDestroy() {
@ -167,7 +169,8 @@ export class SearchDataProvidersComponent {
this.results = data[1];
//console.log(this.results);
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow((this.type=="all" || this.type == "deposit")?data[2]:this.filters, this.searchUtils.totalResults);
this.filters =
this.searchPage.prepareFiltersToShow((this.type=="all" || this.type == "deposit")?data[2]:this.filters, this.searchUtils.totalResults);
}else{
this.searchPage.buildPageURLParameters(this.filters, [], false);
}

View File

@ -121,7 +121,7 @@ public resourcesQuery = "(oaftype exact organization)";
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "organization");
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
firstLoad = false;
});
}
ngOnDestroy() {

View File

@ -50,13 +50,16 @@ export class NavigationBarComponent {
ngOnInit() {
this.activeRouteEnabled = false;
this.sub = this.route.queryParams.subscribe(params => {
//this.sub = this.route.queryParams.subscribe(params => {
//console.log("params: ",params);
this.initialize();
});
//});
}
ngOnDestroy() {
this.sub.unsubscribe();
if(this.sub) {
this.sub.unsubscribe();
}
}
initialize() {

View File

@ -27,7 +27,11 @@ export class IFrameComponent {
this.style = {
"width.px": this.width,
"height.px": this.height
}
};
} else if(this.height) {
this.style = {
"height.px": this.height
};
}
}
}

View File

@ -58,7 +58,11 @@ export class SearchTabComponent {
} else if (entityType == "other") {
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
} else if (entityType == "result") {
return (full ? ("research outcome" + (plural ? "s" : "")) : "result");
return ((full ? "research outcome" : "result") + (plural ? "s" : ""));
} else if (entityType == "project") {
return "project" + (plural ? "s" : "");
} else if (entityType == "dataprovider") {
return ((full ? "content provider" : "dataprovider") + (plural ? "s" : ""));
}
}
}