diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index 3251fbe..4bc307a 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -1,124 +1,124 @@
+ let-resultType="resultType" let-fetch="fetch" let-searchLinkToAdvancedPage="searchLinkToAdvancedPage" + let-params="params" let-type="type" let-typeName="typeName">
+ [searchLinkToAdvancedPage]="searchLinkToAdvancedPage" [properties]="properties">
+ let-type="type" let-typeName="typeName">
+ && statistics.statisticsSum && statistics.statisticsDisplay && statistics.statisticsSum[type].total>0 + && (statistics.statisticsDisplay.entities[type].numbers.map['total']['showInMonitor'] + || statistics.statisticsDisplay.entities[type].numbers.map['project']['showInMonitor'] + || statistics.statisticsDisplay.entities[type].numbers.map['open']['showInMonitor'] + || statistics.statisticsDisplay.entities[type].numbers.map['closed']['showInMonitor'] + || statistics.statisticsDisplay.entities[type].numbers.map['embargo']['showInMonitor'] + || statistics.statisticsDisplay.entities[type].numbers.map['restricted']['showInMonitor'] + || (statistics.allowedEntitiesMode['showInMonitor'] && statistics.statisticsSum + && statistics.allowedChartsMode['showInMonitor'] && statistics.statisticsSum[type] + && statistics.allowedChartsMode['showInMonitor'][type] && statistics.statisticsSum[type].total > 0 + && statistics.allowedChartsMode['showInMonitor'][type].length > 0) )">
- {{typeName}} -
+ {{typeName}} +
+ entity: type, entityName: typeName, + statisticsSum:statistics.statisticsSum, statisticsDisplay:statistics.statisticsDisplay, + allowedEntities: statistics.allowedEntitiesMode['showInMonitor'], + allowedCharts:statistics.allowedChartsMode['showInMonitor'], + showChartTitle: statistics.chartTitlesMode['showInMonitor'], + chartsInfoMap:statistics.chartsInfoMap, showIn:'showInMonitor'}">
+ let-statisticsDisplay="statisticsDisplay" let-allowedEntities="allowedEntities" + let-allowedCharts="allowedCharts" let-chartsInfoMap="chartsInfoMap" + let-showChartTitle="showChartTitle" + let-showIn="showIn">
+ !statisticsDisplay.entities[entity].numbers.map['total'][showIn] && !statisticsDisplay.entities[entity].numbers.map['project'][showIn] && + !statisticsDisplay.entities[entity].numbers.map['open'][showIn] && !statisticsDisplay.entities[entity].numbers.map['closed'][showIn] && + !statisticsDisplay.entities[entity].numbers.map['embargo'][showIn] && !statisticsDisplay.entities[entity].numbers.map['restricted'][showIn]" + class="uk-alert uk-alert-primary"> No graphs available
+ [class]="'uk-grid uk-grid-small uk-grid-match ' + (showIn == 'showInMonitor' ? ' uk-child-width-1-3@s uk-child-width-1-6@m' : ' uk-child-width-1-1@s uk-child-width-1-3@m')" + uk-grid>
- {{statisticsSum[entity].total|number}} -
+ {{statisticsSum[entity].total|number}} +
- Total -
+ Total +
- {{statisticsSum[entity].projects|number}} -
+ {{statisticsSum[entity].projects|number}} +
- Total linked projects -
+ Total linked projects +
- {{statisticsSum[entity].open_access|number}} -
+ {{statisticsSum[entity].open_access|number}} +
- Open access -
+ Open access +
- {{statisticsSum[entity].closed_access|number}} -
+ {{statisticsSum[entity].closed_access|number}} +
- Closed access -
+ Closed access +
- {{statisticsSum[entity].embargo|number}} -
+ {{statisticsSum[entity].embargo|number}} +
- Embargoed -
+ Embargoed +
- {{statisticsSum[entity].restricted|number}} -
+ {{statisticsSum[entity].restricted|number}} +
- Restricted -
+ Restricted +
+ statisticsSum && allowedCharts && statisticsSum[entity] && + allowedCharts[entity] && statisticsSum[entity].total>0 && + allowedCharts[entity].length>0">
@@ -149,17 +149,17 @@
-
-
-
+
+
+

{{community.shortTitle}}

-
+
{{community.title}}
-
+
-
-
-
-
+
+
+
+
-
-
-
- +
+ + + + +
+
+ + + + + + + + +
+
+ + +
+
+ +
+
Here are listed some of the most important energy datasets as selected by energy experts.
+
+ Check them if you want to easily explore and visualize the European energy landscape, + using only well-known datasets which you can trust. +
+
+
+
+
+
+ +
+
+ Browse OpenAIRE Research Graph through a map of the main concepts linked to Coronavirus +
+ +
+
+ + + --> - +
-
-
-
-
-
-
-
-
-
- -
-
-
-
- Created: {{community.date | date:'dd-MMM-yyyy'}} -
- - -
-
-
- - - - -
- -
-
-
-
-
-
-
Subjects
- - - - {{subject}} - - , - - - -
-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
- Browse OpenAIRE Research Graph through a map of the main concepts linked to Coronavirus -
-
- - - Powered by - Opscidia and - OpenAIRE Research Graph - - Visit - - Opscidia Tool - - -
-
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+ Created: {{community.date | date:'dd-MMM-yyyy'}} +
+ + +
+
+
+ + + + +
+ +
+
+
+
+
+
+
Subjects
+ + + + {{item.value}} + + , + + + +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ Browse OpenAIRE Research Graph through a map of the main concepts linked to Coronavirus +
+
+ + + Powered by + Opscidia and + OpenAIRE Research Graph + + Visit + + Opscidia Tool + + +
+
@@ -730,73 +730,73 @@
Check them if you want to easily explore and visualize the European energy landscape, using only well-known datasets which you can trust. -
-
- - - -
-
-
-
-
-
+ + + + + + + + + + + - +
- + class="uk-container uk-container-large"> +
+ class="uk-section tm-middle uk-container uk-margin-large-top ">
diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 517f078..cc9fccd 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -29,20 +29,20 @@ import {OpenaireEntities} from '../openaireLibrary/utils/properties/searchFields @Component({ selector: 'community', templateUrl: 'community.component.html', - styles: [ + styles: [ + ` + #mytabs .uk-tab::before { + border-bottom: none; + } + #mytabs::before { + content: ""; + position: absolute; + bottom: 0; + left: 0; + right: 0; + border-bottom: 1px solid #eaeaea; + } ` - #mytabs .uk-tab::before { - border-bottom: none; - } - #mytabs::before { - content: ""; - position: absolute; - bottom: 0; - left: 0; - right: 0; - border-bottom: 1px solid #eaeaea; - } - ` ] }) @@ -86,13 +86,18 @@ export class CommunityComponent { public thresholdDescription: number = 500; public descriptionDiff: number = 100; - page = 1; - size = 5; + page = 1; + size = 5; subscribers: number = 0; subs: Subscription[] = []; + displayedAllSubjects = []; + displayedSubjects = []; + displayedSdg = []; + displayedFos = []; + @ViewChild(StatisticsForDashboardComponent) statistics: StatisticsForDashboardComponent = null; public activeTab = "summary"; public show: string = 'overview'; @@ -110,7 +115,7 @@ export class CommunityComponent { selectedEntity = 'result'; selectedEntitySimpleUrl; selectedEntityAdvancedUrl; - resultTypes: Filter = { + resultTypes: Filter = { values: [], filterId: "type", countSelectedValues: 0, @@ -120,7 +125,7 @@ export class CommunityComponent { title: "Type", filterOperator: "or" }; - showPublications: boolean = false; + showPublications: boolean = false; showDatasets: boolean = false; showSoftware: boolean = false; showOrp: boolean = false; @@ -135,9 +140,9 @@ export class CommunityComponent { filterId: "resultbestaccessright", value: "Open Access" }; - disableSelect: boolean = true; - openaireEntities= OpenaireEntities; - piwikSiteId; + disableSelect: boolean = true; + openaireEntities= OpenaireEntities; + piwikSiteId; constructor( private element: ElementRef, @@ -156,9 +161,9 @@ export class CommunityComponent { private _zenodoCommunitieService: ZenodoCommunitiesService, private seoService: SEOService, private userManagementService: UserManagementService, - private _renderer2: Renderer2, - private cdr: ChangeDetectorRef, - @Inject(DOCUMENT) private _document: Document) { + private _renderer2: Renderer2, + private cdr: ChangeDetectorRef, + @Inject(DOCUMENT) private _document: Document) { var description = "OpenAIRE - Connect, Community Dashboard, research community"; var title = "OpenAIRE - Connect"; @@ -192,6 +197,18 @@ export class CommunityComponent { community => { this.community = community; if(community && !ConnectHelper.isPrivate(community, this.user)) { + this.displayedSubjects = community.subjects; + this.displayedSdg = community.sdg; + this.displayedFos = community.fos; + this.displayedSubjects.forEach(element => { + this.displayedAllSubjects.push({value: element, type: 'resultsubject'}); + }); + this.displayedSdg.forEach(element => { + this.displayedAllSubjects.push({value: element, type: 'sdg'}); + }); + this.displayedFos.forEach(element => { + this.displayedAllSubjects.push({value: element, type: 'fos'}); + }); if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) { this.thresholdDescription = community.description.length; } @@ -204,12 +221,12 @@ export class CommunityComponent { this._meta.updateTag({content: community.title}, "property='og:title'"); this._title.setTitle(community.title); if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { - this.subs.push(this.config.communityInformationState.subscribe(portal => { - if(portal && portal.piwik) { - this.piwikSiteId = portal.piwik; - this.subs.push(this._piwikService.trackView(this.properties, community.title, this.piwikSiteId).subscribe()); - } - })); + this.subs.push(this.config.communityInformationState.subscribe(portal => { + if(portal && portal.piwik) { + this.piwikSiteId = portal.piwik; + this.subs.push(this._piwikService.trackView(this.properties, community.title, this.piwikSiteId).subscribe()); + } + })); } if (this.community.zenodoCommunity) { this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + this.community.zenodoCommunity, null).subscribe( @@ -283,47 +300,47 @@ export class CommunityComponent { this.handleError("Error getting community with id: " + this.communityId, error); } )); - this.subs.push(this.config.communityInformationState.subscribe(data => { - if (data) { - var showEntity = {}; - for (var i = 0; i < data['entities'].length; i++) { - showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"]; - } - this.showPublications = !!showEntity["publication"]; - this.showDatasets = !!showEntity["dataset"]; - this.showSoftware = !!showEntity["software"]; - this.showOrp = !!showEntity["orp"]; - this.showProjects = !!showEntity["project"]; - this.showDataProviders = !!showEntity["datasource"]; - if (this.showPublications) { - this.resultTypes.values.push({ - name: this.openaireEntities.PUBLICATIONS, - id: "publications", - selected: false, - number: 0 - }); - } - if (this.showDatasets) { - this.resultTypes.values.push({ - name: this.openaireEntities.DATASETS, - id: "datasets", - selected: false, - number: 0 - }); - } - if (this.showSoftware) { - this.resultTypes.values.push({ - name: this.openaireEntities.SOFTWARE, - id: "software", - selected: false, - number: 0 - }); - } - if (this.showOrp) { - this.resultTypes.values.push({name: this.openaireEntities.OTHER, id: "other", selected: false, number: 0}); - } - } - })); + this.subs.push(this.config.communityInformationState.subscribe(data => { + if (data) { + var showEntity = {}; + for (var i = 0; i < data['entities'].length; i++) { + showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"]; + } + this.showPublications = !!showEntity["publication"]; + this.showDatasets = !!showEntity["dataset"]; + this.showSoftware = !!showEntity["software"]; + this.showOrp = !!showEntity["orp"]; + this.showProjects = !!showEntity["project"]; + this.showDataProviders = !!showEntity["datasource"]; + if (this.showPublications) { + this.resultTypes.values.push({ + name: this.openaireEntities.PUBLICATIONS, + id: "publications", + selected: false, + number: 0 + }); + } + if (this.showDatasets) { + this.resultTypes.values.push({ + name: this.openaireEntities.DATASETS, + id: "datasets", + selected: false, + number: 0 + }); + } + if (this.showSoftware) { + this.resultTypes.values.push({ + name: this.openaireEntities.SOFTWARE, + id: "software", + selected: false, + number: 0 + }); + } + if (this.showOrp) { + this.resultTypes.values.push({name: this.openaireEntities.OTHER, id: "other", selected: false, number: 0}); + } + } + })); } private searchPublications(page: number, size: number) { @@ -385,7 +402,7 @@ export class CommunityComponent { ) ) { this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", this.communityId, page, size, this.properties, "enermaps::selection"); - // console.log(this.fetchFeaturedDatasets); + // console.log(this.fetchFeaturedDatasets); } this.reloadFeaturedDatasets = false; } @@ -522,9 +539,9 @@ export class CommunityComponent { return tooltipContent; } - public buildContentProvidersTooltip(): string { + public buildContentProvidersTooltip(): string { let tooltipContent: string = "
"; - + if (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) { tooltipContent += "Content Providers"; } @@ -541,7 +558,7 @@ export class CommunityComponent { tooltipContent += "Zenodo is a catch-all repository for OpenAIRE."; tooltipContent += "
A Zenodo Community is created and curated by Zenodo users.
"; tooltipContent += "
"; - + return tooltipContent; } @@ -643,24 +660,24 @@ export class CommunityComponent { this.activeTab = 'mapping'; } else if (activeTabId == 'enermaps') { this.show = 'enermaps'; - this.activeTab = 'enermaps'; + this.activeTab = 'enermaps'; this.searchFeaturedDatasets(1, this.fetchFeaturedDatasets.searchUtils.totalResults); } else if (activeTabId == 'twitter') { - this.show = 'twitter'; - this.activeTab = 'twitter'; - } + this.show = 'twitter'; + this.activeTab = 'twitter'; + } } } isPrivate(){ return ConnectHelper.isPrivate(this.community, this.user); } - disableSelectChange(event: boolean) { + disableSelectChange(event: boolean) { this.disableSelect = event; this.cdr.detectChanges(); } - public updatePage(event) { + public updatePage(event) { this.page = event.value; } } diff --git a/src/app/subjects/subjects.component.ts b/src/app/subjects/subjects.component.ts index 421d22e..2ee6942 100644 --- a/src/app/subjects/subjects.component.ts +++ b/src/app/subjects/subjects.component.ts @@ -18,112 +18,330 @@ import {Subscriber, Subscription} from "rxjs"; +
+ +
+
+
+
+ +
+
+

+ Subjects +

+
+ + +
+
+
No subjects
+
+
+ + +
+
+
+
` }) export class SubjectsComponent { - public subjects: string[]; - public communityId = null; - public showLoading = true; - - public properties: EnvProperties = properties; - public pageContents = null; - public divContents = null; - public groupedSubjects = []; - public index: number = 0; - public subjectsLimit: number = 6; - public viewAll: boolean = false; - public maxCharacters: number = 25; - public subjectsColumns = []; - - public url: string = null; - public pageTitle: string = "Subjects"; - - public breadcrumbs: Breadcrumb[] = [{name: 'Home', route: '/'}, {name: 'About - Subjects'}]; - + properties: EnvProperties = properties; + breadcrumbs: Breadcrumb[] = [{name: 'Home', route: '/'}, {name: 'About - Subjects'}]; + pageContents = null; + divContents = null; + url: string = null; + pageTitle: string = "Subjects"; + communityId = null; + showLoading = true; subs: Subscription[] = []; - + + displayedAllSubjects = []; + displayedSubjects = []; + displayedSdg = []; + displayedFos = []; + groupedAllSubjects = []; + groupedSubjects = []; + groupedSdg = []; + groupedFos = []; + subjectsColumns = []; + subjectsLimit: number = 6; + maxCharacters: number = 25; + activeTab: 'all' | 'freeText' | 'sdg' | 'fos' = 'all'; + indexAll: number = 0; + indexSubjects: number = 0; + indexSdg: number = 0; + indexFos: number = 0; + + viewAll: boolean = false; + constructor(private route: ActivatedRoute, private communityService: CommunityService, private _router: Router, @@ -147,18 +365,20 @@ export class SubjectsComponent { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle, PiwikHelper.getSiteId(this.communityId)).subscribe()); } - //this.getDivContents(); this.getPageContents(); - this.subjects = community.subjects; - this.subjects.sort((a,b) => { - if(!a || a.toLocaleUpperCase() < b.toLocaleUpperCase()) { - return -1; - } else if (!b || a.toLocaleUpperCase() > b.toLocaleUpperCase()) { - return 1; - } - return 0; - }); - this.groupSubjects(); + this.displayedSubjects = community.subjects; + this.displayedSdg = community.sdg; + this.displayedFos = community.fos; + this.displayedSubjects.forEach(element => { + this.displayedAllSubjects.push({value: element, type: 'resultsubject'}); + }); + this.displayedSdg.forEach(element => { + this.displayedAllSubjects.push({value: element, type: 'sdg'}); + }); + this.displayedFos.forEach(element => { + this.displayedAllSubjects.push({value: element, type: 'fos'}); + }); + this.groupSubjects(this.displayedAllSubjects, 'all'); this.showLoading = false; } })); @@ -182,51 +402,111 @@ export class SubjectsComponent { })); } - private getDivContents() { - this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { - this.divContents = contents; - })); + public groupSubjects(subjects: string[], type: string) { + if(subjects.length === 0) { + return []; + } + if(type === 'all') { + subjects.sort((a, b) => a['value'].localeCompare(b['value'])); + this.indexAll = 0; + this.activeTab = 'all'; + this.groupedAllSubjects = Object.values( + subjects.reduce((acc, subject) => { + let firstLetter = subject['value'][0].toLocaleUpperCase(); + if(!acc[firstLetter]) { + acc[firstLetter] = {group: firstLetter, data: [subject]}; + } else { + acc[firstLetter].data.push(subject); + } + return acc; + },{}) + ) + if(subjects.length > 1) { + this.groupedAllSubjects.unshift({group: 'All', data: subjects}); + } + } + if(type === 'freeText') { + subjects.sort((a, b) => a.localeCompare(b)); + this.indexSubjects = 0; + this.activeTab = 'freeText'; + this.groupedSubjects = Object.values( + subjects.reduce((acc, subject) => { + let firstLetter = subject[0].toLocaleUpperCase(); + if(!acc[firstLetter]) { + acc[firstLetter] = {group: firstLetter, data: [subject]}; + } else { + acc[firstLetter].data.push(subject); + } + return acc; + },{}) + ) + if(subjects.length > 1) { + this.groupedSubjects.unshift({group: 'All', data: subjects}); + } + } + if(type === 'sdg') { + subjects.sort((a, b) => a.localeCompare(b)); + this.indexSdg = 0; + this.activeTab = 'sdg'; + this.groupedSdg = Object.values( + subjects.reduce((acc, subject) => { + let firstLetter = subject[0].toLocaleUpperCase(); + if(!acc[firstLetter]) { + acc[firstLetter] = {group: firstLetter, data: [subject]}; + } else { + acc[firstLetter].data.push(subject); + } + return acc; + },{}) + ) + if(subjects.length > 1) { + this.groupedSdg.unshift({group: 'All', data: subjects}); + } + } + if(type === 'fos') { + subjects.sort((a, b) => a.localeCompare(b)); + this.indexFos = 0; + this.activeTab = 'fos'; + this.groupedFos = Object.values( + subjects.reduce((acc, subject) => { + let key = subject.substring(0,2).toLocaleUpperCase(); + if(!acc[key]) { + acc[key] = {group: key, data: [subject]}; + } else { + acc[key].data.push(subject); + } + return acc; + },{}) + ) + if(subjects.length > 1) { + this.groupedFos.unshift({group: 'All', data: subjects}); + } + } } - // private sortSubjects(a, b) { + public changeDisplayedSubjects(i, group) { + this.subjectsColumns = []; + if(this.activeTab === 'all') { + this.indexAll = i; + } else if(this.activeTab === 'freeText') { + this.indexSubjects = i; + } else if(this.activeTab === 'sdg') { + this.indexSdg = i; + } else if(this.activeTab === 'fos') { + this.indexFos = i; + } + if(group.data.length > this.subjectsLimit && group.group != 'All') { + this.divideSubjects(group); + } + } - // } - - private groupSubjects() { - if(this.subjects.length === 0) { - return []; - } - this.groupedSubjects = Object.values( - this.subjects.reduce((acc, subject) => { - let firstLetter = subject[0].toLocaleUpperCase(); - if(!acc[firstLetter]) { - acc[firstLetter] = {group: firstLetter, data: [subject]}; - } else { - acc[firstLetter].data.push(subject); - } - return acc; - },{}) - ) - if(this.subjects.length > 1) { - this.groupedSubjects.unshift({group: 'All', data: this.subjects}); - } - } - - public changeDisplayedSubjects(i, group) { - this.subjectsColumns = []; - this.index = i; - if(group.data.length > this.subjectsLimit && group.group != 'All') { - this.divideSubjects(group); - } - } - - public divideSubjects(group) { - let columns = []; - for(let i = 0; i < (group.data.length / this.subjectsLimit); i++) { - columns.push(group.data.slice(i * this.subjectsLimit, ((i + 1) * this.subjectsLimit))); - } - this.subjectsColumns = columns; - } + public divideSubjects(group) { + let columns = []; + for(let i = 0; i < (group.data.length / this.subjectsLimit); i++) { + columns.push(group.data.slice(i * this.subjectsLimit, ((i + 1) * this.subjectsLimit))); + } + this.subjectsColumns = columns; + } private updateDescription(description: string) { this._meta.updateTag({content: description}, "name='description'");