[Trunk | Monitor Dashboard]: stakeholderCreator.ts: [Bug fix] When building a default Stakeholder, create Section in SubCategory before adding Indicators.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@58696 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Konstantina Galouni 2020-05-14 14:24:42 +00:00
parent 3bf624d4a2
commit de37f95bce
1 changed files with 9 additions and 1 deletions

View File

@ -5,7 +5,7 @@ export class StakeholderCreator {
static createFunderDefaultProfile(funder:Stakeholder):Stakeholder{ static createFunderDefaultProfile(funder:Stakeholder):Stakeholder{
// let funder:Stakeholder = new Stakeholder(null,"funder","dfid","Default Funder Profile","dfsn","default_funder",true,true, null); // let funder:Stakeholder = new Stakeholder(null,"funder","dfid","Default Funder Profile","dfsn","default_funder",true,true, null);
funder['isDefault'] = true; funder['defaultId'] = null;
funder.topics.push(StakeholderCreator.createResearchProductionTopic(funder)); funder.topics.push(StakeholderCreator.createResearchProductionTopic(funder));
funder.topics.push(StakeholderCreator.createOSTopic(funder)); funder.topics.push(StakeholderCreator.createOSTopic(funder));
let collaboration = new Topic("Collaboration","Indexes for collaboration","collaboration", true, true); let collaboration = new Topic("Collaboration","Indexes for collaboration","collaboration", true, true);
@ -23,6 +23,7 @@ export class StakeholderCreator {
impact.categories.push(this.createEmptyCategory("Societal Impact","Indicators that correlate research results with SDGs","societal-impact")); impact.categories.push(this.createEmptyCategory("Societal Impact","Indicators that correlate research results with SDGs","societal-impact"));
funder.topics.push(impact); funder.topics.push(impact);
console.log(funder);
return funder; return funder;
} }
@ -116,6 +117,7 @@ export class StakeholderCreator {
pubDefSub.recommendedFor.push("ec__________::EC"); pubDefSub.recommendedFor.push("ec__________::EC");
} }
if(index==0) { if(index==0) {
pubDefSub.numbers.push(new Section("number", null, null, stakeholder.alias));
let n_total = new Indicator("Total " + typePlural, null, "number", "small", true, true, [new IndicatorPath(null, "search", let n_total = new Indicator("Total " + typePlural, null, "number", "small", true, true, [new IndicatorPath(null, "search",
"/" + dbTypePlural + "/count?fq=" + (encodeURIComponent("relfunderid exact index_id")) + "&format=json", null, ["total"])]); "/" + dbTypePlural + "/count?fq=" + (encodeURIComponent("relfunderid exact index_id")) + "&format=json", null, ["total"])]);
n_total.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact " + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix; n_total.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact " + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix;
@ -129,6 +131,8 @@ export class StakeholderCreator {
pubDefSub.numbers[0].indicators.push(n_linkedPubs); pubDefSub.numbers[0].indicators.push(n_linkedPubs);
} }
pubDefSub.charts.push(new Section("chart", null, null, stakeholder.alias));
let res_timeline = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("column", "stats-tool", "chart?json=", '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"select":[{"field":"'+dbType+'","aggregate":"count"},{"field":"'+dbType+'.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"'+dbType+'.project.funder","type":"=","values":["'+ChartHelper.prefix+'index_name'+ChartHelper.suffix+'"]}],"op":"AND"},{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]},{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}'+fundingFilter[index]+'],"entity":"'+dbType+'","profile":"OpenAIRE All-inclusive","limit":"0"}}],"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":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"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)]); let res_timeline = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("column", "stats-tool", "chart?json=", '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"select":[{"field":"'+dbType+'","aggregate":"count"},{"field":"'+dbType+'.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"'+dbType+'.project.funder","type":"=","values":["'+ChartHelper.prefix+'index_name'+ChartHelper.suffix+'"]}],"op":"AND"},{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]},{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}'+fundingFilter[index]+'],"entity":"'+dbType+'","profile":"OpenAIRE All-inclusive","limit":"0"}}],"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":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"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_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,chartTitle[index] + typePlural+" timeline","column"); res_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,chartTitle[index] + typePlural+" timeline","column");
res_timeline.indicatorPaths[0].parameters["start_year"] = (index == 1?"2014":"2008"); res_timeline.indicatorPaths[0].parameters["start_year"] = (index == 1?"2014":"2008");
@ -230,6 +234,7 @@ export class StakeholderCreator {
} }
static createOASub(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory { static createOASub(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
let sub:SubCategory = new SubCategory(typePlural, null, dbTypePlural, true, true); let sub:SubCategory = new SubCategory(typePlural, null, dbTypePlural, true, true);
sub.charts.push(new Section("chart", null, null, stakeholder.alias));
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, 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, 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, 2 ));
@ -342,6 +347,7 @@ export class StakeholderCreator {
static createOSOverviewPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory { static createOSOverviewPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
let pubDefSub = new SubCategory(typePlural, null, dbTypePlural, true, true); let pubDefSub = new SubCategory(typePlural, null, dbTypePlural, true, true);
pubDefSub.numbers.push(new Section("number", null, null, stakeholder.alias));
if( dbType != "publication") { if( dbType != "publication") {
pubDefSub.numbers[0].indicators.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication")); pubDefSub.numbers[0].indicators.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication"));
@ -413,6 +419,8 @@ export class StakeholderCreator {
let category2:Category = new Category("Category 2 - no subcategories","","cat-2",true,true); let category2:Category = new Category("Category 2 - no subcategories","","cat-2",true,true);
topic.categories.push(category2); topic.categories.push(category2);
let defSub = new SubCategory(null, null,null,true, true); let defSub = new SubCategory(null, null,null,true, true);
//defSub.charts.push(new Section("chart", null, null, stakeholder.alias));
category2.subCategories.push(defSub); category2.subCategories.push(defSub);
let chart1 = new Indicator( let chart1 = new Indicator(