113 lines
3.7 KiB
TypeScript
113 lines
3.7 KiB
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {JSONP_PROVIDERS} from '@angular/http';
|
|
import {Observable} from 'rxjs/Observable';
|
|
import { RouteParams, RouteConfig, ROUTER_DIRECTIVES, Router } from '@angular/router-deprecated';
|
|
import {ClaimContextComponent} from '../linking/claimContext/claimContext.component';
|
|
import {ClaimSelectedComponent} from '../linking/selected/selected.component';
|
|
import {ClaimInsertComponent} from '../linking/insertClaim/insertClaim.component';
|
|
|
|
@Component({
|
|
selector: 'inline-claim-context',
|
|
directives: [ROUTER_DIRECTIVES, ClaimContextComponent, ClaimSelectedComponent, ClaimInsertComponent],
|
|
template: `
|
|
|
|
|
|
|
|
<div class="panel-body" >
|
|
<h6>Find Context:</h6>
|
|
<div *ngIf=" show == 'context' " class="row" >
|
|
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
|
|
<claim-selected [contexts]="contexts"
|
|
(contextsChange)="contextsChange($event)"
|
|
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
|
</div>
|
|
<div *ngIf=" show == 'claim'" >
|
|
<claim-selected [contexts]="contexts" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
|
<claim-insert (showChange)="showChange($event)" inline="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert>
|
|
</div>
|
|
<nav>
|
|
<ul class="pager">
|
|
<li *ngIf="show != 'context'" class="previous" (click)="prev()"><a ><span aria-hidden="true">←</span> Previous</a></li>
|
|
<li class="next" *ngIf="show != 'claim'" (click)="next()" ><a >Next <span aria-hidden="true">→</span></a></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
<!-- <h3>Find Context</h3>
|
|
|
|
<div *ngIf="show=='context'" >
|
|
|
|
|
|
<claim-contexts [selectedList]="contexts" (contextsChange)="contextsChange($event)" > </claim-contexts>
|
|
|
|
<h3>Link to</h3>
|
|
<claim-selected [contexts]="contexts"
|
|
(contextsChange)="contextsChange($event)"
|
|
(showChange)="showChange($event)" [inlineEntity]="inlineEntity" inline="true" [inlineType]="inlineType" > </claim-selected>
|
|
|
|
|
|
|
|
<button (click)="claim()" class="btn btn-primary" style="float:right">Finish</button>
|
|
|
|
</div>
|
|
<div *ngIf="show=='claim'" >
|
|
<claim-insert showAccessRights="true" [contexts]="contexts" [publications]="publications" [datasets]="datasets" ></claim-insert>
|
|
</div>-->
|
|
|
|
`
|
|
|
|
})
|
|
export class InlineClaimContextComponent {
|
|
constructor ( private _router: Router ) {
|
|
|
|
}
|
|
|
|
@Input() public inlineEntity:any;
|
|
@Input() public inlineType:string;
|
|
|
|
|
|
contexts=[];
|
|
publications;
|
|
datasets;
|
|
show = "context";
|
|
keyword: string = "";
|
|
|
|
ngOnInit() {
|
|
|
|
}
|
|
next(){
|
|
if(this.inlineType === 'dataset'){
|
|
this.datasets = [];
|
|
this.datasets.push(this.inlineEntity[0]);
|
|
}else if(this.inlineType === 'publication'){
|
|
this.publications = [];
|
|
this.publications.push(this.inlineEntity[0]);
|
|
console.info(" result: :targetId: " +this.publications[0].id + "targetType :"+ this.publications[0].type+" targetCollectedFrom:"+ this.publications[0].source+ "targetAccessRights :"+this.publications[0].accessRights+ " targetEmbargoEndDate:"+this.publications[0].embargoEndDate);
|
|
}
|
|
if( this.show == 'context'){
|
|
this.show='claim';
|
|
}
|
|
}
|
|
prev(){
|
|
if(this.show == 'claim'){
|
|
this.show = 'context';
|
|
}
|
|
}
|
|
|
|
|
|
contextsChange($event) {
|
|
this.contexts=$event.value;
|
|
console.log($event.value);
|
|
}
|
|
|
|
showChange($event) {
|
|
this.show=$event.value;
|
|
if(this.show == "end"){
|
|
this.contexts = [];
|
|
this.show = "context";
|
|
}
|
|
}
|
|
|
|
}
|