-
+
-
diff --git a/src/app/topic/topic.component.ts b/src/app/topic/topic.component.ts
index a9a7cd4..6c140e1 100644
--- a/src/app/topic/topic.component.ts
+++ b/src/app/topic/topic.component.ts
@@ -112,8 +112,12 @@ export class TopicComponent implements OnInit, OnDestroy {
if(!this.topic.alias) {
this.topic.alias = this.topic.name.toLowerCase().trim();
}
- this.stakeholder.topics[this.topicIndex] = HelperFunctions.copy(this.topic);
- this.save('Topic has been successfully saved', element, true);
+ let path = [this.stakeholder._id];
+ let callback = (topic: Topic): void => {
+ this.stakeholder.topics[this.topicIndex] = topic;
+ this.stakeholderService.setStakeholder(this.stakeholder);
+ };
+ this.save('Topic has been successfully saved', element, path, this.topic, callback,true);
} else {
this.valid = false;
}
@@ -125,10 +129,14 @@ export class TopicComponent implements OnInit, OnDestroy {
public deleteTopic() {
let path: string[] = [
- this.stakeholder.alias,
- this.stakeholder.topics[this.topicIndex].alias
+ this.stakeholder._id,
+ this.stakeholder.topics[this.topicIndex]._id
];
- this.delete('Topic has been successfully be deleted', path, true);
+ let callback = (): void => {
+ this.stakeholder.topics.splice(this.topicIndex, 1);
+ this.stakeholderService.setStakeholder(this.stakeholder);
+ };
+ this.delete('Topic has been successfully be deleted', path, callback, true);
}
public toggleCategory(index: number) {
@@ -158,19 +166,19 @@ export class TopicComponent implements OnInit, OnDestroy {
if(!this.copyCategory.alias) {
this.copyCategory.alias = this.copyCategory.name.toLowerCase();
}
+ let path = [this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id];
+ let callback = (category: Category): void => {
+ if(index === -1) {
+ this.stakeholder.topics[this.topicIndex].categories.push(category);
+ } else {
+ this.stakeholder.topics[this.topicIndex].categories[index] = HelperFunctions.copy(category);
+ }
+ this.stakeholderService.setStakeholder(this.stakeholder);
+ };
if(index === -1) {
- this.copyCategory.subCategories.push(
- new SubCategory(this.copyCategory.name,
- this.copyCategory.description,
- this.copyCategory.alias,
- this.copyCategory.isPublic,
- this.copyCategory.isActive)
- );
- this.stakeholder.topics[this.topicIndex].categories.push(this.copyCategory);
- this.save('Category has been successfully created', element);
+ this.save('Category has been successfully created', element, path, this.copyCategory, callback);
} else {
- this.stakeholder.topics[this.topicIndex].categories[index] = HelperFunctions.copy(this.copyCategory);
- this.save('Category has been successfully saved', element);
+ this.save('Category has been successfully saved', element, path, this.copyCategory, callback);
}
} else {
this.valid = false;
@@ -183,11 +191,15 @@ export class TopicComponent implements OnInit, OnDestroy {
public deleteCategory() {
let path: string[] = [
- this.stakeholder.alias,
- this.stakeholder.topics[this.topicIndex].alias,
- this.stakeholder.topics[this.topicIndex].categories[this.index].alias
+ this.stakeholder._id,
+ this.stakeholder.topics[this.topicIndex]._id,
+ this.stakeholder.topics[this.topicIndex].categories[this.index]._id
];
- this.delete('Category has been successfully be deleted', path);
+ let callback = (): void => {
+ this.stakeholder.topics[this.topicIndex].categories.splice(this.index, 1);
+ this.stakeholderService.setStakeholder(this.stakeholder);
+ };
+ this.delete('Category has been successfully be deleted', path, callback);
}
public editSubCategoryOpen(element, index:number = -1) {
@@ -209,14 +221,25 @@ export class TopicComponent implements OnInit, OnDestroy {
if(!this.copySubCategory.alias) {
this.copySubCategory.alias = this.copySubCategory.name.toLowerCase();
}
+ let path: string[] = [
+ this.stakeholder._id,
+ this.stakeholder.topics[this.topicIndex]._id,
+ this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex]._id,
+ ];
+ let callback = (subCategory: SubCategory): void => {
+ if(index === -1) {
+ this.stakeholder.topics[this.topicIndex].
+ categories[this.selectedCategoryIndex].subCategories.push(subCategory);
+ } else {
+ this.stakeholder.topics[this.topicIndex].
+ categories[this.selectedCategoryIndex].subCategories[index] = subCategory;
+ }
+ this.stakeholderService.setStakeholder(this.stakeholder);
+ };
if(index === -1) {
- this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].
- subCategories.push(this.copySubCategory);
- this.save('Subcategory has been successfully created', element);
+ this.save('Subcategory has been successfully created', element, path, this.copySubCategory, callback);
} else {
- this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].
- subCategories[index] = HelperFunctions.copy(this.copySubCategory);
- this.save('Subcategory has been successfully saved', element);
+ this.save('Subcategory has been successfully saved', element, path, this.copySubCategory, callback);
}
this.hide(element);
} else {
@@ -230,12 +253,17 @@ export class TopicComponent implements OnInit, OnDestroy {
public deleteSubcategory() {
let path: string[] = [
- this.stakeholder.alias,
- this.stakeholder.topics[this.topicIndex].alias,
- this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].alias,
- this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index].alias
+ this.stakeholder._id,
+ this.stakeholder.topics[this.topicIndex]._id,
+ this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex]._id,
+ this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index]._id
];
- this.delete('Subcategory has been successfully be deleted', path);
+ let callback = (): void => {
+ this.stakeholder.topics[this.topicIndex].
+ categories[this.selectedCategoryIndex].subCategories.splice(this.index, 1);
+ this.stakeholderService.setStakeholder(this.stakeholder);
+ };
+ this.delete('Subcategory has been successfully be deleted', path, callback);
}
private navigateToError() {
@@ -252,16 +280,16 @@ export class TopicComponent implements OnInit, OnDestroy {
modal.open();
}
- private save(message: string, element, redirect = false) {
- this.stakeholderService.saveStakeholder(this.properties.monitorServiceAPIURL, this.stakeholder).subscribe(stakeholder => {
- this.stakeholderService.setStakeholder(stakeholder);
+ private save(message: string, element, path: string[], saveElement: any, callback: Function, redirect = false) {
+ this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, saveElement, path).subscribe(saveElement => {
+ callback(saveElement);
UIkit.notification(message, {
status: 'success',
timeout: 3000,
pos: 'top-left'
});
if(redirect) {
- this.router.navigate(['../' + this.topic.alias], {
+ this.router.navigate(['../' + saveElement.alias], {
relativeTo: this.route
});
}
@@ -276,9 +304,9 @@ export class TopicComponent implements OnInit, OnDestroy {
});
}
- private delete(message: string, path: string[], redirect = false) {
- this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(stakeholder => {
- this.stakeholderService.setStakeholder(stakeholder);
+ private delete(message: string, path: string[], callback: Function, redirect = false) {
+ this.stakeholderService.deleteElement(this.properties.monitorServiceAPIURL, path).subscribe(() => {
+ callback();
UIkit.notification(message, {
status: 'success',
timeout: 3000,
diff --git a/src/app/topic/topic.module.ts b/src/app/topic/topic.module.ts
index 797a1a7..2636199 100644
--- a/src/app/topic/topic.module.ts
+++ b/src/app/topic/topic.module.ts
@@ -12,10 +12,13 @@ import {RouterModule} from "@angular/router";
import {FormsModule, ReactiveFormsModule} from "@angular/forms";
import {IndicatorsComponent} from "./indicators.component";
import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module";
+import {InputModule} from "../library/sharedComponents/input/input.module";
+import {DragDropModule} from "@angular/cdk/drag-drop";
@NgModule({
imports: [
- CommonModule, TopicRoutingModule, ModalModule, RouterModule, FormsModule, AlertModalModule, ReactiveFormsModule
+ CommonModule, TopicRoutingModule, ModalModule, RouterModule, FormsModule, AlertModalModule,
+ ReactiveFormsModule, InputModule, DragDropModule
],
declarations: [
TopicComponent, IndicatorsComponent
diff --git a/src/app/utils/entities/stakeholder.ts b/src/app/utils/entities/stakeholder.ts
index 4ad28e1..fbe69f2 100644
--- a/src/app/utils/entities/stakeholder.ts
+++ b/src/app/utils/entities/stakeholder.ts
@@ -1,15 +1,17 @@
import {SafeResourceUrl} from "@angular/platform-browser";
import {IndicatorUtils} from "../indicator-utils";
-export const ChartHelper={
- prefix : "((__",
- suffix : "__))"
+
+export const ChartHelper = {
+ prefix: "((__",
+ suffix: "__))"
};
+
export class Stakeholder {
- id: string;
+ _id: string;
type: string;
index_id;
index_name: string;
- index_shortName:string;
+ index_shortName: string;
alias: string;
isDefaultProfile: boolean;
isActive: boolean;
@@ -17,14 +19,16 @@ export class Stakeholder {
creationDate: string;
updateDate: string;
managers: string[];
- topics:Topic[];
- constructor( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
- this.initializeFunder(id,type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic);
- this.topics =[];
- this.managers =[];
+ topics: Topic[];
+
+ constructor(id: string, type: string, index_id, index_name: string, index_shortName: string, isDefaultProfile: boolean, alias: string, isActive: boolean, isPublic: boolean) {
+ this.initializeFunder(id, type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic);
+ this.topics = [];
+ this.managers = [];
}
- initializeFunder( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
- this.id = id;
+
+ initializeFunder(id: string, type: string, index_id, index_name: string, index_shortName: string, isDefaultProfile: boolean, alias: string, isActive: boolean, isPublic: boolean) {
+ this._id = id;
this.type = type;
this.index_id = index_id;
this.index_name = index_name;
@@ -34,76 +38,77 @@ export class Stakeholder {
this.isActive = isActive;
this.isPublic = isPublic;
}
- static createECStakeholder():Stakeholder{
- let ec:Stakeholder = new Stakeholder("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
+
+ static createECStakeholder(): Stakeholder {
+ let ec: Stakeholder = new Stakeholder("ec", "funder", "ec__________::EC", "European Commission", "EC", false, "ec", true, true);
// new Stakeholder('wt','funder','wt__________::WT','Wellcome Trust','WT',false, 'wt',true,true);
ec.topics.push(ec.createOSTopic(ec));
ec.topics.push(ec.createImpactTopic());
ec.topics.push(ec.createCollaborationTopic());
return ec;
}
- createOSTopic(stakeholder:Stakeholder):Topic{
- let topic = new Topic("OpenScience","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
-/* let overview:Category = new Category("Overview","","overview",true,true);
- topic.categories.push(overview);
- let overviewDefSub = new SubCategory(null, null,null,true, true);
- overview.subCategories.push(overviewDefSub);*/
+ createOSTopic(stakeholder: Stakeholder): Topic {
+ let topic = new Topic("OpenScience", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "open-science", true, true);
+
+ /* let overview:Category = new Category("Overview","","overview",true,true);
+ topic.categories.push(overview);
+ let overviewDefSub = new SubCategory(null, null,null,true, true);
+ overview.subCategories.push(overviewDefSub);*/
-
- let pubCategory:Category = new Category("Publications","","publications",true,true);
+ let pubCategory: Category = new Category("Publications", "", "publications", true, true);
topic.categories.push(pubCategory);
- let pubDefSub = new SubCategory(null, null,null,true, true);
+ let pubDefSub = new SubCategory(null, null, null, true, true);
pubCategory.subCategories.push(pubDefSub);
-/* let pubOpenSub = new SubCategory("Openess","","openness",true,true);
- pubCategory.subCategories.push(pubOpenSub);
- let pubFundingSub = new SubCategory("Funding","","funding",true,true);
- pubCategory.subCategories.push(pubFundingSub);
- let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true);
- pubCategory.subCategories.push(pubDatasourceSub);
- let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true);
- pubCategory.subCategories.push(pubDocTypeSub);
- let pubFindSub = new SubCategory("Findability","","dindability",true,true);
- pubCategory.subCategories.push(pubFindSub);*/
+ /* let pubOpenSub = new SubCategory("Openess","","openness",true,true);
+ pubCategory.subCategories.push(pubOpenSub);
+ let pubFundingSub = new SubCategory("Funding","","funding",true,true);
+ pubCategory.subCategories.push(pubFundingSub);
+ let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true);
+ pubCategory.subCategories.push(pubDatasourceSub);
+ let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true);
+ pubCategory.subCategories.push(pubDocTypeSub);
+ let pubFindSub = new SubCategory("Findability","","dindability",true,true);
+ pubCategory.subCategories.push(pubFindSub);*/
- let dataCategory:Category = new Category("Research data","","data",true,true);
+ let dataCategory: Category = new Category("Research data", "", "data", true, true);
topic.categories.push(dataCategory);
- let dataDefSub = new SubCategory(null, null,null,true, true);
+ let dataDefSub = new SubCategory(null, null, null, true, true);
dataCategory.subCategories.push(dataDefSub);
- let softwareCategory:Category = new Category("Software","","software",true,true);
+ let softwareCategory: Category = new Category("Software", "", "software", true, true);
topic.categories.push(softwareCategory);
- let softDefSub = new SubCategory(null, null,null,true, true);
+ let softDefSub = new SubCategory(null, null, null, true, true);
softwareCategory.subCategories.push(softDefSub);
- let otherCategory:Category = new Category("Other research products","","other",true,true);
+ let otherCategory: Category = new Category("Other research products", "", "other", true, true);
topic.categories.push(otherCategory);
- let otherDefSub = new SubCategory(null, null,null,true, true);
+ let otherDefSub = new SubCategory(null, null, null, true, true);
otherCategory.subCategories.push(otherDefSub);
-/* let datasourceCategory:Category = new Category("Content Providers","","content-providers",true,true);
- topic.categories.push(datasourceCategory);
- let datasourceDefSub = new SubCategory(null, null,null,true, true);
- datasourceCategory.subCategories.push(datasourceDefSub);*/
+ /* let datasourceCategory:Category = new Category("Content Providers","","content-providers",true,true);
+ topic.categories.push(datasourceCategory);
+ let datasourceDefSub = new SubCategory(null, null,null,true, true);
+ datasourceCategory.subCategories.push(datasourceDefSub);*/
- let projectCategory:Category = new Category("Projects","","projects",true,true);
+ let projectCategory: Category = new Category("Projects", "", "projects", true, true);
topic.categories.push(projectCategory);
- let projectDefSub = new SubCategory(null, null,null,true, true);
+ let projectDefSub = new SubCategory(null, null, null, true, true);
projectCategory.subCategories.push(projectDefSub);
//Numbers
- let n_total_pubs = new Indicator("Publications",'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","publications"])]);
- let n_open_pubs = new Indicator("OA Publications",'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null,["statistics","open_access"])]);
- let n_total_projects = new Indicator("Projects",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","total_projects"])]);
- let n_total_data = new Indicator("Reserach data",null, "number","small",true, true, [new IndicatorPath(null, "search",
- "/datasets/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null, ["total"])]);
- let n_total_soft = new Indicator("Software",null, "number","small",true, true, [new IndicatorPath(null, "search",
- "/software/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
- let n_total_other = new Indicator("Other research products",null, "number","small",true, true, [new IndicatorPath(null, "search",
- "/other/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
+ let n_total_pubs = new Indicator("Publications", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "publications"])]);
+ let n_open_pubs = new Indicator("OA Publications", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "open_access"])]);
+ let n_total_projects = new Indicator("Projects", null, "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "total_projects"])]);
+ let n_total_data = new Indicator("Reserach data", null, "number", "small", true, true, [new IndicatorPath(null, "search",
+ "/datasets/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
+ let n_total_soft = new Indicator("Software", null, "number", "small", true, true, [new IndicatorPath(null, "search",
+ "/software/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
+ let n_total_other = new Indicator("Other research products", null, "number", "small", true, true, [new IndicatorPath(null, "search",
+ "/other/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
/*overviewDefSub.numbers.push(n_total_pubs);
overviewDefSub.numbers.push(n_open_pubs);
@@ -122,9 +127,9 @@ export class Stakeholder {
//Charts
- let c_pubs_per_project = new Indicator("Which are the top "+stakeholder.index_shortName+" projects?",'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "chart","large",true, true, [
- new IndicatorPath("bar", "old","chart.php?com=query&data=",'{"table":"result","fields":[{"fld":"number","agg":"count","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","yaxis":1,"c":false}],"xaxis":{"name":"result_projects-project-acronym","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"count-number","yaxisheaders":[""],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"result_projects-project-funder","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"}],"having":[],"xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"title":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'","subtitle":"","xaxistitle":"project","order":"d"}', null )]);
- c_pubs_per_project.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,"Publications per project (top 30)","bar");
+ let c_pubs_per_project = new Indicator("Which are the top " + stakeholder.index_shortName + " projects?", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "chart", "large", true, true, [
+ new IndicatorPath("bar", "old", "chart.php?com=query&data=", '{"table":"result","fields":[{"fld":"number","agg":"count","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","yaxis":1,"c":false}],"xaxis":{"name":"result_projects-project-acronym","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"count-number","yaxisheaders":[""],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"result_projects-project-funder","values":["' + ChartHelper.prefix + 'funder_name' + ChartHelper.suffix + '"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"}],"having":[],"xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"title":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '","subtitle":"","xaxistitle":"project","order":"d"}', null)]);
+ c_pubs_per_project.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, "Publications per project (top 30)", "bar");
pubDefSub.charts.push(c_pubs_per_project);
//TO check
@@ -140,11 +145,11 @@ export class Stakeholder {
true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Open Access","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Total","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.type","type":"=","values":["publication"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"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)]);
pubDefSub.charts.push(c_pubs_funding_scheme);
*/
- /* //TODO check why doesn't load
- let c_pubs_gg_funding_scheme = new Indicator("What is the percentage of green and gold publications by funding scheme / programme?",null, "chart","medium",true,
- true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Gold","color":"#f8b500","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},,{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Journal"]},{"field":"result.datasource.type","type":"=","values":["Journal Aggregator/Publisher"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Green","color":"#239d60","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Institutional Repository"]},{"field":"result.datasource.type","type":"=","values":["Thematic Repository"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"H2020 green and gold publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"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)]);
- //pubDefSub.charts.push(c_pubs_gg_funding_scheme);
- */
+ /* //TODO check why doesn't load
+ let c_pubs_gg_funding_scheme = new Indicator("What is the percentage of green and gold publications by funding scheme / programme?",null, "chart","medium",true,
+ true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Gold","color":"#f8b500","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},,{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Journal"]},{"field":"result.datasource.type","type":"=","values":["Journal Aggregator/Publisher"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Green","color":"#239d60","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Institutional Repository"]},{"field":"result.datasource.type","type":"=","values":["Thematic Repository"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"H2020 green and gold publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"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)]);
+ //pubDefSub.charts.push(c_pubs_gg_funding_scheme);
+ */
/* let c_pubs_open = new Indicator("Open Access publications timeline",null, "chart","small",true, true,
[new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.year","type":">=","values":["2000"]},{"field":"publication.year","type":"<=","values":["2019"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Open Access Publications"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"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)]);
@@ -209,57 +214,58 @@ export class Stakeholder {
return topic;
}
- createImpactTopic():Topic{
- let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true);
- let pubCategory:Category = new Category("Publications","","publications",true,true);
+ createImpactTopic(): Topic {
+ let topic = new Topic("Impact/Correlation", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "impact", true, true);
+
+ let pubCategory: Category = new Category("Publications", "", "publications", true, true);
topic.categories.push(pubCategory);
- let pubDefSub = new SubCategory(null, null,null,true, true);
+ let pubDefSub = new SubCategory(null, null, null, true, true);
pubCategory.subCategories.push(pubDefSub);
- let dataCategory:Category = new Category("Research data","","data",true,true);
+ let dataCategory: Category = new Category("Research data", "", "data", true, true);
topic.categories.push(dataCategory);
- let dataDefSub = new SubCategory(null, null,null,true, true);
+ let dataDefSub = new SubCategory(null, null, null, true, true);
dataCategory.subCategories.push(dataDefSub);
- let softwareCategory:Category = new Category("Software","","software",true,true);
+ let softwareCategory: Category = new Category("Software", "", "software", true, true);
topic.categories.push(softwareCategory);
- let softDefSub = new SubCategory(null, null,null,true, true);
+ let softDefSub = new SubCategory(null, null, null, true, true);
softwareCategory.subCategories.push(softDefSub);
- /* let otherCategory:Category = new Category("Other research products","","other",true,true);
- topic.categories.push(otherCategory);
- let otherDefSub = new SubCategory(null, null,null,true, true);
- otherCategory.subCategories.push(otherDefSub);*/
+ /* let otherCategory:Category = new Category("Other research products","","other",true,true);
+ topic.categories.push(otherCategory);
+ let otherDefSub = new SubCategory(null, null,null,true, true);
+ otherCategory.subCategories.push(otherDefSub);*/
return topic;
}
- createCollaborationTopic():Topic{
- let topic = new Topic("Demo Topic","This is a demo topic","demo-topic",true,true);
- let category1:Category = new Category("Category 1","This is ","cat-1",true,true);
+ createCollaborationTopic(): Topic {
+ let topic = new Topic("Demo Topic", "This is a demo topic", "demo-topic", true, true);
+
+ let category1: Category = new Category("Category 1", "This is ", "cat-1", true, true);
topic.categories.push(category1);
- let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true);
+ let subCat1 = new SubCategory("Sub-category 1", "", "sub-cat-1", true, true);
category1.subCategories.push(subCat1);
- let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true);
+ let subCat2 = new SubCategory("Sub-category 2", "", "sub-cat-2", true, true);
category1.subCategories.push(subCat2);
-
- 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);
- let defSub = new SubCategory(null, null,null,true, true);
+ let defSub = new SubCategory(null, null, null, true, true);
category2.subCategories.push(defSub);
let chart1 = new Indicator(
- "Chart title goes here","Chart description goes here", "chart","medium",true, true,
- [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null, null)]);
- let chart2 = new Indicator("Chart title goes here","Chart description goes here", "chart","medium",true, true, [new IndicatorPath("?", "fake","https://static.boredpanda.com/blog/wp-content/uuuploads/funny-graphs-2/funny-graphs-legs.jpg", null, null)]);
+ "Chart title goes here", "Chart description goes here", "chart", "medium", true, true,
+ [new IndicatorPath("?", "fake", "https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null, null)]);
+ let chart2 = new Indicator("Chart title goes here", "Chart description goes here", "chart", "medium", true, true, [new IndicatorPath("?", "fake", "https://static.boredpanda.com/blog/wp-content/uuuploads/funny-graphs-2/funny-graphs-legs.jpg", null, null)]);
subCat1.charts.push(chart1);
subCat2.charts.push(chart2);
@@ -267,15 +273,15 @@ export class Stakeholder {
defSub.charts.push(chart2);
let utils = new IndicatorUtils();
let url = "https://beta.openaire.eu/stats/chart.php?com=query&data={%22table%22:%22result%22,%22fields%22:[{%22fld%22:%22number%22,%22agg%22:%22count%22,%22type%22:%22bar%22,%22yaxis%22:1,%22c%22:false}],%22xaxis%22:{%22name%22:%22result_datasources-datasource-name%22,%22agg%22:%22avg%22},%22group%22:%22%22,%22color%22:%22%22,%22type%22:%22chart%22,%22size%22:%2220%22,%22sort%22:%22count-number%22,%22yaxisheaders%22:[%22%22],%22fieldsheaders%22:[%22publications%22],%22in%22:[],%22filters%22:[{%22name%22:%22result_projects-project-funding_lvl0%22,%22values%22:[%22H2020%22],%22to%22:%22-1%22},{%22name%22:%22type%22,%22values%22:[%22publication%22],%22to%22:%22-1%22},{%22name%22:%22result_datasources-datasource-type%22,%22exvalues%22:[%22Publication%20Catalogue%22]}],%22having%22:[],%22xStyle%22:{%22r%22:%22-%22,%22s%22:%22-%22,%22l%22:%22-%22,%22ft%22:%22-%22,%22wt%22:%22-%22},%22title%22:%22H2020%20Publications%20by%20datasource%20%28top%2020%29%22,%22subtitle%22:%22%22,%22xaxistitle%22:%22datasource%22,%22order%22:%22d%22}&w=90%";
- defSub.charts.push(new Indicator("Old tool graph","","chart","large",true,true,[utils.generateIndicatorByChartUrl("old",url,"bar")]))
+ defSub.charts.push(new Indicator("Old tool graph", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("old", url, "bar")]))
url = "http://88.197.53.71:8080/stats-api/chart?json=%7B%22library%22%3A%22HighCharts%22%2C%22chartDescription%22%3A%7B%22queries%22%3A%5B%7B%22name%22%3A%22Research%20data%22%2C%22type%22%3A%22column%22%2C%22query%22%3A%7B%22select%22%3A%5B%7B%22field%22%3A%22dataset%22%2C%22aggregate%22%3A%22count%22%7D%2C%7B%22field%22%3A%22dataset.year%22%2C%22aggregate%22%3Anull%7D%5D%2C%22filters%22%3A%5B%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22dataset.project.funder%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22European%20Commission%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%2C%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22dataset.year%22%2C%22type%22%3A%22%3E%3D%22%2C%22values%22%3A%5B%222008%22%5D%7D%2C%7B%22field%22%3A%22dataset.year%22%2C%22type%22%3A%22%3C%3D%22%2C%22values%22%3A%5B%222020%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%5D%2C%22entity%22%3A%22dataset%22%2C%22profile%22%3A%22OpenAIRE%20All-inclusive%22%2C%22limit%22%3A%220%22%7D%7D%5D%2C%22chart%22%3A%7B%22backgroundColor%22%3A%22%23FFFFFFFF%22%2C%22borderColor%22%3A%22%23335cadff%22%2C%22borderRadius%22%3A0%2C%22borderWidth%22%3A0%2C%22plotBorderColor%22%3A%22%23ccccccff%22%2C%22plotBorderWidth%22%3A0%7D%2C%22title%22%3A%7B%22text%22%3A%22Research%20data%20timeline%22%7D%2C%22subtitle%22%3A%7B%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Research%20data%22%7D%7D%2C%22xAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Year%22%7D%7D%2C%22lang%22%3A%7B%22noData%22%3A%22No%20Data%20available%20for%20the%20Query%22%7D%2C%22exporting%22%3A%7B%22enabled%22%3Atrue%7D%2C%22plotOptions%22%3A%7B%22series%22%3A%7B%22dataLabels%22%3A%7B%22enabled%22%3Afalse%7D%7D%7D%2C%22legend%22%3A%7B%22enabled%22%3Atrue%2C%22align%22%3A%22center%22%2C%22verticalAlign%22%3A%22bottom%22%2C%22layout%22%3A%22horizontal%22%7D%2C%22credits%22%3A%7B%22href%22%3Anull%2C%22enabled%22%3Atrue%2C%22text%22%3A%22Created%20by%20OpenAIRE%20via%20HighCharts%22%7D%7D%7D";
- defSub.charts.push(new Indicator("","","chart","large",true,true,[utils.generateIndicatorByChartUrl("stats-tool",url,"bar")]))
+ defSub.charts.push(new Indicator("", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("stats-tool", url, "bar")]))
return topic;
}
}
export class Topic {
- id:string;
+ _id: string;
name: string;
alias: string;
description: string;
@@ -283,9 +289,10 @@ export class Topic {
isPublic: boolean;
isDefault: boolean;
categories: Category[];
- constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
- this.id = null;
- this.name = name;
+
+ constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
+ this._id = null;
+ this.name = name;
this.description = description;
this.alias = alias;
this.isActive = isActive;
@@ -293,8 +300,9 @@ export class Topic {
this.categories = [];
}
}
+
export class Category {
- id:string;
+ _id: string;
name: string;
alias: string;
description: string;
@@ -303,9 +311,10 @@ export class Category {
isOverview: boolean;
isDefault: boolean;
subCategories: SubCategory[];
- constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
- this.id = null;
- this.name = name;
+
+ constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
+ this._id = null;
+ this.name = name;
this.description = description;
this.alias = alias;
this.isActive = isActive;
@@ -315,7 +324,7 @@ export class Category {
}
export class SubCategory {
- id:string;
+ _id: string;
name: string;
alias: string;
description: string;
@@ -324,9 +333,10 @@ export class SubCategory {
isDefault: boolean;
charts: Indicator[];
numbers: Indicator[];
- constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
- this.id = null;
- this.name = name;
+
+ constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
+ this._id = null;
+ this.name = name;
this.description = description;
this.alias = alias;
this.isActive = isActive;
@@ -336,22 +346,24 @@ export class SubCategory {
}
}
+
export class Indicator {
- id:string;
+ _id: string;
name: string;
description: string;
- type:string; //number,chart
- width:string; //small,medium,large
- tags:string[];
+ type: string; //number,chart
+ width: string; //small,medium,large
+ tags: string[];
isActive: boolean;
isPublic: boolean;
isDefault: boolean;
- indicatorPaths:IndicatorPath[];
- constructor(name: string, description: string, type:string , width:string, isActive: boolean, isPublic: boolean, indicatorPaths:IndicatorPath[]){
- this.id = null;
- this.name = name;
+ indicatorPaths: IndicatorPath[];
+
+ constructor(name: string, description: string, type: string, width: string, isActive: boolean, isPublic: boolean, indicatorPaths: IndicatorPath[]) {
+ this._id = null;
+ this.name = name;
this.description = description;
- this.type = type;
+ this.type = type;
this.width = width;
this.isActive = isActive;
this.isPublic = isPublic;
@@ -362,35 +374,37 @@ export class Indicator {
export class IndicatorPath {
type: string; // for charts is type of chart {table, bar, column, etc}
- source:string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
+ source: string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
url: string;
safeResourceUrl: SafeResourceUrl; // initialize on front end
- jsonPath:string[];
- chartObject:string;
- parameters:Map
;
- filters:Map;
- constructor(type: string, source:string, url: string, chartObject:string, jsonPath:string[]){
- this.type = type;
+ jsonPath: string[];
+ chartObject: string;
+ parameters: any;
+ filters: any;
+
+ constructor(type: string, source: string, url: string, chartObject: string, jsonPath: string[]) {
+ this.type = type;
this.url = url;
this.source = source;
this.jsonPath = jsonPath;
- this.chartObject =chartObject;
- this.parameters = new Map();
- this.filters = new Map();
+ this.chartObject = chartObject;
+ this.parameters = {};
+ this.filters = {};
}
- static createParameters(funderName:string=null, title:string=null, chartType:string=null):Map{
- let parameters = new Map();
- parameters.set("funder_name",funderName);
- parameters.set("title",title);
- parameters.set("type",chartType);
- return parameters;
+ static createParameters(funderName: string = null, title: string = null, chartType: string = null): any {
+ return {
+ funder_name: funderName,
+ title: title,
+ type: chartType
+ };
}
- static createResultFilters(dbType:string=null):Map{
- let filters = new Map();
- filters.set("fundingL0",'{"groupFilters":[{"field":"'+dbType+'.project.funding level 0","type":"=","values":["'+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix+'"]}],"op":"AND"}');
- filters.set("start_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
- filters.set("end_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
- return filters;
+
+ static createResultFilters(dbType: string = null): any {
+ return {
+ fundingL0: '{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["' + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix + '"]}],"op":"AND"}',
+ start_year: '{"groupFilters":[{"field":"' + dbType + '.year","type":">=","values":["' + ChartHelper.prefix + 'start_year' + ChartHelper.suffix + '"]}],"op":"AND"}',
+ end_year: '{"groupFilters":[{"field":"' + dbType + '.year","type":"<=","values":["' + ChartHelper.prefix + 'end_year' + ChartHelper.suffix + '"]}],"op":"AND"}'
+ };
}
}
diff --git a/src/app/utils/entities/stakeholderCreator.ts b/src/app/utils/entities/stakeholderCreator.ts
index c5907b6..404c17e 100644
--- a/src/app/utils/entities/stakeholderCreator.ts
+++ b/src/app/utils/entities/stakeholderCreator.ts
@@ -21,11 +21,11 @@ export class StakeholderCreator {
for (let indicator of subCategory.charts) {
for (let indicatorPath of indicator.indicatorPaths) {
if(indicatorPath.parameters) {
- indicatorPath.parameters.forEach((value: string, key: string) => {
- if (value.indexOf("_funder_name_")!=-1) {
- indicatorPath.parameters.set(key,value.toString().replace("_funder_name_", funder.index_name));
- }else if (value.indexOf("_fsn_")!=-1) {
- indicatorPath.parameters.set(key,value.toString().replace("_fsn_", funder.index_shortName.toLowerCase()));
+ Object.keys(indicatorPath.parameters).forEach(key => {
+ if (indicatorPath.parameters[key].indexOf("_funder_name_")!=-1) {
+ indicatorPath.parameters[key].replace("_funder_name_", funder.index_name);
+ } else if (indicatorPath.parameters[key].indexOf("_fsn_")!=-1) {
+ indicatorPath.parameters[key].toString().replace("_fsn_", funder.index_shortName.toLowerCase());
}
});
}
@@ -87,7 +87,7 @@ export class StakeholderCreator {
let n_total = new Indicator("Total "+typePlural,null, "number","small",true, true, [new IndicatorPath(null, "search",
"/"+dbTypePlural+"/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
- n_total.indicatorPaths[0].filters.set("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;
pubDefSub.numbers.push(n_total);
if( dbType != "publication") {
@@ -100,8 +100,8 @@ export class StakeholderCreator {
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+'funder_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"}],"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,typePlural+" timeline","column");
- res_timeline.indicatorPaths[0].parameters.set("start_year","2008");
- res_timeline.indicatorPaths[0].parameters.set("end_year","2020");
+ res_timeline.indicatorPaths[0].parameters["start_year"] = "2008";
+ res_timeline.indicatorPaths[0].parameters["end_year"] = "2020";
res_timeline.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
pubDefSub.charts.push(res_timeline);
@@ -138,32 +138,32 @@ export class StakeholderCreator {
let datasource = 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":{"name":"monitor.'+ChartHelper.prefix+'id'+ChartHelper.suffix+'.'+dbTypePlural+'.datasources"}}],"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":"Content provider"}},"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)]);
datasource.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" content provider","bar");
- datasource.indicatorPaths[0].parameters.set("id",stakeholder.index_shortName.toLowerCase());
+ datasource.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts.push(datasource);
if(dbType == "publication") {
let journal = 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":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.journals"}}],"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":"Journal"}},"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)]);
journal.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " journal", "bar");
- journal.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
+ journal.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts.push(journal);
let repo = 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":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.repositories"}}],"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":"Repositories"}},"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)]);
repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar");
- repo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
+ repo.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts.push(repo);
}
if(dbType == "dataset") {
let repo = 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":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.drepositories"}}],"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":"Data Repositories"}},"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)]);
repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar");
- repo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
+ repo.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts.push(repo);
let irepo = 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":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.irepositories"}}],"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":"Institutional repositories"}},"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)]);
irepo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " institutional repositories", "bar");
- irepo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
+ irepo.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
pubDefSub.charts.push(irepo);
}
@@ -171,7 +171,7 @@ export class StakeholderCreator {
let pid = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "stats-tool", "chart?json=",
'{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"name":"monitor.'+ChartHelper.prefix+'id'+ChartHelper.suffix+'.'+dbTypePlural+'.pidtypes"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"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)]);
pid.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" PIDs","pie");
- pid.indicatorPaths[0].parameters.set("id",stakeholder.index_shortName.toLowerCase());
+ pid.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
pid.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
pubDefSub.charts.push(pid);
return pubDefSub;
@@ -246,7 +246,7 @@ export class StakeholderCreator {
static createLinkToIndicator(stakeholder:Stakeholder,typePlural, typeSingl, dbType, linkedToName,linkedToType ):Indicator {
let n_linkedPubs = new Indicator(typePlural+" linked to "+linkedToName, null, "number", "small", true, true, [new IndicatorPath(null, "search",
"/resources?query=" + encodeURIComponent(" ( (oaftype exact result) and (resulttypeid exact " + dbType + ") and (relresulttype="+linkedToType+") )") + "&fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&page=0&size=0&format=json", null, ["meta", "total"])]);
- n_linkedPubs.indicatorPaths[0].filters.set("fundingL0","&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix);
+ n_linkedPubs.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix;
/*
filters.set("start_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
filters.set("end_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
diff --git a/src/app/utils/indicator-utils.ts b/src/app/utils/indicator-utils.ts
index 9e26829..4baa253 100644
--- a/src/app/utils/indicator-utils.ts
+++ b/src/app/utils/indicator-utils.ts
@@ -1,14 +1,47 @@
-import {ChartHelper, IndicatorPath, Stakeholder} from "./entities/stakeholder";
+import {ChartHelper, Indicator, IndicatorPath} from "./entities/stakeholder";
+import {Validators} from "@angular/forms";
+
+export interface Option {
+ icon?: string,
+ iconClass?: string,
+ value: any,
+ label: string
+}
export class IndicatorUtils {
- chartTypes: Map = new Map([
+ chartTypes: Option[] = [
+ {value: 'pie', label: 'Pie'},
+ {value: 'table', label: 'Table'},
+ {value: 'line', label: 'Line'},
+ {value: 'column', label: 'Column'},
+ {value: 'bar', label: 'Bar'},
+ {value: 'other', label: 'Other'}
+ ];
+
+ chartSizes: Option[] = [
+ {value: 'small', label: 'Small'},
+ {value: 'medium', label: 'Medium'},
+ {value: 'large', label: 'Large'}
+ ];
+
+ isPublic: Option[] = [
+ {icon: 'public', value: true, label: 'Public'},
+ {icon: 'lock', value: false, label: 'Private'},
+ ];
+
+ isActive: Option[] = [
+ {icon: 'brightness_1', iconClass: '', value: true, label: 'Active'},
+ {icon: 'brightness_1', value: false, label: 'Inactive'},
+ ];
+
+ chartTypesIcons: Map = new Map([
['pie', 'pie_chart'],
['table', 'table_chart'],
['line', 'show_chart'],
['column', 'bar_chart'],
['bar', 'bar_chart'],
- ['image', 'perm_media']
+ ['other', 'perm_media']
]);
isPublicIcon: Map = new Map([
@@ -20,38 +53,58 @@ export class IndicatorUtils {
ignoredParameters = ['funder_name'];
- public getFullUrl(indicatorPath: IndicatorPath, fundingL0:string = null, startDate:string = null, endDate:string = null):string{
+ parametersValidators: Map = new Map([
+ ['start_year', [Validators.required, Validators.pattern('^\\d+$')]],
+ ['end_year', [Validators.required, Validators.pattern('^\\d+$')]]
+ ]);
+
+ public getFullUrl(indicatorPath: IndicatorPath, fundingL0: string = null, startDate: string = null, endDate: string = null): string {
let replacedUrl = indicatorPath.chartObject;
if (indicatorPath.parameters) {
- indicatorPath.parameters.forEach((value, key) => {
- let replacedValue = value.toString();
- if( startDate && key == "start_year" && indicatorPath.filters.get("start_year")){
- replacedValue = (replacedValue < startDate)?startDate:replacedValue;
+ Object.keys(indicatorPath.parameters).forEach(key => {
+ let replacedValue = indicatorPath.parameters[key];
+ if (startDate && key == "start_year" && indicatorPath.filters["start_year"]) {
+ replacedValue = (replacedValue < startDate) ? startDate : replacedValue;
}
- if( endDate && key == "end_year" && indicatorPath.filters.get("end_year")){
- replacedValue = (replacedValue > endDate)?endDate:replacedValue;
+ if (endDate && key == "end_year" && indicatorPath.filters["end_year"]) {
+ replacedValue = (replacedValue > endDate) ? endDate : replacedValue;
}
replacedUrl = replacedUrl.replace(ChartHelper.prefix + key + ChartHelper.suffix, replacedValue);
});
}
- if(indicatorPath.chartObject){
- if(fundingL0 && indicatorPath.filters.get("fundingL0")){
+ if (indicatorPath.chartObject) {
+ if (fundingL0 && indicatorPath.filters["fundingL0"]) {
let newJsonObject = JSON.parse(replacedUrl);
- for(let queries of newJsonObject["chartDescription"]["queries"]){
- if(!queries["query"]["filters"] || queries["query"]["filters"].length ==0) {
+ for (let queries of newJsonObject["chartDescription"]["queries"]) {
+ if (!queries["query"]["filters"] || queries["query"]["filters"].length == 0) {
queries["query"]["filters"] = [];
}
//TODO check how it works if the query already has a filter
- queries["query"]["filters"].push(JSON.parse(indicatorPath.filters.get("fundingL0").replace(ChartHelper.prefix + "fundingL0" + ChartHelper.suffix,fundingL0)));
+ queries["query"]["filters"].push(JSON.parse(indicatorPath.filters["fundingL0"].
+ replace(ChartHelper.prefix + "fundingL0" + ChartHelper.suffix, fundingL0)));
}
replacedUrl = JSON.stringify(newJsonObject);
-
}
}
return indicatorPath.url + encodeURIComponent(replacedUrl);
}
+ generateIndicatorByForm(form: any, indicatorPaths: IndicatorPath[]): Indicator {
+ let indicator: Indicator = new Indicator(form.name, form.description, 'chart',
+ form.width, form.isActive, form.isPublic, indicatorPaths);
+ indicator._id = form.id;
+ form.indicatorPaths.forEach((indicatorPath, index) => {
+ indicatorPath.parameters.forEach(parameter => {
+ indicator.indicatorPaths[index].parameters[parameter.key] = parameter.value;
+ if(parameter.key === 'type') {
+ indicator.indicatorPaths[index].type = parameter.value;
+ }
+ });
+ });
+ return indicator;
+ }
+
generateIndicatorByChartUrl(source: string, url: string, type: string = null): IndicatorPath {
let indicatorPath = new IndicatorPath("", source, "", "", []);
if (source === 'stats-tool') {
@@ -67,14 +120,14 @@ export class IndicatorUtils {
this.extractStartYear(chart, indicatorPath);
this.extractEndYear(chart, indicatorPath);
indicatorPath.chartObject = JSON.stringify(chart);
- this.addResultFilters(chart,indicatorPath);
+ this.addResultFilters(chart, indicatorPath);
} else if (source === 'old') {
indicatorPath.url = url.split("data=")[0].split("/stats/")[1] + "data=";
indicatorPath.chartObject = decodeURIComponent(url.split("data=")[1].split("&")[0]);
let chart = JSON.parse(indicatorPath.chartObject);
- this.extractOldToolTitle(chart,indicatorPath);
- this.extractOldToolXTitle(chart,indicatorPath);
- this.extractOldToolYTitle(chart,indicatorPath);
+ this.extractOldToolTitle(chart, indicatorPath);
+ this.extractOldToolXTitle(chart, indicatorPath);
+ this.extractOldToolYTitle(chart, indicatorPath);
indicatorPath.chartObject = JSON.stringify(chart);
} else {
indicatorPath.url = url;
@@ -90,7 +143,7 @@ export class IndicatorUtils {
type = defaultTypes [0];
} else {
obj["chartDescription"]["queries"][0]["type"] = ChartHelper.prefix + "type" + ChartHelper.suffix;
- indicatorPath.parameters.set("type", type);
+ indicatorPath.parameters['type'] = type;
}
return type;
}
@@ -98,14 +151,14 @@ export class IndicatorUtils {
private extractFunder(obj, indicatorPath: IndicatorPath) {
let funderName;
for (let query of obj["chartDescription"]["queries"]) {
- if(!query["query"]["filters"]){
+ if (!query["query"]["filters"]) {
return;
}
for (let filter of query["query"]["filters"]) {
if (filter["groupFilters"][0]["field"].indexOf(".funder") != -1) {
funderName = filter["groupFilters"][0]["values"][0];
filter["groupFilters"][0]["values"][0] = ChartHelper.prefix + "funder_name" + ChartHelper.suffix;
- indicatorPath.parameters.set("funder_name", funderName);
+ indicatorPath.parameters["funder_name"] = funderName;
}
}
}
@@ -114,7 +167,7 @@ export class IndicatorUtils {
private extractStartYear(obj, indicatorPath: IndicatorPath) {
let start_year;
for (let query of obj["chartDescription"]["queries"]) {
- if(!query["query"]["filters"]){
+ if (!query["query"]["filters"]) {
return;
}
for (let filter of query["query"]["filters"]) {
@@ -122,7 +175,7 @@ export class IndicatorUtils {
if (gfilter["field"].indexOf(".year") != -1 && gfilter["type"].indexOf(">") != -1) {
start_year = gfilter["values"][0];
gfilter["values"][0] = ChartHelper.prefix + "start_year" + ChartHelper.suffix;
- indicatorPath.parameters.set("start_year", start_year);
+ indicatorPath.parameters["start_year"] = start_year;
}
}
}
@@ -132,7 +185,7 @@ export class IndicatorUtils {
private extractEndYear(obj, indicatorPath: IndicatorPath) {
let end_year;
for (let query of obj["chartDescription"]["queries"]) {
- if(!query["query"]["filters"]){
+ if (!query["query"]["filters"]) {
return;
}
for (let filter of query["query"]["filters"]) {
@@ -140,7 +193,7 @@ export class IndicatorUtils {
if (gfilter["field"].indexOf(".year") != -1 && gfilter["type"].indexOf("<") != -1) {
end_year = gfilter["values"][0];
gfilter["values"][0] = ChartHelper.prefix + "end_year" + ChartHelper.suffix;
- indicatorPath.parameters.set("end_year", end_year);
+ indicatorPath.parameters["end_year"] = end_year;
}
}
}
@@ -152,7 +205,7 @@ export class IndicatorUtils {
if (obj["chartDescription"]["title"]) {
title = obj["chartDescription"]["title"]["text"];
obj["chartDescription"]["title"]["text"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
- indicatorPath.parameters.set("title", title);
+ indicatorPath.parameters["title"] = title;
}
}
@@ -162,7 +215,7 @@ export class IndicatorUtils {
if (obj["chartDescription"]["xAxis"]["title"]) {
title = obj["chartDescription"]["xAxis"]["title"]["text"];
obj["chartDescription"]["xAxis"]["title"]["text"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
- indicatorPath.parameters.set("xAxisTitle", title);
+ indicatorPath.parameters["xAxisTitle"] = title;
}
}
@@ -171,26 +224,27 @@ export class IndicatorUtils {
if (obj["chartDescription"]["yAxis"]["title"]) {
title = obj["chartDescription"]["yAxis"]["title"]["text"];
obj["chartDescription"]["yAxis"]["title"]["text"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
- indicatorPath.parameters.set("yAxisTitle", title);
+ indicatorPath.parameters["yAxisTitle"] = title;
}
}
+
private addResultFilters(obj, indicatorPath: IndicatorPath) {
- let resultTypes = ["publication","software","dataset","other"];
- let index = -1;
+ let resultTypes = ["publication", "software", "dataset", "other"];
+ let index = -1;
for (let query of obj["chartDescription"]["queries"]) {
if (!query["query"]["select"]) {
return;
}
for (let select of query["query"]["select"]) {
- for (var i=0; i < resultTypes.length; i++) {
- if(select.field.startsWith(resultTypes[i]) ) {
+ for (var i = 0; i < resultTypes.length; i++) {
+ if (select.field.startsWith(resultTypes[i])) {
index = i;
}
}
}
}
- if(index != -1){
+ if (index != -1) {
indicatorPath.filters = IndicatorPath.createResultFilters(resultTypes[index]);
}
}
@@ -201,7 +255,7 @@ export class IndicatorUtils {
if (obj["title"]) {
title = obj["title"];
obj["title"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
- indicatorPath.parameters.set("title", title);
+ indicatorPath.parameters["title"] = title;
}
}
@@ -211,20 +265,21 @@ export class IndicatorUtils {
if (obj["xaxistitle"]) {
title = obj["xaxistitle"];
obj["xaxistitle"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
- indicatorPath.parameters.set("xAxisTitle", title);
+ indicatorPath.parameters["xAxisTitle"] = title;
}
}
private extractOldToolYTitle(obj, indicatorPath: IndicatorPath) {
let title = "";
- if (obj["fieldsheaders"] ) {
+ if (obj["fieldsheaders"]) {
title = obj["fieldsheaders"];
- obj["fieldsheaders"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
- indicatorPath.parameters.set("yAxisTitle", title);
+ obj["fieldsheaders"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
+ indicatorPath.parameters["yAxisTitle"] = title;
}
}
}
+
/*
custom query
http://88.197.53.71:8080/stats-api/chart?json=%7B%22library%22%3A%22HighCharts%22%2C%22chartDescription%22%3A%7B%22queries%22%3A%5B%7B%22name%22%3A%22Publications%22%2C%22type%22%3A%22bar%22%2C%22query%22%3A%7B%22name%22%3A%22monitor.ec.publications.datasources%22%7D%7D%5D%2C%22chart%22%3A%7B%22backgroundColor%22%3A%22%23FFFFFFFF%22%2C%22borderColor%22%3A%22%23335cadff%22%2C%22borderRadius%22%3A0%2C%22borderWidth%22%3A0%2C%22plotBorderColor%22%3A%22%23ccccccff%22%2C%22plotBorderWidth%22%3A0%7D%2C%22title%22%3A%7B%22text%22%3A%22Publication%20content%20provider%22%7D%2C%22subtitle%22%3A%7B%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Publications%22%7D%7D%2C%22xAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Content%20provider%22%7D%7D%2C%22lang%22%3A%7B%22noData%22%3A%22No%20Data%20available%20for%20the%20Query%22%7D%2C%22exporting%22%3A%7B%22enabled%22%3Atrue%7D%2C%22plotOptions%22%3A%7B%22series%22%3A%7B%22dataLabels%22%3A%7B%22enabled%22%3Afalse%7D%7D%7D%2C%22legend%22%3A%7B%22enabled%22%3Atrue%2C%22align%22%3A%22center%22%2C%22verticalAlign%22%3A%22bottom%22%2C%22layout%22%3A%22horizontal%22%7D%2C%22credits%22%3A%7B%22href%22%3Anull%2C%22enabled%22%3Atrue%2C%22text%22%3A%22Created%20by%20OpenAIRE%20via%20HighCharts%22%7D%7D%7D
diff --git a/src/app/utils/services/statistics.service.ts b/src/app/utils/services/statistics.service.ts
index 47e0210..8147d4f 100644
--- a/src/app/utils/services/statistics.service.ts
+++ b/src/app/utils/services/statistics.service.ts
@@ -20,7 +20,7 @@ export class StatisticsService {
this.chartSources.set('stats-tool', properties.statisticsFrameNewAPIURL);
this.chartSources.set('old', properties.statisticsFrameAPIURL);
this.chartSources.set('metrics', properties.metricsAPIURL);
- this.chartSources.set('fake', '');
+ this.chartSources.set('image', '');
})
}
@@ -33,7 +33,7 @@ export class StatisticsService {
}
getChartSource(url: string): string {
- let source = 'fake';
+ let source = 'image';
this.chartSources.forEach((value, key) => {
if(value !== '' && url.indexOf(value) !== -1) {
source = key;
diff --git a/src/assets/monitor-custom.css b/src/assets/monitor-custom.css
index 5a64688..fc48a09 100644
--- a/src/assets/monitor-custom.css
+++ b/src/assets/monitor-custom.css
@@ -22,3 +22,8 @@
--header-height: 70px;
--list-card-max-width: 1220px;
}
+
+.refresh-iframe {
+ background-color: rgba(0, 0, 0, 0.50);
+ position: absolute;
+}
diff --git a/src/assets/theme-assets/dashboard-custom.css b/src/assets/theme-assets/dashboard-custom.css
index 6cfd099..26856eb 100644
--- a/src/assets/theme-assets/dashboard-custom.css
+++ b/src/assets/theme-assets/dashboard-custom.css
@@ -16,7 +16,7 @@ html .dashboard {
}
.dashboard .clickable {
- cursor: pointer;
+ cursor: pointer !important;
}
/* On link hover, his items with this class will be displayed*/
@@ -146,3 +146,22 @@ body.dashboard {
padding: 0;
margin-top: 5px;
}
+
+.dashboard .md-input {
+ color: black;
+}
+
+/* Modal*/
+
+.dashboard .uk-modal .large-modal {
+ width: 800px;
+}
+
+/* Sortable*/
+.dashboard .uk-sortable > * {
+ cursor: move;
+}
+
+.dashboard .uk-sortable .uk-sortable-nodrag {
+ cursor: default;
+}
diff --git a/src/index.html b/src/index.html
index 8070d3d..7457948 100644
--- a/src/index.html
+++ b/src/index.html
@@ -72,8 +72,10 @@