[recommendations-and-nl-search | DONE | CHANGED] move DareLAB APIs to environment properties
This commit is contained in:
parent
fe3a439ff0
commit
8ea9cd5dbc
|
@ -59,8 +59,6 @@ export class HomeComponent {
|
||||||
resultsSize: number = 6;
|
resultsSize: number = 6;
|
||||||
errorMessage: string;
|
errorMessage: string;
|
||||||
|
|
||||||
getRecommendationsForOrcidAPI: string = 'https://darelab.athenarc.gr/api/faircore/user-to-item-recommender/recommend'
|
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
private _router: Router,
|
private _router: Router,
|
||||||
private _piwikService:PiwikService,
|
private _piwikService:PiwikService,
|
||||||
|
@ -208,7 +206,7 @@ export class HomeComponent {
|
||||||
|
|
||||||
getOrcidRecommendations() {
|
getOrcidRecommendations() {
|
||||||
let orcid = Identifier.getRawORCID(this.user.orcid);
|
let orcid = Identifier.getRawORCID(this.user.orcid);
|
||||||
this.subs.push(this.recommendationsService.getRecommendationsForOrcid(this.getRecommendationsForOrcidAPI, orcid).subscribe(data => {
|
this.subs.push(this.recommendationsService.getRecommendationsForOrcid(this.properties.recommendationsForOrcidAPI, orcid).subscribe(data => {
|
||||||
this.recommendations = data['recommendations'];
|
this.recommendations = data['recommendations'];
|
||||||
}, error => {
|
}, error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
import {Component} from "@angular/core";
|
import {Component} from "@angular/core";
|
||||||
import {Subscriber} from "rxjs";
|
import {Subscriber} from "rxjs";
|
||||||
import {NaturalLanguageSearchService} from "./natural-language-search.service";
|
import {NaturalLanguageSearchService} from "./natural-language-search.service";
|
||||||
|
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
|
||||||
|
import {properties} from "../../environments/environment";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'natural-language-search',
|
selector: 'natural-language-search',
|
||||||
|
@ -10,6 +12,7 @@ import {NaturalLanguageSearchService} from "./natural-language-search.service";
|
||||||
|
|
||||||
export class NaturalLanguageSearchComponent {
|
export class NaturalLanguageSearchComponent {
|
||||||
private subscriptions = [];
|
private subscriptions = [];
|
||||||
|
properties: EnvProperties = properties;
|
||||||
showLoading: boolean = false;
|
showLoading: boolean = false;
|
||||||
errorMessage: string;
|
errorMessage: string;
|
||||||
|
|
||||||
|
@ -18,8 +21,6 @@ export class NaturalLanguageSearchComponent {
|
||||||
results;
|
results;
|
||||||
indexColumnId: number;
|
indexColumnId: number;
|
||||||
|
|
||||||
naturalLanguageSearchAPI: string = "https://darelab.athenarc.gr/nl_search/api/fc4e_get_results/";
|
|
||||||
|
|
||||||
constructor(private naturalLanguageSearchService: NaturalLanguageSearchService) {
|
constructor(private naturalLanguageSearchService: NaturalLanguageSearchService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ export class NaturalLanguageSearchComponent {
|
||||||
this.queryPhrase = this.phrase;
|
this.queryPhrase = this.phrase;
|
||||||
this.errorMessage = null;
|
this.errorMessage = null;
|
||||||
this.showLoading = true;
|
this.showLoading = true;
|
||||||
this.subscriptions.push(this.naturalLanguageSearchService.getResults(this.naturalLanguageSearchAPI, this.queryPhrase).subscribe(data => {
|
this.subscriptions.push(this.naturalLanguageSearchService.getResults(this.properties.naturalLanguageSearchAPI, this.queryPhrase).subscribe(data => {
|
||||||
if(data && data['columns']) {
|
if(data && data['columns']) {
|
||||||
for(let i = 0; i < data['columns'].length - 1; i++) {
|
for(let i = 0; i < data['columns'].length - 1; i++) {
|
||||||
if(data['columns'][i] == 'id') {
|
if(data['columns'][i] == 'id') {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 2b12959a4ec134092f2d3bf58586518d85d031ae
|
Subproject commit 623debc84662a0e61f197efe506cf121acc5bd49
|
|
@ -30,9 +30,6 @@ export class CategoryToItemComponent {
|
||||||
keywordControl: FormControl;
|
keywordControl: FormControl;
|
||||||
keyword: string;
|
keyword: string;
|
||||||
|
|
||||||
getAvailableCommunitiesAPI: string = 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/available-communities';
|
|
||||||
getRecommendationsForCommunityAPI: string = 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/recommend';
|
|
||||||
|
|
||||||
constructor(private communitiesService: CommunitiesService,
|
constructor(private communitiesService: CommunitiesService,
|
||||||
private recommendationsService: RecommendationsService,
|
private recommendationsService: RecommendationsService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
|
@ -48,7 +45,7 @@ export class CategoryToItemComponent {
|
||||||
this.getCommunities();
|
this.getCommunities();
|
||||||
this.subscriptions.push(this.route.params.subscribe(params => {
|
this.subscriptions.push(this.route.params.subscribe(params => {
|
||||||
if(params && params['community']) {
|
if(params && params['community']) {
|
||||||
this.subscriptions.push(this.recommendationsService.getRecommendationsForCommunity(this.getRecommendationsForCommunityAPI, params['community']).subscribe(data => {
|
this.subscriptions.push(this.recommendationsService.getRecommendationsForCommunity(this.properties.recommendationsForCommunityAPI, params['community']).subscribe(data => {
|
||||||
this.recommendations = data;
|
this.recommendations = data;
|
||||||
this.setActiveCommunity(params['community']);
|
this.setActiveCommunity(params['community']);
|
||||||
}));
|
}));
|
||||||
|
@ -70,7 +67,7 @@ export class CategoryToItemComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCommunities() {
|
private getCommunities() {
|
||||||
this.subscriptions.push(zip(this.recommendationsService.getAvailableCommunities(this.getAvailableCommunitiesAPI), this.communitiesService.getCommunities(this.properties, this.properties.communitiesAPI)).subscribe(data => {
|
this.subscriptions.push(zip(this.recommendationsService.getAvailableCommunities(this.properties.availableCommunitiesAPI), this.communitiesService.getCommunities(this.properties, this.properties.communitiesAPI)).subscribe(data => {
|
||||||
let availableCommunities: any = data[0];
|
let availableCommunities: any = data[0];
|
||||||
this.communities = availableCommunities.map(id => {
|
this.communities = availableCommunities.map(id => {
|
||||||
const obj = data[1].find(o => o.communityId === id);
|
const obj = data[1].find(o => o.communityId === id);
|
||||||
|
|
|
@ -25,7 +25,14 @@ let props: EnvProperties = {
|
||||||
searchLinkToServices: "/search/find/services",
|
searchLinkToServices: "/search/find/services",
|
||||||
searchLinkToAdvancedServices: "/search/advanced/services",
|
searchLinkToAdvancedServices: "/search/advanced/services",
|
||||||
reCaptchaSiteKey: null,
|
reCaptchaSiteKey: null,
|
||||||
footerGrantText : ""
|
footerGrantText : "",
|
||||||
|
|
||||||
|
naturalLanguageSearchAPI: "https://darelab.athenarc.gr/nl_search/api/fc4e_get_results/",
|
||||||
|
availableCommunitiesAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/available-communities',
|
||||||
|
recommendationsForCommunityAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/recommend',
|
||||||
|
recommendationsForOrcidAPI: 'https://darelab.athenarc.gr/api/faircore/user-to-item-recommender/recommend',
|
||||||
|
recommendationsForPublicationAPI: 'https://darelab.athenarc.gr/api/faircore/item-to-item-recommender/recommend/',
|
||||||
|
feedbackForRecommendationAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/update/'
|
||||||
};
|
};
|
||||||
|
|
||||||
export let properties: EnvProperties = {
|
export let properties: EnvProperties = {
|
||||||
|
|
|
@ -25,7 +25,14 @@ let props: EnvProperties = {
|
||||||
searchLinkToServices: "/search/find/services",
|
searchLinkToServices: "/search/find/services",
|
||||||
searchLinkToAdvancedServices: "/search/advanced/services",
|
searchLinkToAdvancedServices: "/search/advanced/services",
|
||||||
reCaptchaSiteKey: null,
|
reCaptchaSiteKey: null,
|
||||||
footerGrantText : ""
|
footerGrantText : "",
|
||||||
|
|
||||||
|
naturalLanguageSearchAPI: "https://darelab.athenarc.gr/nl_search/api/fc4e_get_results/",
|
||||||
|
availableCommunitiesAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/available-communities',
|
||||||
|
recommendationsForCommunityAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/recommend',
|
||||||
|
recommendationsForOrcidAPI: 'https://darelab.athenarc.gr/api/faircore/user-to-item-recommender/recommend',
|
||||||
|
recommendationsForPublicationAPI: 'https://darelab.athenarc.gr/api/faircore/item-to-item-recommender/recommend/',
|
||||||
|
feedbackForRecommendationAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/update/'
|
||||||
};
|
};
|
||||||
|
|
||||||
export let properties: EnvProperties = {
|
export let properties: EnvProperties = {
|
||||||
|
|
|
@ -25,7 +25,14 @@ let props: EnvProperties = {
|
||||||
searchLinkToServices: "/search/find/services",
|
searchLinkToServices: "/search/find/services",
|
||||||
searchLinkToAdvancedServices: "/search/advanced/services",
|
searchLinkToAdvancedServices: "/search/advanced/services",
|
||||||
reCaptchaSiteKey: null,
|
reCaptchaSiteKey: null,
|
||||||
footerGrantText : "This OpenAIRE gateway is part of a project that has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreements No. 777541 and 101017452"
|
footerGrantText : "This OpenAIRE gateway is part of a project that has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreements No. 777541 and 101017452",
|
||||||
|
|
||||||
|
naturalLanguageSearchAPI: "https://darelab.athenarc.gr/nl_search/api/fc4e_get_results/",
|
||||||
|
availableCommunitiesAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/available-communities',
|
||||||
|
recommendationsForCommunityAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/recommend',
|
||||||
|
recommendationsForOrcidAPI: 'https://darelab.athenarc.gr/api/faircore/user-to-item-recommender/recommend',
|
||||||
|
recommendationsForPublicationAPI: 'https://darelab.athenarc.gr/api/faircore/item-to-item-recommender/recommend/',
|
||||||
|
feedbackForRecommendationAPI: 'https://darelab.athenarc.gr/api/faircore/category-based-recommender/update/'
|
||||||
};
|
};
|
||||||
|
|
||||||
export let properties: EnvProperties = {
|
export let properties: EnvProperties = {
|
||||||
|
|
Loading…
Reference in New Issue