2019-07-15 18:14:27 +02:00
|
|
|
import {Component, Input, ViewChild} from '@angular/core';
|
2020-04-27 14:54:48 +02:00
|
|
|
import {ActivatedRoute, Router} from '@angular/router';
|
2019-07-15 18:14:27 +02:00
|
|
|
import {Location} from '@angular/common';
|
|
|
|
import {SearchDataprovidersService} from '../services/searchDataproviders.service';
|
|
|
|
import {ErrorCodes} from '../utils/properties/errorCodes';
|
|
|
|
import {ErrorMessagesComponent} from '../utils/errorMessages.component';
|
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
|
|
|
import {OpenaireEntities, SearchFields} from '../utils/properties/searchFields';
|
2020-03-12 18:03:35 +01:00
|
|
|
|
2020-04-27 14:54:48 +02:00
|
|
|
import {SearchCustomFilter, SearchUtilsClass} from '../searchPages/searchUtils/searchUtils.class';
|
2019-07-15 18:14:27 +02:00
|
|
|
import {EnvProperties} from '../utils/properties/env-properties';
|
2019-07-16 13:24:13 +02:00
|
|
|
import {ZenodoInformationClass} from "./utils/zenodoInformation.class";
|
2019-07-31 12:41:06 +02:00
|
|
|
import {RouterHelper} from "../utils/routerHelper.class";
|
2020-04-27 14:54:48 +02:00
|
|
|
import {Breadcrumb} from "../utils/breadcrumbs/breadcrumbs.component";
|
2020-11-18 17:06:27 +01:00
|
|
|
import {properties} from "../../../environments/environment";
|
2019-07-15 18:14:27 +02:00
|
|
|
|
|
|
|
@Component({
|
2020-03-12 18:03:35 +01:00
|
|
|
selector: 'deposit-search-dataproviders',
|
2019-07-15 18:14:27 +02:00
|
|
|
template: `
|
|
|
|
|
2019-07-22 16:15:23 +02:00
|
|
|
<div class="uk-section uk-padding-remove-bottom uk-padding-remove-top">
|
2022-06-30 17:24:08 +02:00
|
|
|
<div class="uk-padding-small">
|
2019-07-15 18:14:27 +02:00
|
|
|
<div class="uk-container uk-container-large uk-margin-small-top uk-margin-small-bottom">
|
2022-06-30 17:24:08 +02:00
|
|
|
<breadcrumbs [breadcrumbs]="breadcrumbs"></breadcrumbs>
|
2019-07-15 18:14:27 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-05-07 19:20:33 +02:00
|
|
|
<div class="">
|
2020-04-27 14:54:48 +02:00
|
|
|
<div class="uk-container uk-container-large">
|
2022-05-30 15:52:28 +02:00
|
|
|
<div class="uk-margin-top uk-flex uk-flex-center">
|
2022-04-19 15:32:45 +02:00
|
|
|
<div class="uk-width-large">
|
|
|
|
<div search-input [(value)]="keyword" placeholder="Search by name, description, subject..." (searchEmitter)="keywordChanged()"></div>
|
2022-05-30 15:52:28 +02:00
|
|
|
<div class="uk-margin-top uk-text-center">
|
2022-06-30 17:24:08 +02:00
|
|
|
<a *ngIf="zenodoInformation.url" [href]="zenodoInformation.url" target="_blank" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
|
2022-05-30 15:52:28 +02:00
|
|
|
<span class="uk-flex uk-flex-middle">
|
|
|
|
<span>Zenodo Repository</span><span class="custom-external custom-icon space"></span>
|
|
|
|
</span>
|
|
|
|
</a>
|
2022-06-30 17:24:08 +02:00
|
|
|
<a *ngIf="!zenodoInformation.url" routerLink="/participate/deposit/zenodo" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
|
|
|
|
Related Zenodo Communities
|
|
|
|
</a>
|
2022-05-30 15:52:28 +02:00
|
|
|
</div>
|
2020-04-28 12:46:23 +02:00
|
|
|
</div>
|
2022-04-19 15:32:45 +02:00
|
|
|
</div>
|
2020-04-27 14:54:48 +02:00
|
|
|
</div>
|
2022-04-15 14:38:41 +02:00
|
|
|
<search-dataproviders [simpleView]="true" [searchForm]="{class: null, dark: false}" type="deposit" simpleSearchLink="/participate/deposit/search" [includeOnlyResultsAndFilter]="true" >
|
2020-04-27 14:54:48 +02:00
|
|
|
</search-dataproviders>
|
|
|
|
</div>
|
2019-07-15 18:14:27 +02:00
|
|
|
`
|
|
|
|
})
|
|
|
|
export class SearchDataprovidersToDepositComponent {
|
|
|
|
private errorCodes: ErrorCodes;
|
|
|
|
private errorMessages: ErrorMessagesComponent;
|
|
|
|
@Input() piwikSiteId = null;
|
|
|
|
public results =[];
|
|
|
|
public filters =[];
|
|
|
|
public totalResults:number = 0 ;
|
|
|
|
public baseUrl:string;
|
|
|
|
public searchUtils:SearchUtilsClass = new SearchUtilsClass();
|
|
|
|
public sub: any; public subResults: any;
|
|
|
|
public _location:Location;
|
|
|
|
public searchFields:SearchFields = new SearchFields();
|
|
|
|
public refineFields: string[] = this.searchFields.DEPOSIT_DATASOURCE_REFINE_FIELDS;
|
|
|
|
public fieldIdsMap= this.searchFields.DEPOSIT_DATASOURCE_FIELDS;
|
|
|
|
public keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
|
|
|
|
public csvParams: string;
|
|
|
|
|
|
|
|
public disableForms: boolean = false;
|
|
|
|
public loadPaging: boolean = true;
|
|
|
|
public oldTotalResults: number = 0;
|
|
|
|
pagingLimit = 0;
|
|
|
|
|
2021-02-19 18:50:34 +01:00
|
|
|
properties:EnvProperties = properties;
|
2019-07-15 18:14:27 +02:00
|
|
|
|
2020-03-12 18:03:35 +01:00
|
|
|
// @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ;
|
2019-07-15 18:14:27 +02:00
|
|
|
|
2019-07-31 12:41:06 +02:00
|
|
|
@Input() public communityId: string = null;
|
2019-07-16 13:24:13 +02:00
|
|
|
@Input() public zenodoInformation: ZenodoInformationClass = new ZenodoInformationClass();
|
|
|
|
|
2019-07-31 12:41:06 +02:00
|
|
|
depositLearnHowPage: string = null;
|
|
|
|
public routerHelper:RouterHelper = new RouterHelper();
|
2020-04-27 14:54:48 +02:00
|
|
|
breadcrumbs:Breadcrumb[] = [];
|
|
|
|
parameters = {};
|
|
|
|
keyword = "";
|
|
|
|
constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchDataprovidersService, private router: Router) {
|
2019-07-15 18:14:27 +02:00
|
|
|
this.errorCodes = new ErrorCodes();
|
|
|
|
this.errorMessages = new ErrorMessagesComponent();
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
this.searchUtils.page =1;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ngOnInit() {
|
2019-07-31 12:41:06 +02:00
|
|
|
this.depositLearnHowPage = this.properties.depositLearnHowPage;
|
|
|
|
this.baseUrl = this.properties.depositSearchPage;
|
|
|
|
this.pagingLimit = this.properties.pagingLimit;
|
2020-04-27 14:54:48 +02:00
|
|
|
this.breadcrumbs.push({name: 'home', route: '/'}, {
|
|
|
|
name: "Deposit",
|
|
|
|
route: this.depositLearnHowPage
|
|
|
|
}, {name: "Browse repositories", route: null});
|
2020-11-18 17:06:27 +01:00
|
|
|
|
2020-04-27 14:54:48 +02:00
|
|
|
this.sub = this.route.queryParams.subscribe(params => {
|
2020-05-05 18:21:31 +02:00
|
|
|
this.parameters = Object.assign({}, params);
|
2020-04-27 14:54:48 +02:00
|
|
|
this.keyword = params["fv0"]?params["fv0"]:'';
|
2019-07-15 18:14:27 +02:00
|
|
|
});
|
2022-05-30 16:56:47 +02:00
|
|
|
|
|
|
|
if (!this.zenodoInformation) {
|
|
|
|
this.zenodoInformation = new ZenodoInformationClass();
|
|
|
|
}
|
|
|
|
if (!this.zenodoInformation.shareInZenodoUrl) {
|
|
|
|
this.zenodoInformation.url = this.properties.zenodo;
|
|
|
|
}
|
2020-03-12 18:03:35 +01:00
|
|
|
// this.searchPage.refineFields = this.refineFields;
|
|
|
|
// this.searchPage.fieldIdsMap = this.fieldIdsMap;
|
|
|
|
// this.searchPage.keywordFields = this.keywordFields;
|
|
|
|
// var firstLoad =true;
|
|
|
|
//
|
2020-11-11 15:43:13 +01:00
|
|
|
// this.subscriptions = this.route.queryParams.subscribe(params => {
|
2020-03-12 18:03:35 +01:00
|
|
|
// this.loadPaging = true;
|
|
|
|
// if(params['page'] && this.searchUtils.page != params['page']) {
|
|
|
|
// this.loadPaging = false;
|
|
|
|
// this.oldTotalResults = this.searchUtils.totalResults;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// this.searchUtils.keyword = (params['keyword']?params['keyword']:'');
|
|
|
|
// var refine = true;
|
|
|
|
// if(this.searchUtils.page != ((params['page']=== undefined)?1:+params['page']) && this.filters && !firstLoad){
|
|
|
|
// refine = false;
|
|
|
|
//
|
|
|
|
// }
|
|
|
|
// firstLoad = false;
|
|
|
|
// this.searchUtils.page = (params['page']=== undefined)?1:+params['page'];
|
|
|
|
// this.searchUtils.size = (params['size']=== undefined)?5:+params['size'];
|
|
|
|
// if(this.searchUtils.size != 5 && this.searchUtils.size != 10 && this.searchUtils.size != 20 && this.searchUtils.size != 50) {
|
|
|
|
// this.searchUtils.size = 5;
|
|
|
|
// }
|
|
|
|
// this.searchPage.usedBy = "deposit";
|
|
|
|
// var queryParameters = this.searchPage.getQueryParametersFromUrl(params);
|
|
|
|
// this._getResults(queryParameters, refine, this.searchUtils.page, this.searchUtils.size);
|
|
|
|
// });
|
2019-07-15 18:14:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public ngOnDestroy() {
|
|
|
|
if(this.sub){
|
|
|
|
this.sub.unsubscribe();
|
|
|
|
}
|
|
|
|
if(this.subResults){
|
|
|
|
this.subResults.unsubscribe();
|
|
|
|
}
|
|
|
|
}
|
2020-04-27 14:54:48 +02:00
|
|
|
keywordChanged(){
|
|
|
|
|
|
|
|
if ( this.keyword.length > 0) {
|
|
|
|
this.parameters["fv0"] = this.keyword;
|
|
|
|
this.parameters["f0"] = "q";
|
|
|
|
}else{
|
|
|
|
delete this.parameters['fv0'];
|
|
|
|
delete this.parameters['f0'];
|
|
|
|
}
|
2019-07-15 18:14:27 +02:00
|
|
|
|
2020-05-05 18:21:31 +02:00
|
|
|
if(this.parameters["page"]){
|
|
|
|
//GO to first page
|
|
|
|
delete this.parameters['page'];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-27 14:54:48 +02:00
|
|
|
this.router.navigate([this.properties.depositSearchPage], {queryParams: this.parameters} );
|
|
|
|
}
|
2020-03-12 18:03:35 +01:00
|
|
|
/*public getResults(keyword:string,refine:boolean, page: number, size: number){
|
2019-07-15 18:14:27 +02:00
|
|
|
var parameters = "";
|
|
|
|
if(keyword.length > 0){
|
|
|
|
//parameters = "q="+ keyword;
|
|
|
|
|
|
|
|
if(this.keywordFields.length > 0) {
|
|
|
|
parameters = "&fq=";
|
|
|
|
}
|
|
|
|
|
|
|
|
for(let i=0; i< this.keywordFields.length ; i++) {
|
|
|
|
if(i > 0) {
|
|
|
|
parameters += " or ";
|
|
|
|
}
|
|
|
|
let field = this.keywordFields[i];
|
|
|
|
parameters += field.name+field.equalityOperator+StringUtils.URIEncode(this.searchUtils.keyword);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this._getResults(parameters,refine,page, size);
|
|
|
|
}
|
|
|
|
private _getResults(parameters:string,refine:boolean, page: number, size: number){
|
|
|
|
if(page > this.pagingLimit) {
|
|
|
|
size=0;
|
|
|
|
}
|
|
|
|
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
|
|
|
|
this.csvParams = parameters;
|
|
|
|
|
|
|
|
this.searchUtils.status = this.errorCodes.LOADING;
|
|
|
|
|
|
|
|
this.disableForms = true;
|
|
|
|
this.results = [];
|
|
|
|
this.searchUtils.totalResults = 0;
|
|
|
|
|
|
|
|
this.subResults = this._searchDataprovidersService.searchDataprovidersForDepositSearch(parameters,(refine)?this.searchPage.getRefineFieldsQuery():null, page, size, this.searchPage.getFields(),this.properties, "deposit").subscribe(
|
|
|
|
data => {
|
|
|
|
this.searchUtils.totalResults = data[0];
|
|
|
|
this.results = data[1];
|
|
|
|
if(refine){
|
|
|
|
this.filters = data[2];
|
|
|
|
}
|
|
|
|
this.searchPage.checkSelectedFilters(this.filters);
|
|
|
|
this.searchPage.updateBaseUrlWithParameters(this.filters);
|
|
|
|
this.searchUtils.status = this.errorCodes.DONE;
|
|
|
|
if(this.searchUtils.totalResults == 0 ){
|
|
|
|
this.searchUtils.status = this.errorCodes.NONE;
|
|
|
|
}
|
|
|
|
this.disableForms = false;
|
|
|
|
|
|
|
|
if(this.searchUtils.status == this.errorCodes.DONE) {
|
|
|
|
// Page out of limit!!!
|
|
|
|
let totalPages:any = this.searchUtils.totalResults/(this.searchUtils.size);
|
|
|
|
if(!(Number.isInteger(totalPages))) {
|
|
|
|
totalPages = (parseInt(totalPages, 10) + 1);
|
|
|
|
}
|
|
|
|
if(totalPages < page) {
|
|
|
|
this.searchUtils.totalResults = 0;
|
|
|
|
this.searchUtils.status = this.errorCodes.OUT_OF_BOUND;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
err => {
|
|
|
|
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
|
|
|
|
|
|
|
|
this.disableForms = false;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2020-03-12 18:03:35 +01:00
|
|
|
*/
|
2019-07-15 18:14:27 +02:00
|
|
|
|
|
|
|
private handleError(message: string, error) {
|
[Monitor Dashboard & Library | new-theme]: Renaming entity types using OpenaireEntities.
Files updated: develop.component.ts, methodology.component.ts, claimEntitiesSelection.component.ts, directLinking.component.ts, linkingGeneric.component.html, linkingGeneric.component.ts, approved.component.ts, searchDataprovidersToDeposit.component.ts, errorPage.component.ts, dataProvider.component.html, dataProvider.component.ts, dataProvider.service.ts, relatedDatasourcesTab.component.ts, project.component.ts, myOrcidLinks.component.ts, searchMyOrcidResults.component.html, searchMyOrcidResults.component.ts, searchAll.component.html, searchAll.component.ts, advancedSearchForm.component.html, advancedSearchForm.component.ts, searchDataProviders.component.ts, searchResearchResults.service.ts, numbers.component.ts, other-portals.component.html, other-portals.component.ts, fetchDataproviders.class.ts, fetchResearchResults.class.ts, searchFields.ts, result-preview.component.ts
2022-05-09 12:13:44 +02:00
|
|
|
console.error(OpenaireEntities.DATASOURCES+" simple Search Page: "+message, error);
|
2019-07-15 18:14:27 +02:00
|
|
|
}
|
|
|
|
}
|