diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9c73910..606a914 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -307,9 +307,11 @@ export class AppComponent implements OnInit, OnDestroy { }); this.adminMenuItems.push(new MenuItem("general", "General", "", "/admin/" + this.stakeholder.alias, false, [], [], {}, "")); this.adminMenuItems.push(new MenuItem("indicators", "Indicators", "", "/admin/" + this.stakeholder.alias + '/indicators', false, [], [], {}, "")); - this.adminMenuItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + "/users", false, [], [], {}, "")); - if(Session.isPortalAdministrator(this.user) ) { - this.adminMenuItems.push(new MenuItem("monitorOptions", "Pages & Entities", "", "/admin-tools/" + this.stakeholder.alias + "/pages", false, [], [], {communityId:this.stakeholder.alias})); + if(this.stakeholder.defaultId) { + this.adminMenuItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + "/users", false, [], [], {}, "")); + if (Session.isPortalAdministrator(this.user)) { + this.adminMenuItems.push(new MenuItem("monitorOptions", "Pages & Entities", "", "/admin-tools/" + this.stakeholder.alias + "/pages", false, [], [], {communityId: this.stakeholder.alias})); + } } this.specialSideBarMenuItem = new MenuItem("back", "Manage profiles", "", "/admin", false, [], null, {}); this.specialSideBarMenuItem.icon = '' + arrow_left.data + ''; // ''; diff --git a/src/app/monitor/monitor.component.ts b/src/app/monitor/monitor.component.ts index 27275e6..a5587b2 100644 --- a/src/app/monitor/monitor.component.ts +++ b/src/app/monitor/monitor.component.ts @@ -418,7 +418,7 @@ export class MonitorComponent implements OnInit, OnDestroy { private getCoFunded() { if (this.queryParams["co-funded"] && this.filters.length > 0) { - return this.queryParams["co-funded"] && this.queryParams["co-funded"] == "co-funded-results"; + return this.queryParams["co-funded"] && StringUtils.URIDecode(StringUtils.unquote(this.queryParams["co-funded"] )) == "co-funded-results"; } return false; } diff --git a/src/app/topic/indicators.component.html b/src/app/topic/indicators.component.html index d98d791..1f319de 100644 --- a/src/app/topic/indicators.component.html +++ b/src/app/topic/indicators.component.html @@ -262,6 +262,12 @@ placeholder="Write a URL" [warning]="urlParameterizedMessage"> +
+
+ There are schema enchancements that can be applied in this query. Apply now +
+
+
+
+ There are schema enchancements that can be applied in this query. Apply now +
+
@@ -448,11 +460,11 @@
- -
I frames - preview is disabled
+ +
diff --git a/src/app/topic/indicators.component.ts b/src/app/topic/indicators.component.ts index fc20662..8b7cca5 100644 --- a/src/app/topic/indicators.component.ts +++ b/src/app/topic/indicators.component.ts @@ -94,7 +94,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV private firstLoad: boolean = true; urlParameterizedMessage = null; - + showCheckForSchemaEnhancements:boolean = false; constructor(private layoutService: LayoutService, private stakeholderService: StakeholderService, private statisticsService: StatisticsService, @@ -548,6 +548,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV let index = this.numberIndicatorPaths.length - 1; if (this.numberIndicatorPaths.at(index).get('url').valid) { this.validateJsonPath(index); + this.checkForSchemaEnhancements(this.numberIndicatorPaths.at(index).get('url').value); } if (this.indicator.defaultId === null) { this.subscriptions.push(this.numberIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => { @@ -565,6 +566,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV } else { this.urlParameterizedMessage = null; } + this.checkForSchemaEnhancements(this.numberIndicatorPaths.at(index).get('url').value); if (this.indicator.indicatorPaths[index]) { this.indicator.indicatorPaths[index] = indicatorPath; } else { @@ -619,6 +621,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV if (disableUrl) { this.chartIndicatorPaths.at(index).get('url').disable(); } else { + this.checkForSchemaEnhancements(this.chartIndicatorPaths.at(index).get('url').value); this.urlSubscriptions.push(this.chartIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => { if (this.chartIndicatorPaths.at(index).get('url').valid) { let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.statisticsService.getChartSource(value), value, this.chartIndicatorPaths.at(index).get('type').value, this.stakeholder); @@ -632,6 +635,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV } else { this.urlParameterizedMessage = null; } + this.checkForSchemaEnhancements(this.chartIndicatorPaths.at(index).get('url').value); (this.chartIndicatorPaths.at(index) as FormGroup).get('type').setValue(indicatorPath.type); let parameters = this.getParametersAsFormArray(indicatorPath); (this.chartIndicatorPaths.at(index) as FormGroup).setControl('parameters', parameters); @@ -1122,4 +1126,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV this.editing = false; })); } + private checkForSchemaEnhancements(url:string){ + //new schema + this.showCheckForSchemaEnhancements = this.isAdministrator && url && !this.properties.useOldStatisticsSchema && this.indicatorUtils.checkForSchemaEnhancements(url); + } + } diff --git a/src/app/utils/indicator-utils.ts b/src/app/utils/indicator-utils.ts index ac8147c..b739dd4 100644 --- a/src/app/utils/indicator-utils.ts +++ b/src/app/utils/indicator-utils.ts @@ -11,6 +11,7 @@ import {AbstractControl, ValidatorFn, Validators} from "@angular/forms"; import {Option} from "../openaireLibrary/sharedComponents/input/input.component"; import {Session} from "../openaireLibrary/login/utils/helper.class"; import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; +import {properties} from "../../environments/environment"; export class StakeholderUtils { statuses: Option[] = [ @@ -671,7 +672,10 @@ export class IndicatorUtils { return; } for (let filter of query["query"]["filters"]) { - if (filter["groupFilters"][0]["field"].indexOf(".funder") != -1) { + if (filter["groupFilters"][0]["field"].indexOf(" funder") != -1) {//new statistcs schema + filter["groupFilters"][0]["values"][0] = ChartHelper.prefix + "index_name" + ChartHelper.suffix; + indicatorPath.parameters["index_name"] = stakeholder.index_name; + }else if (filter["groupFilters"][0]["field"].indexOf(".funder") != -1) { filter["groupFilters"][0]["values"][0] = ChartHelper.prefix + "index_name" + ChartHelper.suffix; indicatorPath.parameters["index_name"] = stakeholder.index_name; }else if (filter["groupFilters"][0]["field"].indexOf(".funder.id") != -1) { @@ -899,4 +903,29 @@ export class IndicatorUtils { } } + public checkForSchemaEnhancements(url:string):boolean{ + return url !=this.applySchemaEnhancements(url); + } + public applySchemaEnhancements(url:string):string{ + let resultEnhancements = [ + [".project.acronym",".project acronym"], + [".project.title",".project title"], + [".project.funder",".project funder"], + [".project.funding level 0",".project funding level 0"], + [".datasource.name",".HostedBy datasource"], + [".datasource.type",".HostedBy datasource type"] + ]; + let changes = ""; + for (let field of resultEnhancements) { + for (let type of ["publication", "software", "dataset", "other", "result"]) { + if (url.indexOf(encodeURIComponent(type + field[0])) != -1) { + changes += "Changed " + type + field[0] + " to " + type + field[1] + "\n"; + url = url.split(encodeURIComponent(type + field[0])).join(encodeURIComponent(type + field[1])); + } + } + } + console.debug(changes); + console.debug(url); + return url; + } } diff --git a/src/app/utils/services/statistics.service.ts b/src/app/utils/services/statistics.service.ts index fd13de6..ea6f269 100644 --- a/src/app/utils/services/statistics.service.ts +++ b/src/app/utils/services/statistics.service.ts @@ -17,8 +17,8 @@ export class StatisticsService { this.numberSources.set('statistics', [properties.statisticsAPIURL]); this.numberSources.set('search', [properties.searchAPIURLLAst]); this.numberSources.set('metrics', [properties.metricsAPIURL]); - this.numberSources.set('stats-tool', [properties.statisticsFrameNewAPIURL, "http://marilyn.athenarc.gr:8080/stats-api/", "http://88.197.53.71:8080/stats-api/", "https://stats.madgik.di.uoa.gr/stats-api/","https://beta.services.openaire.eu/stats-tool/","https://services.openaire.eu/stats-tool/"]); - this.chartSources.set('stats-tool', [properties.statisticsFrameNewAPIURL, "http://marilyn.athenarc.gr:8080/stats-api/", "http://88.197.53.71:8080/stats-api/", "https://stats.madgik.di.uoa.gr/stats-api/","https://beta.services.openaire.eu/stats-tool/","https://services.openaire.eu/stats-tool/"]); + this.numberSources.set('stats-tool', [properties.monitorStatsFrameUrl, "http://marilyn.athenarc.gr:8080/stats-api/", "http://88.197.53.71:8080/stats-api/", "https://stats.madgik.di.uoa.gr/stats-api/","https://beta.services.openaire.eu/stats-tool/","https://services.openaire.eu/stats-tool/"]); + this.chartSources.set('stats-tool', [properties.monitorStatsFrameUrl, "http://marilyn.athenarc.gr:8080/stats-api/", "http://88.197.53.71:8080/stats-api/", "https://stats.madgik.di.uoa.gr/stats-api/","https://beta.services.openaire.eu/stats-tool/","https://services.openaire.eu/stats-tool/"]); this.chartSources.set('old', [properties.statisticsFrameAPIURL]); this.chartSources.set('metrics', [properties.metricsAPIURL]); this.chartSources.set('image', [""]); diff --git a/src/environments/environment.beta.ts b/src/environments/environment.beta.ts index 9f8014f..6861bd2 100644 --- a/src/environments/environment.beta.ts +++ b/src/environments/environment.beta.ts @@ -13,6 +13,8 @@ export let properties: EnvProperties = { statisticsFrameAPIURL: "https://beta.openaire.eu/stats/", statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/", useNewStatistisTool: true, + monitorStatsFrameUrl:"https://beta.services.openaire.eu/stats-tool/", + useOldStatisticsSchema: true, claimsAPIURL: "https://beta.services.openaire.eu/claims/rest/claimsService/", searchAPIURLLAst: "https://beta.services.openaire.eu/search/v2/api/", searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources", diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 23ab814..fa08a42 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -13,6 +13,8 @@ export let properties: EnvProperties = { statisticsFrameAPIURL: "https://www.openaire.eu/stats/", statisticsFrameNewAPIURL: "https://services.openaire.eu/stats-tool/", useNewStatistisTool: true, + monitorStatsFrameUrl:"https://stats.madgik.di.uoa.gr/stats-api/", + useOldStatisticsSchema: false, claimsAPIURL: "https://services.openaire.eu/claims/rest/claimsService/", searchAPIURLLAst: "https://services.openaire.eu/search/v2/api/", searchResourcesAPIURL: "https://services.openaire.eu/search/v2/api/resources", diff --git a/src/environments/environment.ts b/src/environments/environment.ts index c6183ab..5ea1ea8 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -17,8 +17,10 @@ export let properties: EnvProperties = { framesAPIURL: "https://beta.openaire.eu/stats3/", statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/", statisticsFrameAPIURL: "https://beta.openaire.eu/stats/", - statisticsFrameNewAPIURL: "https://stats.madgik.di.uoa.gr/stats-api/", - useNewStatistisTool: false, + statisticsFrameNewAPIURL: "https://beta.services.openaire.eu/stats-tool/", + useNewStatistisTool: true, + monitorStatsFrameUrl:"https://stats.madgik.di.uoa.gr/stats-api/", + useOldStatisticsSchema: false, disableFrameLoad: true, claimsAPIURL: "http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/", searchAPIURLLAst: "https://beta.services.openaire.eu/search/v2/api/", @@ -58,7 +60,7 @@ export let properties: EnvProperties = { cookieDomain: ".di.uoa.gr", feedbackmail: "openaire.test@gmail.com", cacheUrl: "http://scoobydoo.di.uoa.gr:3000/get?url=", - // monitorServiceAPIURL: "https://beta.services.openaire.eu/uoa-monitor-service", + // monitorServiceAPIURL: "https://services.openaire.eu/uoa-monitor-service", monitorServiceAPIURL: "http://duffy.di.uoa.gr:8080/uoa-monitor-service", adminToolsAPIURL: "http://duffy.di.uoa.gr:8080/uoa-monitor-service/",