[MOnitor Dashboard|Trunk]
Indicator utils: support highmaps make code more generic (eliminate using library name in if-then-else) properties: update with proper login service remove routing to 'ec' when no stakeholder defined git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@58909 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
2da590e0fc
commit
06ec6b383f
|
@ -31,10 +31,10 @@
|
|||
# read -n1 ans
|
||||
# pico ../src/robots.txt;
|
||||
# echo -n "Pressed";
|
||||
rm -rf ../src/assets/common-assets/.svn/;
|
||||
rm -rf ../src/app/openaireLibrary/.svn/;
|
||||
# rm -rf ../src/assets/common-assets/.svn/;
|
||||
# rm -rf ../src/app/openaireLibrary/.svn/;
|
||||
# cd ..; npm run build:ssr; cd deploy;
|
||||
rm -rf ../src ../node_modules ../.idea/ ../installOpenaireLib.sh; cd ../; rm -rf deploy;
|
||||
rm -rf ../src ../node_modules ../.idea/ ../installOpenaireLib.sh; rm -rf ../dist/assets/common-assets/.svn/; cd ../; rm -rf deploy;
|
||||
# echo 'Now copy to the server!'
|
||||
|
||||
##<-- to here
|
||||
|
|
|
@ -13,7 +13,7 @@ enableProdMode();
|
|||
// Express server
|
||||
const app = express();
|
||||
|
||||
const PORT = 5000;
|
||||
const PORT = 4000;
|
||||
const DIST_FOLDER = join(process.cwd(), 'dist');
|
||||
|
||||
// Our index.html we'll use as our template
|
||||
|
|
|
@ -8,7 +8,7 @@ import {CanExitGuard} from "../openaireLibrary/utils/can-exit.guard";
|
|||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', redirectTo: '/ec', pathMatch: 'full'},
|
||||
{ path: '', redirectTo: '/admin', pathMatch: 'full'},
|
||||
{
|
||||
path: ':stakeholder',
|
||||
component: MonitorComponent,
|
||||
|
|
|
@ -249,7 +249,7 @@ export class IndicatorUtils {
|
|||
if (indicatorPath.chartObject) {
|
||||
if (fundingL0 && indicatorPath.filters["fundingL0"]) {
|
||||
let newJsonObject = JSON.parse(replacedUrl);
|
||||
for (let queries of newJsonObject["chartDescription"]["queries"]) {
|
||||
for (let queries of newJsonObject[this.getDescriptionObjectName(newJsonObject)]["queries"]) {
|
||||
if (!queries["query"]["filters"] || queries["query"]["filters"].length == 0) {
|
||||
queries["query"]["filters"] = [];
|
||||
}
|
||||
|
@ -288,7 +288,8 @@ export class IndicatorUtils {
|
|||
let chart = JSON.parse(indicatorPath.chartObject);
|
||||
// console.debug(indicatorPath);
|
||||
if (indicatorPath.url == "chart?json=") {
|
||||
if (chart["library"] && (chart["library"] == "HighCharts" || chart["library"] == "eCharts" )) {
|
||||
|
||||
if (chart["library"] && (chart["library"] == "HighCharts" || chart["library"] == "eCharts" || chart["library"] == "HighMaps" )) {
|
||||
indicatorPath.type = this.extractType(chart, indicatorPath);
|
||||
} else {
|
||||
indicatorPath.type = this.defaultChartType;
|
||||
|
@ -337,18 +338,27 @@ export class IndicatorUtils {
|
|||
return indicatorPath;
|
||||
}
|
||||
private getQueryObjectName(obj){
|
||||
if(obj["library"] && obj["library"] == "GoogleCharts"){
|
||||
if((obj[this.getDescriptionObjectName(obj)]).hasOwnProperty("queriesInfo")){
|
||||
return "queriesInfo";
|
||||
}else if(obj["library"] && ( obj["library"] == "HighCharts" || obj["library"] == "eCharts")) {
|
||||
}else if((obj[this.getDescriptionObjectName(obj)]).hasOwnProperty("queries")) {
|
||||
return "queries";
|
||||
}
|
||||
}
|
||||
private getDescriptionObjectName(obj){
|
||||
if(obj.hasOwnProperty("mapDescription")){
|
||||
return "mapDescription";
|
||||
}else if(obj.hasOwnProperty("chartDescription")) {
|
||||
return "chartDescription";
|
||||
}else if(obj.hasOwnProperty("tableDescription") ){
|
||||
return "tableDescription";
|
||||
}
|
||||
}
|
||||
private extractType(obj, indicatorPath: IndicatorPath): IndicatorPathType {
|
||||
let type = obj["chartDescription"]["queries"][0]["type"];
|
||||
let type = (obj[this.getDescriptionObjectName(obj)] && obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)][0]["type"])?obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)][0]["type"]:"";
|
||||
if (this.basicChartTypes.indexOf(type) == -1) {
|
||||
type = this.defaultChartType;
|
||||
} else {
|
||||
obj["chartDescription"]["queries"][0]["type"] = ChartHelper.prefix + "type" + ChartHelper.suffix;
|
||||
obj[this.getDescriptionObjectName(obj)]["queries"][0]["type"] = ChartHelper.prefix + "type" + ChartHelper.suffix;
|
||||
indicatorPath.parameters['type'] = type;
|
||||
}
|
||||
return type;
|
||||
|
@ -362,7 +372,7 @@ export class IndicatorUtils {
|
|||
if(stakeholder.type != "funder"){
|
||||
return;
|
||||
}
|
||||
for (let query of obj[(obj["chartDescription"]?"chartDescription":"tableDescription")][this.getQueryObjectName(obj)]) {
|
||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||
if (!query["query"]["filters"]) {
|
||||
return;
|
||||
}
|
||||
|
@ -382,7 +392,7 @@ export class IndicatorUtils {
|
|||
if(stakeholder.type != "ri"){
|
||||
return;
|
||||
}
|
||||
for (let query of obj[(obj["chartDescription"]?"chartDescription":"tableDescription")][this.getQueryObjectName(obj)]) {
|
||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||
if (!query["query"]["filters"]) {
|
||||
return;
|
||||
}
|
||||
|
@ -404,7 +414,7 @@ export class IndicatorUtils {
|
|||
if(stakeholder.type != "organization"){
|
||||
return;
|
||||
}
|
||||
for (let query of obj[(obj["chartDescription"]?"chartDescription":"tableDescription")][this.getQueryObjectName(obj)]) {
|
||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||
if (!query["query"]["filters"]) {
|
||||
return;
|
||||
}
|
||||
|
@ -421,7 +431,7 @@ export class IndicatorUtils {
|
|||
}
|
||||
private extractStartYear(obj, indicatorPath: IndicatorPath) {
|
||||
let start_year;
|
||||
for (let query of obj[(obj["chartDescription"]?"chartDescription":"tableDescription")][this.getQueryObjectName(obj)]) {
|
||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||
if (!query["query"]["filters"]) {
|
||||
return;
|
||||
}
|
||||
|
@ -439,7 +449,7 @@ export class IndicatorUtils {
|
|||
|
||||
private extractEndYear(obj, indicatorPath: IndicatorPath) {
|
||||
let end_year;
|
||||
for (let query of obj[(obj["chartDescription"]?"chartDescription":"tableDescription")][this.getQueryObjectName(obj)]) {
|
||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||
if (!query["query"]["filters"]) {
|
||||
return;
|
||||
}
|
||||
|
@ -457,8 +467,7 @@ export class IndicatorUtils {
|
|||
|
||||
private parameterizeDefaultQuery(obj, indicatorPath: IndicatorPath, stakeholder:Stakeholder) {
|
||||
let name = "";
|
||||
|
||||
for (let query of obj[(obj["chartDescription"]?"chartDescription":"tableDescription")][this.getQueryObjectName(obj)]) {
|
||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||
//monitor.{{stakeholderType}}.{{queryname}}
|
||||
//parameters: stakeholderId*, type
|
||||
if (query["query"]["name"]) {
|
||||
|
@ -493,7 +502,10 @@ export class IndicatorUtils {
|
|||
}
|
||||
private extractDataTitle(obj, indicatorPath: IndicatorPath) {
|
||||
let index = 0;
|
||||
for (let query of obj[(obj["chartDescription"]?"chartDescription":"tableDescription")][this.getQueryObjectName(obj)]) {
|
||||
if(obj[this.getDescriptionObjectName(obj)] && obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]){
|
||||
return;
|
||||
}
|
||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||
if (query["name"]) {
|
||||
let name = query["name"];
|
||||
query["name"] = ChartHelper.prefix + "data_title_"+index + ChartHelper.suffix;
|
||||
|
@ -504,55 +516,55 @@ export class IndicatorUtils {
|
|||
}
|
||||
private extractTitle(obj, indicatorPath: IndicatorPath) {
|
||||
let title = "";
|
||||
if (obj["library"] && ( obj["library"] == "HighCharts" || obj["library"] == "eCharts") && obj["chartDescription"]["title"]) {
|
||||
title = obj["chartDescription"]["title"]["text"];
|
||||
obj["chartDescription"]["title"]["text"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
|
||||
}else if (obj["library"] && obj["library"] == "GoogleCharts" && obj["chartDescription"]["options"]["title"]) {
|
||||
title = obj["chartDescription"]["options"]["title"];
|
||||
obj["chartDescription"]["options"]["title"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
|
||||
if (obj[this.getDescriptionObjectName(obj)]["title"]) {
|
||||
title = obj[this.getDescriptionObjectName(obj)]["title"]["text"];
|
||||
obj[this.getDescriptionObjectName(obj)]["title"]["text"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
|
||||
}else if (obj[this.getDescriptionObjectName(obj)]["options"] && obj[this.getDescriptionObjectName(obj)]["options"]["title"]) {
|
||||
title = obj[this.getDescriptionObjectName(obj)]["options"]["title"];
|
||||
obj[this.getDescriptionObjectName(obj)]["options"]["title"] = ChartHelper.prefix + "title" + ChartHelper.suffix;
|
||||
}
|
||||
indicatorPath.parameters["title"] = title ? title : "";
|
||||
}
|
||||
|
||||
private extractSubTitle(obj, indicatorPath: IndicatorPath) {
|
||||
let subtitle = "";
|
||||
if (obj["chartDescription"]["subtitle"]) {
|
||||
subtitle = obj["chartDescription"]["subtitle"]["text"];
|
||||
obj["chartDescription"]["subtitle"]["text"] = ChartHelper.prefix + "subtitle" + ChartHelper.suffix;
|
||||
if (obj[this.getDescriptionObjectName(obj)]["subtitle"]) {
|
||||
subtitle = obj[this.getDescriptionObjectName(obj)]["subtitle"]["text"];
|
||||
obj[this.getDescriptionObjectName(obj)]["subtitle"]["text"] = ChartHelper.prefix + "subtitle" + ChartHelper.suffix;
|
||||
indicatorPath.parameters["subtitle"] = subtitle ? subtitle : "";
|
||||
}else if (obj["chartDescription"]["title"] && obj["chartDescription"]["title"]["subtext"]) {
|
||||
subtitle = obj["chartDescription"]["title"]["subtext"];
|
||||
obj["chartDescription"]["title"]["subtext"] = ChartHelper.prefix + "subtitle" + ChartHelper.suffix;
|
||||
}else if (obj[this.getDescriptionObjectName(obj)]["title"] && obj[this.getDescriptionObjectName(obj)]["title"] && obj[this.getDescriptionObjectName(obj)]["title"]["subtext"]) {
|
||||
subtitle = obj[this.getDescriptionObjectName(obj)]["title"]["subtext"];
|
||||
obj[this.getDescriptionObjectName(obj)]["title"]["subtext"] = ChartHelper.prefix + "subtitle" + ChartHelper.suffix;
|
||||
indicatorPath.parameters["subtitle"] = subtitle ? subtitle : "";
|
||||
}
|
||||
}
|
||||
|
||||
private extractXTitle(obj, indicatorPath: IndicatorPath) {
|
||||
let title = "";
|
||||
if (obj["library"] && obj["library"] == "HighCharts" && obj["chartDescription"]["xAxis"]["title"]) {
|
||||
title = obj["chartDescription"]["xAxis"]["title"]["text"];
|
||||
obj["chartDescription"]["xAxis"]["title"]["text"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||
}else if (obj["library"] && obj["library"] == "GoogleCharts" && obj["chartDescription"]["options"]["hAxis"]["title"]) {
|
||||
title = obj["chartDescription"]["options"]["hAxis"]["title"];
|
||||
obj["chartDescription"]["options"]["hAxis"]["title"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||
}else if (obj["library"] && obj["library"] == "eCharts" && obj["chartDescription"]["xAxis"]["name"]) {
|
||||
title = obj["chartDescription"]["xAxis"]["name"];
|
||||
obj["chartDescription"]["xAxis"]["name"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||
if (obj[this.getDescriptionObjectName(obj)]["xAxis"] && obj[this.getDescriptionObjectName(obj)]["xAxis"]["title"]) {
|
||||
title = obj[this.getDescriptionObjectName(obj)]["xAxis"]["title"]["text"];
|
||||
obj[this.getDescriptionObjectName(obj)]["xAxis"]["title"]["text"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||
}else if (obj[this.getDescriptionObjectName(obj)]["options"] && obj[this.getDescriptionObjectName(obj)]["options"]["hAxis"] && obj[this.getDescriptionObjectName(obj)]["options"]["hAxis"]["title"]) {
|
||||
title = obj[this.getDescriptionObjectName(obj)]["options"]["hAxis"]["title"];
|
||||
obj[this.getDescriptionObjectName(obj)]["options"]["hAxis"]["title"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||
}else if (obj[this.getDescriptionObjectName(obj)]["xAxis"] && obj[this.getDescriptionObjectName(obj)]["xAxis"]["name"]) {
|
||||
title = obj[this.getDescriptionObjectName(obj)]["xAxis"]["name"];
|
||||
obj[this.getDescriptionObjectName(obj)]["xAxis"]["name"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||
}
|
||||
indicatorPath.parameters["xAxisTitle"] = title ? title : "";
|
||||
}
|
||||
|
||||
private extractYTitle(obj, indicatorPath: IndicatorPath) {
|
||||
let title = "";
|
||||
if (obj["library"] && obj["library"] == "HighCharts" && obj["chartDescription"]["yAxis"]["title"]) {
|
||||
title = obj["chartDescription"]["yAxis"]["title"]["text"];
|
||||
obj["chartDescription"]["yAxis"]["title"]["text"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
|
||||
}else if (obj["library"] && obj["library"] == "GoogleCharts" && obj["chartDescription"]["options"]["vAxis"]["title"]) {
|
||||
title = obj["chartDescription"]["options"]["vAxis"]["title"];
|
||||
obj["chartDescription"]["options"]["vAxis"]["title"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
|
||||
}else if (obj["library"] && obj["library"] == "eCharts" && obj["chartDescription"]["yAxis"]["name"]) {
|
||||
title = obj["chartDescription"]["yAxis"]["name"];
|
||||
obj["chartDescription"]["yAxis"]["name"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||
if (obj[this.getDescriptionObjectName(obj)]["yAxis"] && obj[this.getDescriptionObjectName(obj)]["yAxis"]["title"] ) {
|
||||
title = obj[this.getDescriptionObjectName(obj)]["yAxis"]["title"]["text"];
|
||||
obj[this.getDescriptionObjectName(obj)]["yAxis"]["title"]["text"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
|
||||
}else if (obj[this.getDescriptionObjectName(obj)]["options"]&& obj[this.getDescriptionObjectName(obj)]["options"]["vAxis"] && obj[this.getDescriptionObjectName(obj)]["options"]["vAxis"]["title"]) {
|
||||
title = obj[this.getDescriptionObjectName(obj)]["options"]["vAxis"]["title"];
|
||||
obj[this.getDescriptionObjectName(obj)]["options"]["vAxis"]["title"] = ChartHelper.prefix + "yAxisTitle" + ChartHelper.suffix;
|
||||
}else if (obj[this.getDescriptionObjectName(obj)]["yAxis"] && obj[this.getDescriptionObjectName(obj)]["yAxis"]["name"]) {
|
||||
title = obj[this.getDescriptionObjectName(obj)]["yAxis"]["name"];
|
||||
obj[this.getDescriptionObjectName(obj)]["yAxis"]["name"] = ChartHelper.prefix + "xAxisTitle" + ChartHelper.suffix;
|
||||
}
|
||||
indicatorPath.parameters["yAxisTitle"] = title ? title : "";
|
||||
}
|
||||
|
@ -560,7 +572,7 @@ export class IndicatorUtils {
|
|||
private addResultFilters(obj, indicatorPath: IndicatorPath) {
|
||||
let resultTypes = ["publication", "software", "dataset", "other"];
|
||||
let index = -1;
|
||||
for (let query of obj[(obj["chartDescription"]?"chartDescription":"tableDescription")][this.getQueryObjectName(obj)]) {
|
||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||
if (!query["query"]["select"]) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ export let properties: EnvProperties = {
|
|||
|
||||
piwikBaseUrl: "https://analytics.openaire.eu/piwik.php?idsite=",
|
||||
piwikSiteId: "298",
|
||||
loginUrl: "https://beta.services.openaire.eu/monitor-login/openid_connect_login",
|
||||
loginUrl: "https://beta.services.openaire.eu/monitor-dashboard-login/openid_connect_login",
|
||||
userInfoUrl : "https://beta.services.openaire.eu/uoa-user-management/api/users/getUserInfo?accessToken=",
|
||||
|
||||
logoutUrl: "https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
|
||||
|
@ -64,7 +64,7 @@ export let properties: EnvProperties = {
|
|||
resultsPerPage: 10,
|
||||
|
||||
baseLink: "https://beta.monitor.openaire.eu",
|
||||
afterLoginRedirectLink: "/myCommunities",
|
||||
|
||||
searchLinkToPublication: "/search/publication?articleId=",
|
||||
searchLinkToProject: "/search/project?projectId=",
|
||||
searchLinkToDataProvider: "/search/dataprovider?datasourceId=",
|
||||
|
|
Loading…
Reference in New Issue