[Connect|Trunk]

Enermaps
- add the extra tab for enermaps featured datasets
- visible in dev




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@60613 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2021-03-10 10:47:07 +00:00
parent ead614facc
commit 4321ca1033
3 changed files with 51 additions and 7 deletions

View File

@ -498,6 +498,17 @@
</div> </div>
</div> </div>
</ng-template> </ng-template>
<ng-template #enermaps_tab>
<div class="uk-grid uk-margin-remove">
<div class="uk-width-expand uk-padding">
<search-tab [fetch]="fetchFeaturedDatasets" [resultType]="'dataset'"
[properties]="properties" customTitle="Featured Datasets"
[showImpactFactors]="false" [showImage]="true">
</search-tab>
</div>
</div>
</ng-template>
<ng-template #mapping_tab> <ng-template #mapping_tab>
<div *ngIf="activeTab == 'mapping'"> <div *ngIf="activeTab == 'mapping'">
<a class="uk-float-right uk-margin-right uk-margin-small-top" <a class="uk-float-right uk-margin-right uk-margin-small-top"
@ -547,6 +558,11 @@
[tabTitle]="'Ontology Mapping'" [tabId]="'mapping'"> [tabTitle]="'Ontology Mapping'" [tabId]="'mapping'">
<ng-container *ngTemplateOutlet="mapping_tab;"></ng-container> <ng-container *ngTemplateOutlet="mapping_tab;"></ng-container>
</my-tab> </my-tab>
<my-tab *ngIf="properties.environment == 'development' && communityId == 'enermaps' &&
fetchFeaturedDatasets.searchUtils.totalResults > 0 && isEntityEnabled('dataset')"
[tabTitle]="'Featured datasets'" [tabId]="'enermaps'" [tabNumber]="fetchFeaturedDatasets.searchUtils.totalResults">
<ng-container *ngTemplateOutlet="enermaps_tab;"></ng-container>
</my-tab>
</my-tabs> </my-tabs>
<my-small-tabs (selectedActiveTab)="onSelectActiveTab($event)"> <my-small-tabs (selectedActiveTab)="onSelectActiveTab($event)">
@ -580,6 +596,11 @@
[tabTitle]="'Ontology Mapping'" [tabId]="'mapping'"> [tabTitle]="'Ontology Mapping'" [tabId]="'mapping'">
<ng-container *ngTemplateOutlet="mapping_tab;"></ng-container> <ng-container *ngTemplateOutlet="mapping_tab;"></ng-container>
</my-tab> </my-tab>
<my-tab *ngIf="properties.environment == 'development' && communityId == 'enermaps' &&
fetchFeaturedDatasets.searchUtils.totalResults > 0 && isEntityEnabled('dataset')"
[tabTitle]="'Featured datasets'" [tabId]="'enermaps'" [tabNumber]="fetchFeaturedDatasets.searchUtils.totalResults">
<ng-container *ngTemplateOutlet="enermaps_tab;"></ng-container>
</my-tab>
</my-small-tabs> </my-small-tabs>
</div> </div>
</div> </div>

View File

@ -51,12 +51,14 @@ export class CommunityComponent {
private reloadDatasets: boolean = true; private reloadDatasets: boolean = true;
private reloadSoftware: boolean = true; private reloadSoftware: boolean = true;
private reloadOrps: boolean = true; private reloadOrps: boolean = true;
private reloadFeaturedDatasets: boolean = true;
// Variables for publications, research data, projects, content providers, related content providers tabs // Variables for publications, research data, projects, content providers, related content providers tabs
public fetchPublications: FetchResearchResults; public fetchPublications: FetchResearchResults;
public fetchDatasets: FetchResearchResults; public fetchDatasets: FetchResearchResults;
public fetchSoftware: FetchResearchResults; public fetchSoftware: FetchResearchResults;
public fetchOrps: FetchResearchResults; public fetchOrps: FetchResearchResults;
public fetchFeaturedDatasets: FetchResearchResults;
public searchNumber: number = 5; public searchNumber: number = 5;
@Input() communityId = null; @Input() communityId = null;
@ -129,6 +131,8 @@ export class CommunityComponent {
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService); this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService); this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService); this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
} }
public ngOnInit() { public ngOnInit() {
@ -190,6 +194,9 @@ export class CommunityComponent {
this.countResearchResults("dataset"); this.countResearchResults("dataset");
this.countResearchResults("software"); this.countResearchResults("software");
this.countResearchResults("other"); this.countResearchResults("other");
if(this.communityId == "enermaps"){
this.countResearchResults("dataset", "enermaps::selection" );
}
this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe( this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
projectTotal => { projectTotal => {
@ -277,21 +284,33 @@ export class CommunityComponent {
} }
this.reloadOrps = false; 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; let fetch: FetchResearchResults;
if (resultType == "publication") { if (resultType == "publication") {
fetch = this.fetchPublications; fetch = this.fetchPublications;
} else if (resultType == "dataset") { } else if (resultType == "dataset" && !contextId) {
fetch = this.fetchDatasets; fetch = this.fetchDatasets;
} else if (resultType == "software") { } else if (resultType == "software") {
fetch = this.fetchSoftware; fetch = this.fetchSoftware;
} else if (resultType == "other") { } else if (resultType == "other") {
fetch = this.fetchOrps; fetch = this.fetchOrps;
} else if (resultType == "dataset" && contextId) {
fetch = this.fetchFeaturedDatasets;
} }
fetch.getNumForCommunity(resultType, this.communityId, this.properties, contextId);
fetch.getNumForCommunity(resultType, this.communityId, this.properties);
} }
public ngOnDestroy() { public ngOnDestroy() {
@ -302,6 +321,7 @@ export class CommunityComponent {
this.fetchDatasets.clearSubscriptions(); this.fetchDatasets.clearSubscriptions();
this.fetchOrps.clearSubscriptions(); this.fetchOrps.clearSubscriptions();
this.fetchSoftware.clearSubscriptions(); this.fetchSoftware.clearSubscriptions();
this.fetchFeaturedDatasets.clearSubscriptions();
} }
isEntityEnabled(entity: string) { isEntityEnabled(entity: string) {
@ -512,6 +532,9 @@ export class CommunityComponent {
} else if (activeTabId == 'mapping') { } else if (activeTabId == 'mapping') {
this.show = 'mapping'; this.show = 'mapping';
this.activeTab = 'mapping'; this.activeTab = 'mapping';
} else if (activeTabId == 'enermaps') {
this.show = 'enermaps';
this.searchFeaturedDatasets(1, this.fetchFeaturedDatasets.searchUtils.totalResults < 20?this.fetchFeaturedDatasets.searchUtils.totalResults:20);
} }
} }
} }

View File

@ -53,9 +53,9 @@ export let properties: EnvProperties = {
piwikBaseUrl: 'https://analytics.openaire.eu/piwik.php?idsite=', piwikBaseUrl: 'https://analytics.openaire.eu/piwik.php?idsite=',
piwikSiteId: '80', piwikSiteId: '80',
registryUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/registry/', 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", loginUrl: "http://dl170.madgik.di.uoa.gr:8180/dnet-login/openid_connect_login",
userInfoUrl: "http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/users/getUserInfo?accessToken=", userInfoUrl: "http://dl170.madgik.di.uoa.gr:8180/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', logoutUrl: 'http://dl170.madgik.di.uoa.gr:8180/dnet-login/openid_logout',
cookieDomain: '.di.uoa.gr', cookieDomain: '.di.uoa.gr',
feedbackmail: 'openaire.test@gmail.com', feedbackmail: 'openaire.test@gmail.com',
cacheUrl: 'http://duffy.di.uoa.gr:3000/get?url=', cacheUrl: 'http://duffy.di.uoa.gr:3000/get?url=',