From 3b8075b6b92bc02ab1719744439ecf630b447696 Mon Sep 17 00:00:00 2001 From: Argiro Kokogiannaki Date: Fri, 10 Jan 2020 13:31:53 +0000 Subject: [PATCH] [Monitor Dashboard|Trunk] StakeholderCreator: Update method StakeholderCreator.updateECProfile with proper values update method that creates default profile to add only common things Monitor Component: update section layout git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57967 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../manageStakeholders.component.ts | 2 +- src/app/monitor/monitor.component.html | 14 ++--- src/app/monitor/monitor.component.ts | 2 - src/app/utils/entities/stakeholderCreator.ts | 52 +++++++++++++------ src/app/utils/indicator-utils.ts | 1 - 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/src/app/manageStakeholders/manageStakeholders.component.ts b/src/app/manageStakeholders/manageStakeholders.component.ts index d7934a7..45baa89 100644 --- a/src/app/manageStakeholders/manageStakeholders.component.ts +++ b/src/app/manageStakeholders/manageStakeholders.component.ts @@ -215,7 +215,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy { /* this.stakeholderFb.setValue(this.stakeholderUtils.createFunderFromDefaultProfile(this.stakeholderFb.value, StakeholderCreator.createFunderDefaultProfile().topics));*/ } else { - this.stakeholderFb.setValue(StakeholderCreator.createFunderDefaultProfile()); + this.stakeholderFb.setValue(StakeholderCreator.createFunderDefaultProfile(this.stakeholderFb.value)); } this.stakeholderService.buildStakeholder(this.properties.monitorServiceAPIURL, this.stakeholderFb.value).subscribe(stakeholder => { if (stakeholder.defaultId === null) { diff --git a/src/app/monitor/monitor.component.html b/src/app/monitor/monitor.component.html index 81c7f9c..61afe38 100644 --- a/src/app/monitor/monitor.component.html +++ b/src/app/monitor/monitor.component.html @@ -125,17 +125,19 @@ -
- -

{{chart.title}}

+
+
+ +

{{chart.title}}

-

+

{{indicator.name + " "}}

@@ -161,7 +163,7 @@
- +
diff --git a/src/app/monitor/monitor.component.ts b/src/app/monitor/monitor.component.ts index 967beb4..ce08b27 100644 --- a/src/app/monitor/monitor.component.ts +++ b/src/app/monitor/monitor.component.ts @@ -116,8 +116,6 @@ export class MonitorComponent implements OnInit, OnDestroy, IDeactivateComponent // stakeholder.logoUrl = "./assets/ec.png"; // } if (stakeholder) { - console.info(stakeholder); - // StakeholderCreator.updateECProfile(stakeholder); this.stakeholder = stakeholder; console.info(this.stakeholder); diff --git a/src/app/utils/entities/stakeholderCreator.ts b/src/app/utils/entities/stakeholderCreator.ts index 249395c..64b7118 100644 --- a/src/app/utils/entities/stakeholderCreator.ts +++ b/src/app/utils/entities/stakeholderCreator.ts @@ -1,10 +1,10 @@ -import {Stakeholder,Topic,Category,SubCategory,Indicator, IndicatorPath, ChartHelper} from "./stakeholder"; +import {Stakeholder, Topic, Category, SubCategory, Indicator, IndicatorPath, ChartHelper, Section} from "./stakeholder"; import {IndicatorUtils} from "../indicator-utils"; export class StakeholderCreator { - static createFunderDefaultProfile():Stakeholder{ - let funder:Stakeholder = new Stakeholder(null,"funder","dfid","Default Funder Profile","dfsn","default_funder",true,true, null); + static createFunderDefaultProfile(funder:Stakeholder):Stakeholder{ + // let funder:Stakeholder = new Stakeholder(null,"funder","dfid","Default Funder Profile","dfsn","default_funder",true,true, null); funder['isDefault'] = true; funder.topics.push(StakeholderCreator.createResearchProductionTopic(funder)); funder.topics.push(StakeholderCreator.createOSTopic(funder)); @@ -40,6 +40,26 @@ export class StakeholderCreator { funder.topics[0].categories[3].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Other research products", "Other research product","other", "other",1)); funder.topics[0].categories[3].subCategories.push(StakeholderCreator.createResearchProductionPerType(funder,"Other research products", "Other research product","other", "other",2)); + + funder.topics[1].categories[0].subCategories[0].charts.push(new Section("chart","FP7 Section" )); + funder.topics[1].categories[0].subCategories[0].charts[1].indicators = this.createOAPerType(funder,"Publications","Publication","publication","publications", 1 ); + funder.topics[1].categories[0].subCategories[0].charts.push(new Section("chart","H2020" )); + funder.topics[1].categories[0].subCategories[0].charts[2].indicators = this.createOAPerType(funder,"Publications","Publication","publication","publications", 2 ); + + funder.topics[1].categories[0].subCategories[1].charts.push(new Section("chart","FP7 Section" )); + funder.topics[1].categories[0].subCategories[1].charts[1].indicators = this.createOAPerType(funder,"Research data", "Research data","dataset", "datasets", 1 ); + funder.topics[1].categories[0].subCategories[1].charts.push(new Section("chart","H2020" )); + funder.topics[1].categories[0].subCategories[1].charts[2].indicators = this.createOAPerType(funder,"Research data", "Research data","dataset", "datasets", 2 ); + + funder.topics[1].categories[0].subCategories[2].charts.push(new Section("chart","FP7 Section" )); + funder.topics[1].categories[0].subCategories[2].charts[1].indicators = this.createOAPerType(funder,"Software", "Software","software", "software", 1 ); + funder.topics[1].categories[0].subCategories[2].charts.push(new Section("chart","H2020" )); + funder.topics[1].categories[0].subCategories[2].charts[2].indicators = this.createOAPerType(funder,"Software", "Software","software", "software", 2 ); + + funder.topics[1].categories[0].subCategories[3].charts.push(new Section("chart","FP7 Section" )); + funder.topics[1].categories[0].subCategories[3].charts[1].indicators = this.createOAPerType(funder,"Other research products", "Other research product","other", "other", 1 ); + funder.topics[1].categories[0].subCategories[3].charts.push(new Section("chart","H2020" )); + funder.topics[1].categories[0].subCategories[3].charts[2].indicators = this.createOAPerType(funder,"Other research products", "Other research product","other", "other", 2 ); return funder; } @@ -61,25 +81,25 @@ export class StakeholderCreator { topic.categories.push(pubCategory); // let pubDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications"); pubCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications",0)); - pubCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications",1)); - pubCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications",2)); + // pubCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications",1)); + // pubCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications",2)); let dataCategory:Category = new Category("Research data","","data",true,true); topic.categories.push(dataCategory); dataCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets",0)); - dataCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets",1)); - dataCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets",2)); + // dataCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets",1)); + // dataCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets",2)); let softwareCategory:Category = new Category("Software","","software",true,true); topic.categories.push(softwareCategory); softwareCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "software",0)); - softwareCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "software",1)); - softwareCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "software",2)); + // softwareCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "software",1)); + // softwareCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "software",2)); let otherCategory:Category = new Category("Other research products","","other",true,true); topic.categories.push(otherCategory); otherCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other",0)); - otherCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other",1)); - otherCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other",2)); + // otherCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other",1)); + // otherCategory.subCategories.push(StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other",2)); return topic; @@ -133,7 +153,7 @@ export class StakeholderCreator { pubDefSub.charts[0].indicators.push(res_access_mode); - let res_sci_area = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=", +/* let res_sci_area = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=", '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funder","type":"=","values":["' + ChartHelper.prefix + 'index_name' + ChartHelper.suffix + '"]}],"op":"AND"}'+fundingFilter[index]+'],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Scientific area"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); res_sci_area.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " scientific area", "bar"); res_sci_area.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType); @@ -145,7 +165,7 @@ export class StakeholderCreator { res_programmes.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, chartTitle[index] + typeSingl + " programmes", "bar"); res_programmes.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType); res_programmes.recommendedFor = ["ec__________::EC"]; - pubDefSub.charts[0].indicators.push(res_programmes); + pubDefSub.charts[0].indicators.push(res_programmes);*/ //{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research Data","type":"bar","query":{"select":[{"field":"dataset","aggregate":"count"},{"field":"dataset.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"dataset.project.funder","type":"=","values":["European Commission"]}],"op":"AND"}],"entity":"dataset","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Scientific Area"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}} let datasource = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("bar", "stats-tool", "chart?json=", @@ -211,8 +231,8 @@ export class StakeholderCreator { static createOASub(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory { let sub:SubCategory = new SubCategory(typePlural, null, dbTypePlural, true, true); sub.charts[0].indicators = sub.charts[0].indicators.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 0 )); - sub.charts[0].indicators = sub.charts[0].indicators.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 1 )); - sub.charts[0].indicators = sub.charts[0].indicators.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 2 )); + // sub.charts[0].indicators = sub.charts[0].indicators.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 1 )); + // sub.charts[0].indicators = sub.charts[0].indicators.concat( this.createOAPerType(stakeholder,typePlural, typeSingl, dbType, dbTypePlural, 2 )); return sub; } static createOAPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural, index:number):Indicator[] { @@ -227,7 +247,7 @@ export class StakeholderCreator { let open_non_url = "http://88.197.53.71:8080/stats-api/chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"pie","color":"#e62020ee","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.oavsnonoa"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+chartTitle[index]+' Open Access vs Non Open Access"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'); encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Data","type":"pie","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix +(index==2?".h2020":(index==1?".fp7":""))+ '.' + dbTypePlural+'.greenvsgold"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'); - let open_non_ind:Indicator = new Indicator(chartTitle[index]+" Overview", "", "chart", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", open_non_url, "pie",stakeholder)]) + let open_non_ind:Indicator = new Indicator("", "", "chart", "small", true, true, [utils.generateIndicatorByChartUrl("stats-tool", open_non_url, "pie",stakeholder)]) open_non_ind.indicatorPaths[0].parameters["index_id"] = stakeholder.index_shortName.toLowerCase(); if(index!=0){ open_non_ind.recommendedFor.push("ec__________::EC"); diff --git a/src/app/utils/indicator-utils.ts b/src/app/utils/indicator-utils.ts index f19ab39..df7ebd8 100644 --- a/src/app/utils/indicator-utils.ts +++ b/src/app/utils/indicator-utils.ts @@ -36,7 +36,6 @@ export class StakeholderUtils { isActiveIcon: string = 'brightness_1'; public createFunderFromDefaultProfile(funder: Stakeholder, defaultTopics: Topic[]): Stakeholder { - console.log(funder); funder.topics = defaultTopics; for (let topic of funder.topics) { // console.log('id:' + topic._id);