[Library|Trunk]

Landing pages: add check for openaire id

Search Page: support quoted queries only if the number is even



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58940 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-06-16 16:42:51 +00:00
parent b310eb4e64
commit b819a68e96
6 changed files with 19 additions and 6 deletions

View File

@ -172,7 +172,7 @@ export class DataProviderComponent {
this.updateTitle("Content provider");
this.updateDescription("");
this.datasourceId = data['datasourceId'];
if (this.datasourceId) {
if (this.datasourceId && StringUtils.isOpenAIREID(this.datasourceId)) {
this.initializeValues();
this.getDataProviderInfo(this.datasourceId);
} else {

View File

@ -159,7 +159,7 @@ export class OrganizationComponent {
this.organizationId = params['organizationId'];
if (this.organizationId) {
if (this.organizationId && StringUtils.isOpenAIREID(this.organizationId)) {
this.getOrganizationInfo();
} else {
this.showLoading = false;

View File

@ -186,7 +186,7 @@ export class ProjectComponent {
var funder = params['funder'];
if (this.projectId) {
if (this.projectId && StringUtils.isOpenAIREID(this.projectId)) {
this.getProjectInfo(this.projectId);
this.actionsAfterLoadId();
} else if (grantId && funder) {

View File

@ -16,6 +16,7 @@ import {MetricsService} from "../../services/metrics.service";
import {RelationResult, ResultPreview} from "../../utils/result-preview/result-preview";
import {IndexInfoService} from "../../utils/indexInfo.service";
import {FormBuilder, FormGroup} from "@angular/forms";
import {StringUtils} from "../../utils/string-utils.class";
@Component({
@ -165,7 +166,7 @@ export class ResultLandingComponent {
this.metricsClicked = false;
if (this.id) {
if (this.id && StringUtils.isOpenAIREID(this.id)) {
this.getProvenanceVocabularyAndResultLandingInfo();
} else {
this.showLoading = false;

View File

@ -770,7 +770,13 @@ export class NewSearchPageComponent {
}
private static createQuotedKeywordQuery(fieldValue, fieldId, fieldOperator, countParams:number, isSearchAll:boolean, forceQuotted:boolean=false){
let params = "";
let quotedParts = (fieldValue)?fieldValue.match(/(["'])(.*?)*?\1/g):[];
let countQuote = (fieldValue.match(/'/g) || []).length;
let countDoubleQuote = (fieldValue.match(/"/g) || []).length;
let quotedParts = [];
if(countQuote % 2 == 0 && countDoubleQuote % 2 ==0){
console.log("Allow quoting");
quotedParts = (fieldValue)?fieldValue.match(/(["'])(.*?)*?\1/g):[];
}
// params+= (countParams == 0 ? "" : fieldOperator) +
params+= " (";
if(forceQuotted){

View File

@ -263,6 +263,12 @@ export class StringUtils {
"Portugal", "Romania", "Russia", "San Marino", "Serbia", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland", "Turkey", "Ukraine", "United Kingdom", "Vatican City",
];
return (country && countries.indexOf(country) != -1);
}
public static isOpenAIREID(id:string){
if(id && id.length == 46){
let exp1 = /^.{12}::([0-9a-z]{32})$/g;
return (id.match(exp1)!=null);
}
return false;
}
}