diff --git a/claims/claim-utils/claimHelper.class.ts b/claims/claim-utils/claimHelper.class.ts index d3fb38f4..c9d82250 100644 --- a/claims/claim-utils/claimHelper.class.ts +++ b/claims/claim-utils/claimHelper.class.ts @@ -1,6 +1,7 @@ //Classes used in linking / inlinelinking when selecting an entity import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {OpenaireEntities} from "../../utils/properties/searchFields"; +import {ClaimsProperties} from "./claims.properties"; export class ClaimResult { public source: string; @@ -38,6 +39,12 @@ export class ClaimProject { public fundingLevel0: string; public url: string; } +export class ClaimOrganization { + public name: string; + // public shortName: string; + public url: string; + // public country: string; +} export class ClaimContext { public community: string; @@ -72,6 +79,7 @@ export class ClaimEntity { result: ClaimResult; project: ClaimProject; context: ClaimContext; + organization: ClaimOrganization; constructor() { this.warningMessages = []; @@ -117,7 +125,12 @@ export class ClaimDBContext { title: string; openaireId: string; } - +export class ClaimDBOrganization { + openaireId: string; + name: string; + shortName: string; + country: string; +} export class ClaimDBProject { openaireId: string; name: string; @@ -177,17 +190,18 @@ export class ShowOptions { } - initSelectOptions(){ + initSelectOptions(claimProperties:ClaimsProperties){ let options =[]; if(this.linkToEntities.indexOf('result')!=-1){ options.push({value: 'result',label: OpenaireEntities.RESULTS}) } if(this.linkToEntities.indexOf('project')!=-1){ - options.push({value: 'project',label: OpenaireEntities.PROJECTS}) + options.push({value: 'project',label: claimProperties.SELECT_ENTITIES.projects}) } if(this.linkToEntities.indexOf('context')!=-1){ options.push({value: 'context',label: OpenaireEntities.COMMUNITIES}) } this.selectOptions = options; + console.log(options, claimProperties.SELECT_ENTITIES.projects) } } diff --git a/claims/claim-utils/claimProjectSearchForm.component.html b/claims/claim-utils/claimProjectSearchForm.component.html index 3734b038..cf4806ef 100644 --- a/claims/claim-utils/claimProjectSearchForm.component.html +++ b/claims/claim-utils/claimProjectSearchForm.component.html @@ -1,69 +1,25 @@ -
+
-
+ [options]="showOptions.selectOptions" class="uk-width-medium@xl uk-width-auto">
+
+
-
+
No {{openaireEntities.PROJECT.toLowerCase()}} results yet...
Start searching for {{openaireEntities.PROJECTS.toLowerCase()}} to add them in the Basket
-
+
+
Select funder or search for projects to proceed +
+
+
-
- - +
@@ -104,9 +60,12 @@ role="alert">Service not available
+ role="alert"> + +
+
No projects for funder {{selectedFunder.name}}.
{ + let option = {value : null, label: "No funder selected"}; + this.funderOptions.push(option); + for(let v of data[2][0].values){ + let option = {value : v, label: v.name}; + this.funderOptions.push(option); + } + this.openaireResultsStatus = this.errorCodes.DONE; + }, error =>{ + this.openaireResultsStatus = this.errorCodes.ERROR; + }) + } + funderChanged(value){ + this.keyword = "" + this.selectedFunder = value; + this.isNoProjectFunder = this.selectedFunder && this.selectedFunder.number == 1; + this.openaireResults = []; + if(this.isNoProjectFunder){ + this.showResults = true; + this.search(1,1); + }else{ + this.openaireResults = []; + } + } search(page,size) { - if (this.keyword.length == 0) { + /* if (this.keyword.length == 0) { this.showResults = false; return; - } + }*/ this.showResults = true; this.openaireResults = []; this.openaireResultsStatus = this.errorCodes.LOADING; this.prevFilters = this.filters; //searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any { - this.sub = this._projectService.advancedSearchProjects(this.createOpenaireQueryParams(), page, size, this.properties, (page == 1) ? this.refineFieldsQuery : null, (page == 1) ? this.refineFields : [], this.createOpenaireRefineQuery()).subscribe( + this.sub = this._projectService.advancedSearchProjects(this.createOpenaireQueryParams(), page, size, this.properties, this.createOpenaireRefineQuery(), [], null).subscribe( // this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe( data => { if (data != null) { @@ -91,6 +125,9 @@ export class ClaimProjectsSearchFormComponent { this.openaireResultsStatus = this.errorCodes.NONE; this.filters = this.checkSelectedFilters([], this.prevFilters); } + /* if(this.isNoProjectFunder && this.claimResultsComponent){ + this.claimResultsComponent.add(this.openaireResults[0]) + }*/ } else { this.openaireResultsStatus = this.errorCodes.ERROR; } @@ -102,83 +139,20 @@ export class ClaimProjectsSearchFormComponent { } ); } -// select(entity){ -// if(this.selectedProjects.length > 50){ -// UIkit.notification({ -// message : 'Your basket exceeds the number of allowed projects (50)', -// status : 'warning', -// timeout : 1500, -// pos : 'top-center' -// }); -// return; -// } -// this.query = ""; -// // this.searchTermStream.next(this.query); //clear -// entity = entity.value; -// // var project: ClaimProject = new ClaimProject(); -// // project.funderId = entity.funderId; -// // project.funderName = entity.funderName; -// // project.id = entity.id; -// // project.projectName = entity.projectName; -// // project.projectAcronym = entity.projectAcronym; -// // project.startDate = entity.startDate; -// // project.endDate = entity.endDate; -// // project.code = entity.code; -// // project.jurisdiction = entity.jurisdiction; -// // project.fundingLevel0 = entity.fundingLevel0; -// -// -// var index:number =this.selectedProjects.indexOf(entity); -// var found:boolean = false; -// this.warningMessage = ""; -// -// for (var _i = 0; _i < this.selectedProjects.length; _i++) { -// let project = this.selectedProjects[_i]; -// if(entity.id == project.id){ -// found=true; -// this.warningMessage = "Project already in your basket"; -// } -// } -// -// if (!found) { -// this.selectedProjects.push(entity); -// if(this.selectedProjects != null){ -// localStorage.setItem(this.localStoragePrefix + "projects", JSON.stringify(this.selectedProjects)); -// } -// this.projectSelected.emit({ -// value: true -// }); -// -// } -// } -/* static showItem(item):string{ - return ((item.field[1]['@value'])?item.field[1]['@value']+" - ":"" ) + item.field[3]['@value']; - }*/ - remove(item){ + remove(item){ let index:number =this.selectedProjects.indexOf(item); if (index > -1) { this.selectedProjects.splice(index, 1); } } -/* handleClick(event){ - var clickedComponent = event.target; - var inside = false; - do { - if (clickedComponent === this.elementRef.nativeElement) { - inside = true; - } - clickedComponent = clickedComponent.parentNode; - } while (clickedComponent); - - }*/ - static openaire2ClaimEntity(items, properties:EnvProperties){ + static openaire2ClaimEntity(items, properties:EnvProperties){ const projects: ClaimEntity[] = []; for(const item of items){ const entity: ClaimEntity = new ClaimEntity(); entity.project = new ClaimProject(); entity.project.funderId = item.funderId; - entity.project.funderShortname = item.funderShortname?item.funderShortname:(entity.project.funderId.split("::")[1]); + entity.project.funderShortname = item.funderShortname?item.funderShortname:(entity.project.funderId?entity.project.funderId.split("::")[1]:""); entity.project.funderName = item.funderName; entity.id = item.id; entity.project.url = (item.code !="unidentified") ? properties.searchLinkToProject + entity.id : null; @@ -214,12 +188,6 @@ export class ClaimProjectsSearchFormComponent { } createOpenaireRefineQuery(): string { - /*if(this.startYear.length > 0 ){ - query+='&fq=projectstartyear exact \"'+this.startYear+'\"' - } - if(this.endYear.length > 0 ){ - query+='&fq=projectendyear exact \"'+this.endYear+'\"' - }*/ let allFqs = ""; for (let filter of this.filters) { if (filter.countSelectedValues > 0) { @@ -237,6 +205,12 @@ export class ClaimProjectsSearchFormComponent { } } } + if(this.selectedFunder){ + allFqs += "&fq=" + StringUtils.URIEncode( "funder exact " + (StringUtils.quote(this.selectedFunder.id))); + } + if(!this.isNoProjectFunder || !this.selectedFunder){ + allFqs += '&fq=(projectcode<>"unidentified")' + } for (let i = 0; i < this.rangeFilters.length; i++) { let filter = this.rangeFilters[i]; //selectedFromValue, selectedToValue, equalityOp, equalityOpFrom, equalityOpTo, filterOp ){ diff --git a/claims/claim-utils/claimProjectSearchForm.module.ts b/claims/claim-utils/claimProjectSearchForm.module.ts index 3d2ace89..c81fcd1c 100644 --- a/claims/claim-utils/claimProjectSearchForm.module.ts +++ b/claims/claim-utils/claimProjectSearchForm.module.ts @@ -17,14 +17,15 @@ import {RangeFilterModule} from "../../utils/rangeFilter/rangeFilter.module"; import {AdvancedSearchInputModule} from "../../sharedComponents/advanced-search-input/advanced-search-input.module"; import {InputModule} from "../../sharedComponents/input/input.module"; import {DropdownFilterModule} from "../../utils/dropdown-filter/dropdown-filter.module"; +import {LoadingModule} from "../../utils/loading/loading.module"; @NgModule({ - imports: [ - SharedModule, CommonModule, - // LoadingModalModule, - ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule, HelperModule, - PagingModule, SearchFilterModule, ClaimResultsModule, RangeFilterModule, AdvancedSearchInputModule, InputModule, DropdownFilterModule - ], + imports: [ + SharedModule, CommonModule, + // LoadingModalModule, + ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule, HelperModule, + PagingModule, SearchFilterModule, ClaimResultsModule, RangeFilterModule, AdvancedSearchInputModule, InputModule, DropdownFilterModule, LoadingModule + ], providers:[ ], declarations: [ diff --git a/claims/claim-utils/claimResultSearchForm.component.html b/claims/claim-utils/claimResultSearchForm.component.html index fe0ab300..52664c99 100644 --- a/claims/claim-utils/claimResultSearchForm.component.html +++ b/claims/claim-utils/claimResultSearchForm.component.html @@ -51,7 +51,9 @@
+ role="alert"> + +
Loading...
+ role="alert">
@@ -177,7 +179,7 @@
+
@@ -190,7 +192,7 @@
+ role="alert">
diff --git a/claims/claim-utils/claimResultSearchForm.module.ts b/claims/claim-utils/claimResultSearchForm.module.ts index 63c4e7b9..7be27ea4 100644 --- a/claims/claim-utils/claimResultSearchForm.module.ts +++ b/claims/claim-utils/claimResultSearchForm.module.ts @@ -22,10 +22,11 @@ import {AdvancedSearchInputModule} from "../../sharedComponents/advanced-search- import {InputModule} from "../../sharedComponents/input/input.module"; import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module"; import {DropdownFilterModule} from "../../utils/dropdown-filter/dropdown-filter.module"; +import {LoadingModule} from "../../utils/loading/loading.module"; @NgModule({ imports: [SharedModule, CommonModule, SearchResearchResultsServiceModule, PagingModule, SearchCrossrefServiceModule, - SearchDataciteServiceModule, HelperModule, SearchFilterModule, ClaimResultsModule, MatSelectModule, QuickSelectionsModule, RangeFilterModule, ClaimProjectsSearchFormModule, AdvancedSearchInputModule, InputModule, SearchInputModule, DropdownFilterModule], + SearchDataciteServiceModule, HelperModule, SearchFilterModule, ClaimResultsModule, MatSelectModule, QuickSelectionsModule, RangeFilterModule, ClaimProjectsSearchFormModule, AdvancedSearchInputModule, InputModule, SearchInputModule, DropdownFilterModule, LoadingModule], providers:[ SearchOrcidService ], diff --git a/claims/claim-utils/claims.properties.ts b/claims/claim-utils/claims.properties.ts new file mode 100644 index 00000000..d1c10c5a --- /dev/null +++ b/claims/claim-utils/claims.properties.ts @@ -0,0 +1,23 @@ +export class ClaimsProperties{ + ALLOW_ORGANIZATION_LINKING:boolean = false; + SELECT_ENTITIES = { + projects:"Funding" + } + INLINE_ENTITY = { + show: true, + guideText : null + } + BASKET ={ + source_title: "Source", + target_title: "Link source to" + } + METADATA_PREVIEW ={ + source_title: "Source", + target_title: "Link to", + edit_source_title: "Edit", + edit_target_title: "Edit", + edit_target_icon: "edit" + } + + +} diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html index 94034a2e..8aa09cae 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/claims/claim-utils/displayClaims/displayClaims.component.html @@ -1,25 +1,27 @@
-
+
-
+
-
-
+
-
+
+
+ Mine +
@@ -43,6 +45,7 @@ type="select" [options]="sortOptions">
+
diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index 8fd1f4ee..9e9e4648 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -40,7 +40,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { page: number = 1; size: number = 50; keyword: string; // the keyword string to give to the request as parameter - types = ["All", "Project", "Context", "Result", "User"]; + types = ["All", "Project", "Context", "Result", "User", "Organization"]; loading: boolean = false; @Input() fetchBy: string; @Input() fetchId: string; @@ -53,6 +53,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { public filterForm: FormGroup; public entities: string[] = []; selected = []; + mine = false; allOptions: Option[] = [ {label: OpenaireEntities.PUBLICATIONS, value: "publication"}, @@ -133,6 +134,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { this.fetchId = this.fetchId ? this.fetchId : ''; } let page = (params['page'] === undefined) ? 1 : +params['page']; + this.mine = (params['mine'] == 'true' ? true:false); this.keyword = (params['keyword'] ? params['keyword'] : ""); this.filterForm.get('keyword').setValue(this.keyword); this.page = (page <= 0) ? 1 : page; @@ -186,6 +188,16 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId); } ); + } else if (this.fetchBy == "Organization") { + this.subResults = this._claimService.getClaimsByOrganization(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe( + data => { + this.manageAPIData(data); + this.loading = false; + }, + err => { + this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId); + } + ); } else if (this.fetchBy == "User") { this.subResults = this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( data => { @@ -209,7 +221,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { } ); } else if (this.fetchBy == "Context") { - this.subResults = this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + this.subResults = this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe( data => { this.manageAPIData(data); this.loading = false; @@ -220,7 +232,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { } ); } else { - this.subResults = this._claimService.getClaims(this.size, this.page, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + this.subResults = this._claimService.getClaims(this.size, this.page, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe( data => { this.manageAPIData(data); this.loading = false; @@ -259,15 +271,8 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { types += (types.length > 0 ? ',' : '') + type; } params += (this.entities.length > 0) ? (params.length > 0 ? '&' : '') + "types=" + types : ""; - if (this.isAdmin) { - params += (this.fetchBy == 'All' ? "" : (params.length > 0 ? '&' : '') + "fetchBy=" + this.fetchBy); - params += (this.fetchId == '' ? "" : (params.length > 0 ? '&' : '') + "fetchId=" + this.fetchId); - } params += (this.filterForm.get("sort").value.sort == 'date' && this.filterForm.get("sort").value.descending ? "" : (params.length > 0 ? '&' : '') + "sort=" + this.filterForm.get("sort").value.sort + "-" + this.filterForm.get("sort").value.descending); params += (this.keyword == '' ? "" : (params.length > 0 ? '&' : '') + "keyword=" + this.keyword); - if (this.communityId != null) { - params += "&communityId=" + this.communityId; - } return params; } diff --git a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts index 547e4c16..b1571d34 100644 --- a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts @@ -1,6 +1,6 @@ import {Component, Input} from '@angular/core'; import {EnvProperties} from '../../../utils/properties/env-properties'; -import {ClaimDBContext, ClaimDBProject, ClaimDBResult} from "../claimHelper.class"; +import {ClaimDBContext, ClaimDBOrganization, ClaimDBProject, ClaimDBResult} from "../claimHelper.class"; import {OpenaireEntities} from "../../../utils/properties/searchFields"; import {StringUtils} from "../../../utils/string-utils.class"; @@ -26,6 +26,10 @@ import {StringUtils} from "../../../utils/string-utils.class";
+
+ Link to: + +
Link to:
@@ -36,7 +40,7 @@ import {StringUtils} from "../../../utils/string-utils.class"; }) export class ClaimEntityFormatter { - @Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject; + @Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject | ClaimDBOrganization; @Input() type: string; @Input() properties: EnvProperties; @Input() externalPortalUrl: string = null; diff --git a/claims/claim-utils/entityFormatter/claimEntityFormatter.module.ts b/claims/claim-utils/entityFormatter/claimEntityFormatter.module.ts index 620c7f1b..a14f1e27 100644 --- a/claims/claim-utils/entityFormatter/claimEntityFormatter.module.ts +++ b/claims/claim-utils/entityFormatter/claimEntityFormatter.module.ts @@ -5,18 +5,19 @@ import { RouterModule } from '@angular/router'; import {ProjectTitleFormatter} from './projectTitleFormatter.component'; import {PublicationTitleFormatter} from './publicationTitleFormatter.component'; import {ClaimEntityFormatter} from './claimEntityFormatter.component'; +import {OrganizationTitleFormatterComponent} from "./organizationTitleFormatter.component"; @NgModule({ imports: [ CommonModule, RouterModule ], declarations: [ - ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter + ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter, OrganizationTitleFormatterComponent ], providers: [ ], exports: [ - ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter + ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter, OrganizationTitleFormatterComponent ] }) diff --git a/claims/claim-utils/entityFormatter/organizationTitleFormatter.component.ts b/claims/claim-utils/entityFormatter/organizationTitleFormatter.component.ts new file mode 100644 index 00000000..4160eac6 --- /dev/null +++ b/claims/claim-utils/entityFormatter/organizationTitleFormatter.component.ts @@ -0,0 +1,18 @@ +import {Component, Input} from '@angular/core'; + +@Component({ + selector: 'organization-title', + template: ` +
+

+ {{(organization.shortName ? ('[' + organization.shortName + '] ') : '')}}{{organization.name}} +

+
+ ` +}) + +export class OrganizationTitleFormatterComponent { + @Input() organization: any; + public url: string; + +} diff --git a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts index 14ee0e60..75013234 100644 --- a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts @@ -10,10 +10,10 @@ import {properties} from "../../../../../environments/environment";

- + {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} - + {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}

diff --git a/claims/claim-utils/service/claims.service.ts b/claims/claim-utils/service/claims.service.ts index d7d46218..54208d7b 100644 --- a/claims/claim-utils/service/claims.service.ts +++ b/claims/claim-utils/service/claims.service.ts @@ -12,8 +12,8 @@ export class ClaimsService { private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any { return this.http.get(url, CustomOptions.getAuthOptionsWithBody()); } - getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any { - let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); + getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string, mine:boolean):any { + let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types) + (mine?"&mine=true":"") + (mine?"&mine=true":""); return this.getClaimRequest(size,page,url,true); } @@ -23,7 +23,7 @@ export class ClaimsService { return this.getClaimRequest(size,page,url,false); } - getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string , apiUrl:string):any { + getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string , apiUrl:string, mine:boolean):any { //console.info('ClaimsService: getClaims for context : '+contextId); let url = apiUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); return this.getClaimRequest(size,page,url,true); @@ -40,6 +40,10 @@ export class ClaimsService { let url = apiUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); return this.getClaimRequest(size,page,url,true); } + getClaimsByOrganization( size : number, page : number, organizationId:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string, mine:boolean):any { + let url = apiUrl +"organizations/"+organizationId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types) + (mine?"&mine=true":""); + return this.getClaimRequest(size,page,url,true); + } deleteClaimById(claimId:string , apiUrl:string):any{ //console.warn('Trying to delete claim with id : '+claimId); diff --git a/claims/directLinking/directLinking.component.html b/claims/directLinking/directLinking.component.html index e05bc3a3..f34e2c57 100644 --- a/claims/directLinking/directLinking.component.html +++ b/claims/directLinking/directLinking.component.html @@ -1,6 +1,6 @@ + pageTitle="Direct Linking" [claimsProperties]="claimsProperties">
diff --git a/claims/directLinking/directLinking.component.ts b/claims/directLinking/directLinking.component.ts index 70d46032..f84b0e59 100644 --- a/claims/directLinking/directLinking.component.ts +++ b/claims/directLinking/directLinking.component.ts @@ -1,7 +1,7 @@ import {Component, Input, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {EnvProperties} from '../../utils/properties/env-properties'; -import {ClaimEntity, ClaimProject, ShowOptions} from '../claim-utils/claimHelper.class'; +import {ClaimEntity, ClaimOrganization, ClaimProject, ShowOptions} from '../claim-utils/claimHelper.class'; import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service'; import {SearchResearchResultsService} from '../../services/searchResearchResults.service'; import {LinkingGenericComponent} from "../linking/linkingGeneric.component"; @@ -11,6 +11,7 @@ import {properties} from "../../../../environments/environment"; import {OpenaireEntities} from "../../utils/properties/searchFields"; import {StringUtils} from "../../utils/string-utils.class"; import {ClaimProjectsSearchFormComponent} from "../claim-utils/claimProjectSearchForm.component"; +import {ClaimsProperties} from "../claim-utils/claims.properties"; @Component({ @@ -24,18 +25,20 @@ export class DirectLinkingComponent { // linkType: string = "project"; // link type (selected in home page) : project, context, software, etc /* url Parameters for inline linking */ - id: string = null; //entity id + @Input() id: string = null; //entity id type: string = null; // entity type (publication or dataset) // linkTo: string = null; // entity type (project or context or entity) // linkToEntities: string[] = []; showOptions:ShowOptions = new ShowOptions(); - validEntityTypes = ["dataset", "publication", "software", "other", "project", "context"]; + validEntityTypes = ["dataset", "publication", "software", "other", "project", "context", "organization"]; sources: ClaimEntity[] = []; inlineEntity: ClaimEntity = null; validInput: boolean = null;//'true; properties: EnvProperties; @Input() communityId: string = null; localStoragePrefix: string = ""; + @Input() organizationClaim: boolean = false; + @Input() claimsProperties:ClaimsProperties = new ClaimsProperties(); constructor(private _router: Router, private route: ActivatedRoute,private entitySearch:EntitiesSearchService, private _searchResearchResultsService: SearchResearchResultsService) {} subscriptions = []; @@ -48,11 +51,18 @@ export class DirectLinkingComponent { } ngOnInit() { this.properties = properties; - + /* if(!this.claimsProperties){ + this.claimsProperties = new ClaimsProperties(); + }*/ this.subscriptions.push(this.route.queryParams.subscribe(params => { - this.id = params['id']; - this.type = params['type']; - this.showOptions.linkTo = params['linkTo']; + if(this.organizationClaim){ + this.type = "organization"; + this.showOptions.linkTo = "result"; + }else { + this.id = params['id']; + this.type = params['type']; + this.showOptions.linkTo = params['linkTo']; + } if (this.type != null && this.showOptions.linkTo != null) { this.type = (this.validEntityTypes.indexOf(this.type) != -1) ? this.type : 'publication'; this.showOptions.linkTo = (this.validEntityTypes.indexOf(this.showOptions.linkTo) != -1 || this.showOptions.linkTo == "result") ? this.showOptions.linkTo : 'project'; @@ -68,6 +78,8 @@ export class DirectLinkingComponent { if (this.type == "project") { // this.linkType = "project"; this.getProjectById(this.id); + } else if (this.type == "organization") { + this.getOrganizationById(this.id); } else if (this.type == "publication") { this.getResearchResultById("publication", this.id); } else if (this.type == "dataset") { @@ -81,7 +93,7 @@ export class DirectLinkingComponent { } //set which entities it is allowed to link to. // add first the - if(this.type == "project"){ + if(this.type == "project" || this.type == "organization"){ this.showOptions.linkToEntities = ["result"]; this.showOptions.linkTo = "result"; }else{ @@ -95,24 +107,27 @@ export class DirectLinkingComponent { this.showOptions.linkToEntities = ["result","project","context" ]; } + } + + } else { + this.validInput = this.isValidInput(null); + } - } else { - this.validInput = this.isValidInput(null); + })); - } - - })); } isValidInput(result: ClaimEntity) { if (result == null) { return false; - } else if (this.type == "project" && this.showOptions.linkTo != "result") { + } else if (this.type == "organization" && !this.claimsProperties.ALLOW_ORGANIZATION_LINKING) { + return false; + } else if ((this.type == "project" || this.type == "organization") && this.showOptions.linkTo != "result") { return false; } else if (["dataset", "publication", "software", "other"].indexOf(this.type) != -1 && (["project", "context", "result"].indexOf(this.showOptions.linkTo) == -1)) { return false; - } else if (["project", "dataset", "publication", "software", "other"].indexOf(this.type) == -1) { + } else if (["project", "dataset", "publication", "software", "other", "organization"].indexOf(this.type) == -1) { return false; } else { return true; @@ -130,6 +145,17 @@ export class DirectLinkingComponent { this.handleError("Error getting project by id: " + id, err); })); } + getOrganizationById(id: string) { + this.subscriptions.push(this.entitySearch.fetchByType(id,"organization", this.properties).subscribe( + data => { + this.createClaimEntity(data, "organization"); + }, + err => { + this.validInput = this.isValidInput(null); + //console.log("An error occured") + this.handleError("Error getting project by id: " + id, err); + })); + } getResearchResultById(resultType: string, id: string) { this.subscriptions.push(this._searchResearchResultsService.searchById(resultType, id, this.properties).subscribe(data => { @@ -162,7 +188,17 @@ export class DirectLinkingComponent { entity.project.jurisdiction = project.jurisdiction; entity.project.startDate = project.startDate; this.inlineEntity = entity; - }else{ + }else if(type =="organization"){ + let organization = data[0]; + let entity:ClaimEntity = new ClaimEntity(); + entity.id = organization.id; + entity.type = "organization"; + entity.title = organization.label; + entity.organization = new ClaimOrganization(); + // entity.organization.url = properties.searchLinkToOrganization + entity.id; + entity.organization.name = organization.label; + this.inlineEntity = entity; + }else{ results = ClaimResultSearchFormComponent.openaire2ClaimResults(data, this.properties); } diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index 0cf983e5..4aebe5f3 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -176,7 +176,7 @@ export class ClaimInsertComponent { "id": entity.id, "record": ClaimInsertComponent.createDirectClaim(entity, this.sources, idSuffix) }); - } else if (this.inlineEntity) { + } else if (this.inlineEntity && this.inlineEntity.type != "organization") { directclaims.push({ "id": entity.id, "record": ClaimInsertComponent.createDirectClaim(entity, [this.inlineEntity], idSuffix) @@ -193,6 +193,8 @@ export class ClaimInsertComponent { claims.push(ClaimInsertComponent.createContextClaim(result, entity, user.email, dashboard, idSuffix)); } else if (entity.project) { claims.push(ClaimInsertComponent.createProjectClaim(result, entity, user.email, dashboard, idSuffix)); + /* } else if (entity.organization) { + claims.push(ClaimInsertComponent.createOrganizationClaim(result, entity, user.email, dashboard, idSuffix));*/ } this.infoToLog.push([ result.title?result.title: result.id, entity.title?entity.title:entity.id]); @@ -212,6 +214,10 @@ export class ClaimInsertComponent { if (entity.result) { claims.push(ClaimInsertComponent.createProjectClaim(entity, this.inlineEntity, user.email, dashboard, idSuffix)); } + } else if (this.inlineEntity.organization) { + if (entity.result) { + claims.push(ClaimInsertComponent.createOrganizationClaim(entity, this.inlineEntity, user.email, dashboard, idSuffix)); + } } } @@ -385,8 +391,13 @@ export class ClaimInsertComponent { localStorage.removeItem(this.localStoragePrefix + "results"); localStorage.removeItem(this.localStoragePrefix + "claimsJob"); localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob"); - - this._router.navigate([this.properties.myClaimsLink], {queryParams: this.params}); + if(this.properties.myClaimsLink && this.properties.myClaimsLink.indexOf(".") == -1) { + this._router.navigate([this.properties.myClaimsLink], {queryParams: this.params}); + }else if(this.properties.myClaimsLink && this.properties.myClaimsLink.indexOf(".") != -1) { + this._router.navigate([this.properties.myClaimsLink], {relativeTo: this.route}); + }else{ + this._router.navigate(["/"]); + } } } @@ -426,6 +437,23 @@ export class ClaimInsertComponent { idSuffix : idSuffix }; } + private static createOrganizationClaim(resultEntity: ClaimEntity, organizationEntity: ClaimEntity, user: any, dashboard:string, idSuffix:string): ClaimRecord2Insert { + return { + claimedBy: user, + sourceId: organizationEntity.id, + sourceType: "organization", + sourceCollectedFrom: "openaire", + sourceAccessRights: "OPEN", + sourceEmbargoEndDate: "", + targetId: resultEntity.id, + targetType: resultEntity.type, + targetCollectedFrom: resultEntity.result.source, + targetAccessRights: resultEntity.result.accessRights, + targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity), + claimedInDashboard : dashboard, + idSuffix : idSuffix + }; + } private static createResultClaim(inlineResult: ClaimEntity, resultEntity: ClaimEntity, user: string, dashboard:string, idSuffix:string): ClaimRecord2Insert { diff --git a/claims/linking/linkingGeneric.component.html b/claims/linking/linkingGeneric.component.html index 16cb04bf..625d75d0 100644 --- a/claims/linking/linkingGeneric.component.html +++ b/claims/linking/linkingGeneric.component.html @@ -67,18 +67,19 @@ [results]="results" [sources]="sources" [localStoragePrefix]="localStoragePrefix" [inlineEntity]="inlineEntity" [showOptions]="showOptions" [properties]=properties [pageContents]="pageContents" - [defaultColors]="!communityId" [communityId]="communityId" + [defaultColors]="!communityId" [communityId]="communityId" [claimsProperties]="claimsProperties" >
-
+
-

Link source to

+

Link source to

+
{{claimsProperties.INLINE_ENTITY.guideText}}
-
-
Source
+
+
{{claimsProperties.BASKET.source_title}}
-

+

-
Link source to ({{(results.length) | number}})
+
{{claimsProperties.BASKET.target_title}} ({{(results.length) | number}})
diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index 31b76062..229fb9de 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -18,6 +18,7 @@ import {RouterHelper} from "../../utils/routerHelper.class"; import { Location } from '@angular/common'; import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; import {UserManagementService} from "../../services/user-management.service"; +import {ClaimsProperties} from "../claim-utils/claims.properties"; @Component({ selector: 'linking-generic', @@ -41,7 +42,7 @@ export class LinkingGenericComponent { // show linkToEntities /values: result, project, context @Input() sources:ClaimEntity[] =[]; - properties:EnvProperties; + properties:EnvProperties = properties; public openaireEntities = OpenaireEntities; @Input() localStoragePrefix:string = "linking_"; url=null; @@ -49,7 +50,7 @@ export class LinkingGenericComponent { public pageContents = null; @Input() breadcrumbs: Breadcrumb[] = []; public routerHelper: RouterHelper = new RouterHelper(); - + @Input() claimsProperties:ClaimsProperties = new ClaimsProperties(); constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, private _meta: Meta, private _title: Title, private _piwikService:PiwikService, private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef, @@ -58,6 +59,9 @@ export class LinkingGenericComponent { subscriptions = []; ngOnInit() { + /* if(!this.claimsProperties){ + this.claimsProperties = new ClaimsProperties(); + }*/ this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { if (!user) { this.saveStateAndRedirectLogin(); @@ -68,14 +72,13 @@ export class LinkingGenericComponent { this.breadcrumbs.push({name: "Link", route: null}); } this.showOptions.show = 'source'; - this.showOptions.initSelectOptions(); + this.showOptions.initSelectOptions(this.claimsProperties); if(this.inlineEntity){ this.showOptions.showLinkTo(); // this.showOptions.basketShowLinksTo = true; this.showOptions.show = this.showOptions.linkTo; } - this.properties = properties; this.url = this.properties.domain + this.properties.baseLink+this._router.url; var description = "Linking is a functionality provided by OpenAIRE, in order to link research results with a project, a research community or other research results."; diff --git a/claims/linking/selected/ClaimEntitiesMetadata.module.ts b/claims/linking/selected/ClaimEntitiesMetadata.module.ts index 444f3f9f..c4116c3c 100644 --- a/claims/linking/selected/ClaimEntitiesMetadata.module.ts +++ b/claims/linking/selected/ClaimEntitiesMetadata.module.ts @@ -3,13 +3,21 @@ import {SharedModule} from '../../../../openaireLibrary/shared/shared.module'; import {ClaimEntityTitleComponent} from "./ClaimEntityTitle.component"; import {ClaimEntityResultMetadataComponent} from "./ClaimEntityResultMetadata.component"; import {ClaimEntityProjectMetadataComponent} from "./ClaimEntityProjectMetadata.component"; +import {IconsService} from "../../../utils/icons/icons.service"; +import {coins} from "../../../utils/icons/icons"; +import {IconsModule} from "../../../utils/icons/icons.module"; @NgModule({ imports: [ - SharedModule + SharedModule, + IconsModule ], declarations: [ ClaimEntityTitleComponent, ClaimEntityResultMetadataComponent, ClaimEntityProjectMetadataComponent ], exports:[ ClaimEntityTitleComponent, ClaimEntityResultMetadataComponent, ClaimEntityProjectMetadataComponent] }) -export class ClaimEntitiesMetadataModule { } +export class ClaimEntitiesMetadataModule { + constructor(private _iconsService:IconsService) { + this._iconsService.registerIcons([coins]) + } +} diff --git a/claims/linking/selected/ClaimEntityProjectMetadata.component.ts b/claims/linking/selected/ClaimEntityProjectMetadata.component.ts index 229ebeca..1d51a233 100644 --- a/claims/linking/selected/ClaimEntityProjectMetadata.component.ts +++ b/claims/linking/selected/ClaimEntityProjectMetadata.component.ts @@ -8,20 +8,28 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; -
+ + funder + + +
+
-
- Funder: {{entity.project.funderName?entity.project.funderName:entity.project.funderShortname}} -
-
+
Project Code: {{entity.project.code}} -
+
+
+ Funding: {{entity.project.funderName?entity.project.funderName:entity.project.funderShortname}} +
+
`, diff --git a/claims/linking/selected/ClaimEntityTitle.component.ts b/claims/linking/selected/ClaimEntityTitle.component.ts index 12231e53..ab5a8db8 100644 --- a/claims/linking/selected/ClaimEntityTitle.component.ts +++ b/claims/linking/selected/ClaimEntityTitle.component.ts @@ -5,16 +5,18 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; selector: 'claim-title', template: `
- - - insert_drive_file - - - assignment_turned_in - - - people - + + + + + + + + + + + +
@@ -27,7 +29,15 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; {{entity.title ? sliceString(entity.title) : '[No title available]'}} - + + + {{(entity.project.funderShortname ? '[' + entity.project.funderShortname + '] ' : '') + entity.project.funderName}} + + + {{sliceString(entity.project.funderName)}} + + + @@ -46,6 +56,9 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; + + {{sliceString(entity.title)}} + {{entity.context.community }} > {{entity.context.category}} > diff --git a/claims/linking/selected/metadataPreview.component.html b/claims/linking/selected/metadataPreview.component.html index a0723118..9a6dd093 100644 --- a/claims/linking/selected/metadataPreview.component.html +++ b/claims/linking/selected/metadataPreview.component.html @@ -6,15 +6,14 @@
-
+
-
+
-
- LINK TO ({{results.length | number}}) +
+ {{claimsProperties.METADATA_PREVIEW.target_title}} ({{results.length | number}}) +
diff --git a/claims/linking/selected/metadataPreview.component.ts b/claims/linking/selected/metadataPreview.component.ts index 8aedd081..cd2ce799 100644 --- a/claims/linking/selected/metadataPreview.component.ts +++ b/claims/linking/selected/metadataPreview.component.ts @@ -4,6 +4,7 @@ import {ClaimEntity, ClaimsErrorMessage, Message, ShowOptions} from '../../claim import {EnvProperties} from "../../../utils/properties/env-properties"; import {Dates} from "../../../utils/string-utils.class"; import {HelperFunctions} from "../../../utils/HelperFunctions.class"; +import {ClaimsProperties} from "../../claim-utils/claims.properties"; @Component({ selector: 'metadata-preview', @@ -28,6 +29,7 @@ export class MetadataPreviewComponent { @ViewChild(AlertModal) alertApplyAll; @Input() localStoragePrefix: string = ""; @Input() communityId:string= null; + @Input() claimsProperties:ClaimsProperties; errors:ClaimsErrorMessage[] = []; warnings:Message[] = []; public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every entity diff --git a/claims/linking/selected/metadataPreview.module.ts b/claims/linking/selected/metadataPreview.module.ts index 2c7fdb17..7e414381 100644 --- a/claims/linking/selected/metadataPreview.module.ts +++ b/claims/linking/selected/metadataPreview.module.ts @@ -11,16 +11,17 @@ import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; import {HelperModule} from "../../../utils/helper/helper.module"; import {SelectedPublicationsModule} from "./selectedResults.module"; +import {IconsModule} from "../../../utils/icons/icons.module"; @NgModule({ - imports: [ - SharedModule, - AlertModalModule, - ClaimEntitiesMetadataModule, - InsertClaimsModule, - MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatSelectModule, - HelperModule, SelectedPublicationsModule - ], + imports: [ + SharedModule, + AlertModalModule, + ClaimEntitiesMetadataModule, + InsertClaimsModule, + MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatSelectModule, + HelperModule, SelectedPublicationsModule, IconsModule + ], declarations: [MetadataPreviewComponent], exports:[MetadataPreviewComponent] }) diff --git a/dashboard/menu/menu.component.ts b/dashboard/menu/menu.component.ts index abf77901..11914b6c 100644 --- a/dashboard/menu/menu.component.ts +++ b/dashboard/menu/menu.component.ts @@ -370,8 +370,10 @@ export class MenuComponent implements OnInit { } public valueChange() { + this.elements.disable(); this.cdr.detectChanges(); this.elements.init(); + this.elements.enable(); } public get displayMenuItems() { diff --git a/dashboard/users/role-users/role-users.component.html b/dashboard/users/role-users/role-users.component.html index 88befe57..e4a39cc3 100644 --- a/dashboard/users/role-users/role-users.component.html +++ b/dashboard/users/role-users/role-users.component.html @@ -8,16 +8,16 @@
+ [searchControl]="filterForm.get('active')" [expandable]="true" [placeholder]="'Search ' + roleUtils.roles[role] + 's'" searchInputClass="outer">
@@ -27,7 +27,7 @@ [attr.uk-tooltip]="inviteDisableMessage" [class.uk-disabled]="loadPending || loadPending" [disabled]="loadActive || loadPending || !!inviteDisableMessage" (click)="openInviteModal()"> - Invite {{stakeholderUtils.roles[role]}} + Invite {{roleUtils.roles[role]}}
-
+ +
-
+ @@ -137,10 +223,16 @@ class="uk-link-text" [innerHTML]="highlightKeyword(subItem.id)">
-
+
+ +
+ + +
diff --git a/fos/fos.component.ts b/fos/fos.component.ts index 3065b2c0..e86317ea 100644 --- a/fos/fos.component.ts +++ b/fos/fos.component.ts @@ -16,6 +16,7 @@ import {debounceTime, distinctUntilChanged} from "rxjs/operators"; import Timeout = NodeJS.Timeout; import {ISVocabulariesService} from "../utils/staticAutoComplete/ISVocabularies.service"; import {SearchFields} from "../utils/properties/searchFields"; +import {HelperFunctions} from "../utils/HelperFunctions.class"; declare var UIkit; @@ -28,6 +29,8 @@ export class FosComponent implements OnInit, OnDestroy { public url: string = null; public pageTitle: string = "OpenAIRE | Fields of Science"; public pageDescription: string = "We have integrated a Field-of-Science (FoS) taxonomy into our dataset to organize and discover research more effectively. Using the full capabilities of the OpenAIRE Graph (full-texts, citations, references, venues) we apply AI and bring forward any multidisciplinarity potential."; + public scrollPos = 0; + public selectedParentLevels = []; public fos: any[] = []; public fosOptions: string[] = []; public activeSection: string; @@ -82,21 +85,43 @@ export class FosComponent implements OnInit, OnDestroy { item.classList.remove('uk-active'); }); if (this.route.snapshot.fragment) { - this.activeSection = this.route.snapshot.fragment; - let i = this.fos.findIndex(item => item.id == this.route.snapshot.fragment); - slider.show(i); + let splitFragment = this.route.snapshot.fragment.split("||"); + this.activeSection = this.route.snapshot.fragment.split("||")[0]; + let i = this.fos.findIndex(item => (item.id == this.route.snapshot.fragment || this.route.snapshot.fragment.startsWith(item.id+"||"))); + if(i <0 || i>this.fos.length-1) { + this._router.navigate(['./'], {fragment: "", relativeTo: this.route, state: {disableScroll: true}}); + } else { + if (splitFragment.length > 1) { + let level1 = this.fos[i]; + let level2 = null; + let level3 = null; + if (level1.children) { + level2 = level1.children.find(item => item.code == splitFragment[1]); + if (level2 && level2.children) { + level3 = level2.children.find(item => item.code == splitFragment[2]); + this.selectedParentLevels = [this.fos[i], level2, level3]; + } + } + if(!level2 || !level3) { + this._router.navigate(['./'], {fragment: level1.id, relativeTo: this.route, state: {disableScroll: true}}); + } + } else { + slider.show(i); + } + } } else { this.activeSection = this.fos[0].id; } this.cdr.detectChanges(); }); } + this.subscriptions.push(this.route.fragment.subscribe(fragment => { if(fragment) { - this.activeSection = fragment; + this.activeSection = fragment.split("||")[0]; if(this.tabs) { let slider = UIkit.slider(this.tabs.nativeElement); - let i = this.fos.findIndex(item => item.id == fragment); + let i = this.fos.findIndex(item => (item.id == fragment || fragment.startsWith(item.id+"||"))); slider.show(i); } } else { @@ -105,13 +130,16 @@ export class FosComponent implements OnInit, OnDestroy { })); this.keywordControl = this.fb.control(''); this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => { - this.keyword = value; - this.findMatches(this.keyword); - if (typeof IntersectionObserver !== 'undefined') { - setTimeout(() => { - this.setObserver(); - }); - } + if(this.keyword !== undefined || value) { + this.selectedParentLevels = []; + } + this.keyword = value; + this.findMatches(this.keyword); + if (typeof IntersectionObserver !== 'undefined') { + setTimeout(() => { + this.setObserver(); + }); + } })); }); } @@ -154,11 +182,16 @@ export class FosComponent implements OnInit, OnDestroy { this.fos.forEach(fos => { this.fosOptions.push(fos.id); if(fos.children) { - fos.children.forEach(child => { - this.fosOptions.push(child.id); - if(child.children) { - child.children.forEach(child2 => { - this.fosOptions.push(child2.id); + fos.children.forEach(l2 => { + this.fosOptions.push(l2.id); + if(l2.children) { + l2.children.forEach(l3 => { + this.fosOptions.push(l3.id); + if(l3.children) { + l3.children.forEach(l4 => { + this.fosOptions.push(l4.id); + }) + } }); } }); @@ -170,19 +203,29 @@ export class FosComponent implements OnInit, OnDestroy { this.viewResults = JSON.parse(JSON.stringify(this.fos)); let matchLevel1: boolean = false; let matchLevel2: boolean = false; + let matchLevel3: boolean = false; // 1st level search if(this.viewResults.length) { this.viewResults = this.viewResults.filter(item => { matchLevel1 = !!item.id.includes(value?.toLowerCase()); - // // 2nd level search + // 2nd level search if(item.children?.length && !matchLevel1) { item.children = item.children.filter(subItem => { matchLevel2 = !!subItem.id.includes(value?.toLowerCase()); // 3rd level search if(subItem.children?.length && !matchLevel2) { - subItem.children = subItem.children.filter(subSubItem => subSubItem.id.includes(value?.toLowerCase())); + subItem.children = subItem.children.filter(subSubItem => { + matchLevel3 = subSubItem.id.includes(value?.toLowerCase()); + // 4th level search + if(subSubItem.children?.length && !matchLevel3) { + subSubItem.children = subSubItem.children.filter(level4Item => { + return level4Item.id.toLowerCase().includes(value?.toLowerCase()) + }); + } + return subSubItem.children?.length > 0 || matchLevel3; + }); } - return subItem.children?.length > 0 || matchLevel2; + return subItem.children?.length > 0; }); } return item.children?.length > 0; @@ -191,7 +234,7 @@ export class FosComponent implements OnInit, OnDestroy { } highlightKeyword(name) { - if(name.includes(this.keyword.toLowerCase())) { + if(name.toLowerCase().includes(this.keyword.toLowerCase())) { return name.replace(new RegExp(this.keyword, "gi"), (matchedValue) => `${matchedValue}`); } else { return name; @@ -221,4 +264,41 @@ export class FosComponent implements OnInit, OnDestroy { // return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}; return (this.searchFieldsHelper.getFosParameter() == 'foslabel' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)})); } + + public backClicked() { + let id = this.selectedParentLevels[0].id; + this.selectedParentLevels=[]; + this.cdr.detectChanges(); + + if(this.scrollPos) { + HelperFunctions.scrollTo(0, this.scrollPos); + this._router.navigate(['./'], {fragment: id, relativeTo: this.route, state: {disableScroll: true}}); + } else { + this._router.navigate(['./'], { + fragment: id, + relativeTo: this.route, + state: {disableScroll: false, behavior: 'auto'} + }); + } + + this.cdr.detectChanges(); + if (typeof IntersectionObserver !== 'undefined') { + setTimeout(() => { + this.setObserver(); + }, 200); + } + } + + public moreClicked(level1, level2, level3) { + this.scrollPos = window.scrollY; + + if(this.observer) { + this.observer.disconnect(); + } + this.selectedParentLevels=[level1, level2, level3]; + this.cdr.detectChanges(); + this._router.navigate(['./'], + {fragment: this.selectedParentLevels[0].id+"||"+this.selectedParentLevels[1].code+"||"+this.selectedParentLevels[2].code, + relativeTo: this.route, state: {disableScroll: false, behavior: 'auto'}}); + } } diff --git a/landingPages/dataProvider/relatedDatasourcesTab.component.ts b/landingPages/dataProvider/relatedDatasourcesTab.component.ts index c8b1b25d..8c7662ad 100644 --- a/landingPages/dataProvider/relatedDatasourcesTab.component.ts +++ b/landingPages/dataProvider/relatedDatasourcesTab.component.ts @@ -17,8 +17,8 @@ import {OpenaireEntities} from "../../utils/properties/searchFields";
-
- *Only top 100 {{openaireEntities.DATASOURCES}} that host {{openaireEntities.RESULTS}} which are also available via the Federated Research Data Repository are shown. +
+ *Only top 100 {{openaireEntities.DATASOURCES}} that host {{openaireEntities.RESULTS}} which are also available via {{collectedFromName}} are shown.
-

-
+

+
+
diff --git a/landingPages/landing-utils/entity-metadata.component.ts b/landingPages/landing-utils/entity-metadata.component.ts index d27eb26e..42e74781 100644 --- a/landingPages/landing-utils/entity-metadata.component.ts +++ b/landingPages/landing-utils/entity-metadata.component.ts @@ -159,7 +159,7 @@ import {RouterHelper} from "../../utils/routerHelper.class"; {{showInline ? projectNames.join(', ') : projectNames.slice(0, projectsLimit).join(', ')}} - +{{projects.length - projectsLimit | number}} projects + +{{projects.length - projectsLimit | number}}{{projects.length == 1000 ? ' more' : ''}} projects @@ -173,7 +173,7 @@ import {RouterHelper} from "../../utils/routerHelper.class"; {{showInline ? organizationNames.join(', ') : organizationNames.slice(0, organizationsLimit).join(', ')}} - +{{organizations.length - organizationsLimit | number}} partners + +{{organizations.length - organizationsLimit | number}}{{organizations.length == 1000 ? ' more' : ''}} partners @@ -197,6 +197,7 @@ import {RouterHelper} from "../../utils/routerHelper.class"; +
Only 1000 Partners of {{resultTitle}} are shown here.
@@ -207,6 +208,7 @@ import {RouterHelper} from "../../utils/routerHelper.class"; +
Only 1000 {{openaireEntities.PROJECTS}} of {{resultTitle}} are shown here.
@@ -223,6 +225,7 @@ import {RouterHelper} from "../../utils/routerHelper.class"; styleUrls: ['entity-metadata.component.less'] }) export class EntityMetadataComponent { + @Input() resultTitle: string = null; @Input() isMobile: boolean = false; @Input() entityType: string; @Input() types: string[]; diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index d5d614a3..961c9209 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -39,7 +39,7 @@ export class ParsingFunctions { let fundedByProject: Project = { "id": "", "acronym": "", "title": "", - "funderShortname": "", "funderName": "", + "funderShortname": "", "funderName": "", "funderJurisdiction": "", "funding": "", "code": "", "provenanceAction": "", "validated": false }; @@ -61,8 +61,7 @@ export class ParsingFunctions { } if (relation.hasOwnProperty("funding")) { - let funding: { "funderName": string, "funderShortname": string, "stream": string }; - funding = this.parseFundingTrees(relation.funding); + let funding = this.parseFundingTrees(relation.funding); if (funding.funderName) { fundedByProject['funderName'] = funding.funderName; @@ -70,6 +69,9 @@ export class ParsingFunctions { if (funding.funderShortname) { fundedByProject['funderShortname'] = funding.funderShortname; } + if(funding.funderJurisdiction) { + fundedByProject['funderJurisdiction'] = funding.funderJurisdiction; + } if (funding.stream) { fundedByProject['funding'] = funding.stream; } @@ -79,10 +81,11 @@ export class ParsingFunctions { } // publication & research data : for fundedByProjects | project landing : for funding - public parseFundingTrees(fundingTree: any): { "funderName": string, "funderShortname": string, "stream": string } { - let funding: { "funderName": string, "funderShortname": string, "stream": string } = { + public parseFundingTrees(fundingTree: any): any { + let funding: { "funderName": string, "funderShortname": string, "funderJurisdiction": string, "stream": string } = { "funderName": "", "funderShortname": "", + "funderJurisdiction": "", "stream": "" }; let length = Array.isArray(fundingTree) ? fundingTree.length : 1; @@ -93,6 +96,7 @@ export class ParsingFunctions { if (fundingData.hasOwnProperty("funder")) { funding.funderShortname = fundingData['funder'].shortname; funding.funderName = fundingData['funder'].name; + funding.funderJurisdiction = fundingData['funder'].jurisdiction; } funding.stream = this.addFundingLevel0(fundingData, funding.stream); @@ -581,7 +585,7 @@ export class ParsingFunctions { return eoscSubjectsFound; } - + // publication & dataset landing : for subjects and otherSubjects and classifiedSubjects parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map, Map, string[], string[],] { // let eoscSubjectsFound = []; @@ -590,12 +594,12 @@ export class ParsingFunctions { let classifiedSubjects: Map; let fos: string[]; let sdg: string[]; - + let setOfEoscSubjects: Set = new Set(); - + let subject; let length = Array.isArray(_subjects) ? _subjects.length : 1; - + for (let i = 0; i < length; i++) { subject = Array.isArray(_subjects) ? _subjects[i] : _subjects; if (subject.classid != "") { @@ -628,7 +632,7 @@ export class ParsingFunctions { if (classifiedSubjects == undefined) { classifiedSubjects = new Map(); } - + let content: string = subject.content + ""; // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); // let found: boolean = checkAndAddEoscSubjectResp["found"]; @@ -639,7 +643,11 @@ export class ParsingFunctions { if (!classifiedSubjects.has(subject.classname)) { classifiedSubjects.set(subject.classname, new Array()); } - classifiedSubjects.get(subject.classname).push(content); + if(properties.environment == "production") { + classifiedSubjects.get(subject.classname).push(content); + } else { + classifiedSubjects.get(subject.classname).push(subject.classid + ": " + content); + } // } } } else { @@ -659,6 +667,17 @@ export class ParsingFunctions { } } } + + if(properties.environment != "production" && classifiedSubjects != null) { + if (subjects == undefined) { + subjects = new Array(); + } + for (let classified of classifiedSubjects.keys()) { + subjects = subjects.concat(classifiedSubjects.get(classified)); + } + classifiedSubjects = null; + } + return [subjects, otherSubjects, classifiedSubjects, fos, sdg]; } diff --git a/landingPages/landing-utils/projects-in-modal.component.ts b/landingPages/landing-utils/projects-in-modal.component.ts index b82392f7..93dcf007 100644 --- a/landingPages/landing-utils/projects-in-modal.component.ts +++ b/landingPages/landing-utils/projects-in-modal.component.ts @@ -116,7 +116,8 @@ export class ProjectsInModalComponent { } if (filterLimits.length > 0) { //this.filterQuery+=' and '+filter.filterId + ' exact '+ filterLimits + ' '; - this.filterQuery += ' and ( ' + filterLimits + ' ) '; + // this.filterQuery += ' and ( ' + filterLimits + ' ) '; + this.filterQuery += '( ' + filterLimits + ' ) '; } } diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index f313a196..e1a039b7 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -488,7 +488,7 @@ export class OrganizationComponent { let filename: string = 'funder-project-' + this.contentFileName + '-report'; - this.subscriptions.push(this._searchProjectsService.getProjectsForOrganizations(this.organizationId, ' and (funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe( + this.subscriptions.push(this._searchProjectsService.getProjectsForOrganizations(this.organizationId, '(funder exact "' + this.encodeURI(this.funderId) + '" ) ', 1, this.funderCount, [], this.properties).subscribe( data => { projects = data[1]; for (let index = 0; index < projects.length; index++) { diff --git a/landingPages/result/deletedByInference/deletedByInference.component.ts b/landingPages/result/deletedByInference/deletedByInference.component.ts index 30ebb017..b986c240 100644 --- a/landingPages/result/deletedByInference/deletedByInference.component.ts +++ b/landingPages/result/deletedByInference/deletedByInference.component.ts @@ -28,7 +28,7 @@ import {HelperFunctions} from "../../../utils/HelperFunctions.class";
  • + [isDeletedByInferenceModal]="true" [isMobile]="isMobile">
  • - +
    +
    @@ -1169,19 +1171,27 @@ + [resultType]="type" [type]="openaireEntities.PUBLICATIONS" + [isMobile]="isMobile" + [modal]="alertModalDeletedByInferenceFS"> + [resultType]="'dataset'" [type]="openaireEntities.DATASETS" + [isMobile]="isMobile" + [modal]="alertModalDeletedByInferenceFS"> + [resultType]="type" [type]="openaireEntities.SOFTWARE" + [isMobile]="isMobile" + [modal]="alertModalDeletedByInferenceFS"> + [resultType]="'other'" [type]="openaireEntities.OTHER" + [isMobile]="isMobile" + [modal]="alertModalDeletedByInferenceFS"> @@ -1192,4 +1202,4 @@ - \ No newline at end of file + diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index 769f1975..59b3c41e 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -1,4 +1,4 @@ -import {ChangeDetectorRef, Component, ElementRef, Input, ViewChild} from '@angular/core'; +import {ChangeDetectorRef, Component, ElementRef, EventEmitter, Input, Output, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {Meta, Title} from '@angular/platform-browser'; @@ -43,6 +43,7 @@ export class ResultLandingComponent { @Input() type: string = "publication"; @Input() communityId = null; + @Output() result: EventEmitter = new EventEmitter(); enermapsId; // @ViewChild('linkModal') linkModal; @ViewChild('citeModal') citeModal; @@ -514,6 +515,9 @@ export class ResultLandingComponent { this.resultLandingInfo = data; this.id = this.resultLandingInfo.objIdentifier; + let typeId = this.identifier?.id?'pid':'id'; + let id = this.identifier?.id?this.identifier.id:this.id; + this.resultLandingInfo.setBelongsTo(typeId, id); //old // this.viewsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoViews", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly views"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; // this.downloadsFrameUrl = this.properties.framesAPIURL + 'merge.php?com=query&data=[{"query":"resRepoDownloads", "resTitle":"' + this.id + '", "table":"","fields":[{"fld":"sum","agg":"sum","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"month","agg":"sum"},"group":" ","color":"","type":"chart","size":200,"sort":"xaxis","xStyle":{"r":-30,"s":"6","l":"-","ft":"-","wt":"-"},"title":"","subtitle":"","xaxistitle":"Repository","yaxisheaders":["Monthly downloads"],"generalxaxis":"","theme":0,"in":[],"filters":[{"name":"","values":[""],"to":"-1"}]}]&info_types=["column"]&stacking=normal&steps=false&fontFamily=Courier&spacing=[5,0,0,0]&style=[{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"rgba(0, 0, 0, 1)","size":"18"},{"color":"000000","size":""},{"color":"000000","size":""}]&backgroundColor=rgba(255,255,255,1)&colors[]=rgba(67, 67, 72, 1)&colors[]=rgba(144, 237, 125, 1)&colors[]=rgba(247, 163, 92, 1)&colors[]=rgba(128, 133, 233, 1)&colors[]=rgba(241, 92, 128, 1)&colors[]=rgba(228, 211, 84, 1)&colors[]=rgba(43, 144, 143, 1)&colors[]=rgba(244, 91, 91, 1)&colors[]=rgba(145, 232, 225, 1)&xlinew=0&ylinew=1&legends=true&tooltips=true&persistent=false'; @@ -591,7 +595,6 @@ export class ResultLandingComponent { this.setActiveTab(); this.cdr.detectChanges(); - if (contexts) { if (this.communityId && this.communityId == "enermaps" && properties.enermapsURL) { this.enermapsId = ParsingFunctions.getEnermapsConceptId(contexts); diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index 152cda48..2e3c2a3e 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -221,6 +221,11 @@ export class COOKIE { } } +class Roles { + manager = 'manager'; + member = 'member'; +} + export class Role { public static GROUP = ''; public static PORTAL_ADMIN = 'PORTAL_ADMINISTRATOR'; @@ -228,6 +233,7 @@ export class Role { public static ANONYMOUS_USER = 'ROLE_ANONYMOUS'; public static USER_MANAGER = 'USER_MANAGER'; public static CURATOR_CLAIM = 'CURATOR_CLAIM'; + public static ROLES: Roles = new Roles(); public static roleName(type: string, id: string) { return this.GROUP + this.mapType(type) + '.' + id; @@ -285,3 +291,10 @@ export class Role { return this.mapType(type, false).toUpperCase() + "_" + id.toUpperCase(); } } + +export class RoleUtils { + + get roles() { + return Role.ROLES; + } +} diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html index 7452df47..21d0f0e2 100644 --- a/monitor-admin/topic/indicators.component.html +++ b/monitor-admin/topic/indicators.component.html @@ -181,19 +181,6 @@ class="uk-text-center uk-text-bold uk-margin-small-bottom"> {{ indicator.name }}
    -