diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index 1c2d3d8..1e9d346 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -498,6 +498,17 @@ + + +
+
+ + +
+
+
+ + + @@ -580,6 +596,11 @@ [tabTitle]="'Ontology Mapping'" [tabId]="'mapping'"> + + +
diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 8dbf07a..64c6b03 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -51,12 +51,14 @@ export class CommunityComponent { private reloadDatasets: boolean = true; private reloadSoftware: boolean = true; private reloadOrps: boolean = true; + private reloadFeaturedDatasets: boolean = true; // Variables for publications, research data, projects, content providers, related content providers tabs public fetchPublications: FetchResearchResults; public fetchDatasets: FetchResearchResults; public fetchSoftware: FetchResearchResults; public fetchOrps: FetchResearchResults; + public fetchFeaturedDatasets: FetchResearchResults; public searchNumber: number = 5; @Input() communityId = null; @@ -129,6 +131,8 @@ export class CommunityComponent { this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService); this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService); this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService); + this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService); + } public ngOnInit() { @@ -190,6 +194,9 @@ export class CommunityComponent { this.countResearchResults("dataset"); this.countResearchResults("software"); this.countResearchResults("other"); + if(this.communityId == "enermaps"){ + this.countResearchResults("dataset", "enermaps::selection" ); + } this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe( projectTotal => { @@ -277,21 +284,33 @@ export class CommunityComponent { } this.reloadOrps = false; } + private searchFeaturedDatasets(page: number, size: number) { + this.setActiveTab("enermaps"); + if (this.reloadFeaturedDatasets && + (this.fetchFeaturedDatasets.searchUtils.status == this.errorCodes.LOADING || + (this.fetchFeaturedDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchFeaturedDatasets.searchUtils.totalResults > 0) + ) + ) { + this.fetchFeaturedDatasets.getResultsForCommunity("dataset", this.communityId, page, size, this.properties, "enermaps::selection"); + } + this.reloadFeaturedDatasets = false; + } - private countResearchResults(resultType: string) { + private countResearchResults(resultType: string, contextId = null) { let fetch: FetchResearchResults; if (resultType == "publication") { fetch = this.fetchPublications; - } else if (resultType == "dataset") { + } else if (resultType == "dataset" && !contextId) { fetch = this.fetchDatasets; } else if (resultType == "software") { fetch = this.fetchSoftware; } else if (resultType == "other") { fetch = this.fetchOrps; + } else if (resultType == "dataset" && contextId) { + fetch = this.fetchFeaturedDatasets; } - - fetch.getNumForCommunity(resultType, this.communityId, this.properties); + fetch.getNumForCommunity(resultType, this.communityId, this.properties, contextId); } public ngOnDestroy() { @@ -302,6 +321,7 @@ export class CommunityComponent { this.fetchDatasets.clearSubscriptions(); this.fetchOrps.clearSubscriptions(); this.fetchSoftware.clearSubscriptions(); + this.fetchFeaturedDatasets.clearSubscriptions(); } isEntityEnabled(entity: string) { @@ -512,6 +532,9 @@ export class CommunityComponent { } else if (activeTabId == 'mapping') { this.show = 'mapping'; this.activeTab = 'mapping'; + } else if (activeTabId == 'enermaps') { + this.show = 'enermaps'; + this.searchFeaturedDatasets(1, this.fetchFeaturedDatasets.searchUtils.totalResults < 20?this.fetchFeaturedDatasets.searchUtils.totalResults:20); } } } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index c46afa8..aa49358 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -53,9 +53,9 @@ export let properties: EnvProperties = { piwikBaseUrl: 'https://analytics.openaire.eu/piwik.php?idsite=', piwikSiteId: '80', registryUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/registry/', - loginUrl: "http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login", - userInfoUrl: "http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=", - logoutUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_logout', + loginUrl: "http://dl170.madgik.di.uoa.gr:8180/dnet-login/openid_connect_login", + userInfoUrl: "http://dl170.madgik.di.uoa.gr:8180/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=", + logoutUrl: 'http://dl170.madgik.di.uoa.gr:8180/dnet-login/openid_logout', cookieDomain: '.di.uoa.gr', feedbackmail: 'openaire.test@gmail.com', cacheUrl: 'http://duffy.di.uoa.gr:3000/get?url=',