[Library | Trunk]: Remove if enviroment is development from feedback.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58347 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-03-27 10:06:09 +00:00
parent 5aeef7a068
commit 059db9755b
5 changed files with 93 additions and 88 deletions

View File

@ -4,91 +4,96 @@ import {DomSanitizer} from "@angular/platform-browser";
import {ResultLandingInfo} from "../../utils/entities/resultLandingInfo";
@Component({
selector: 'b2note',
template: `
<form ngNoForm
action="https://b2note.eudat.eu/interface_main.html"
method="post"
target="b2note_iframe"
class="uk-padding-small uk-padding-remove-vertical">
<!--URL of the annotated record-->
<input
type="hidden"
name="recordurl_tofeed"
[value]="url">
<!--PID of the annotated record-->
<input
type="hidden"
name="pid_tofeed"
[value]="pid">
<!--URL of the record contents for downloading-->
<button class="uk-button uk-button-secondary uk-width-1-1"
(click)="toggleAnnotation($event)"
type="submit"
value="Annotate"
title="Click to annotate file using B2Note.">
Annotate
</button>
</form>
<div [class.uk-hidden]="!visible" class="widget-container">
<!--Close button, should be bound to hide the widget-->
<button type="button" class="close" aria-label="Close" (click)="toggleAnnotation($event)">
<span aria-hidden="true">×</span>
</button>
<!--The glorious iframe with the running app!-->
<iframe id="b2note_iframe" name="b2note_iframe" class="b2note-iframe">
</iframe>
</div>`,
styleUrls: ['annotation.css']
selector: 'b2note',
template: `
<form ngNoForm
action="https://b2note-dev.bsc.es/widget/"
method="post"
target="b2note_iframe"
class="uk-padding-small uk-padding-remove-vertical">
<!--URL of the annotated record-->
<input
type="hidden"
name="recordurl_tofeed"
[value]="url">
<!--URL of the record contents for downloading-->
<input
type="hidden"
name="subject_tofeed"
[value]="url">
<!--PID of the annotated record-->
<input
type="hidden"
name="pid_tofeed"
[value]="pid">
<!--URL of the record contents for downloading-->
<button class="uk-button uk-button-secondary uk-width-1-1"
(click)="toggleAnnotation($event)"
type="submit"
value="Annotate"
title="Click to annotate file using B2Note.">
Annotate
</button>
</form>
<div [class.uk-hidden]="!visible" class="widget-container">
<!--Close button, should be bound to hide the widget-->
<button type="button" class="close" aria-label="Close" (click)="toggleAnnotation($event)">
<span aria-hidden="true">×</span>
</button>
<!--The glorious iframe with the running app!-->
<iframe id="b2note_iframe" name="b2note_iframe" class="b2note-iframe">
</iframe>
</div>`,
styleUrls: ['annotation.css']
})
export class AnnotationComponent implements OnInit, OnDestroy {
@Input()
public landingInfo: ResultLandingInfo = null;
@Input()
public id: string = null;
public url: string = null;
public pid: string = null;
public keywords: string[] = [];
public visible: boolean = false;
constructor(private annotationService: AnnotationService,
private sanitizer: DomSanitizer) {
}
ngOnInit(): void {
if(typeof window !== "undefined") {
let id = this.id;
this.url = window.location.href;
if (this.landingInfo.deletedByInferenceIds) {
id = this.landingInfo.deletedByInferenceIds[0];
this.url = this.url.replace(this.id, id);
}
if (this.landingInfo.identifiers.size > 0) {
if (this.landingInfo.identifiers.get('doi')) {
this.pid = this.landingInfo.identifiers.get('doi')[0];
} else {
const key: string = this.landingInfo.identifiers.keys().next().value;
if (key) {
this.pid = this.landingInfo.identifiers.get(key)[0];
}
}
} else {
this.pid = id;
}
console.log(this.pid);
console.log(this.url);
@Input()
public landingInfo: ResultLandingInfo = null;
@Input()
public id: string = null;
public url: string = null;
public pid: string = null;
public keywords: string[] = [];
public visible: boolean = false;
constructor(private annotationService: AnnotationService,
private sanitizer: DomSanitizer) {
}
ngOnInit(): void {
if (typeof window !== "undefined") {
let id = this.id;
this.url = window.location.href;
if (this.landingInfo.deletedByInferenceIds) {
id = this.landingInfo.deletedByInferenceIds[0];
this.url = this.url.replace(this.id, id);
}
if (this.landingInfo.identifiers.size > 0) {
if (this.landingInfo.identifiers.get('doi')) {
this.pid = this.landingInfo.identifiers.get('doi')[0];
} else {
const key: string = this.landingInfo.identifiers.keys().next().value;
if (key) {
this.pid = this.landingInfo.identifiers.get(key)[0];
}
}
} else {
this.pid = id;
}
console.log(this.pid);
console.log(this.url);
}
ngOnDestroy(): void {
}
public toggleAnnotation(event) {
if(this.visible) {
event.preventDefault()
}
this.visible = !this.visible;
}
ngOnDestroy(): void {
}
public toggleAnnotation(event) {
if (this.visible) {
event.preventDefault()
}
this.visible = !this.visible;
}
}

View File

@ -603,7 +603,7 @@
</div>
</div>
</div>
<feedback *ngIf="dataProviderInfo && properties.environment === 'development'" [dataProviderInfo]="dataProviderInfo"
<feedback *ngIf="dataProviderInfo" [dataProviderInfo]="dataProviderInfo"
[properties]="properties" [entityType]="'content provider'" [fields]="feedbackFields"
[showForm]="showFeedback" (show)="showFeedback = $event"></feedback>
<!-- Statistics -->

View File

@ -201,7 +201,7 @@
</div>
</div>
</div>
<feedback *ngIf="organizationInfo && properties.environment === 'development'" [organizationInfo]="organizationInfo"
<feedback *ngIf="organizationInfo" [organizationInfo]="organizationInfo"
[properties]="properties" [entityType]="'organization'" [fields]="feedbackFields"
[showForm]="showFeedback" (show)="showFeedback = $event"></feedback>
</div>

View File

@ -718,7 +718,7 @@
</modal-alert>
</div>
</div>
<feedback *ngIf="projectInfo && properties.environment === 'development'" [projectInfo]="projectInfo"
<feedback *ngIf="projectInfo" [projectInfo]="projectInfo"
[properties]="properties" [entityType]="'project'" [title]="projectName" [fields]="feedbackFields"
[showForm]="showFeedback" (show)="showFeedback = $event"></feedback>
</div>

View File

@ -435,10 +435,10 @@
</div>
<div class="uk-width-1-3@m uk-width-1-1@s">
<div class="uk-card uk-card-default uk-padding-small">
<!--<b2note *ngIf=" properties.environment === 'development' && resultLandingInfo" [id]="id"
[landingInfo]="resultLandingInfo"></b2note>-->
<div *ngIf="isRouteAvailable('participate/direct-claim')">
<div class="uk-margin-auto uk-width-3-4">
<!-- <b2note *ngIf=" properties.environment === 'development' && resultLandingInfo" [id]="id"
[landingInfo]="resultLandingInfo"></b2note>-->
<button class="uk-button uk-width-1-1 portal-button">
<span uk-icon="link"></span>
Link this <span *ngIf="type != 'orp'">{{title.toLowerCase()}}</span><span
@ -534,7 +534,7 @@
</div>
</div>
<feedback *ngIf="resultLandingInfo && properties.environment === 'development'" [resultLandingInfo]="resultLandingInfo"
<feedback *ngIf="resultLandingInfo" [resultLandingInfo]="resultLandingInfo"
[properties]="properties" [entityType]="getTypeName()" [fields]="feedbackFields"
[showForm]="showFeedback" (show)="showFeedback = $event"></feedback>
<!-- Other versions -->