0">
+
+
0" class="alert alert-warning" role="alert">{{warningMessage}}
0" class="alert alert-info" role="alert">{{infoMessage}}
`
})
export class ClaimContextComponent {
- ngOnInit() {
-this.getCommunities();
-
-}
@Input() public inline:boolean = false ; // for claimed started from landing pages
@Input() public showComponent:boolean = true ; // for claimed started from landing pages
+@Input() public selectedList = [];
+@Input() public selectedCommunityId:string = "0";
+@Input() public selectedCategoryId:string ="0";
+@Output() cselectedCommunityChange = new EventEmitter();
+@Output() selectedCategoryChange = new EventEmitter();
public query = '';
public filteredList = [];
-@Input() public selectedList ;
public elementRef;
-// @Output() contextsChange = new EventEmitter();
public communities:string[];
-@Input() public selectedCommunityId:string = "0";
- selectedCommunityLabel:string = "Community:";
-@Output() cselectedCommunityChange = new EventEmitter();
+private selectedCommunityLabel:string = "Community:";
public categories:string[];
-@Input() public selectedCategoryId:string ="0";
-selectedCategoryLabel:string ="Category:";
-@Output() selectedCategoryChange = new EventEmitter();
+private selectedCategoryLabel:string ="Category:";
public concepts:string[];
public warningMessage = "";
public infoMessage = "";
+ngOnInit() {
+ this.getCommunities();
+}
constructor(private _contextService: ContextsService,myElement: ElementRef) {
this.elementRef = myElement;
}
-filter() {
- this.warningMessage = "";
- this.infoMessage = "";
- if(this.selectedCommunityId == "0"){
- this.warningMessage = "Please select Community";
- }else if (this.query !== ""){
- this.warningMessage = "";
- this.infoMessage = "";
- if(this.selectedCategoryId == "0"){
- this.warningMessage = "Specify category for more concepts";
- }
- this.filteredList = this.concepts.filter(function(el){
- return el.label.toLowerCase().indexOf(this.query.toLowerCase()) > -1;
- }.bind(this));
- if(this.filteredList.length == 0 ){
- this.infoMessage = "No results found";
- }
- }else{
- this.filteredList = [];
+// filter() {
+ // this.warningMessage = "";
+ // this.infoMessage = "";
+ // if(this.selectedCommunityId == "0"){
+ // this.warningMessage = "Please select Community";
+ // }else if (this.query !== ""){
+ // this.warningMessage = "";
+ // this.infoMessage = "";
+ // if(this.selectedCategoryId == "0"){
+ // this.warningMessage = "Specify category for more concepts";
+ // }
+ // this.filteredList = this.concepts.filter(function(el){
+ // return el.label.toLowerCase().indexOf(this.query.toLowerCase()) > -1;
+ // }.bind(this));
+ // if(this.filteredList.length == 0 ){
+ // this.infoMessage = "No results found";
+ // }
+ // }else{
+ // this.filteredList = [];
+ // }
+ //
+// }
+
+
+filter($event) {
+ var query = $event.value;
+ this.query = $event.value;
+ this.filteredList = this.concepts.filter(function(el){
+ return el.label.toLowerCase().indexOf(query.toLowerCase()) > -1;
+ }.bind(this));
+ var list = [ ];
+ for (var _i = 0; _i < this.filteredList.length; _i++) {
+ let item = this.filteredList[_i];
+ var context: ClaimContext= { community: this.selectedCommunityLabel, category: this.selectedCategoryLabel, concept: item };
+ list.push(context);
}
+ this.filteredList = list;
}
select(item){
this.query = "";
this.filteredList = [];
- var context= { community: this.selectedCommunityLabel, category: this.selectedCategoryLabel, concept: item };
+ var context: ClaimContext= { community: this.selectedCommunityLabel, category: this.selectedCategoryLabel, concept: item };
var found:boolean = false;
this.warningMessage = "";
for (var _i = 0; _i < this.selectedList.length; _i++) {
@@ -142,48 +165,26 @@ select(item){
}
if (!found) {
this.selectedList.push(context);
- // this.contextsChange.emit({
- // value: this.selectedList
- // });
}
- // var index:number =this.selectedList.indexOf(context);
- // if (index == -1) {
- // this.selectedList.push(context);
- // this.contextsChange.emit({
- // value: this.selectedList
- // });
- // }
+}
-}
-// remove(item){
-// var index:number =this.selectedList.indexOf(item);
-// if (index > -1) {
-// this.selectedList.splice(index, 1);
+// handleClick(event){
+// var clickedComponent = event.target;
+// var inside = false;
+// do {
+// if (clickedComponent === this.elementRef.nativeElement) {
+// inside = true;
+// }
+// clickedComponent = clickedComponent.parentNode;
+// } while (clickedComponent);
+// if(!inside){
+// this.filteredList = [];
// }
-// this.contextsChange.emit({
-// value: this.selectedList
-// });
// }
-handleClick(event){
- var clickedComponent = event.target;
- var inside = false;
- do {
- if (clickedComponent === this.elementRef.nativeElement) {
- inside = true;
- }
- clickedComponent = clickedComponent.parentNode;
- } while (clickedComponent);
- if(!inside){
- this.filteredList = [];
- }
-}
getCommunities () {
this._contextService.getCommunities().subscribe(
data => {
this.communities = data.communities;
- // var concept= ["{id: this.communities['id'], label: this.communities['label'] }"];
- // this.filteredList.push(concept);
- // this.concepts.push(concept);
},
err => console.error(err)
);
@@ -197,7 +198,9 @@ getCommunities () {
this.concepts = [];
this.filteredList = [];
if (this.query !== ""){
- this.filter();
+ var event = {value: ""};
+ event.value = this.query;
+ this.filter(event);
}
},
@@ -211,8 +214,10 @@ getCommunities () {
data => {
this.concepts = data.concept;
if (this.query !== ""){
- this.filter();
- }
+ var event = {value: ""};
+ event.value = this.query;
+ this.filter(event);
+ }
},
err => console.error(err)
);
@@ -220,21 +225,21 @@ getCommunities () {
this.concepts=[];
}
}
-communityChanged(communityId:string, communityLabel:string){
- this.warningMessage = "";
- this.infoMessage = "";
- this.selectedCommunityId= communityId;
- this.selectedCommunityLabel= communityLabel;
- this.getCategories();
-
-}
-categoryChanged(categoryId:string, categoryLabel:string){
- this.warningMessage = "";
- this.infoMessage = "";
- this.selectedCategoryId = categoryId;
- this.selectedCategoryLabel = categoryLabel;
- this.getConcepts();
-
-}
+ communityChanged(communityId:string, communityLabel:string){
+ this.warningMessage = "";
+ this.infoMessage = "";
+ this.selectedCommunityId= communityId;
+ this.selectedCommunityLabel= communityLabel;
+ this.getCategories();
+
+ }
+ categoryChanged(categoryId:string, categoryLabel:string){
+ this.warningMessage = "";
+ this.infoMessage = "";
+ this.selectedCategoryId = categoryId;
+ this.selectedCategoryLabel = categoryLabel;
+ this.getConcepts();
+
+ }
}
diff --git a/portal-2/src/app/claimPages/claim-utils/claimDataset.component.ts b/portal-2/src/app/claimPages/claim-utils/claimDataset.component.ts
index 5e06eada..07c539d5 100644
--- a/portal-2/src/app/claimPages/claim-utils/claimDataset.component.ts
+++ b/portal-2/src/app/claimPages/claim-utils/claimDataset.component.ts
@@ -1,6 +1,7 @@
import { Component, Input, Output, EventEmitter} from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { SearchDataciteService } from '../../services/searchDatacite.service';
+import {ClaimResult} from '../../utils/entities/claimEntities.class';
@Component({
@@ -112,7 +113,7 @@ export class ClaimDatasetComponent {
}
add(item, itemId,itemType,itemSource,itemTitle, itemUrl, date){
- var result ;
+ var result: ClaimResult ;
if(itemSource == 'datacite'){
result = {id: itemId, type :itemType, source : itemSource, title: itemTitle,url: itemUrl, result: item, accessRights: 'OPEN', embargoEndDate: this.nextDate, date : date};
}else if (itemSource == 'openaire'){
diff --git a/portal-2/src/app/claimPages/claim-utils/claimProject.component.ts b/portal-2/src/app/claimPages/claim-utils/claimProject.component.ts
index d1153420..0e330c08 100644
--- a/portal-2/src/app/claimPages/claim-utils/claimProject.component.ts
+++ b/portal-2/src/app/claimPages/claim-utils/claimProject.component.ts
@@ -4,10 +4,12 @@ import {OpenaireProjectsService} from '../../services/openaireProjects.service';
import {ProjectService} from '../../services/project.service';
import {ModalLoading} from '../../utils/modal/loading.component';
import { Subject } from 'rxjs/Subject';
-
+import {ClaimProject} from '../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-projects',
+ // styleUrls: ['/autoComplete.component.css'],
+
template: `
@@ -15,10 +17,9 @@ import { Subject } from 'rxjs/Subject';
-->
-
-
-
+ [linkToResults]="(bulkMode)?false:true" >
diff --git a/portal-2/src/app/claimPages/linking/selected/selected.component.ts b/portal-2/src/app/claimPages/linking/selected/selected.component.ts
index 66e09d87..3917e35d 100644
--- a/portal-2/src/app/claimPages/linking/selected/selected.component.ts
+++ b/portal-2/src/app/claimPages/linking/selected/selected.component.ts
@@ -1,4 +1,5 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
+import {ClaimResult,ClaimProject, ClaimContext} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected',
@@ -121,10 +122,10 @@ export class ClaimSelectedComponent {
}
- @Input() contexts;
- @Input() projects;
- @Input() publications;
- @Input() datasets;
+ @Input() contexts: ClaimContext[];
+ @Input() projects: ClaimProject[];
+ @Input() publications: ClaimResult[];
+ @Input() datasets: ClaimResult[];
@Input() showAccessRights:boolean = false;
@Input() show='home';
@Input() inline:boolean = false;
diff --git a/portal-2/src/app/claimPages/linking/selected/selectedContexts.component.ts b/portal-2/src/app/claimPages/linking/selected/selectedContexts.component.ts
index f9fb1af8..6ebbb1d2 100644
--- a/portal-2/src/app/claimPages/linking/selected/selectedContexts.component.ts
+++ b/portal-2/src/app/claimPages/linking/selected/selectedContexts.component.ts
@@ -1,5 +1,5 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
-
+import {ClaimContext} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-contexts',
template: `
@@ -31,7 +31,7 @@ export class ClaimSelectedContextsComponent {
}
- @Input() contexts;
+ @Input() contexts:ClaimContext[];
@Input() componentClass:string = ""; //"" or "col-sm-6" for horizontal display (besides projects)
@Input() show='home';
@Input() inline:boolean = false;
diff --git a/portal-2/src/app/claimPages/linking/selected/selectedDatasets.component.ts b/portal-2/src/app/claimPages/linking/selected/selectedDatasets.component.ts
index ea4a19a7..3628677e 100644
--- a/portal-2/src/app/claimPages/linking/selected/selectedDatasets.component.ts
+++ b/portal-2/src/app/claimPages/linking/selected/selectedDatasets.component.ts
@@ -1,6 +1,6 @@
import {Component, Input,Output, EventEmitter,ViewChild} from '@angular/core';
import {AlertModal} from '../../../utils/modal/alert';
-
+import {ClaimResult} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-datasets',
template: `
@@ -51,7 +51,7 @@ export class ClaimSelectedDatasetsComponent {
- @Input() datasets;
+ @Input() datasets: ClaimResult[];
@Input() showAccessRights:boolean = false;
@Input() inline:boolean = false;
@Input() hideType;
diff --git a/portal-2/src/app/claimPages/linking/selected/selectedProjects.component.ts b/portal-2/src/app/claimPages/linking/selected/selectedProjects.component.ts
index 91c45bcf..57f761ae 100644
--- a/portal-2/src/app/claimPages/linking/selected/selectedProjects.component.ts
+++ b/portal-2/src/app/claimPages/linking/selected/selectedProjects.component.ts
@@ -1,4 +1,5 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
+import {ClaimProject} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-projects',
@@ -33,7 +34,7 @@ ngOnInit() {
}
-@Input() projects;
+@Input() projects: ClaimProject[];
@Input() show='home';
@Input() inline:boolean = false;
@Input() hideType;
diff --git a/portal-2/src/app/claimPages/linking/selected/selectedPublications.component.ts b/portal-2/src/app/claimPages/linking/selected/selectedPublications.component.ts
index 210f5ccf..40ce24b6 100644
--- a/portal-2/src/app/claimPages/linking/selected/selectedPublications.component.ts
+++ b/portal-2/src/app/claimPages/linking/selected/selectedPublications.component.ts
@@ -1,5 +1,6 @@
import {Component, Input,Output, EventEmitter, ViewChild} from '@angular/core';
import {AlertModal} from '../../../utils/modal/alert';
+import {ClaimResult} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-publications',
@@ -48,7 +49,7 @@ export class ClaimSelectedPublicationsComponent {
//2015-05-01
}
- @Input() publications;
+ @Input() publications: ClaimResult[];
@Input() showAccessRights:boolean = false;
@Input() inline:boolean = false;
@Input() hideType;
diff --git a/portal-2/src/app/claimPages/linking/selected/selectedResults.component.ts b/portal-2/src/app/claimPages/linking/selected/selectedResults.component.ts
index 14db9103..2d5af1bc 100644
--- a/portal-2/src/app/claimPages/linking/selected/selectedResults.component.ts
+++ b/portal-2/src/app/claimPages/linking/selected/selectedResults.component.ts
@@ -1,4 +1,5 @@
import {Component, Input,Output, EventEmitter} from '@angular/core';
+import {ClaimResult} from '../../../utils/entities/claimEntities.class';
@Component({
selector: 'claim-selected-results',
@@ -47,8 +48,8 @@ export class ClaimSelectedResultsComponent {
- @Input() publications;
- @Input() datasets;
+ @Input() publications:ClaimResult[];
+ @Input() datasets:ClaimResult[];
@Input() showAccessRights:boolean = false;
@Input() show='home';
@Input() inline:boolean = false;
diff --git a/portal-2/src/app/test/test.component.ts b/portal-2/src/app/test/test.component.ts
index e3f06da9..c830d042 100644
--- a/portal-2/src/app/test/test.component.ts
+++ b/portal-2/src/app/test/test.component.ts
@@ -6,7 +6,7 @@ import {Component, ElementRef} from '@angular/core';
template: `
-
+
Selected::
diff --git a/portal-2/src/app/utils/autoComplete.component.css b/portal-2/src/app/utils/autoComplete.component.css
new file mode 100644
index 00000000..690cbed7
--- /dev/null
+++ b/portal-2/src/app/utils/autoComplete.component.css
@@ -0,0 +1,25 @@
+.auto-complete-box{
+}
+.auto-complete-choice .remove {
+ cursor: pointer;
+}
+.auto-complete-choice{
+ background: grey none repeat scroll 0 0;
+ border-color: grey;
+ border-radius: 5px;
+ border-style: solid;
+ color: white;
+ margin: 3px;
+ padding: 1px;
+}
+.auto-complete-input {
+ border-radius:0;
+ border-color: white;
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0) inset;
+}
+.form-control. auto-complete-input {
+ box-shadow: 0 1px 1px rgba(0, 0, 0, 0) inset;
+}
+.auto-complete-box .suggestions.list-group-item {
+ padding: 5px 10px;
+}
diff --git a/portal-2/src/app/utils/autoComplete.component.ts b/portal-2/src/app/utils/autoComplete.component.ts
index 43872092..71a646b9 100644
--- a/portal-2/src/app/utils/autoComplete.component.ts
+++ b/portal-2/src/app/utils/autoComplete.component.ts
@@ -1,46 +1,28 @@
import {Component, ElementRef, Input, Output, EventEmitter} from '@angular/core';
-
+import {Value} from '../searchPages/searchUtils/searchHelperClasses.class';
+import {ClaimResult, ClaimContext, ClaimProject} from './entities/claimEntities.class';
//Usage example
//
@Component({
selector: 'autocomplete',
- styles: [`
- .auto-complete-box{ }
- .auto-complete-choice .remove {
- cursor: pointer;
- }
- .auto-complete-choice{
- background: grey none repeat scroll 0 0;
- border-color: grey;
- border-radius: 5px;
- border-style: solid;
- color: white;
- margin: 3px;
- padding: 1px;
- }
- .auto-complete-input { border-radius:0; border-color: white; box-shadow: 0 1px 1px rgba(0, 0, 0, 0) inset; }
- .form-control. auto-complete-input {box-shadow: 0 1px 1px rgba(0, 0, 0, 0) inset;}
- .auto-complete-box .suggestions.list-group-item {
- padding: 5px 10px;
- }
- `],
+ styleUrls: ['autoComplete.component.css'],
template: `