Merge branch 'new-theme' of code-repo.d4science.org:MaDgIK/openaire-library into new-theme
This commit is contained in:
commit
896f95366c
|
@ -66,7 +66,7 @@
|
|||
</div>
|
||||
<!-- Basket-->
|
||||
<div *ngIf="showOptions.show != 'claim'" class="uk-width-1-3">
|
||||
<div id="basket" uk-sticky=" offset: 220; top:#basketStickTop; end: .basketContainer; media: @m"
|
||||
<div id="basket" uk-sticky=" offset: 220; top:#basketStickTop; bottom: #basketStickBottom; media: @m"
|
||||
class="uk-card uk-card-default linkingBasket" style="z-index: 0!important;">
|
||||
<div class="uk-card-body uk-padding-small">
|
||||
<div class="uk-margin-right">
|
||||
|
|
|
@ -22,7 +22,7 @@ export class ConnectAdminLoginGuard implements CanActivate, CanActivateChild {
|
|||
|
||||
check(community: string, path: string): Observable<boolean> | boolean {
|
||||
let errorCode = LoginErrorCodes.NOT_LOGIN;
|
||||
const authorized = this.userManagementService.getUserInfo(false).pipe(take(1), map(user => {
|
||||
const authorized = this.userManagementService.getUserInfo().pipe(take(1), map(user => {
|
||||
if (user) {
|
||||
if (Session.isPortalAdministrator(user) || Session.isCommunityCurator(user) || Session.isManager('community', community, user)) {
|
||||
return of(true);
|
||||
|
|
|
@ -30,7 +30,7 @@ export class ConnectSubscriberGuard implements CanActivate, CanActivateChild {
|
|||
} else {
|
||||
community = ConnectHelper.getCommunityFromDomain(properties.domain);
|
||||
}
|
||||
const authorized = this.userManagementService.getUserInfo(false).pipe(take(1), map(user => {
|
||||
const authorized = this.userManagementService.getUserInfo().pipe(take(1), map(user => {
|
||||
if (user) {
|
||||
if (Session.isSubscribedTo('community', community, user)) {
|
||||
return of(true);
|
||||
|
|
|
@ -58,10 +58,10 @@ import {HelperFunctions} from '../../utils/HelperFunctions.class';
|
|||
<span class="uk-text-meta">Funding stream: </span>{{item.funding}}
|
||||
</li>
|
||||
</ul>
|
||||
<div *ngIf="item.provenanceAction || item.validated" class="uk-text-meta">
|
||||
<div *ngIf="getVocabularyLabel(item, provenanceActionVocabulary, i) || item.validated" class="uk-text-meta">
|
||||
<span *ngIf="item.validated">Validated by funder</span>
|
||||
<span *ngIf="item.provenanceAction && item.validated"> | </span>
|
||||
<span *ngIf="item.provenanceAction">{{getVocabularyLabel(item.provenanceAction, provenanceActionVocabulary)}}</span>
|
||||
<span *ngIf="item.provenanceAction">{{item.provenanceAction}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -80,6 +80,7 @@ export class FundedByComponent {
|
|||
public url = properties.searchLinkToProject.split('?')[0];
|
||||
public title: string = "Funded by";
|
||||
@Input() provenanceActionVocabulary = null;
|
||||
public provenancesCalculated: boolean[] = [];
|
||||
|
||||
public viewAllClick() {
|
||||
if(this.fundedByProjects.length <= this.threshold*2) {
|
||||
|
@ -96,7 +97,11 @@ export class FundedByComponent {
|
|||
this.viewAllClicked.emit("");
|
||||
}
|
||||
|
||||
public getVocabularyLabel(value: any, vocabulary: any) {
|
||||
return HelperFunctions.getVocabularyLabel(value, vocabulary);
|
||||
public getVocabularyLabel(item: any, vocabulary: any, index: number) {
|
||||
if(!this.provenancesCalculated[index]) {
|
||||
this.provenancesCalculated[index] = true;
|
||||
item.provenanceAction = HelperFunctions.getVocabularyLabel(item.provenanceAction, vocabulary, false);
|
||||
}
|
||||
return item.provenanceAction;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ import {properties} from "../../../../environments/environment";
|
|||
Subjects by Vocabulary
|
||||
</div>
|
||||
<ng-container *ngTemplateOutlet="subjects_by_vocabulary_template; context: {customClasses: 'multi-line-ellipsis lines-2', id: 'content'}"></ng-container>
|
||||
<ng-container *ngTemplateOutlet="eosc_subjects_template"></ng-container>
|
||||
<ng-container *ngIf="eoscSubjects && eoscSubjects.length > 0"><ng-container *ngTemplateOutlet="eosc_subjects_template"></ng-container></ng-container>
|
||||
<div *ngIf="isClassifiedLarge" class="uk-text-right">
|
||||
<a (click)="openSubjectsByVocabularyModal()" class="view-more-less-link">View all</a>
|
||||
</div>
|
||||
|
@ -97,7 +97,7 @@ import {properties} from "../../../../environments/environment";
|
|||
<modal-alert #subjectsByVocabularyModal *ngIf="(classifiedSubjects && classifiedSubjects.size > 0) || (eoscSubjects && eoscSubjects.length > 0)" large="true">
|
||||
<div class="uk-text-small">
|
||||
<ng-container *ngTemplateOutlet="subjects_by_vocabulary_template"></ng-container>
|
||||
<ng-container *ngTemplateOutlet="eosc_subjects_template"></ng-container>
|
||||
<ng-container *ngIf="eoscSubjects && eoscSubjects.length > 0"><ng-container *ngTemplateOutlet="eosc_subjects_template"></ng-container></ng-container>
|
||||
</div>
|
||||
</modal-alert>
|
||||
`
|
||||
|
|
|
@ -87,7 +87,7 @@ export class ResultLandingService {
|
|||
res[1]['oaf:result']['pid'], // 4
|
||||
res[1]['oaf:result']['journal'], // 5
|
||||
res[1]['oaf:result']['language'], // 6
|
||||
res[1]['oaf:result']['eoscifgiudelines'], // 7
|
||||
res[1]['oaf:result']['eoscifguidelines'], // 7
|
||||
res[1]['oaf:result']['subject'], // 8
|
||||
res[1]['oaf:result']['context'], // 9
|
||||
res[1]['oaf:result']['creator'], // 10
|
||||
|
|
|
@ -22,7 +22,7 @@ export class AdminLoginGuard implements CanActivate, CanActivateChild {
|
|||
|
||||
check(data: Data, path: string): Observable<boolean> {
|
||||
let errorCode = LoginErrorCodes.NOT_LOGIN;
|
||||
return this.userManagementService.getUserInfo(false).pipe(map(user => {
|
||||
return this.userManagementService.getUserInfo().pipe(map(user => {
|
||||
if (user) {
|
||||
errorCode = LoginErrorCodes.NOT_ADMIN;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ export class ClaimsCuratorGuard implements CanActivate {
|
|||
|
||||
check(path: string): Observable<boolean> | boolean {
|
||||
let errorCode = LoginErrorCodes.NOT_LOGIN;
|
||||
return this.userManagementService.getUserInfo(false).pipe(map(user => {
|
||||
return this.userManagementService.getUserInfo().pipe(map(user => {
|
||||
if (user) {
|
||||
errorCode = LoginErrorCodes.NOT_ADMIN;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ export class LoginGuard implements CanActivate, CanLoad, CanActivateChild {
|
|||
}
|
||||
|
||||
check(path: string): Observable<boolean> | boolean {
|
||||
return this.userManagementService.getUserInfo(false).pipe(map(user => {
|
||||
return this.userManagementService.getUserInfo().pipe(map(user => {
|
||||
return user !== null;
|
||||
}),tap(isLoggedIn => {
|
||||
if(!isLoggedIn) {
|
||||
|
|
|
@ -43,8 +43,8 @@ export class UserComponent {
|
|||
this.loginUrl = this.properties.loginUrl;
|
||||
if (typeof document !== 'undefined') {
|
||||
this.server = false;
|
||||
this.subscriptions.push(this.userManagementsService.getUserInfo(false).subscribe(user => {
|
||||
this.user = user;
|
||||
this.userManagementsService.updateUserInfo(() => {
|
||||
this.user = this.userManagementsService.user;
|
||||
this.loggedIn = !!this.user;
|
||||
this.errorMessage = "";
|
||||
this.loading = true;
|
||||
|
@ -58,7 +58,7 @@ export class UserComponent {
|
|||
this.loading = false;
|
||||
}
|
||||
}));
|
||||
}));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn
|
|||
ngAfterViewInit() {
|
||||
this.subs.push(this.route.queryParams.subscribe(params => {
|
||||
if (params && params['verify']) {
|
||||
this.subs.push(this.userManagementService.getUserInfo(false).subscribe(user => {
|
||||
this.subs.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
if (this.user) {
|
||||
this.subs.push(this.userRegistryService.getInvitation(params['verify']).subscribe(verification => {
|
||||
|
|
|
@ -103,7 +103,7 @@ export class SearchAllComponent {
|
|||
resultTypes = {publication: true, dataset: true, software: true, other: true};
|
||||
|
||||
//adv Search Form
|
||||
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
|
||||
public fieldIds: string[] = this.searchFields.getResultAdvancedFields();
|
||||
public fieldIdsMap = this.searchFields.RESULT_FIELDS;
|
||||
public selectedFields: AdvancedField[] = [];
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ export class SearchResearchResultsComponent {
|
|||
public searchUtils: SearchUtilsClass = new SearchUtilsClass();
|
||||
public searchFields: SearchFields = new SearchFields();
|
||||
|
||||
public fieldIds: string[] = this.searchFields.RESULT_ADVANCED_FIELDS;
|
||||
public fieldIds: string[] = this.searchFields.getResultAdvancedFields();
|
||||
public fieldIdsMap = this.searchFields.RESULT_FIELDS;
|
||||
public rangeFields: string[][] = this.searchFields.RESULT_RANGE_FIELDS;
|
||||
public selectedFields: AdvancedField[] = [];
|
||||
|
|
|
@ -16,22 +16,11 @@ export class UserManagementService {
|
|||
private readonly getUserInfoSubject: AdvancedAsyncSubject<User> = new AdvancedAsyncSubject<User>();
|
||||
public fixRedirectURL: string = null;
|
||||
private redirectUrl: string = null;
|
||||
private readonly promise: Promise<User>;
|
||||
private subscription;
|
||||
private readonly routerSubscription;
|
||||
|
||||
constructor(private http: HttpClient, private router: Router) {
|
||||
this.promise = new Promise<any>((resolve => {
|
||||
this.updateUserInfo(resolve);
|
||||
}));
|
||||
this.routerSubscription = this.router.events.subscribe(event => {
|
||||
if (event instanceof NavigationEnd) {
|
||||
const token = COOKIE.getCookie('AccessToken');
|
||||
if (!token && this.getUserInfoSubject.getValue() !== null) {
|
||||
this.getUserInfoSubject.next(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
constructor(private http: HttpClient) {
|
||||
this.updateUserInfo();
|
||||
}
|
||||
|
||||
clearSubscriptions() {
|
||||
|
@ -43,12 +32,12 @@ export class UserManagementService {
|
|||
}
|
||||
}
|
||||
|
||||
public getUserInfo(subject: boolean = true): Observable<User> {
|
||||
if (subject) {
|
||||
return this.getUserInfoSubject.asObservable();
|
||||
} else {
|
||||
return from(this.getUserInfoAsync());
|
||||
}
|
||||
public get user(): User {
|
||||
return this.getUserInfoSubject.getValue();
|
||||
}
|
||||
|
||||
public getUserInfo(): Observable<User> {
|
||||
return this.getUserInfoSubject.asObservable();
|
||||
}
|
||||
|
||||
public updateUserInfo(resolve: Function = null) {
|
||||
|
@ -67,14 +56,6 @@ export class UserManagementService {
|
|||
});
|
||||
}
|
||||
|
||||
private async getUserInfoAsync(): Promise<User> {
|
||||
await this.promise;
|
||||
if (this.subscription) {
|
||||
this.subscription.unsubscribe();
|
||||
}
|
||||
return this.getUserInfoSubject.getValue();
|
||||
}
|
||||
|
||||
private parseUserInfo(info: any) {
|
||||
const user: User = new User();
|
||||
user.id = (info.sub && info.sub.indexOf('@')) ? info.sub.substring(0, info.sub.indexOf('@')) : info.sub;
|
||||
|
@ -144,6 +125,7 @@ export class UserManagementService {
|
|||
public logout() {
|
||||
this.setRedirectUrl();
|
||||
Session.removeUser();
|
||||
this.getUserInfoSubject.next(null);
|
||||
window.location.href = properties.logoutUrl + "?redirect=" + this.redirectUrl;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,11 +72,17 @@ export class HelperFunctions {
|
|||
return Object.keys(value).map(key => value[key]);
|
||||
}
|
||||
|
||||
public static getVocabularyLabel(value: any, vocabulary: any) {
|
||||
public static getVocabularyLabel(value: any, vocabulary: any, returnIfNotFound: boolean = true) {
|
||||
if(value == undefined || value == null) {
|
||||
return null;
|
||||
}
|
||||
if(vocabulary && value in vocabulary) {
|
||||
return vocabulary[value];
|
||||
}
|
||||
return value;
|
||||
if(returnIfNotFound) {
|
||||
return value;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static sortSDGs(sgd1: string, sdg2: string): number {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {Filter} from "../../searchPages/searchUtils/searchHelperClasses.class";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
|
||||
export class SearchFields {
|
||||
|
||||
|
@ -17,7 +18,7 @@ export class SearchFields {
|
|||
"relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
|
||||
"relproject", "sdg", "country", "resultlanguagename", "resulthostingdatasource", "community"];
|
||||
|
||||
public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "resultpublisher",
|
||||
public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "eoscifguidelines", "resultpublisher",
|
||||
"resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance",
|
||||
"relfunder",
|
||||
"relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
|
||||
|
@ -56,6 +57,14 @@ export class SearchFields {
|
|||
equalityOperator: "=",
|
||||
filterType: null
|
||||
},
|
||||
["eoscifguidelines"]: {
|
||||
name: "EOSC Subject",
|
||||
type: "keyword",
|
||||
param: "eoscSubj",
|
||||
operator: "es",
|
||||
equalityOperator: " exact ",
|
||||
filterType: null
|
||||
},
|
||||
["resultdescription"]: {
|
||||
name: "Abstract",
|
||||
type: "keyword",
|
||||
|
@ -690,6 +699,16 @@ export class SearchFields {
|
|||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
getResultAdvancedFields() {
|
||||
if(properties.environment == "production") {
|
||||
this.RESULT_ADVANCED_FIELDS = this.RESULT_ADVANCED_FIELDS.filter((value, index, array) => {
|
||||
return value != "eoscifguidelines";
|
||||
})
|
||||
}
|
||||
return this.RESULT_ADVANCED_FIELDS;
|
||||
}
|
||||
|
||||
getField(fieldId: string, fieldType: string): any {
|
||||
if (fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result") {
|
||||
return this.RESULT_FIELDS[fieldId];
|
||||
|
|
|
@ -123,7 +123,10 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
|
|||
this.beforeTitle.push(this.result.startYear.toString() + ' - ' + this.result.endYear.toString());
|
||||
}
|
||||
if(this.result.provenanceAction) {
|
||||
this.beforeTitle.push(HelperFunctions.getVocabularyLabel(this.result.provenanceAction, this.provenanceActionVocabulary));
|
||||
let value = HelperFunctions.getVocabularyLabel(this.result.provenanceAction, this.provenanceActionVocabulary, false);
|
||||
if(value) {
|
||||
this.beforeTitle.push(value);
|
||||
}
|
||||
}
|
||||
if(this.result.relationName) {
|
||||
this.beforeTitle.push(HelperFunctions.getVocabularyLabel(this.result.relationName, this.relationsVocabulary));
|
||||
|
|
Loading…
Reference in New Issue