1
|
import {Component, ElementRef, Input, ViewChild} from '@angular/core';
|
2
|
import {ActivatedRoute, Router} from '@angular/router';
|
3
|
import {Location} from '@angular/common';
|
4
|
import {Meta, Title} from '@angular/platform-browser';
|
5
|
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
|
6
|
|
7
|
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
8
|
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
|
9
|
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
10
|
import {SearchZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
|
11
|
import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
|
12
|
import {Session, User} from '../openaireLibrary/login/utils/helper.class';
|
13
|
import {StatisticsForDashboardComponent} from '../statistics/statistics.component';
|
14
|
import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
|
15
|
|
16
|
import {PiwikHelper} from '../utils/piwikHelper';
|
17
|
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
18
|
import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service";
|
19
|
import {SearchCommunityProjectsService} from "../openaireLibrary/connect/projects/searchProjects.service";
|
20
|
import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service";
|
21
|
import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class";
|
22
|
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
|
23
|
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
24
|
import {SubscribeComponent} from "../utils/subscribe/subscribe.component";
|
25
|
import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
26
|
import {FetchResearchResults} from "../openaireLibrary/utils/fetchEntitiesClasses/fetchResearchResults.class";
|
27
|
import {ErrorCodes} from "../openaireLibrary/utils/properties/errorCodes";
|
28
|
import {Subscription} from "rxjs";
|
29
|
import {properties} from "../../environments/environment";
|
30
|
|
31
|
@Component({
|
32
|
selector: 'community',
|
33
|
templateUrl: 'community.component.html',
|
34
|
})
|
35
|
|
36
|
export class CommunityComponent {
|
37
|
public url: string = null;
|
38
|
|
39
|
public projectTotal = null;
|
40
|
public contentProviderTotal = null;
|
41
|
|
42
|
public projectsCalculated: boolean = false;
|
43
|
public contentProvidersCalculated: boolean = false;
|
44
|
|
45
|
params: any = {};
|
46
|
properties: EnvProperties = properties;
|
47
|
|
48
|
public errorCodes: ErrorCodes = new ErrorCodes();
|
49
|
// Request results of each tab only the one time (first time tab is clicked)
|
50
|
private reloadPublications: boolean = true;
|
51
|
private reloadDatasets: boolean = true;
|
52
|
private reloadSoftware: boolean = true;
|
53
|
private reloadOrps: boolean = true;
|
54
|
private reloadFeaturedDatasets: boolean = true;
|
55
|
|
56
|
// Variables for publications, research data, projects, content providers, related content providers tabs
|
57
|
public fetchPublications: FetchResearchResults;
|
58
|
public fetchDatasets: FetchResearchResults;
|
59
|
public fetchSoftware: FetchResearchResults;
|
60
|
public fetchOrps: FetchResearchResults;
|
61
|
public fetchFeaturedDatasets: FetchResearchResults;
|
62
|
public searchNumber: number = 5;
|
63
|
|
64
|
@Input() communityId = null;
|
65
|
public community = null;
|
66
|
|
67
|
public communityInfo = null;
|
68
|
|
69
|
public showLoading: boolean = true;
|
70
|
masterZenodoCommunity = null;
|
71
|
zenodoCommunityIdS = [];
|
72
|
showAllDescription = false;
|
73
|
public thresholdDescription: number = 500;
|
74
|
public descriptionDiff: number = 100;
|
75
|
|
76
|
subscribers: number = 0;
|
77
|
|
78
|
subs: Subscription[] = [];
|
79
|
|
80
|
@ViewChild(StatisticsForDashboardComponent) statistics: StatisticsForDashboardComponent = null;
|
81
|
public activeTab = "summary";
|
82
|
public show: string = 'overview';
|
83
|
public analyticsActiveTab: string = "";
|
84
|
public analyticsChecked: boolean = false;
|
85
|
|
86
|
searchLinkToResults: string = null;
|
87
|
|
88
|
searchLinkToProjects: string = null;
|
89
|
searchLinkToDataProviders: string = null;
|
90
|
searchLinkToAdvancedResults: string = null;
|
91
|
shareInZenodoPage: string = null;
|
92
|
public routerHelper: RouterHelper = new RouterHelper();
|
93
|
private user: User;
|
94
|
|
95
|
@ViewChild(SubscribeComponent) subscribeComponent: SubscribeComponent = null;
|
96
|
//Search Form
|
97
|
selectedEntity;
|
98
|
selectedEntitySimpleUrl;
|
99
|
selectedEntityAdvancedUrl;
|
100
|
keyword: string = "";
|
101
|
customFilter;
|
102
|
placeholderText = "Search by title, author, abstract, DOI, orcid... ";
|
103
|
|
104
|
constructor(
|
105
|
private element: ElementRef,
|
106
|
private route: ActivatedRoute,
|
107
|
private _router: Router,
|
108
|
private location: Location,
|
109
|
private _meta: Meta,
|
110
|
private _title: Title,
|
111
|
private _piwikService: PiwikService,
|
112
|
private config: ConfigurationService,
|
113
|
private _communityService: CommunityService,
|
114
|
private _searchCommunityDataprovidersService: SearchCommunityDataprovidersService,
|
115
|
private _searchCommunityProjectsService: SearchCommunityProjectsService,
|
116
|
private _searchResearchResultsService: SearchResearchResultsService,
|
117
|
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService,
|
118
|
private _zenodoCommunitieService: ZenodoCommunitiesService,
|
119
|
private seoService: SEOService,
|
120
|
private userManagementService: UserManagementService) {
|
121
|
|
122
|
var description = "OpenAIRE - Connect, Community Dashboard, research community";
|
123
|
var title = "OpenAIRE - Connect";
|
124
|
this._meta.updateTag({content: description}, "name='description'");
|
125
|
this._meta.updateTag({content: description}, "property='og:description'");
|
126
|
this._meta.updateTag({content: title}, "property='og:title'");
|
127
|
this._title.setTitle(title);
|
128
|
|
129
|
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
|
130
|
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
131
|
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
|
132
|
this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService);
|
133
|
this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService);
|
134
|
|
135
|
}
|
136
|
|
137
|
public ngOnInit() {
|
138
|
this.searchLinkToResults = this.properties.searchLinkToResults;
|
139
|
this.searchLinkToProjects = this.properties.searchLinkToProjects;
|
140
|
this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders;
|
141
|
this.searchLinkToAdvancedResults = this.properties.searchLinkToAdvancedResults;
|
142
|
this.shareInZenodoPage = this.properties.shareInZenodoPage;
|
143
|
this.url = properties.domain + properties.baseLink + this._router.url;
|
144
|
this.seoService.createLinkForCanonicalURL(this.url, false);
|
145
|
this._meta.updateTag({content: this.url}, "property='og:url'");
|
146
|
this.subs.push(this.userManagementService.getUserInfo().subscribe(user => {
|
147
|
this.user = user;
|
148
|
}));
|
149
|
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
|
150
|
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
|
151
|
community => {
|
152
|
if(community) {
|
153
|
this.community = community;
|
154
|
if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
|
155
|
this.thresholdDescription = community.description.length;
|
156
|
}
|
157
|
|
158
|
if (this.properties.environment == "development") {
|
159
|
this.params = {communityId: community.communityId};
|
160
|
}
|
161
|
this._meta.updateTag({content: community.description}, "name='description'");
|
162
|
this._meta.updateTag({content: community.description}, "property='og:description'");
|
163
|
this._meta.updateTag({content: community.title}, "property='og:title'");
|
164
|
this._title.setTitle(community.title);
|
165
|
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
|
166
|
this.subs.push(this._piwikService.trackView(this.properties, community.title, PiwikHelper.getSiteId(this.communityId, this.properties.environment)).subscribe());
|
167
|
}
|
168
|
if (this.community.zenodoCommunity) {
|
169
|
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe(
|
170
|
result => {
|
171
|
this.masterZenodoCommunity = result;
|
172
|
},
|
173
|
error => {
|
174
|
this.handleError("Error getting Master Zenodo community with id: " + this.community.zenodoCommunity, error);
|
175
|
}
|
176
|
));
|
177
|
}
|
178
|
this.subs.push(this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.communityId).subscribe(
|
179
|
result => {
|
180
|
this.zenodoCommunityIdS = result;
|
181
|
},
|
182
|
error => {
|
183
|
this.handleError("Error getting list of zenodo communities for community with openaire id: " + this.communityId, error);
|
184
|
}
|
185
|
));
|
186
|
}
|
187
|
}));
|
188
|
|
189
|
this.countResearchResults("publication");
|
190
|
this.countResearchResults("dataset");
|
191
|
this.countResearchResults("software");
|
192
|
this.countResearchResults("other");
|
193
|
if(this.communityId == "enermaps"){
|
194
|
this.countResearchResults("dataset", "enermaps::selection" );
|
195
|
}
|
196
|
|
197
|
this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe(
|
198
|
projectTotal => {
|
199
|
this.projectTotal = projectTotal;
|
200
|
},
|
201
|
error => {
|
202
|
this.handleError("Error getting number of projects for community with id: " + this.communityId, error);
|
203
|
},
|
204
|
() => {
|
205
|
this.projectsCalculated = true;
|
206
|
}
|
207
|
));
|
208
|
|
209
|
this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe(
|
210
|
contentProviderTotal => {
|
211
|
this.contentProviderTotal = contentProviderTotal;
|
212
|
//console.log(contentProviderTotal);
|
213
|
},
|
214
|
error => {
|
215
|
this.handleError("Error getting number of content providers for community with id: " + this.communityId, error);
|
216
|
},
|
217
|
() => {
|
218
|
this.contentProvidersCalculated = true;
|
219
|
}
|
220
|
));
|
221
|
this.subs.push(this.config.communityInformationState.subscribe(
|
222
|
res => {
|
223
|
this.communityInfo = res;
|
224
|
},
|
225
|
error => {
|
226
|
//console.log(error)
|
227
|
this.handleError("Error getting community with id: " + this.communityId, error);
|
228
|
}
|
229
|
));
|
230
|
}
|
231
|
|
232
|
private searchPublications(page: number, size: number) {
|
233
|
this.setActiveTab("publication");
|
234
|
|
235
|
if (this.reloadPublications &&
|
236
|
(this.fetchPublications.searchUtils.status == this.errorCodes.LOADING ||
|
237
|
(this.fetchPublications.searchUtils.status == this.errorCodes.DONE && this.fetchPublications.searchUtils.totalResults > 0)
|
238
|
)
|
239
|
) {
|
240
|
this.fetchPublications.getResultsForCommunity("publication", this.communityId, page, size, this.properties);
|
241
|
}
|
242
|
this.reloadPublications = false;
|
243
|
}
|
244
|
|
245
|
private searchDatasets(page: number, size: number) {
|
246
|
this.setActiveTab("dataset");
|
247
|
|
248
|
if (this.reloadDatasets &&
|
249
|
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
250
|
(this.fetchDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchDatasets.searchUtils.totalResults > 0)
|
251
|
)
|
252
|
) {
|
253
|
this.fetchDatasets.getResultsForCommunity("dataset", this.communityId, page, size, this.properties);
|
254
|
}
|
255
|
this.reloadDatasets = false;
|
256
|
}
|
257
|
|
258
|
private searchSoftware(page: number, size: number) {
|
259
|
this.setActiveTab("software");
|
260
|
|
261
|
if (this.reloadSoftware &&
|
262
|
(this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING ||
|
263
|
(this.fetchSoftware.searchUtils.status == this.errorCodes.DONE && this.fetchSoftware.searchUtils.totalResults > 0)
|
264
|
)
|
265
|
) {
|
266
|
this.fetchSoftware.getResultsForCommunity("software", this.communityId, page, size, this.properties);
|
267
|
}
|
268
|
this.reloadSoftware = false;
|
269
|
}
|
270
|
|
271
|
private searchOrps(page: number, size: number) {
|
272
|
this.setActiveTab("other");
|
273
|
|
274
|
if (this.reloadOrps &&
|
275
|
(this.fetchOrps.searchUtils.status == this.errorCodes.LOADING ||
|
276
|
(this.fetchOrps.searchUtils.status == this.errorCodes.DONE && this.fetchOrps.searchUtils.totalResults > 0)
|
277
|
)
|
278
|
) {
|
279
|
this.fetchOrps.getResultsForCommunity("other", this.communityId, page, size, this.properties);
|
280
|
}
|
281
|
this.reloadOrps = false;
|
282
|
}
|
283
|
private searchFeaturedDatasets(page: number, size: number) {
|
284
|
this.setActiveTab("enermaps");
|
285
|
if (this.reloadFeaturedDatasets &&
|
286
|
(this.fetchFeaturedDatasets.searchUtils.status == this.errorCodes.LOADING ||
|
287
|
(this.fetchFeaturedDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchFeaturedDatasets.searchUtils.totalResults > 0)
|
288
|
)
|
289
|
) {
|
290
|
this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", this.communityId, page, size, this.properties, "enermaps::selection");
|
291
|
}
|
292
|
this.reloadFeaturedDatasets = false;
|
293
|
}
|
294
|
|
295
|
private countResearchResults(resultType: string, contextId = null) {
|
296
|
let fetch: FetchResearchResults;
|
297
|
|
298
|
if (resultType == "publication") {
|
299
|
fetch = this.fetchPublications;
|
300
|
} else if (resultType == "dataset" && !contextId) {
|
301
|
fetch = this.fetchDatasets;
|
302
|
} else if (resultType == "software") {
|
303
|
fetch = this.fetchSoftware;
|
304
|
} else if (resultType == "other") {
|
305
|
fetch = this.fetchOrps;
|
306
|
} else if (resultType == "dataset" && contextId) {
|
307
|
fetch = this.fetchFeaturedDatasets;
|
308
|
this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", this.communityId, 0, 0, this.properties, contextId);
|
309
|
return;
|
310
|
}
|
311
|
fetch.getNumForCommunity(resultType, this.communityId, this.properties, contextId);
|
312
|
}
|
313
|
|
314
|
public ngOnDestroy() {
|
315
|
for (let sub of this.subs) {
|
316
|
sub.unsubscribe();
|
317
|
}
|
318
|
this.fetchPublications.clearSubscriptions();
|
319
|
this.fetchDatasets.clearSubscriptions();
|
320
|
this.fetchOrps.clearSubscriptions();
|
321
|
this.fetchSoftware.clearSubscriptions();
|
322
|
this.fetchFeaturedDatasets.clearSubscriptions();
|
323
|
}
|
324
|
|
325
|
isEntityEnabled(entity: string) {
|
326
|
return this.communityInfo.entities.some(x => x['pid'] == entity && x['isEnabled'] === true);
|
327
|
}
|
328
|
|
329
|
isRouteEnabled(route: string) {
|
330
|
return this.communityInfo.pages.some(x => x['route'] == route && x['isEnabled'] === true);
|
331
|
}
|
332
|
|
333
|
showInvite() {
|
334
|
return this.isManager();
|
335
|
}
|
336
|
|
337
|
isManager() {
|
338
|
if (!this.user) {
|
339
|
return false;
|
340
|
}
|
341
|
var email = this.user.email;
|
342
|
var index = -1;
|
343
|
if (email && this.community != null && this.community.managers != null) {
|
344
|
index = this.community.managers.indexOf(email);
|
345
|
}
|
346
|
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || index != -1;
|
347
|
}
|
348
|
|
349
|
private handleError(message: string, error) {
|
350
|
console.error("Community (component): " + message, error);
|
351
|
}
|
352
|
|
353
|
getSearchPlaceHolder() {
|
354
|
var entities = [];
|
355
|
if (this.isEntityEnabled("publication")) {
|
356
|
entities.push("publications");
|
357
|
}
|
358
|
if (this.isEntityEnabled("dataset")) {
|
359
|
entities.push("research data");
|
360
|
}
|
361
|
if (this.isEntityEnabled("software")) {
|
362
|
entities.push("software");
|
363
|
}
|
364
|
if (this.isEntityEnabled("orp")) {
|
365
|
entities.push("other research products");
|
366
|
}
|
367
|
return "Search" + ((entities.length > 0) ? (" for " + entities.join(', ') + "...") : "");
|
368
|
}
|
369
|
|
370
|
countOtherGraphs() {
|
371
|
var count = 0;
|
372
|
if (this.statistics && this.statistics.allowedEntities) {
|
373
|
for (var entity of this.statistics.allowedEntities) {
|
374
|
if (this.statistics.statisticsSum[entity].total > 0 && this.statistics.allowedCharts[entity].length > 0 && this.activeTab != entity) {
|
375
|
count += this.statistics.allowedCharts[entity].length;
|
376
|
}
|
377
|
}
|
378
|
}
|
379
|
return count;
|
380
|
}
|
381
|
|
382
|
createParams(param) {
|
383
|
return StringUtils.quote(StringUtils.URIEncode(param));
|
384
|
}
|
385
|
|
386
|
private setActiveTab(entityType: string) {
|
387
|
if (entityType == "other") {
|
388
|
this.activeTab = "orp";
|
389
|
} else {
|
390
|
this.activeTab = entityType;
|
391
|
}
|
392
|
}
|
393
|
|
394
|
public getParamsForSearchLink(type: string = "") {
|
395
|
if (type) {
|
396
|
return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']);
|
397
|
} else {
|
398
|
return {};
|
399
|
}
|
400
|
}
|
401
|
|
402
|
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
|
403
|
if (entityType == "publication") {
|
404
|
return "publication" + (plural ? "s" : "");
|
405
|
} else if (entityType == "dataset") {
|
406
|
return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
|
407
|
} else if (entityType == "software") {
|
408
|
return "software";
|
409
|
} else if (entityType == "other") {
|
410
|
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
|
411
|
}
|
412
|
}
|
413
|
|
414
|
public buildProjectsAndContentProvidesTooltip(): string {
|
415
|
let tooltipContent: string = "<div class='uk-margin'>";
|
416
|
|
417
|
if (this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)) {
|
418
|
tooltipContent += "<span class='uk-text-bold'>Projects</span>";
|
419
|
}
|
420
|
if (this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)
|
421
|
&& (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders))) {
|
422
|
tooltipContent += " and ";
|
423
|
}
|
424
|
if (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) {
|
425
|
tooltipContent += "<span class='uk-text-bold'>Content Providers</span>";
|
426
|
}
|
427
|
|
428
|
tooltipContent += " have been selected as relevant for your community by the gateway curators.";
|
429
|
tooltipContent += "</div>";
|
430
|
|
431
|
return tooltipContent;
|
432
|
}
|
433
|
|
434
|
public buildZenodoCommunitiesTooltip(): string {
|
435
|
let tooltipContent: string = "<div class='uk-margin'>";
|
436
|
|
437
|
tooltipContent += "<span class='uk-text-bold'>Zenodo</span> is a catch-all repository for OpenAIRE.";
|
438
|
tooltipContent += "<div class='uk-margin-small-top'>A <span class='uk-text-bold'>Zenodo Community</span> is created and curated by Zenodo users.</div>";
|
439
|
tooltipContent += "</div>";
|
440
|
return tooltipContent;
|
441
|
}
|
442
|
|
443
|
entityChanged($event) {
|
444
|
this.selectedEntity = $event.entity;
|
445
|
this.selectedEntitySimpleUrl = $event.simpleUrl;
|
446
|
this.selectedEntityAdvancedUrl = $event.advancedUrl;
|
447
|
if (this.selectedEntity == 'result') {
|
448
|
this.placeholderText = "Search by title, author, abstract, DOI, orcid... ";
|
449
|
} else if (this.selectedEntity == 'project') {
|
450
|
this.placeholderText = "Search by project title, grant id, funder...";
|
451
|
} else if (this.selectedEntity == 'dataprovider') {
|
452
|
this.placeholderText = "Search by name...";
|
453
|
} else {
|
454
|
this.placeholderText = "Search community content";
|
455
|
}
|
456
|
}
|
457
|
|
458
|
goTo(simple: boolean) {
|
459
|
let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl;
|
460
|
let parameterNames = [];
|
461
|
let parameterValues = [];
|
462
|
if (this.keyword.length > 0) {
|
463
|
parameterNames.push("fv0");
|
464
|
parameterValues.push(this.keyword);
|
465
|
parameterNames.push("f0");
|
466
|
parameterValues.push("q");
|
467
|
}
|
468
|
this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)});
|
469
|
}
|
470
|
|
471
|
public countSubscribersEvent($event) {
|
472
|
this.subscribers = $event.value;
|
473
|
}
|
474
|
|
475
|
public checkStatistics(type: string) {
|
476
|
return !!(this.isEntityEnabled(type)
|
477
|
&& this.statistics && this.statistics.statisticsDisplay && this.statistics.statisticsDisplay.isActive
|
478
|
&& this.statistics.statisticsSum && this.statistics.statisticsSum[type] && this.statistics.statisticsSum[type].total > 0
|
479
|
&&
|
480
|
(this.statistics.statisticsDisplay.entities[type].numbers.map['total']['showInMonitor']
|
481
|
|| this.statistics.statisticsDisplay.entities[type].numbers.map['project']['showInMonitor']
|
482
|
|| this.statistics.statisticsDisplay.entities[type].numbers.map['open']['showInMonitor']
|
483
|
|| this.statistics.statisticsDisplay.entities[type].numbers.map['closed']['showInMonitor']
|
484
|
|| this.statistics.statisticsDisplay.entities[type].numbers.map['embargo']['showInMonitor']
|
485
|
|| this.statistics.statisticsDisplay.entities[type].numbers.map['restricted']['showInMonitor']
|
486
|
|| (this.statistics.allowedEntitiesMode['showInMonitor']
|
487
|
&& this.statistics.allowedChartsMode['showInMonitor'][type]
|
488
|
&& this.statistics.allowedChartsMode['showInMonitor'][type].length > 0)));
|
489
|
}
|
490
|
|
491
|
public initializeAnalyticsActiveTab() {
|
492
|
if (!this.analyticsChecked) {
|
493
|
if (this.checkStatistics("publication")) {
|
494
|
this.analyticsActiveTab = "publication";
|
495
|
} else if (this.checkStatistics("dataset")) {
|
496
|
this.analyticsActiveTab = "dataset";
|
497
|
} else if (this.checkStatistics("software")) {
|
498
|
this.analyticsActiveTab = "software";
|
499
|
} else if (this.checkStatistics("orp")) {
|
500
|
this.analyticsActiveTab = "orp";
|
501
|
}
|
502
|
}
|
503
|
}
|
504
|
|
505
|
public showAnalyticsTab() {
|
506
|
this.initializeAnalyticsActiveTab();
|
507
|
return this.analyticsActiveTab;
|
508
|
}
|
509
|
|
510
|
public onSelectActiveTab(activeTabId) {
|
511
|
if (this.activeTab != "activaTabId") { // tab really changed
|
512
|
if (activeTabId == 'summary') {
|
513
|
this.activeTab = 'summary';
|
514
|
} else if (activeTabId == 'publications') {
|
515
|
this.show = 'overview';
|
516
|
this.searchPublications(1, this.searchNumber);
|
517
|
} else if (activeTabId == 'datasets') {
|
518
|
this.show = 'overview';
|
519
|
this.searchDatasets(1, this.searchNumber);
|
520
|
} else if (activeTabId == 'software') {
|
521
|
this.show = 'overview';
|
522
|
this.searchSoftware(1, this.searchNumber);
|
523
|
} else if (activeTabId == 'other') {
|
524
|
this.show = 'overview';
|
525
|
this.searchOrps(1, this.searchNumber);
|
526
|
} else if (activeTabId == 'analytics') {
|
527
|
this.show = 'analysis';
|
528
|
this.activeTab = 'analytics';
|
529
|
this.analyticsChecked = true;
|
530
|
} else if (activeTabId == 'mapping') {
|
531
|
this.show = 'mapping';
|
532
|
this.activeTab = 'mapping';
|
533
|
} else if (activeTabId == 'enermaps') {
|
534
|
this.show = 'enermaps';
|
535
|
this.searchFeaturedDatasets(1, this.fetchFeaturedDatasets.searchUtils.totalResults < 20?this.fetchFeaturedDatasets.searchUtils.totalResults:20);
|
536
|
}
|
537
|
}
|
538
|
}
|
539
|
}
|