[Library | Trunk]: 1. showSubjects.component.ts: Nothing but aligning code 2. parsingFunctions.class.ts: Added field "notebookInSubjects", which is set to true when "notebook" is included in subjects. 3. resultLandingInfo.ts: [New] "showEgiNotebookButton" property added. 4. resultLanding.service.ts: Set resultLandingInfo.showEgiNotebookButton. 5. resultLanding.component.html: Added Egi Notebook button on top right section of page (for beta Explore only). 6. resultLanding.component.ts: Added styles (background color) for new class "notebook-button".

This commit is contained in:
Konstantina Galouni 2021-09-23 17:49:41 +03:00
parent d80ac4904a
commit ef8c330f7c
6 changed files with 41 additions and 9 deletions

View File

@ -6,6 +6,8 @@ import {Injectable} from '@angular/core';
providedIn: 'root'
})
export class ParsingFunctions {
public notebookInSubjects: boolean = false;
public open = 'assets/common-assets/unlock.svg';
public closed = 'assets/common-assets/lock.svg';
public unknown = 'assets/common-assets/question.svg';
@ -530,8 +532,12 @@ export class ParsingFunctions {
if (subjects == undefined) {
subjects = new Array<string>();
}
subjects.push(subject.content);
let content: string = subject.content;
if(content && content.toLowerCase().includes("notebook")) {
this.notebookInSubjects = true;
}
subjects.push(content);
} else {
if (otherSubjects == undefined) {
otherSubjects = new Map<string, string[]>();
@ -540,7 +546,13 @@ export class ParsingFunctions {
if (!otherSubjects.has(subject.classname)) {
otherSubjects.set(subject.classname, new Array<string>());
}
otherSubjects.get(subject.classname).push(subject.content);
let content: string = subject.content;
let classname: string = subject.classname;
if( (content && content.toLowerCase().includes("notebook") ||
(classname && classname.toLowerCase().includes("notebook")))) {
this.notebookInSubjects = true;
}
otherSubjects.get(classname).push(content);
}
}
}

View File

@ -23,13 +23,13 @@ import {Component, Input} from '@angular/core';
<span *ngIf="subjects && subjects.length > 0">{{subjects.join(', ')}}</span>
<span *ngIf="(subjects && subjects.length > 0) && (otherSubjects && otherSubjects.size > 0)">, </span>
<span *ngIf="otherSubjects && otherSubjects.size > 0">
<span *ngFor="let key of getKeys(otherSubjects); let i=index">
<span *ngIf="otherSubjects.get(key).length > 0">
<span>{{otherSubjects.get(key).join(', ')}}</span>
<span *ngIf="i < (otherSubjects.size - 1)">, </span>
<span *ngFor="let key of getKeys(otherSubjects); let i=index">
<span *ngIf="otherSubjects.get(key).length > 0">
<span>{{otherSubjects.get(key).join(', ')}}</span>
<span *ngIf="i < (otherSubjects.size - 1)">, </span>
</span>
</span>
</span>
</span>
</span>
</div>
</div>
</div>

View File

@ -121,6 +121,19 @@
<span class="uk-margin-small-left">add annotation</span>
</span>
</li>
<!-- EGI Notebook-->
<li *ngIf="resultLandingInfo.showEgiNotebookButton && properties.adminToolsPortalType == 'explore'
&& (properties.environment == 'beta' || properties.environment == 'development')">
<a class="uk-link-text uk-text-bold uk-text-uppercase"
target="_blank" href="https://marketplace.eosc-portal.eu/services/egi-notebooks?q=EGI+Notebook">
<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>
<span class="uk-margin-small-left"><u>EGI Notebook</u></span>
<span class="custom-external custom-icon space"></span>
</a>
</li>
<!-- Metrics -->
<li *ngIf="hasAltMetrics || hasMetrics" class="uk-margin-medium-top">
<div uk-grid

View File

@ -27,6 +27,10 @@ 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',
})

View File

@ -312,6 +312,8 @@ export class ResultLandingService {
this.resultLandingInfo.subjects = subjectResults[0];
this.resultLandingInfo.otherSubjects = subjectResults[1];
this.resultLandingInfo.classifiedSubjects = subjectResults[2];
this.resultLandingInfo.showEgiNotebookButton = this.parsingFunctions.notebookInSubjects;
}
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(

View File

@ -49,6 +49,7 @@ export class ResultLandingInfo {
subjects: string[];
otherSubjects: Map<string, string[]>;
classifiedSubjects: Map<string, string[]>; //<class of subject, subjects>
showEgiNotebookButton: boolean = false;
// percentage is for trust
relatedResearchResults: RelationResult[];