DMP Editor. Prefixing queries on searching existing identifiers.
This commit is contained in:
parent
8a7cfab3b8
commit
a8f75aafb9
|
@ -17,6 +17,8 @@ export class AddOrganizationComponent extends BaseComponent implements OnInit {
|
|||
|
||||
public formGroup: FormGroup;
|
||||
|
||||
private readonly _REFERENCE_PREFIX:string = "Internal:";
|
||||
private readonly _KEY: string = 'Internal';
|
||||
private existingReferences: string[] = [];
|
||||
get referenceExists(){
|
||||
const reference = this.formGroup.get('reference').value;
|
||||
|
@ -31,9 +33,9 @@ export class AddOrganizationComponent extends BaseComponent implements OnInit {
|
|||
) {
|
||||
super();
|
||||
if(data){
|
||||
const researchers = (data as FormControl).value ;
|
||||
if(researchers){
|
||||
this.existingReferences = (researchers as Array<any>).map(researcher => researcher.reference);
|
||||
const organisations = (data as FormControl).value ;
|
||||
if(organisations){
|
||||
this.existingReferences = (organisations as Array<any>).map(organisation => organisation.reference);
|
||||
}
|
||||
}}
|
||||
|
||||
|
@ -62,11 +64,11 @@ export class AddOrganizationComponent extends BaseComponent implements OnInit {
|
|||
return (control: AbstractControl) :Observable<ValidationErrors | null> =>{
|
||||
return control.valueChanges.pipe(
|
||||
debounceTime(600),
|
||||
mergeMap(value=>this.externalSourcesService.searchDMPOrganizations('',value)),
|
||||
mergeMap(value=>this.externalSourcesService.searchDMPOrganizations('',this._REFERENCE_PREFIX +value)),
|
||||
takeUntil(this._destroyed),
|
||||
map((response)=>{
|
||||
if(response && response.length){
|
||||
const internalOrganizations = (response as Array<any>).filter(organization=> organization.key === "Internal");
|
||||
const internalOrganizations = (response as Array<any>).filter(organization=> organization.key === this._KEY);
|
||||
|
||||
if(internalOrganizations && internalOrganizations.length){
|
||||
return {organizationIdentifierExists:true};
|
||||
|
|
|
@ -16,7 +16,8 @@ export class AddResearcherComponent extends BaseComponent implements OnInit {
|
|||
|
||||
public formGroup: FormGroup;
|
||||
|
||||
// private readonly _REFERENCE_PREFIX:string = "dmp:";
|
||||
private readonly _REFERENCE_PREFIX:string = "dmp:";
|
||||
private readonly _KEY:string = 'Internal';
|
||||
private existingReferences: string[] = [];
|
||||
get referenceExists(){
|
||||
const reference = this.formGroup.get('reference').value;
|
||||
|
@ -70,12 +71,12 @@ export class AddResearcherComponent extends BaseComponent implements OnInit {
|
|||
return control.valueChanges.pipe(
|
||||
debounceTime(600),
|
||||
takeUntil(this._destroyed),
|
||||
mergeMap(value=>this.externalSourcesService.searchDMPResearchers({criteria:{name: '',like: null,reference:value }})),
|
||||
mergeMap(value=>this.externalSourcesService.searchDMPResearchers({criteria:{name: '',like: null,reference: (this._REFERENCE_PREFIX + value) }})),
|
||||
map((response)=>{
|
||||
if(response && response.length){
|
||||
let internalEntries = (response as any[]).filter(record=>record.key === 'Internal');
|
||||
let internalEntries = (response as any[]).filter(record=>record.key === this._KEY);
|
||||
if(internalEntries && internalEntries.length){
|
||||
internalEntries = internalEntries.filter(record=> (record.reference === (control.value)));
|
||||
internalEntries = internalEntries.filter(record=> (record.reference === (this._REFERENCE_PREFIX + control.value)));
|
||||
}
|
||||
return internalEntries && internalEntries.length? {researcherIdentifierExists:true} : null;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,11 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
|||
isFunderPending:boolean = false;
|
||||
isGrantPending:boolean = false;
|
||||
isProjectPending:boolean = false;
|
||||
|
||||
private readonly _FUNDER_PREFIX = "dmp:";
|
||||
private readonly _GRANT_PREFIX = "dmp:";
|
||||
private readonly _PROJECT_PREFIX = "dmp:";
|
||||
private readonly _KEY = "Internal";
|
||||
constructor(
|
||||
private grantService: GrantService,
|
||||
private projectService: ProjectService,
|
||||
|
@ -101,12 +106,12 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
|||
switchMap(value=> {
|
||||
const requestItem = new RequestItem<FunderCriteria>();
|
||||
requestItem.criteria = new FunderCriteria();
|
||||
requestItem.criteria.exactReference = value;
|
||||
requestItem.criteria.exactReference = this._FUNDER_PREFIX +value;
|
||||
return this.funderService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
||||
}),
|
||||
map(response=>{
|
||||
if(response && response.length){
|
||||
const internalFunders = (response as Array<any>).filter(funder=> funder.key === 'Internal');
|
||||
const internalFunders = (response as Array<any>).filter(funder=> funder.key === this._KEY);
|
||||
|
||||
if(internalFunders && internalFunders.length){
|
||||
return {funderIdentifierExists:true};
|
||||
|
@ -136,12 +141,12 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
|||
switchMap(value=> {
|
||||
const requestItem = new RequestItem<GrantCriteria>();
|
||||
requestItem.criteria = new GrantCriteria();
|
||||
requestItem.criteria.exactReference = value;
|
||||
requestItem.criteria.exactReference = this._GRANT_PREFIX + value;
|
||||
return this.grantService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
||||
}),
|
||||
map(response=>{
|
||||
if(response && response.length){
|
||||
const internalGrants = (response as Array<any>).filter(grant=> grant.key === 'Internal');
|
||||
const internalGrants = (response as Array<any>).filter(grant=> grant.key === this._KEY);
|
||||
|
||||
if(internalGrants && internalGrants.length){
|
||||
return {grantIdentifierExists:true};
|
||||
|
@ -171,12 +176,12 @@ export class FundingInfoComponent extends BaseComponent implements OnInit {
|
|||
switchMap(value=> {
|
||||
const requestItem = new RequestItem<ProjectCriteria>();
|
||||
requestItem.criteria = new ProjectCriteria();
|
||||
requestItem.criteria.exactReference = value;
|
||||
requestItem.criteria.exactReference = this._PROJECT_PREFIX + value;
|
||||
return this.projectService.getWithExternal(requestItem).pipe(takeUntil(this._destroyed));
|
||||
}),
|
||||
map(response=>{
|
||||
if(response && response.length){
|
||||
const internalProjects = (response as Array<any>).filter(project=> project.key === 'Internal');
|
||||
const internalProjects = (response as Array<any>).filter(project=> project.key === this._KEY);
|
||||
if(internalProjects && internalProjects.length){
|
||||
return {projectIdentifierExists:true};
|
||||
}
|
||||
|
|
|
@ -1006,8 +1006,8 @@
|
|||
"HINT": "A brief description of what the DMP is about, it’s scope and objectives.",
|
||||
"TYPING": "Type more letters of the name so its more possible to find the correct one.",
|
||||
"UNIQUE-IDENTIFIER": "Unique Identifier",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "A researcher with the given identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "An organisation with the given identifier already exists.",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST":"This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST":"This identifier is already used by an organisation in the organisations list."
|
||||
},
|
||||
|
|
|
@ -1006,8 +1006,8 @@
|
|||
"HINT": "A brief description of what the DMP is about, it’s scope and objectives.",
|
||||
"TYPING": "Type more letters of the name so its more possible to find the correct one.",
|
||||
"UNIQUE-IDENTIFIER": "Unique Identifier",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "A researcher with the given identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "An organisation with the given identifier already exists.",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST":"This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST":"This identifier is already used by an organisation in the organisations list."
|
||||
},
|
||||
|
|
|
@ -1006,8 +1006,8 @@
|
|||
"HINT": "Una breve descripción sobre que trata el PGD, su ámbito y objetivos",
|
||||
"TYPING": "Escriba más letras del nombre para que sea más probable encontrar el correcto",
|
||||
"UNIQUE-IDENTIFIER": "Unique Identifier",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "A researcher with the given identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "An organisation with the given identifier already exists.",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST":"This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST":"This identifier is already used by an organisation in the organisations list."
|
||||
},
|
||||
|
|
|
@ -1006,8 +1006,8 @@
|
|||
"HINT": "Μία σύντομη περιγραφή του τι αφορά το Σχέδιο Διαχείρισης Δεδομένων, του πεδίου εφαρμογής και των στόχων του.",
|
||||
"TYPING": "Προσθέστε περισσότερα γράμματα στο όνομα ώστε να είναι πιο πιθανό να βρείτε το σωστό.",
|
||||
"UNIQUE-IDENTIFIER": "Unique Identifier",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "A researcher with the given identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "An organisation with the given identifier already exists.",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST":"This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST":"This identifier is already used by an organisation in the organisations list."
|
||||
},
|
||||
|
|
|
@ -1006,8 +1006,8 @@
|
|||
"HINT": "Uma breve descrição sobre o tema do PGD, o seu âmbito e objetivos.",
|
||||
"TYPING": "Digite mais letras do nome para que seja possível encontrá-lo mais facilmente.",
|
||||
"UNIQUE-IDENTIFIER": "Unique Identifier",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "A researcher with the given identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "An organisation with the given identifier already exists.",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST":"This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST":"This identifier is already used by an organisation in the organisations list."
|
||||
},
|
||||
|
|
|
@ -1006,8 +1006,8 @@
|
|||
"HINT": "Stručný opis toho, čoho sa DMP týka, jeho rozsah a ciele.",
|
||||
"TYPING": "Napíšte viac písmen názvu, aby bolo možné nájsť správny DMP.",
|
||||
"UNIQUE-IDENTIFIER": "Unique Identifier",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "A researcher with the given identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "An organisation with the given identifier already exists.",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST":"This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST":"This identifier is already used by an organisation in the organisations list."
|
||||
},
|
||||
|
|
|
@ -1006,8 +1006,8 @@
|
|||
"HINT": "Kratki opis Plana sa namenom i ciljevima.",
|
||||
"TYPING": "Unesite još neko slovo da bismo lakše pronašli tačno ime.",
|
||||
"UNIQUE-IDENTIFIER": "Unique Identifier",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "A researcher with the given identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "An organisation with the given identifier already exists.",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST":"This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST":"This identifier is already used by an organisation in the organisations list."
|
||||
},
|
||||
|
|
|
@ -1006,8 +1006,8 @@
|
|||
"HINT": "VYP'nin ne hakkında olduğunun, kapsamının ve hedeflerinin kısa bir açıklaması.",
|
||||
"TYPING": "Doğru olanı bulabilmek için daha fazla harf yazın.",
|
||||
"UNIQUE-IDENTIFIER": "Unique Identifier",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "A researcher with the given identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "An organisation with the given identifier already exists.",
|
||||
"RESEARCHER-IDENTIFIER-EXISTS": "Researcher identifier already exists.",
|
||||
"ORGANISATION-IDENTIFIER-EXSTS": "Organisation identifier already exists.",
|
||||
"IDENTIFIER-EXISTS-RESEARCHER-LIST":"This identifier is already used by a researcher in the researchers list.",
|
||||
"IDENTIFIER-EXISTS-ORGANISATION-LIST":"This identifier is already used by an organisation in the organisations list."
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue