Merge remote-tracking branch 'origin/master'

This commit is contained in:
argirok 2021-10-06 16:24:23 +03:00
commit f854849462
9 changed files with 130 additions and 80 deletions

View File

@ -15,6 +15,11 @@ export class CacheInterceptorService implements HttpInterceptor {
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&fields=country&&type=results&page=0&size=0",
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=relfundinglevel0_id&fields=relproject&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&fields=country&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&fq=relfunder%20exact%20%22ec__________%3A%3AEC%7C%7CEuropean%20Commission%7C%7CEC%22&type=results&page=0&size=0",
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&fields=country&&type=publications&page=0&size=0",
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&fields=country&&type=datasets&page=0&size=0",
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&fields=country&&type=software&page=0&size=0",
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&fields=country&&type=other&page=0&size=0",
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&fields=country&&fq=resultbestaccessright%20exact%20%22Open%20Access%22&type=results&page=0&size=0",
"/resources2/?format=json&refine=true&fields=resultbestaccessright&fields=relfunder&fields=instancetypename&fields=resultlanguagename&fields=community&fields=resulthostingdatasource&fields=country&&fq=resultbestaccessright exact \"Open Access\"&type=results&page=0&size=0",
"/resources2/?format=json&refine=true&fields=funder&fields=projectstartyear&fields=projectendyear&fields=projectecsc39&&type=projects&page=0&size=0",

View File

@ -8,6 +8,8 @@ import {Injectable} from '@angular/core';
export class ParsingFunctions {
public notebookInSubjects: boolean = false;
private notebookKeyword: string = "eosc jupyter notebook";
private notebook_label: string = "EOSC";
private notebook_value: string = "EOSC Jupyter Notebook";
public open = 'assets/common-assets/unlock.svg';
public closed = 'assets/common-assets/lock.svg';
@ -530,28 +532,28 @@ export class ParsingFunctions {
classifiedSubjects.get(subject.classname).push(subject.content);
} else {
if (subject.classid == "keyword") {
if (subjects == undefined) {
subjects = new Array<string>();
}
let content: string = subject.content;
console.log("keyword subject: "+content);
if(content && content.toLowerCase().includes(this.notebookKeyword)) {
// console.log("included in keyword subject: "+content);
console.log("included");
this.notebookInSubjects = true;
if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>();
}
if (!classifiedSubjects.has(subject.classname)) {
classifiedSubjects.set(this.notebook_label, new Array<string>());
}
classifiedSubjects.get(this.notebook_label).push(this.notebook_value);
} else {
if (subjects == undefined) {
subjects = new Array<string>();
}
subjects.push(content);
}
} else {
if (otherSubjects == undefined) {
otherSubjects = new Map<string, string[]>();
}
if (!otherSubjects.has(subject.classname)) {
otherSubjects.set(subject.classname, new Array<string>());
}
let content: string = subject.content;
let classname: string = subject.classname;
console.log("other subject: "+classname + ": " +content);
@ -562,12 +564,28 @@ export class ParsingFunctions {
console.log("included");
this.notebookInSubjects = true;
if (classifiedSubjects == undefined) {
classifiedSubjects = new Map<string, string[]>();
}
if (!classifiedSubjects.has(subject.classname)) {
classifiedSubjects.set(this.notebook_label, new Array<string>());
}
classifiedSubjects.get(this.notebook_label).push(this.notebook_value);
} else {
if (otherSubjects == undefined) {
otherSubjects = new Map<string, string[]>();
}
if (!otherSubjects.has(subject.classname)) {
otherSubjects.set(subject.classname, new Array<string>());
}
otherSubjects.get(classname).push(content);
}
}
}
}
}
return [subjects, otherSubjects, classifiedSubjects];
}

View File

@ -126,11 +126,11 @@
&& (properties.environment == 'beta' || properties.environment == 'development')">
<a class="uk-link-text uk-text-bold uk-text-uppercase"
target="_blank" [href]="properties.egiNotebookLink">
<span class="uk-icon-button notebook-button uk-icon">
<img src="assets/common-assets/egi-fed.notebook.png"
loading="lazy" alt="egi_notebook" style="width:30px; height:21px">
<span class="uk-icon-button uk-icon">
<img src="assets/common-assets/eosc-logo.png"
loading="lazy" alt="eosc_logo" style="width:28px; height:28px">
</span>
<span class="uk-margin-small-left"><u>EGI Notebook</u></span>
<span class="uk-margin-small-left"><u>EOSC SERVICE: EGI NOTEBOOK</u></span>
<span class="custom-external custom-icon space"></span>
</a>
</li>

View File

@ -27,10 +27,6 @@ import {$e} from "codelyzer/angular/styles/chars";
@Component({
styles: [
'.notebook-button { background-color: #f2f2f2; border: 1px solid #f2f2f2; } ' +
'.notebook-button:hover { background-color: #e5e5e5; border-color: #e5e5e5; } '
],
selector: 'result-landing',
templateUrl: 'resultLanding.component.html',
})
@ -663,8 +659,6 @@ export class ResultLandingComponent {
if(!(this.properties.environment == "production" || this.properties.environment == "development") ) {
return true;
}else {
/*
//comment out poor content filters
let allow = !!(!resultLandingInfo.underCurationMessage &&
((resultLandingInfo.fundedByProjects && resultLandingInfo.fundedByProjects.length > 0)
|| resultLandingInfo.journal
@ -680,8 +674,7 @@ export class ResultLandingComponent {
|| (resultLandingInfo.supplementaryResearchResults && resultLandingInfo.supplementaryResearchResults.length > 0)
|| (resultLandingInfo.supplementedByResearchResults && resultLandingInfo.supplementedByResearchResults.length > 0)
)
);*/
let allow = true;
);
// console.log("rich content " + allow)
//spam words to exclude - need to be in lower case
let title_authors_words = ["movie","hd","film","kimetsu", "1080p","4k","call of duty", "mobile hack", "tubydi", "电影","電影","download ebook","download [ebook]","düşük hapı", "düşük hapi"];

View File

@ -20,7 +20,7 @@ export class NotificationService {
public getAllNotifications(): Observable<Notification[]> {
return this.httpClient.get<Notification[]>(properties.notificationsAPIURL + 'all', CustomOptions.registryOptions()).pipe(map(notifications => {
notifications.forEach(notification => {
this.formatNotification(notification);
NotificationService.formatNotification(notification);
})
return notifications;
}));
@ -29,7 +29,7 @@ export class NotificationService {
public getNotifications(service: string): Observable<Notification[]> {
return this.httpClient.get<Notification[]>(properties.notificationsAPIURL + encodeURIComponent(service), CustomOptions.registryOptions()).pipe(map(notifications => {
notifications.forEach(notification => {
this.formatNotification(notification);
NotificationService.formatNotification(notification);
})
return notifications;
}));
@ -39,11 +39,15 @@ export class NotificationService {
return this.httpClient.post<Notification>(properties.notificationsAPIURL + 'save', notification, CustomOptions.registryOptions());
}
public markAllAsRead(service: string): Observable<NotificationUser> {
return this.httpClient.put<NotificationUser>(properties.notificationsAPIURL + "all/" + encodeURIComponent(service), null, CustomOptions.registryOptions());
}
public readNotification(id: string): Observable<NotificationUser> {
return this.httpClient.put<NotificationUser>(properties.notificationsAPIURL + encodeURIComponent(id), null, CustomOptions.registryOptions());
}
private formatNotification(notification: Notification): Notification {
private static formatNotification(notification: Notification): Notification {
if (notification.title) {
notification.preview = notification.title;
} else {

View File

@ -87,16 +87,21 @@
overflow: auto;
}
#notifications .uk-offcanvas-bar a {
color: #2D72D6 ;
#notifications .uk-offcanvas-bar a, #notifications .uk-offcanvas-bar button.uk-button-link {
color: var(--secondary-color);
}
#notifications .uk-offcanvas-bar a:hover {
#notifications .uk-offcanvas-bar a:hover, #notifications .uk-offcanvas-bar button.uk-button-link:hover {
color: var(--portal-main-color);
}
#notifications .uk-offcanvas-bar button.uk-button-link:disabled {
color: var(--secondary-color);
opacity: 0.5;
}
#notifications .uk-offcanvas-bar .uk-button-secondary {
background-color: #4687e6;
background-color: var(--secondary-color);
color: #fff;
border: 1px solid transparent;
}

View File

@ -6,6 +6,8 @@ import {User} from "../../login/utils/helper.class";
import {Dates} from "../../utils/string-utils.class";
import {Option} from "../../sharedComponents/input/input.component";
declare var UIkit;
@Component({
selector: 'notification-sidebar',
template: `
@ -23,6 +25,9 @@ import {Option} from "../../sharedComponents/input/input.component";
<ng-template [ngIf]="!notification">
<div class="notification-list uk-position-relative">
<h5 class="uk-text-bold">Notifications</h5>
<div class="uk-flex uk-flex-right@m uk-flex-center uk-padding uk-padding-remove-vertical">
<button [disabled]="unreadCount === 0" (click)="readAll()" class="uk-button uk-button-link">Mark As Read ({{unreadCount}})</button>
</div>
<h6 *ngIf="notifications.length == 0" class="uk-position-center uk-margin-remove">No notifications</h6>
<ul *ngIf="notifications.length > 0" class="uk-list">
<li *ngFor="let notification of notifications; let i=index" class="clickable" (click)="select(notification)">
@ -90,6 +95,13 @@ export class NotificationsSidebarComponent implements OnInit, OnDestroy {
ngOnInit() {
this.subscriptions.push(this.notificationService.getNotifications(this.service).subscribe(notifications => {
this.notifications = notifications;
}, error => {
this.notifications = [];
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
}));
}
@ -110,9 +122,15 @@ export class NotificationsSidebarComponent implements OnInit, OnDestroy {
}
select(notification: Notification) {
this.notificationService.readNotification(notification._id).subscribe(user => {
this.notificationService.readNotification(notification._id).subscribe(() => {
notification.read = true;
this.notification = notification;
}, error => {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
});
}
@ -120,4 +138,18 @@ export class NotificationsSidebarComponent implements OnInit, OnDestroy {
event.stopPropagation();
this.notification = null;
}
readAll() {
this.notificationService.markAllAsRead(this.service).subscribe(() => {
this.notifications.forEach(notification => {
notification.read = true;
});
}, error => {
UIkit.notification('An error has occurred. Please try again later', {
status: 'danger',
timeout: 6000,
pos: 'bottom-right'
});
});
}
}

View File

@ -18,52 +18,19 @@
<span class="space uk-text-small uk-text-capitalize">{{result.visibility.toLowerCase()}}</span>
</div>-->
<div class="uk-grid uk-flex uk-flex-middle" uk-grid>
<a *ngIf="directLink" [href]="(type === 'community')?getCommunityPageUrl(result):getStakeholderPageUrl(result)"
<a *ngIf="directLink && hasPermission(result)" [href]="(type === 'community')?getCommunityPageUrl(result):getStakeholderPageUrl(result)"
target="_blank"
class="uk-width-1-5@s">
<div class="uk-flex uk-flex-center">
<img *ngIf="result.logoUrl && result.logoUrl != '' && result.isUpload "
[src]="properties.utilsService + '/download/' + result.logoUrl"
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<img *ngIf="result.logoUrl && result.logoUrl != '' && !result.isUpload " [src]="result.logoUrl | urlPrefix"
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<span *ngIf="result.logoUrl == null || result.logoUrl == ''" class="uk-icon">
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
stroke="#000"
stroke-width="1.1"
cx="7.7" cy="8.6"
r="3.5"></circle> <path
fill="none" stroke="#000" stroke-width="1.1"
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none"
stroke="#000"
stroke-width="1.1"
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
</span>
</div>
<ng-container *ngTemplateOutlet="resultPreview; context: {result: result}"></ng-container>
</a>
<a *ngIf="!directLink"
<a *ngIf="!directLink && hasPermission(result)"
class="uk-width-1-5@s"
(click)="confirmModalOpen(result)">
<div class="uk-flex uk-flex-center">
<img *ngIf="result.logoUrl && result.logoUrl != '' && result.isUpload "
[src]="properties.utilsService + '/download/' + result.logoUrl"
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<img *ngIf="result.logoUrl && result.logoUrl != '' && !result.isUpload " [src]="result.logoUrl | urlPrefix"
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<span *ngIf="(result.logoUrl == null || result.logoUrl == '' )" class="uk-icon">
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
stroke="#000"
stroke-width="1.1"
cx="7.7" cy="8.6"
r="3.5"></circle> <path
fill="none" stroke="#000" stroke-width="1.1"
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none"
stroke="#000"
stroke-width="1.1"
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
</span>
</div>
<ng-container *ngTemplateOutlet="resultPreview; context: {result: result}"></ng-container>
</a>
<div *ngIf="!hasPermission(result)" class="uk-width-1-5@s">
<ng-container *ngTemplateOutlet="resultPreview; context: {result: result}"></ng-container>
</div>
<div class="uk-width-expand">
<div *ngIf="type === 'community'" [title]="result.shortTitle" class="uk-text-large uk-grid" uk-grid>
<a *ngIf="directLink" [href]="getCommunityPageUrl(result)" target="_blank"
@ -78,14 +45,17 @@
class="uk-width-expand uk-margin-auto-right"></manage>
</div>
<div *ngIf="type === 'stakeholder'" [title]="result.index_shortName" class="uk-text-large uk-grid">
<a *ngIf="directLink" [href]="getStakeholderPageUrl(result)" target="_blank"
[class]="(result.isManager)?'uk-width-3-4@s portal-link':'portal-link'">
<a *ngIf="directLink && hasPermission(result)" [href]="getStakeholderPageUrl(result)" target="_blank"
[class.uk-width-3-4@s]="result.isManager" class="portal-link">
{{(result.name) ? result.name : result.index_shortName}}
</a>
<a *ngIf="!directLink" (click)="confirmModalOpen(result)" [class]="(result.isManager)?'uk-width-3-4@s':''"
<a *ngIf="!directLink && hasPermission(result)" (click)="confirmModalOpen(result)" [class.uk-width-3-4@s]="result.isManager"
class="portal-link">
{{(result.name) ? result.name : result.index_shortName}}
</a>
<div *ngIf="!hasPermission(result)" [class.uk-width-3-4@s]="result.isManager">
{{(result.name) ? result.name : result.index_shortName}}
</div>
<manage *ngIf="result.isManager" [alias]="result.alias"
class="uk-width-expand uk-margin-auto-right"></manage>
</div>
@ -120,4 +90,24 @@
You will be navigated to a new tab. Are you sure that you want to proceed?
</div>
</modal-alert>
<ng-template #resultPreview let-result="result">
<div class="uk-flex uk-flex-center">
<img *ngIf="result.logoUrl && result.logoUrl != '' && result.isUpload "
[src]="properties.utilsService + '/download/' + result.logoUrl"
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<img *ngIf="result.logoUrl && result.logoUrl != '' && !result.isUpload " [src]="result.logoUrl | urlPrefix"
alt="{{(result.title)?result.title:result.shortTitle}} logo" loading="lazy">
<span *ngIf="result.logoUrl == null || result.logoUrl == ''" class="uk-icon">
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none"
stroke="#000"
stroke-width="1.1"
cx="7.7" cy="8.6"
r="3.5"></circle> <path
fill="none" stroke="#000" stroke-width="1.1"
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none"
stroke="#000"
stroke-width="1.1"
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
</span>
</div>
</ng-template>

View File

@ -51,6 +51,9 @@ export class PortalSearchResultComponent implements OnInit{
});
}
hasPermission(result: CommunityInfo & StakeholderInfo) {
return this.type === "community" || result.visibility === "PUBLIC" || result.isManager || result.isMember;
}
getProductionPrefix(id:string): string {
return (this.properties.environment == "production") ? "" : "beta.";