[Monitor Dashboard | trunk]

app: for Default profiles remove  menu for users and pages 
add properties for monitor stats tool
stats tool: apply new schema changes
	in indicator form add method to check for schema enhancements and update the url


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@60258 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2021-01-15 16:02:30 +00:00
parent 79a54ffcbc
commit be871e043b
9 changed files with 72 additions and 14 deletions

View File

@ -307,9 +307,11 @@ export class AppComponent implements OnInit, OnDestroy {
});
this.adminMenuItems.push(new MenuItem("general", "General", "", "/admin/" + this.stakeholder.alias, false, [], [], {}, "<i uk-icon=\"image\"></i>"));
this.adminMenuItems.push(new MenuItem("indicators", "Indicators", "", "/admin/" + this.stakeholder.alias + '/indicators', false, [], [], {}, "<i uk-icon=\"image\"></i>"));
this.adminMenuItems.push(new MenuItem("users", "Users", "", "/admin/" + this.stakeholder.alias + "/users", false, [], [], {}, "<i uk-icon=\"users\"></i>"));
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, [], [], {}, "<i uk-icon=\"users\"></i>"));
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 = '<span class="uk-icon-button small uk-icon uk-button-secondary">' + arrow_left.data + '</span>'; // '<span class="uk-icon-button uk-icon portal-button " uk-icon="chevron-left"></span>';

View File

@ -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;
}

View File

@ -262,6 +262,12 @@
placeholder="Write a URL"
[warning]="urlParameterizedMessage"></div>
</div>
<div *ngIf="showCheckForSchemaEnhancements" class=" uk-width-1-1 ">
<div class="uk-alert uk-alert-warning">
There are schema enchancements that can be applied in this query. <a
(click)="indicatorPath.get('url').setValue(indicatorUtils.applySchemaEnhancements(indicatorPath.get('url').value)); indicatorPath.get('url').markAsDirty()">Apply now</a>
</div>
</div>
<div class="uk-width-1-1">
<div dashboard-input [formInput]="indicatorPath.get('source')" label="Source"
type="select" placeholder="Select a source"
@ -377,6 +383,12 @@
[formInput]="indicatorPath.get('url')" [warning]="urlParameterizedMessage"
placeholder="Write a URL"
label="Chart URL"></div>
<div *ngIf="showCheckForSchemaEnhancements" class=" uk-width-1-1 ">
<div class="uk-alert uk-alert-warning">
There are schema enchancements that can be applied in this query. <a
(click)="indicatorPath.get('url').setValue(indicatorUtils.applySchemaEnhancements(indicatorPath.get('url').value)); indicatorPath.get('url').markAsDirty()">Apply now</a>
</div>
</div>
<div class="uk-width-1-1" formArrayName="parameters">
<div class="uk-grid" uk-grid>
<div *ngIf="getParameter(i, 'title')" class="uk-width-1-1">
@ -448,11 +460,11 @@
</div>
</div>
</div>
<iframe *ngIf="!properties.disableFrameLoad && indicator.indicatorPaths[i].source !== 'image'"
<iframe *ngIf="indicator.indicatorPaths[i].source !== 'image'"
[src]="indicator.indicatorPaths[i].safeResourceUrl"
class="uk-width-1-1 uk-height-large"></iframe>
<div *ngIf="properties.disableFrameLoad && indicator.indicatorPaths[i].source !== 'image'" class="uk-alert uk-alert-danger uk-text-center">I frames
preview is disabled</div>
<!-- <div *ngIf="properties.disableFrameLoad && indicator.indicatorPaths[i].source !== 'image'" class="uk-alert uk-alert-danger uk-text-center">I frames-->
<!-- preview is disabled</div>-->
<div *ngIf="indicator.indicatorPaths[i].source === 'image'">
<img class="uk-width-1-1 uk-height-large" [src]="indicator.indicatorPaths[i].url">
</div>

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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', [""]);

View File

@ -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",

View File

@ -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",

View File

@ -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/",