diff --git a/claims/claim-utils/service/searchOrcid.service.ts b/claims/claim-utils/service/searchOrcid.service.ts index 208ce16e..892dc77d 100644 --- a/claims/claim-utils/service/searchOrcid.service.ts +++ b/claims/claim-utils/service/searchOrcid.service.ts @@ -21,14 +21,38 @@ export class SearchOrcidService { let url = properties.searchOrcidURL + term + '/record'; return this.http.get(url, { headers: headers }) - //.map(res => res.json()['person']) - .pipe(map(res => res['person'])) - .pipe(map(res => [res['name']['given-names'], - res['name']['family-name'], - res['name']])) - .pipe(map(res => SearchOrcidService.parseOrcidAuthor(res, authorIds, authors, addId))); - } + //.map(res => res.json()['person']) + .pipe(map(res => res['person'])) + .pipe(map(res => [res['name']['given-names'], + res['name']['family-name'], + res['name'], res['name']['institution-name']])) + .pipe(map(res => SearchOrcidService.parseOrcidAuthor(res, authorIds, authors, addId))); + } + searchOrcidSingleAuthor(term: string, properties: EnvProperties, addId): any { + + //var headers = new Headers(); + //headers.append('Accept', 'application/orcid+json'); + let headers = new HttpHeaders({'Accept': 'application/orcid+json'}); + + let url ="https://pub.orcid.org/v3.0/expanded-search/?q=orcid:" + term + '&start=0&rows=50'; + return this.http.get(url, {headers: headers}) + .pipe(map(res => res['expanded-result'])) + .pipe(map(res => { + if(res) { + for (let auth_result of res) { + const author = {}; + author['id'] = auth_result['orcid-id']; + author['authorGivenName'] = auth_result['given-names']; + author['authorFamilyName'] = auth_result['family-names']; + author['institutions'] = auth_result['institution-name']; + return author; + } + } + return null; + + })); + } searchOrcidAuthors(term: string, properties: EnvProperties): any { @@ -45,17 +69,46 @@ export class SearchOrcidService { } + searchOrcidAuthorsNew(term: string, + properties: EnvProperties, size = 10): any { + let headers = new HttpHeaders({'Accept': 'application/orcid+json'}); + // let url = properties.searchOrcidURL+'search?defType=edismax&q='+term+'&qf=given-name^1.0+family-name^2.0+other-names^1.0+credit-name^1.0&start=0&rows=10'; + let url = /*properties.searchOrcidURL +*/ 'https://pub.orcid.org/v3.0/expanded-search?q=' + StringUtils.URIEncode('{!edismax qf="given-and-family-names^50.0 family-name^10.0 given-names^10.0 credit-name^10.0 other-names^5.0 text^1.0" pf="given-and-family-names^50.0" bq="current-institution-affiliation-name:[* TO *]^100.0 past-institution-affiliation-name:[* TO *]^70" mm=1}') + term + '&start=0&rows=' + size; + // given-and-family-names^50.0 family-name^10.0 given-names^10.0 credit-name^10.0 other-names^5.0 text^1.0" pf="given-and-family-names^50.0" bq="current-institution-affiliation-name:[* TO *]^100.0 past-institution-affiliation-name:[* TO *]^70" mm=1} + // https://pub.orcid.org/v3.0/expanded-search/?q=%7B!edismax%20qf%3D%22given-and-family-names%5E50.0%20family-name%5E10.0%20given-names%5E10.0%20credit-name%5E10.0%20other-names%5E5.0%20text%5E1.0%22%20pf%3D%22given-and-family-names%5E50.0%22%20bq%3D%22current-institution-affiliation-name%3A%5B*%20TO%20*%5D%5E100.0%20past-institution-affiliation-name%3A%5B*%20TO%20*%5D%5E70%22%20mm%3D1%7Dpaolo%20manghi&start=0&rows=50 + + //q={!edismax qf="given-and-family-names^50.0 family-name^10.0 given-names^5.0 credit-name^10.0 other-names^5.0 text^1.0" pf="given-and-family-names^50.0" mm=1}alessia bardi&start=0&rows=10 + let key = url; + return this.http.get(url, {headers: headers}) + .pipe(map(res => res['expanded-result'])) + .pipe(map(res => { + let authors = []; + if(res) { + for (let auth_result of res) { + const author = {}; + author['id'] = auth_result['orcid-id']; + author['authorGivenName'] = auth_result['given-names']; + author['authorFamilyName'] = auth_result['family-names']; + author['institutions'] = auth_result['institution-name']; + authors.push(author); + } + } + return authors; + + })); + } searchOrcidPublications(id: string, properties: EnvProperties, parse: boolean = false): any { let headers = new HttpHeaders({'Accept': 'application/orcid+json'}); let url = properties.searchOrcidURL + id + '/works'; - return this.http.get(url, { headers: headers }) - .pipe(map(res => res['group'])) - .pipe(map(request => (parse ? SearchOrcidService.parse(id, request) : request))); - } + return this.http.get(url, { headers: headers }) + .pipe(map(res => res['group'])) + .pipe(map(request => (parse ? SearchOrcidService.parse(id, request) : request))); + } static parseOrcidAuthor(data: any, authorIds: string[], authors, addId): any { + console.log(data) if (data[2] != null) { if (addId) { authorIds.push(data[2].path); @@ -72,7 +125,12 @@ export class SearchOrcidService { } else { author['authorFamilyName'] = ""; } + if (data[3] != null) { + author['institution'] = data[3]; + } + console.log(author['institution']) authors.push(author); + return true; } return false; diff --git a/claims/claim-utils/service/searchOrcidService.module.ts b/claims/claim-utils/service/searchOrcidService.module.ts new file mode 100644 index 00000000..64b31c1d --- /dev/null +++ b/claims/claim-utils/service/searchOrcidService.module.ts @@ -0,0 +1,19 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import {SearchOrcidService} from "./searchOrcid.service"; + + +@NgModule({ + imports: [ + CommonModule, FormsModule + ], + declarations: [ + ], + providers:[ + SearchOrcidService +], + exports: [ + ] +}) +export class SearchOrcidServiceModule { } diff --git a/claims/claimsAdmin/claimsAdmin.component.ts b/claims/claimsAdmin/claimsAdmin.component.ts index 8b142399..d1240a38 100644 --- a/claims/claimsAdmin/claimsAdmin.component.ts +++ b/claims/claimsAdmin/claimsAdmin.component.ts @@ -37,7 +37,6 @@ export class ClaimsAdminComponent { @Input() isConnect: boolean = false; @Input() externalPortalUrl: string; @Input() claimsInfoURL: string; - @Input() userInfoURL: string; public user: User = null; sub; diff --git a/claims/directLinking/directLinking.component.ts b/claims/directLinking/directLinking.component.ts index 229558ea..3fcd7537 100644 --- a/claims/directLinking/directLinking.component.ts +++ b/claims/directLinking/directLinking.component.ts @@ -29,7 +29,7 @@ export class DirectLinkingComponent { // linkTo: string = null; // entity type (project or context or entity) // linkToEntities: string[] = []; showOptions:ShowOptions = new ShowOptions(); - validEntityTypes = ["dataset", "publication", "software", "orp", "project", "context"]; + validEntityTypes = ["dataset", "publication", "software", "other", "project", "context"]; sources: ClaimEntity[] = []; inlineEntity: ClaimEntity = null; validInput: boolean = null;//'true; @@ -74,7 +74,7 @@ export class DirectLinkingComponent { this.getResearchResultById("dataset", this.id); } else if (this.type == "software") { this.getResearchResultById("software", this.id); - } else if (this.type == "orp") { + } else if (this.type == "other") { this.getResearchResultById("other", this.id); } else { this.validInput = this.isValidInput(null); @@ -110,9 +110,9 @@ export class DirectLinkingComponent { return false; } else if (this.type == "project" && this.showOptions.linkTo != "result") { return false; - } else if (["dataset", "publication", "software", "orp"].indexOf(this.type) != -1 && (["project", "context", "result"].indexOf(this.showOptions.linkTo) == -1)) { + } 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", "orp"].indexOf(this.type) == -1) { + } else if (["project", "dataset", "publication", "software", "other"].indexOf(this.type) == -1) { return false; } else { return true; diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index a2be4b98..d9314aeb 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -16,6 +16,7 @@ import { import {UserManagementService} from "../../../services/user-management.service"; import {Subscriber, timer} from "rxjs"; import {map} from "rxjs/operators"; +import {LogService} from "../../../utils/log/log.service"; @Component({ selector: 'claim-insert', @@ -59,7 +60,7 @@ import {map} from "rxjs/operators"; }) export class ClaimInsertComponent { constructor(private claimService: ClaimsService, private _router: Router, private route: ActivatedRoute, - private userManagementService: UserManagementService) { + private userManagementService: UserManagementService, private _logService: LogService) { } subscriptions = []; ngOnDestroy() { @@ -127,6 +128,7 @@ export class ClaimInsertComponent { public feedRecordsJob; public claims2Insert; public records2Insert + infoToLog = []; public insert() { this.confirmOpen(); } @@ -145,6 +147,7 @@ export class ClaimInsertComponent { this.errorInClaims = []; this.insertedRecords = []; this.errorInRecords = []; + this.infoToLog = []; this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { if (!user) { this.saveAndNavigate(); @@ -190,10 +193,11 @@ export class ClaimInsertComponent { } else if (entity.project) { claims.push(ClaimInsertComponent.createProjectClaim(result, entity, user.email, dashboard)); } - + this.infoToLog.push([ result.title?result.title: result.id, entity.title?entity.title:entity.id]); } if (this.inlineEntity) { + this.infoToLog.push([ this.inlineEntity.title?this.inlineEntity.title: this.inlineEntity.id, entity.title?entity.title:entity.id]); if (this.inlineEntity.result) { if (entity.result) { @@ -256,6 +260,12 @@ export class ClaimInsertComponent { data => { this.claims2Insert = claims.length; this.claimsJob = data.data; + if(this.properties.logServiceUrl) { + for(let info of this.infoToLog) { + this.subscriptions.push(this._logService.logLink(this.properties, info[0],info[1]).subscribe(res => { + })); + } + } this.saveLocalStorage(); let timerSubscription = timer(0, 10000).pipe( map(() => { @@ -375,7 +385,7 @@ export class ClaimInsertComponent { localStorage.removeItem(this.localStoragePrefix + "claimsJob"); localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob"); - this._router.navigate(['/myclaims'], {queryParams: this.params}); + this._router.navigate([this.properties.myClaimsLink], {queryParams: this.params}); } } diff --git a/claims/linking/insertClaim/insertClaim.module.ts b/claims/linking/insertClaim/insertClaim.module.ts index 5b756a47..991ffc4a 100644 --- a/claims/linking/insertClaim/insertClaim.module.ts +++ b/claims/linking/insertClaim/insertClaim.module.ts @@ -6,10 +6,11 @@ import {LoadingModalModule} from '../../../utils/modal/loadingModal.module'; import {ClaimInsertComponent} from './insertClaim.component'; import {ClaimServiceModule} from '../../claim-utils/service/claimsService.module'; import {IconsModule} from "../../../utils/icons/icons.module"; +import {LogServiceModule} from "../../../utils/log/LogService.module"; @NgModule({ imports: [ - SharedModule, AlertModalModule, LoadingModalModule, ClaimServiceModule, IconsModule + SharedModule, AlertModalModule, LoadingModalModule, ClaimServiceModule, IconsModule, LogServiceModule ], declarations: [ClaimInsertComponent], exports:[ ClaimInsertComponent] diff --git a/claims/myClaims/myClaims.component.ts b/claims/myClaims/myClaims.component.ts index 5f2369df..5e6d8833 100644 --- a/claims/myClaims/myClaims.component.ts +++ b/claims/myClaims/myClaims.component.ts @@ -30,7 +30,6 @@ import {Subscriber} from "rxjs"; export class MyClaimsComponent { @Input() claimsInfoURL: string; @Input() communityId:string; - @Input() userInfoURL: string; public user: User = null; constructor(private userManagementService: UserManagementService, private _router: Router) {} diff --git a/connect/connectHelper.ts b/connect/connectHelper.ts index 14542fa2..18c60846 100644 --- a/connect/connectHelper.ts +++ b/connect/connectHelper.ts @@ -6,6 +6,9 @@ import {CommunityInfo} from "./community/communityInfo"; export class ConnectHelper { public static getCommunityFromDomain(domain: string): string{ + if(properties.dashboard === 'irish') { + return properties.adminToolsCommunity; + } if(properties.environment == "development" && (properties.adminToolsPortalType == "connect" || properties.adminToolsPortalType == "community" || properties.adminToolsPortalType == "aggregator" || properties.adminToolsPortalType == "eosc")) { diff --git a/dashboard/portal/portalHelper.ts b/dashboard/portal/portalHelper.ts index bc08cd2a..3f915e10 100644 --- a/dashboard/portal/portalHelper.ts +++ b/dashboard/portal/portalHelper.ts @@ -1,17 +1,18 @@ import {Option} from "../../sharedComponents/input/input.component"; -import {StakeholderEntities} from "../../monitor/entities/stakeholder"; +import {StakeholderConfiguration} from "../../monitor-admin/utils/indicator-utils"; -export class PortalUtils{ +export class PortalUtils { portalTypes: Option[] = [ {value: 'explore', label: 'Explore Portal'}, {value: 'connect', label: 'Connect portal'}, {value: 'monitor', label: 'Monitor portal'}, {value: 'community', label: 'Community Gateway'}, - {value: 'funder', label: StakeholderEntities.FUNDER + ' Dashboard'}, - {value: 'ri', label: StakeholderEntities.RI + ' Dashboard'}, - {value: 'organization', label: StakeholderEntities.ORGANIZATION + ' Dashboard'}, - {value: 'project', label: StakeholderEntities.PROJECT + ' Dashboard'} + {value: 'funder', label: StakeholderConfiguration.ENTITIES.funder + ' ' + StakeholderConfiguration.ENTITIES.stakeholder}, + {value: 'ri', label: StakeholderConfiguration.ENTITIES.ri + ' ' + StakeholderConfiguration.ENTITIES.stakeholder}, + {value: 'organization', label: StakeholderConfiguration.ENTITIES.organization + ' ' + StakeholderConfiguration.ENTITIES.stakeholder}, + {value: 'project', label: StakeholderConfiguration.ENTITIES.project + ' ' + StakeholderConfiguration.ENTITIES.stakeholder}, + {value: 'country', label: StakeholderConfiguration.ENTITIES.country + ' ' + StakeholderConfiguration.ENTITIES.stakeholder}, ]; } diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index 02754405..17657431 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -83,7 +83,11 @@ export class LayoutService { * Add hasStickyHeaderOnMobile: true in order to activate uk-sticky in header of mobile/tablet devices. * */ private hasStickyHeaderOnMobileSubject: BehaviorSubject = new BehaviorSubject(false); - + /** + * Add a class in root element of the html. (For different theme apply) + * Handle it manually in the component, it doesn't use data + * */ + private rootClassSubject: BehaviorSubject = new BehaviorSubject(null); private subscriptions: any[] = []; ngOnDestroy() { @@ -329,4 +333,14 @@ export class LayoutService { setHasStickyHeaderOnMobile(value: boolean) { this.hasStickyHeaderOnMobileSubject.next(value); } + + get rootClass(): Observable { + return this.rootClassSubject.asObservable(); + } + + setRootClass(value: string = null): void { + if(this.rootClassSubject.value != value) { + this.rootClassSubject.next(value); + } + } } diff --git a/dashboard/sharedComponents/sidebar/sideBar.component.html b/dashboard/sharedComponents/sidebar/sideBar.component.html index 9e772ea8..4d92e286 100644 --- a/dashboard/sharedComponents/sidebar/sideBar.component.html +++ b/dashboard/sharedComponents/sidebar/sideBar.component.html @@ -28,6 +28,9 @@ [class.hide-on-close]="backItem.icon">{{backItem.title}} +