1 |
43805
|
argiro.kok
|
import {Component, ElementRef} from '@angular/core';
|
2 |
44262
|
argiro.kok
|
import { Subject } from 'rxjs/Subject';
|
3 |
|
|
import {Observable} from 'rxjs/Observable';
|
4 |
|
|
import {OpenaireProjectsService} from '../services/openaireProjects.service';
|
5 |
44733
|
argiro.kok
|
import {SearchProjectsService} from '../services/searchProjects.service';
|
6 |
|
|
|
7 |
|
|
import {SearchPublicationsService} from '../services/searchPublications.service';
|
8 |
|
|
import {SearchDatasetsService} from '../services/searchDatasets.service';
|
9 |
|
|
|
10 |
44309
|
argiro.kok
|
import {ISVocabulariesService} from '../services/ISVocabularies.service';
|
11 |
44502
|
argiro.kok
|
import {Dates} from '../utils/dates.class';
|
12 |
43805
|
argiro.kok
|
@Component({
|
13 |
|
|
selector: 'test',
|
14 |
|
|
template: `
|
15 |
43890
|
argiro.kok
|
<!--i-frame url="https://google.com" width="30%" height="250"></i-frame-->
|
16 |
44309
|
argiro.kok
|
<div style ="width:30%; height:250px;" >
|
17 |
44726
|
argiro.kok
|
<!--static-autocomplete2 [(list)]=lan [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for languages" title = "Languages:" [multipleSelections]=false ></static-autocomplete2-->
|
18 |
44309
|
argiro.kok
|
<div>
|
19 |
43890
|
argiro.kok
|
<div style ="width:30%; height:250px;" >
|
20 |
44262
|
argiro.kok
|
<static-autocomplete [(filtered)] =filtered [(selected)] =selected [showSelected]=true placeHolderMessage = "Search for countries" title = "Countries:" (keywordChange)="keywordChanged($event)" ></static-autocomplete>
|
21 |
43890
|
argiro.kok
|
<div>
|
22 |
|
|
Selected::
|
23 |
|
|
<span class="row-fluid show-grid auto-complete-choice" *ngFor="let item of selected" >
|
24 |
|
|
<span >{{item.label}} </span>
|
25 |
|
|
</span>
|
26 |
44262
|
argiro.kok
|
|
27 |
44343
|
argiro.kok
|
<div style ="width:80%; height:250px;" >
|
28 |
|
|
<dynamic-autocomplete [showSelected]=true
|
29 |
|
|
placeHolderMessage = "Search for Projects" title = "Projects:" ></dynamic-autocomplete>
|
30 |
44262
|
argiro.kok
|
<div>
|
31 |
44380
|
argiro.kok
|
<div class="container" >
|
32 |
|
|
<div class="title">
|
33 |
|
|
Welcome
|
34 |
|
|
</div>
|
35 |
|
|
<div class="panel-body">
|
36 |
|
|
<div class="row">
|
37 |
|
|
<div class="input-field col s12">
|
38 |
|
|
<input [(ngModel)]="user.email" id="email"
|
39 |
|
|
type="email" class="validate">
|
40 |
|
|
<label for="email">Email</label>
|
41 |
|
|
</div>
|
42 |
|
|
</div>
|
43 |
|
|
|
44 |
|
|
<div class="row">
|
45 |
|
|
<div class="input-field col s12">
|
46 |
|
|
<input [(ngModel)]="user.password" id="password"
|
47 |
|
|
type="password" class="validate">
|
48 |
|
|
<label for="password">Password</label>
|
49 |
|
|
</div>
|
50 |
|
|
</div>
|
51 |
|
|
|
52 |
|
|
<span>{{errorMsg}}</span>
|
53 |
|
|
<button (click)="login()"
|
54 |
|
|
class="btn waves-effect waves-light"
|
55 |
|
|
type="submit" name="action">Login</button>
|
56 |
|
|
</div>
|
57 |
|
|
</div>
|
58 |
43890
|
argiro.kok
|
`
|
59 |
44343
|
argiro.kok
|
//[(filtered)] =filteredObs [(selected)] =selectedObs
|
60 |
|
|
// [(searchTermStream)] = searchTermStream
|
61 |
44262
|
argiro.kok
|
//(keywordChange)="keywordChanged($event)"
|
62 |
43890
|
argiro.kok
|
})
|
63 |
|
|
export class TestComponent {
|
64 |
44262
|
argiro.kok
|
// for auto complete observable:
|
65 |
44343
|
argiro.kok
|
// searchTermStream = new Subject<string>();
|
66 |
|
|
// private selectedObs = [];
|
67 |
|
|
// filteredObs: Observable<{}> = this.searchTermStream
|
68 |
|
|
// .debounceTime(300).distinctUntilChanged()
|
69 |
|
|
// .switchMap((term: string) => this.service(term));
|
70 |
44309
|
argiro.kok
|
private lan;
|
71 |
|
|
private types;
|
72 |
44380
|
argiro.kok
|
|
73 |
|
|
private user:{password:string,email:string} = {password:"",email:""};
|
74 |
44733
|
argiro.kok
|
constructor(private _projectService: OpenaireProjectsService,private _searchProjectsService:SearchProjectsService,private _searchPubService:SearchPublicationsService,private _searchDataService:SearchDatasetsService, private _vocabulariesService: ISVocabulariesService) {
|
75 |
44309
|
argiro.kok
|
// this.elementRef = myElement;
|
76 |
|
|
}
|
77 |
|
|
ngOnInit() {
|
78 |
|
|
// this.lan = this._vocabulariesService.getLanguages();
|
79 |
|
|
this.lan = this._vocabulariesService.getLanguagesJsonFile();
|
80 |
|
|
this.types = this._vocabulariesService.getPublicationTypesJsonFile();
|
81 |
44380
|
argiro.kok
|
this.user.email = localStorage.getItem("email");
|
82 |
|
|
this.user.password = localStorage.getItem("password");
|
83 |
44733
|
argiro.kok
|
//&collectedFrom=openaire____::4a39de251a65e801bb88d3e75b47623f&cl=and
|
84 |
|
|
this._searchDataService.searchDatasets("&collectedFrom=openaire____::fdb035c8b3e0540a8d9a561a6c44f4de&cl=and" ,"&refine=true&fields=resulthostingdatasourceid", 1, 0, ["resulthostingdatasourceid"]).subscribe(
|
85 |
|
|
data => {
|
86 |
|
|
|
87 |
|
|
console.info("done" +data[0]);
|
88 |
|
|
|
89 |
|
|
},
|
90 |
|
|
err => {
|
91 |
|
|
console.error(err)
|
92 |
|
|
|
93 |
|
|
}
|
94 |
|
|
);
|
95 |
|
|
this._searchPubService.searchPublications("&fq=collectedfromdatasourceid exact openaire____::fdb035c8b3e0540a8d9a561a6c44f4de","&refine=true&fields=resulthostingdatasourceid" , 0, 0, ["resulthostingdatasourceid"]).subscribe(
|
96 |
|
|
data => {
|
97 |
|
|
|
98 |
|
|
console.info("done" +data[0]);
|
99 |
|
|
|
100 |
|
|
},
|
101 |
|
|
err => {
|
102 |
|
|
console.error(err)
|
103 |
|
|
|
104 |
|
|
}
|
105 |
|
|
);
|
106 |
|
|
this._searchProjectsService.getProjectsforDataProvider("openaire____::db600878200645bd752cf7fd96a37df5",1,10).subscribe(
|
107 |
|
|
data => {
|
108 |
|
|
|
109 |
|
|
console.info("done" +data[0]);
|
110 |
|
|
|
111 |
|
|
},
|
112 |
|
|
err => {
|
113 |
|
|
console.error(err)
|
114 |
|
|
|
115 |
|
|
}
|
116 |
|
|
);
|
117 |
44309
|
argiro.kok
|
}
|
118 |
44380
|
argiro.kok
|
login(){
|
119 |
|
|
localStorage.setItem("email",this.user.email);
|
120 |
|
|
localStorage.setItem("password",this.user.password);
|
121 |
|
|
console.info("Save email/ password in local Storage. Email is:" + localStorage.getItem("email"));
|
122 |
|
|
|
123 |
|
|
}
|
124 |
44262
|
argiro.kok
|
service(term) {
|
125 |
|
|
var projects = this._projectService.searchForProjectsObs(term, "this.selectedFunderId");
|
126 |
|
|
console.info("Results: "+ projects);
|
127 |
|
|
for( var i = 0 ; i<projects.length ; i++){
|
128 |
|
|
|
129 |
|
|
}
|
130 |
|
|
return projects;
|
131 |
|
|
}
|
132 |
|
|
|
133 |
43890
|
argiro.kok
|
private filtered = [];
|
134 |
|
|
private selected = [];
|
135 |
|
|
keywordChanged($event) {
|
136 |
44309
|
argiro.kok
|
console.log("keyword Changed"+this.lan.length+" "+this.lan[0].id+"-"+this.lan[0].label);
|
137 |
43890
|
argiro.kok
|
var keyword = $event.value;
|
138 |
44309
|
argiro.kok
|
this.filtered = this.types.filter(function(el){
|
139 |
43890
|
argiro.kok
|
return el.label.toLowerCase().indexOf(keyword.toLowerCase()) > -1;
|
140 |
|
|
}.bind(this));
|
141 |
43805
|
argiro.kok
|
|
142 |
43890
|
argiro.kok
|
}
|
143 |
|
|
public countries = [
|
144 |
|
|
{id: '0', label: "Albania"},{id: '1', label: "Andorra"},{id: '2', label: "Armenia"},
|
145 |
|
|
{id: '3', label: "Austria"},{id: '4', label: "Azerbaijan"},{id: '5', label: "Belarus"},{id: '6', label: "Belgium"},
|
146 |
|
|
{id: '7', label: "Bosnia & Herzegovina"},{id: '8', label: "Bulgaria"},{id: '9', label: "Croatia"},
|
147 |
|
|
{id: '10', label: "Cyprus"},{id: '11', label: "Czech Republic"},{id: '12', label: "Denmark"},{id: '13', label: "Estonia"},
|
148 |
|
|
{id: '14', label: "Finland"},{id: '15', label: "France"},{id: '16', label: "Georgia"},
|
149 |
|
|
{id: '17', label: "Germany"},{id: '18', label: "Greece"},{id: '19', label: "Hungary"},{id: '20', label: "Iceland"},
|
150 |
|
|
{id: '21', label: "Ireland"},{id: '22', label: "Italy"},{id: '23', label: "Kosovo"},
|
151 |
|
|
{id: '24', label: "Latvia"},{id: '25', label: "Liechtenstein"},{id: '26', label: "Lithuania"},{id: '27', label: "Luxembourg"}];
|
152 |
43805
|
argiro.kok
|
|
153 |
43890
|
argiro.kok
|
|
154 |
|
|
// "Latvia","Liechtenstein","Lithuania","Luxembourg","Macedonia","Malta",
|
155 |
|
|
// "Moldova","Monaco","Montenegro","Netherlands","Norway","Poland",
|
156 |
|
|
// "Portugal","Romania","Russia","San Marino","Serbia","Slovakia","Slovenia",
|
157 |
|
|
// "Spain","Sweden","Switzerland","Turkey","Ukraine","United Kingdom","Vatican City"];
|
158 |
43805
|
argiro.kok
|
}
|