[Library | Trunk]: [NEW] Added service entity.

1. result-preview.component.ts & datasourcesHelper.class.ts & entitiesSelection.component.ts & newSearchPage.component.ts & errorPage.component.ts & searchAll.component.ts: Added case for service entity.
2. searchFields.ts: Added  in OpenaireEntities names for Services | In methods "getFieldName()" and "getFieldParam()" case for service entity.
3. searchDataProviders.component.ts: Parametrize component to show/query for datasources or services.
4. quick-selections.component.ts: Delete reset of resultTypes from "initializeFilters()" method.
5. searchDataproviders.service.ts: In method "numOfSearchDataproviders2()" added parameter "typePathParam" to search for datasources or services | In method "parseResults()" set "entityType" according to eosctype field.
6. portal.ts: In method "getmockPortalInfo()" added entity and routes for service.
7. env-properties.ts: Added properties "searchLinkToService", "searchLinkToServices", "searchLinkToAdvancedServices".
8. dataProvider.component.html: Parametrize component to show for datasources or services | [Bug fix] Added [class.uk-invisible]="!dataProviderInfo" in #graph_and_feedback_template.
9. dataProvider.component.ts: Parametrize component to show/query for datasources or services.
10. dataProvider.service.ts: In method "getDataproviderInfo()" added parameter "typePathParam" to search for datasources or services.
11. searchAll.component.html: Added tab for search services.
This commit is contained in:
Konstantina Galouni 2022-05-13 15:57:31 +03:00
parent 5aa832d698
commit d61839718e
16 changed files with 231 additions and 77 deletions

View File

@ -102,6 +102,9 @@ export class ErrorPageComponent {
} else if (this.page_type == "dataprovider") {
this.searchPage = properties.searchLinkToDataProviders;
this.page_type_name = OpenaireEntities.DATASOURCE.toLowerCase();
} else if (this.page_type == "service") {
this.searchPage = properties.searchLinkToServices;
this.page_type_name = OpenaireEntities.SERVICE.toLowerCase();
} else {
this.searchPage = properties.searchLinkToResults;
this.page_type_name = OpenaireEntities.RESULT.toLowerCase();

View File

@ -18,7 +18,7 @@
<div class="uk-align-center uk-text-center uk-margin-medium-top uk-flex uk-flex-column uk-flex-between">
<ng-container *ngIf="dataProviderInfo && hasMetrics">
<metrics [pageViews]="pageViews"
[id]="datasourceId" [entityType]="'datasources'" [entity]="'Datasource'"
[id]="datasourceId" [entityType]="'datasources'"
[viewsFrameUrl]="viewsFrameUrl" [downloadsFrameUrl]="downloadsFrameUrl"
(metricsResults)="metricsResults($event)" [properties]=properties>
</metrics>
@ -45,7 +45,7 @@
<!-- center box-->
<div class="uk-width-expand uk-padding-remove uk-background-default">
<ng-template #graph_and_feedback_template>
<div class="uk-flex uk-margin-small-top uk-margin-small-bottom">
<div class="uk-flex uk-margin-small-top uk-margin-small-bottom" [class.uk-invisible]="!dataProviderInfo">
<!-- Last Index Info-->
<div class="uk-width-2-3@m uk-width-1-2 graph">
<icon name="graph" customClass="uk-text-primary"></icon>
@ -75,7 +75,7 @@
<div [attr.style]="'margin-top: '+(graph_height? 'calc(40px + 20px - '+graph_height+'px)': '40px')">
<!-- schema.org-->
<schema2jsonld [data]=dataProviderInfo
[URL]="properties.domain+ properties.baseLink +properties.searchLinkToDataProvider +datasourceId"
[URL]="properties.domain+ properties.baseLink + linkToLandingPage +datasourceId"
type="datasource"
[otherURL]="(dataProviderInfo.provenance)?provenanceUrls:null"></schema2jsonld>
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0"
@ -396,8 +396,8 @@
</div>
<feedback *ngIf="dataProviderInfo && properties.reCaptchaSiteKey" [dataProviderInfo]="dataProviderInfo"
[properties]="properties" [entityType]="openaireEntities.DATASOURCE" [fields]="feedbackFields"
[(showForm)]="showFeedback"></feedback>
[properties]="properties" [entityType]="getTypeName()" [fields]="feedbackFields"
[(showForm)]="showFeedback"></feedback>
<modal-alert *ngIf="dataProviderInfo" #addThisModal classBody="uk-flex uk-flex-center uk-flex-middle">
<addThis></addThis>

View File

@ -38,12 +38,18 @@ declare var ResizeObserver;
})
export class DataProviderComponent {
@Input() type: string = "dataprovider";
private typeQueryPathParam: string = "datasources";
@Input() piwikSiteId = null;
@Input() communityId = null;
public dataProviderInfo: DataProviderInfo;
public datasourceId: string;
public provenanceUrls: string[] = null;
// Links for SEO
public linkToLandingPage: string = null;
public linkToSearchPage: string = null;
// Message variables
public warningMessage = "";
public errorMessage = "";
@ -170,9 +176,17 @@ export class DataProviderComponent {
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
this.subscriptions.push(this.route.queryParams.subscribe(data => {
this.stickyHeader = false;
this.updateTitle(this.openaireEntities.DATASOURCE);
this.updateDescription("");
this.datasourceId = data['datasourceId'];
// this.datasourceId = data['datasourceId'];
if (data['datasourceId']) {
this.datasourceId = data['datasourceId'];
this.typeQueryPathParam = "datasources";
this.initMetaAndLinks("dataprovider");
} else if (data['serviceId']) {
this.datasourceId = data['serviceId'];
this.typeQueryPathParam = "services";
this.initMetaAndLinks("service");
}
if (this.datasourceId && StringUtils.isOpenAIREID(this.datasourceId)) {
this.initializeValues();
this.getDataProviderInfo(this.datasourceId);
@ -181,7 +195,7 @@ export class DataProviderComponent {
this._router.navigate([this.properties.errorLink], {
queryParams: {
"page": this._location.path(true),
"page_type": "dataprovider"
"page_type": this.type
}
});
}
@ -232,6 +246,20 @@ export class DataProviderComponent {
return window.innerHeight-this.graph_height;
}
private initMetaAndLinks(type: string) {
if (type == "service") {
this.type = "service";
this.updateTitle(this.openaireEntities.SERVICE);
this.linkToLandingPage = this.properties.searchLinkToService;
this.linkToSearchPage = this.properties.searchLinkToServices;
} else if (type == "dataprovider") {
this.type = "dataprovider";
this.updateTitle(this.openaireEntities.DATASOURCE);
this.linkToLandingPage = this.properties.searchLinkToDataProvider;
this.linkToSearchPage = this.properties.searchLinkToDataProviders;
}
}
public initializeValues() {
this._numberOfTabs = 0;
this.tabsAreInitialized = false;
@ -293,9 +321,9 @@ export class DataProviderComponent {
this.showTabs = false;
if (this.datasourceId == null || this.datasourceId == '') {
this.showLoading = false;
this.warningMessage = "No valid datasource id";
this.warningMessage = "No valid "+this.getTypeName()+" id";
} else {
this.subscriptions.push(this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties).subscribe(
this.subscriptions.push(this._dataproviderService.getDataproviderInfo(this.datasourceId, this.properties, this.typeQueryPathParam).subscribe(
data => {
this.dataProviderInfo = data;
this.getProvenanceUrls();
@ -329,14 +357,14 @@ export class DataProviderComponent {
this._router.navigate([this.properties.errorLink], {
queryParams: {
"page": this._location.path(true),
"page_type": "dataprovider"
"page_type": this.type
}
});
}else if(err.name == "TimeoutError"){
this.errorMessage = 'An error occurred please try again later';
}else {
this.errorMessage = 'No dataProvider found';
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.properties.searchLinkToDataProviders);
this.errorMessage = 'No '+this.getTypeName()+' found';
this.seoService.createLinkForCanonicalURL(this.properties.domain + this.properties.baseLink + this.linkToSearchPage);
}
this.showLoading = false;
}
@ -689,22 +717,6 @@ export class DataProviderComponent {
console.error(this.openaireEntities.DATASOURCE+" Landing Page: " + message, error);
}
private getEntityName(entityType: string, plural: boolean, full: boolean): string {
if (entityType == "publication") {
return "publication" + (plural ? "s" : "");
} else if (entityType == "dataset") {
return (full ? "research data" : ("dataset" + (plural ? "s" : "")));
} else if (entityType == "software") {
return "software";
} else if (entityType == "other") {
return (full ? ("other research product" + (plural ? "s" : "")) : "other");
} else if (entityType == "dataprovider") {
return (full ? ("content provider" + (plural ? "s" : "")) : "dataprovider" + (plural ? "s" : ""));
} else {
return entityType + (plural ? "s" : "");
}
}
public getResultPreview(result: SearchResult, type: string): ResultPreview {
return ResultPreview.searchResultConvert(result, type);
}
@ -783,4 +795,11 @@ export class DataProviderComponent {
public getProvenanceUrls() {
this.provenanceUrls = Array.from(this.dataProviderInfo.provenance.values()).map(res => res['url']).reduce((acc, val) => acc.concat(val), []);
}
public getTypeName(): string {
if(this.type === "service") {
return this.openaireEntities.SERVICE;
}
return this.openaireEntities.DATASOURCE;
}
}

View File

@ -18,8 +18,8 @@ export class DataProviderService {
dataProviderInfo: DataProviderInfo;
public parsingFunctions: ParsingFunctions;
getDataproviderInfo (id: string, properties:EnvProperties):any {
let url = properties.searchAPIURLLAst + 'datasources/' +id +"?format=json";
getDataproviderInfo (id: string, properties:EnvProperties, typePathParam: string):any {
let url = properties.searchAPIURLLAst + typePathParam+ '/' +id +"?format=json";
let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)

View File

@ -53,6 +53,14 @@
({{fetchDataproviders.searchUtils.totalResults | number}})</span>
</a>
</li>
<li *ngIf="showServices" (click)="entityChanged('services')"
[class]="activeEntity == 'services'?'uk-active':''">
<a class="uk-text-uppercase">
{{servicesName}}
<span *ngIf="fetchServices.searchUtils.totalResults!=null">
({{fetchServices.searchUtils.totalResults | number}})</span>
</a>
</li>
<li *ngIf="showOrganizations" (click)="entityChanged('organizations')"
[class]="activeEntity == 'organizations'?'uk-active':''">
<a class="uk-text-uppercase">
@ -82,3 +90,9 @@
(searchPageUpdates)="activeEntityUpdate($event)"
simpleSearchLink="/search/find" [customFilter]="customFilter">
</search-dataproviders>
<search-dataproviders *ngIf="activeEntity == 'services'" [includeOnlyResultsAndFilter]="true" [showSwitchSearchLink]="false"
(searchPageUpdates)="activeEntityUpdate($event)"
simpleSearchLink="/search/find" [customFilter]="customFilter"
type="services" entityType="service" [typeName]="openaireEntities.SERVICES">
</search-dataproviders>

View File

@ -40,7 +40,8 @@ import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
templateUrl: 'searchAll.component.html'
})
export class SearchAllComponent {
reload:{result:boolean, projects:boolean, datasources: boolean, organizations:boolean} = {result:true, projects:true, datasources: true, organizations:true};
reload:{result:boolean, projects:boolean, datasources: boolean, services: boolean, organizations:boolean} =
{result:true, projects:true, datasources: true, services: true, organizations:true};
public pageTitle = "Search in OpenAIRE"
public keyword: string = "";
public publications: string[];
@ -57,6 +58,7 @@ export class SearchAllComponent {
public linkToSearchOrganizations = "";
public fetchPublications: FetchResearchResults;
public fetchDataproviders: FetchDataproviders;
public fetchServices: FetchDataproviders;
public fetchProjects: FetchProjects;
public fetchDatasets: FetchResearchResults;
public fetchSoftware: FetchResearchResults;
@ -69,12 +71,14 @@ export class SearchAllComponent {
public projectName = OpenaireEntities.PROJECTS;
public organizationsName = OpenaireEntities.ORGANIZATIONS;
public dataSourcesName = OpenaireEntities.DATASOURCES;
public servicesName = OpenaireEntities.SERVICES;
showPublications: boolean = false;
showDatasets: boolean = false;
showSoftware: boolean = false;
showOrps: boolean = false;
showProjects: boolean = false;
showDataProviders: boolean = false;
showServices: boolean = false;
showOrganizations: boolean = false;
advancedSearchLink: string = "/search/advanced/publications";
properties: EnvProperties;
@ -109,6 +113,7 @@ export class SearchAllComponent {
@ViewChild(SearchResearchResultsComponent) searchResearchResultsComponent : SearchResearchResultsComponent ;
@ViewChild(SearchProjectsComponent) searchProjectsComponent : SearchProjectsComponent ;
@ViewChild(SearchDataProvidersComponent) searchDataprovidersComponent : SearchDataProvidersComponent ;
@ViewChild(SearchDataProvidersComponent) searchServicesComponent : SearchDataProvidersComponent ;
@ViewChild(SearchOrganizationsComponent) searchOrganizationsComponent : SearchOrganizationsComponent ;
constructor(private route: ActivatedRoute,
private _router: Router,
@ -125,6 +130,7 @@ export class SearchAllComponent {
private seoService: SEOService, private router: Router, private cdr:ChangeDetectorRef) {
this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService);
this.fetchDataproviders = new FetchDataproviders(this._searchDataprovidersService);
this.fetchServices = new FetchDataproviders(this._searchDataprovidersService);
this.fetchProjects = new FetchProjects(this._searchProjectsService);
this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService);
this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService);
@ -167,12 +173,14 @@ export class SearchAllComponent {
this.showProjects = showEntity["project"];
this.showOrganizations = showEntity["organization"];
this.showDataProviders = showEntity["datasource"];
this.showServices = showEntity["service"];
this.showSoftware = showEntity["software"];
this.showOrps = showEntity["orp"];
if (this.customFilter && this.customFilter.queryFieldName == "communityId") {
this.showProjects = false;
this.showOrganizations = false;
this.showDataProviders = false;
this.showServices = false;
}
this.loadAll();
}
@ -181,12 +189,12 @@ export class SearchAllComponent {
if ((this.customFilter && this.customFilter.queryFieldName == "country")) {
this.showPublications = true;
this.showDatasets = true;
this.showDataProviders = true;
this.showSoftware = true;
this.showOrps = true;
this.showProjects = true;
this.showOrganizations = true;
this.showDataProviders = true;
this.showServices = false;
}
}
this.loadAll();
@ -209,7 +217,7 @@ export class SearchAllComponent {
if(this.activeEntity == null && (!params["active"] || params["active"].length ==0)){
this.activeEntity = this.getDefaultEntityToShow();
}else if(params["active"] && params["active"].length >0 ){
this.activeEntity = ((["result","projects","organizations","datasources"]).indexOf(params["active"])!= -1)?params["active"]:this.getDefaultEntityToShow();
this.activeEntity = ((["result","projects","organizations","datasources","services"]).indexOf(params["active"])!= -1)?params["active"]:this.getDefaultEntityToShow();
}else if (this.activeEntity !=null && (!params["active"] || params["active"].length ==0)){
this.parameters["active"]=this.activeEntity;
if(location.search && location.search.indexOf("active=") == -1){
@ -222,6 +230,8 @@ export class SearchAllComponent {
this.searchProjects();
} else if (this.activeEntity == "datasources") {
this.searchDataProviders();
} else if (this.activeEntity == "services") {
this.searchServices();
} else if (this.activeEntity == "organizations") {
this.searchOrganizations();
}
@ -251,6 +261,7 @@ export class SearchAllComponent {
this.fetchPublications.clearSubscriptions();
this.fetchOrganizations.clearSubscriptions();
this.fetchDataproviders.clearSubscriptions();
this.fetchServices.clearSubscriptions();
this.fetchProjects.clearSubscriptions();
}
@ -282,6 +293,15 @@ export class SearchAllComponent {
}
}
public searchServices() {
this.advancedSearchLink = this.properties.searchLinkToAdvancedServices;//"/search/advanced/services";
if ( this.reload[this.activeEntity] &&
this.fetchServices.searchUtils.status != this.errorCodes.NONE) {
this.reload[this.activeEntity] = false;
this.linkToSearchDataproviders = this.properties.searchLinkToServices;// + "?keyword=" + this.keyword;
}
}
public searchOrganizations() {
this.advancedSearchLink = this.properties.searchLinkToAdvancedOrganizations;//"/search/advanced/organizations";
if (this.reload[this.activeEntity] &&
@ -372,7 +392,7 @@ export class SearchAllComponent {
},
err => {
//console.log(err);
this.handleError("Error getting number of Projects", err);
this.handleError("Error getting number of "+OpenaireEntities.PROJECTS, err);
this.fetchProjects.searchUtils.status = this.errorCodes.ERROR;
this.fetchProjects.searchUtils.totalResults = null;
}
@ -392,12 +412,31 @@ export class SearchAllComponent {
},
err => {
//console.log(err);
this.handleError("Error getting number of Projects", err);
this.handleError("Error getting number of "+OpenaireEntities.DATASOURCES, err);
this.fetchDataproviders.searchUtils.status = this.errorCodes.ERROR;
this.fetchDataproviders.searchUtils.totalResults = null;
}
));
}
if (this.activeEntity != "services" && this.reload["services"] && this.showServices) {
this.fetchServices.results = [];
this.reload["services"] = false;
this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("datasources",this.keyword,"q","="):"", this.properties, refineParams, "services").subscribe(
data => {
this.fetchServices.searchUtils.totalResults = data;
this.fetchServices.searchUtils.status = this.errorCodes.DONE;
if (this.fetchServices.searchUtils.totalResults == 0) {
this.fetchServices.searchUtils.status = this.errorCodes.NONE;
}
},
err => {
//console.log(err);
this.handleError("Error getting number of "+OpenaireEntities.SERVICES, err);
this.fetchServices.searchUtils.status = this.errorCodes.ERROR;
this.fetchServices.searchUtils.totalResults = null;
}
));
}
if (this.activeEntity != "organizations" && this.reload["organizations"] && this.showOrganizations) {
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
this.fetchOrganizations.results = [];
@ -412,7 +451,7 @@ export class SearchAllComponent {
},
err => {
//console.log(err);
this.handleError("Error getting number of Organizations", err);
this.handleError("Error getting number of "+OpenaireEntities.ORGANIZATIONS, err);
this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR;
this.fetchOrganizations.searchUtils.totalResults = null;
@ -441,9 +480,10 @@ export class SearchAllComponent {
}
private reloadTabs() {
this.reload = {result:true, projects:true, datasources: true, organizations:true};
this.reload = {result:true, projects:true, datasources: true, services: true, organizations:true};
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
this.fetchDataproviders.searchUtils.status = this.errorCodes.LOADING;
this.fetchServices.searchUtils.status = this.errorCodes.LOADING;
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
this.fetchDatasets.searchUtils.status = this.errorCodes.LOADING;
@ -475,6 +515,11 @@ export class SearchAllComponent {
this.fetchDataproviders.searchUtils.totalResults = $event.searchUtils.totalResults;
}
this.fetchDataproviders.searchUtils.status = $event.searchUtils.status;
}else if (this.activeEntity == "services"){
if($event.searchUtils.status!=this.errorCodes.LOADING) {
this.fetchServices.searchUtils.totalResults = $event.searchUtils.totalResults;
}
this.fetchServices.searchUtils.status = $event.searchUtils.status;
}else if (this.activeEntity == "organizations") {
if($event.searchUtils.status!=this.errorCodes.LOADING) {
this.fetchOrganizations.searchUtils.totalResults = $event.searchUtils.totalResults;
@ -498,6 +543,8 @@ export class SearchAllComponent {
this.searchProjectsComponent.ngOnDestroy();
}else if(this.activeEntity == "datasources" && this.searchDataprovidersComponent){
this.searchDataprovidersComponent.ngOnDestroy();
}else if(this.activeEntity == "services" && this.searchDataprovidersComponent){
this.searchDataprovidersComponent.ngOnDestroy();
}else if(this.activeEntity == "organizations" && this.searchOrganizationsComponent){
this.searchOrganizationsComponent.ngOnDestroy();
}

View File

@ -19,13 +19,13 @@ import {properties} from "../../../environments/environment";
<new-search-page
pageTitle="{{(simpleView?'':'Advanced ')}} Find research {{ pageTitle }}"
entityType="dataprovider"
[type]="openaireEntities.DATASOURCES"
[entityType]=entityType
[type]="typeName"
[results]="results"
[searchUtils]="searchUtils"
[sortedByChanged]="searchUtils.sortBy"
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
[csvParams]="csvParams" [csvPath]="openaireEntities.DATASOURCES_FILE"
[csvParams]="csvParams" [csvPath]="csvPath"
[simpleSearchLink]="simpleSearchLink" [advancedSearchLink]="advancedSearchLink"
[disableForms]="disableForms"
[disableRefineForms]="disableRefineForms"
@ -35,7 +35,7 @@ import {properties} from "../../../environments/environment";
[includeOnlyResultsAndFilter]="includeOnlyResultsAndFilter"
[piwikSiteId]=piwikSiteId [hasPrefix]="hasPrefix"
[searchForm]="searchForm"
[entitiesSelection]="type=='all'" [showSwitchSearchLink]="showSwitchSearchLink"
[entitiesSelection]="type=='all' || type == 'services'" [showSwitchSearchLink]="showSwitchSearchLink"
[filters]="filters"
[simpleView]="simpleView" formPlaceholderText="Search by name, description, subject..."
[showResultCount]="true" [showIndexInfo]="type!='deposit'"
@ -73,13 +73,16 @@ export class SearchDataProvidersComponent {
public isPiwikEnabled;
properties:EnvProperties;
public openaireEntities = OpenaireEntities;
@Input() type: "all" | "registries" | "journals" | "compatible" | "deposit" = "all";
@Input() type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services" = "all";
@Input() entityType: "dataprovider" | "service" = "dataprovider";
@Input() typeName = OpenaireEntities.DATASOURCES;
public refineFields: string[];
pageTitle;
@ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
@Input() simpleView: boolean = true;
@Input() simpleSearchLink: string = "";
advancedSearchLink: string = "";
csvPath: string = "";
@Input() hasPrefix: boolean = true;
@Input() openaireLink: string;
@Input() includeOnlyResultsAndFilter: boolean = false;
@ -102,12 +105,14 @@ export class SearchDataProvidersComponent {
this.pageTitle = DatasourcesHelperClass.getTitle(this.type);
this.metaDescription = DatasourcesHelperClass.getDescription(this.type)
if(this.showSwitchSearchLink == null){
this.showSwitchSearchLink = (this.type == "all");
this.showSwitchSearchLink = (this.type == "all" || this.type == "services");
}
this.properties= properties;
this.csvPath = this.entityType == "service" ? OpenaireEntities.SERVICES_FILE : OpenaireEntities.DATASOURCES_FILE;
if (!this.simpleSearchLink) {
this.simpleSearchLink = this.properties.searchLinkToDataProviders;
} this.advancedSearchLink = this.properties.searchLinkToAdvancedDataProviders;
this.simpleSearchLink = this.entityType == "service" ? this.properties.searchLinkToServices : this.properties.searchLinkToDataProviders;
}
this.advancedSearchLink = this.entityType == "service" ? this.properties.searchLinkToAdvancedServices : this.properties.searchLinkToAdvancedDataProviders;
this.searchUtils.baseUrl = (this.simpleView)?this.simpleSearchLink:this.advancedSearchLink;
this.pagingLimit = properties.pagingLimit;
this.isPiwikEnabled = properties.enablePiwikTrack;
@ -141,13 +146,13 @@ export class SearchDataProvidersComponent {
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
this.searchPage.usedBy = "deposit";
}
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, this.entityType);
if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(params), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
} else {
this.searchUtils.refineStatus = this.errorCodes.DONE;
}
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
this.getResults(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(params), this.searchUtils.page, this.searchUtils.size, refine, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
firstLoad = false;
}));
}

View File

@ -4,7 +4,7 @@ import {properties} from "../../../../environments/environment";
export class DatasourcesHelperClass {
public static getrefineFields(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
public static getrefineFields(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services") {
let searchFields:SearchFields = new SearchFields();
if (type == "registries") {
return searchFields.ENTITY_REGISTRIES_FIELDS;
@ -20,29 +20,33 @@ export class DatasourcesHelperClass {
}
}
public static getTitle(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
public static getTitle(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services") {
if (type == "registries") {
return "Entity Registries"
} else if (type == "journals") {
return "Journals"
} else if (type == "compatible") {
return "Compatible "+OpenaireEntities.DATASOURCES;
} else if (type == "services") {
return OpenaireEntities.SERVICES;
} else {
return OpenaireEntities.DATASOURCES;
}
}
public static getDescription(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
public static getDescription(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services") {
if (type == "registries") {
return ["Entity Registries","Discover research Entity Registries.","For each entity are available description and the research projects managed. Categorized by type and OpenAIRE compatibility level."];
} else if (type == "journals") {
return ["Research journals","Discover research Journals. ","For each entity are available description, subjects, related "+OpenaireEntities.DATASOURCES.toLowerCase()+", publications and "+OpenaireEntities.RESULTS.toLowerCase()+" per year and type."];
} else if (type == "compatible") {
return ["research repositories", "Discover publication, data, software, istitutional and thematic repositories.","Available repository "+OpenaireEntities.RESULTS.toLowerCase()+" per year and type."];
return ["research repositories", "Discover publication, data, software, istitutional and thematic repositories.", "Available repository " + OpenaireEntities.RESULTS.toLowerCase() + " per year and type."];
} else if (type == "services") {
return [OpenaireEntities.SERVICES,"Discover worldwide research "+OpenaireEntities.SERVICES.toLowerCase()+" and correlated research.","Statistics data about produced "+OpenaireEntities.RESULTS.toLowerCase()+" per year available."];
} else {
return [OpenaireEntities.DATASOURCES,"Discover worldwide research "+OpenaireEntities.DATASOURCES.toLowerCase()+" and correlated research.","Statistics data about produced "+OpenaireEntities.RESULTS.toLowerCase()+" per year available."];
}
}
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services"): string {
if(properties.environment == "production") {
if (type == "registries") {
return ' (datasourcetypeuiid = "entityregistry" or datasourcetypeuiid = "entityregistry::products" or datasourcetypeuiid = "entityregistry::repositories" ' +
@ -54,7 +58,7 @@ export class DatasourcesHelperClass {
} else if (type == "compatible") {
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiid <> other and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals" ';
}else if (type == "deposit") {
} else if (type == "deposit") {
return ' oaftype exact datasource ';
} else {
return "";
@ -76,7 +80,7 @@ export class DatasourcesHelperClass {
}
}
public static createFilters(type: "all" | "registries" | "journals" | "compatible" | "deposit"): Filter[] {
public static createFilters(type: "all" | "registries" | "journals" | "compatible" | "deposit" | "services"): Filter[] {
if (type == "registries") {
return this.createRegistriesFilters();
} else if (type == "journals") {

View File

@ -89,12 +89,15 @@ export class EntitiesSelectionComponent {
if(showPage[this.simpleView ? this.properties.searchLinkToDataProviders : this.properties.searchLinkToAdvancedDataProviders] && showEntity["datasource"]) {
this.entities.push({label: OpenaireEntities.DATASOURCES, value: 'dataprovider'});
}
if (showPage[this.simpleView ? this.properties.searchLinkToServices : this.properties.searchLinkToAdvancedServices] && showEntity["service"]) {
this.entities.push({label: OpenaireEntities.SERVICES, value: 'service'});
}
}
if (this.customFilter && this.customFilter.queryFieldName == "communityId" || this.properties.adminToolsCommunity === "connect") {
//for community pages: no organization in simple search, only results in advanced
this.entities = this.entities.filter(option => option.value !== 'organization' && option.value !== 'all');
if (!this.simpleView) {
this.entities = this.entities.filter(option => option.value !== 'project' && option.value !== 'dataprovider');
this.entities = this.entities.filter(option => option.value !== 'project' && option.value !== 'dataprovider' && option.value !== 'service');
}
}
this.disableSelectEmitter.emit(this.entities.length == 1);
@ -107,6 +110,7 @@ export class EntitiesSelectionComponent {
this.entities.push({label: OpenaireEntities.PROJECTS, value: 'project'});
this.entities.push({label: OpenaireEntities.ORGANIZATIONS, value: 'organization'});
this.entities.push({label: OpenaireEntities.DATASOURCES, value: 'dataprovider'});
this.entities.push({label: OpenaireEntities.SERVICES, value: 'service'});
this.disableSelectEmitter.emit(true);
} else {
if(this.onlyresults) {
@ -125,6 +129,7 @@ export class EntitiesSelectionComponent {
this.entities.push({label: OpenaireEntities.PROJECTS, value: 'project'});
this.entities.push({label: OpenaireEntities.ORGANIZATIONS, value: 'organization'});
this.entities.push({label: OpenaireEntities.DATASOURCES, value: 'dataprovider'});
this.entities.push({label: OpenaireEntities.SERVICES, value: 'service'});
this.disableSelectEmitter.emit(false);
}
}
@ -169,6 +174,8 @@ export class EntitiesSelectionComponent {
return (simpleView ? this.properties.searchLinkToProjects : this.properties.searchLinkToAdvancedProjects);
} else if (this.selectedEntity == "dataprovider") {
return (simpleView ? this.properties.searchLinkToDataProviders : this.properties.searchLinkToAdvancedDataProviders);
} else if (this.selectedEntity == "service") {
return (simpleView ? this.properties.searchLinkToServices : this.properties.searchLinkToAdvancedServices);
} else if (this.selectedEntity == "organization") {
return (simpleView ? this.properties.searchLinkToOrganizations : this.properties.searchLinkToAdvancedOrganizations);
}

View File

@ -95,6 +95,10 @@ export class NewSearchPageComponent {
"software": {"id": "software", "name": OpenaireEntities.SOFTWARE},
"other": {"id": "other", "name": OpenaireEntities.OTHER}
};
serviceTypeOptions = {
"datasources": {"id": "datasource", "name": OpenaireEntities.DATASOURCES},
"services": {"id": "service", "name": OpenaireEntities.SERVICES}
}
selectedTypesNum = 0;
@Input() quickFilter: { filter: Filter, selected: boolean, filterId: string, value: string };
@Input() includeOnlyResultsAndFilter: boolean = false;
@ -852,7 +856,7 @@ export class NewSearchPageComponent {
/**
* Create Search API query based on the selected fields of the advanced form
*/
getSearchAPIQueryForAdvancedSearhFields() {
getSearchAPIQueryForAdvancedSearhFields(URLparams = null) {
var params = "";
var countParams = 0;
@ -925,6 +929,24 @@ export class NewSearchPageComponent {
countParams++;
}
}
if (this.entityType == "service" && URLparams) {
if (URLparams["type"]) {
let types = URLparams["type"];
types = Array.isArray(types) ? types.join(',').split(",") : types.split(",");
types.map(function (t) {
return StringUtils.unquote(StringUtils.URIDecode(t));
});
if (types.indexOf("datasources") == -1 || types.indexOf("services") == -1) {
for (let type of types) {
console.log("add type: " + type);
params += (params ? ' and ' : '') + ("eosctype exact " + (types.indexOf("datasources") != -1 ? "\"Data Source\"" : "\"Service\""));
// allFqs += "&type=" + StringUtils.unquote(StringUtils.URIDecode(type));
}
}
}
}
// console.log("ParameterS:")
// console.log(params)
@ -1119,6 +1141,8 @@ export class NewSearchPageComponent {
allFqs += "&type=organizations";
} else if (this.entityType == "dataprovider") {
allFqs += "&type=datasources";
} else if (this.entityType == "service") {
allFqs += "&type=services";
}
// console.log("AllFqs (check type): "+allFqs);
// console.log("type: "+this.entityType);
@ -1342,7 +1366,14 @@ export class NewSearchPageComponent {
//this.parameterValues.push(this.searchUtils.sortBy);
this.parameterValues.push(this.sortedByChanged);
}
if (this.resultTypes && (this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) {
console.log(this.resultTypes);
if (this.resultTypes &&
(
(this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")
||
(this.entityType == "datasource" || this.entityType == "service")
)
) {
let values = [];
for (let value of this.resultTypes.values) {
if (value.selected) {
@ -1466,20 +1497,27 @@ export class NewSearchPageComponent {
filters.push(filter)
}
}*/
let options = null;
if ((this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) {
options = this.resultTypeOptions;
} else if (this.entityType == "datasource" || this.entityType == "service") {
options = this.serviceTypeOptions;
}
if (options) {
this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"};
for (let typeOption of Object.keys(this.resultTypeOptions)) {
for (let typeOption of Object.keys(options)) {
let type = typeOption;
if ( URLparams["type"] && URLparams["type"].indexOf(type)==-1 || !URLparams["type"]) {
this.resultTypes.values.push({
name: this.resultTypeOptions[StringUtils.unquote(type)].name,
name: options[StringUtils.unquote(type)].name,
id: StringUtils.unquote(type),
selected: false,
number: 0
});
}else{
this.resultTypes.values.push({
name: this.resultTypeOptions[StringUtils.unquote(type)].name,
name: options[StringUtils.unquote(type)].name,
id: StringUtils.unquote(type),
selected: true,
number: 0

View File

@ -131,19 +131,6 @@ export class QuickSelectionsComponent {
}
}
this.resultTypes.countSelectedValues = selected.length;
this.resultTypes.values = [];
if(this.showPublications){
this.resultTypes.values.push({name: OpenaireEntities.PUBLICATIONS , id:"publications",selected:selected.indexOf("publications")!=-1, number:0});
}
if(this.showDatasets){
this.resultTypes.values.push({name: OpenaireEntities.DATASETS , id:"datasets",selected:selected.indexOf("datasets")!=-1, number:0});
}
if(this.showSoftware){
this.resultTypes.values.push({name: OpenaireEntities.SOFTWARE , id:"software",selected:selected.indexOf("software")!=-1, number:0});
}
if(this.showOrp){
this.resultTypes.values.push({name: OpenaireEntities.OTHER , id:"other",selected:selected.indexOf("other")!=-1, number:0});
}
}
this.typeChange.emit("filters_update");
}

View File

@ -303,6 +303,9 @@ export class SearchDataprovidersService {
result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
result['type'] = this.getDataproviderType(resData);
if (resData['eosctype']) {
result.entityType = resData['eosctype'].classname == "Service" ? "service" : "dataprovider";
}
let abstracts = this.parsingFunctions.parseDescription(resData.description);
result.description = abstracts.length > 0 ? abstracts[0] : "";
@ -467,8 +470,8 @@ export class SearchDataprovidersService {
return this.numOfDataproviders(url, properties);
}
numOfSearchDataproviders2(params: string, properties:EnvProperties, refineQuery:string=null):any {
let url: string = properties.searchAPIURLLAst+"resources2/?format=json&size=0&type=datasources";
numOfSearchDataproviders2(params: string, properties:EnvProperties, refineQuery:string=null, typePathParam: string="datasources"):any {
let url: string = properties.searchAPIURLLAst+"resources2/?format=json&size=0&type="+typePathParam;
if(params != "") {
url += "&query=" +params;
}

View File

@ -54,6 +54,10 @@ export class Portal {
"route": "/search/advanced/dataproviders",
"isEnabled": true
},
{
"route": "/search/advanced/services",
"isEnabled": true
},
{
"route": "/search/advanced/organizations",
"isEnabled": true
@ -77,6 +81,10 @@ export class Portal {
"route": "/search/find/dataproviders",
"isEnabled": true
},
{
"route": "/search/find/services",
"isEnabled": true
},
{
"route": "/search/find/organizations",
@ -164,6 +172,10 @@ export class Portal {
"pid": "datasource",
"isEnabled": true
},
{
"pid": "service",
"isEnabled": true
},
{
"pid": "orp",
"isEnabled": true

View File

@ -88,6 +88,7 @@ export interface EnvProperties {
searchLinkToPublication?: string;
searchLinkToProject?: string;
searchLinkToDataProvider?: string;
searchLinkToService?: string;
searchLinkToDataset?: string;
searchLinkToSoftwareLanding?: string;
searchLinkToOrp?: string;
@ -97,6 +98,7 @@ export interface EnvProperties {
searchLinkToStakeholders?: string;
searchLinkToPublications?: string;
searchLinkToDataProviders?: string;
searchLinkToServices?: string;
searchLinkToProjects?: string;
searchLinkToDatasets?: string;
searchLinkToSoftware?: string;
@ -115,6 +117,7 @@ export interface EnvProperties {
searchLinkToAdvancedSoftware?: string;
searchLinkToAdvancedOrps?: string;
searchLinkToAdvancedDataProviders?: string;
searchLinkToAdvancedServices?: string;
searchLinkToAdvancedOrganizations?: string;
searchLinkToAdvancedResults?: string;
errorLink?: string

View File

@ -657,6 +657,8 @@ export class SearchFields {
return this.ORGANIZATION_FIELDS[fieldId].name;
} else if (fieldType == "datasource" || fieldType == "dataprovider") {
return this.DATASOURCE_FIELDS[fieldId].name;
} else if (fieldType == "service") {
return this.DATASOURCE_FIELDS[fieldId].name;
} else {
return "UNDEFINED";
}
@ -689,6 +691,8 @@ export class SearchFields {
return this.ORGANIZATION_FIELDS[fieldId].param;
} else if (fieldType == "datasource" || fieldType == "dataprovider") {
return this.DATASOURCE_FIELDS[fieldId].param;
} else if (fieldType == "service") {
return this.DATASOURCE_FIELDS[fieldId].param;
} else {
return "UNDEFINED";
}
@ -776,6 +780,7 @@ export enum OpenaireEntities {
PROJECTS = "Projects",
ORGANIZATIONS = "Organizations",
DATASOURCES = "Datasources",
SERVICES = "Services",
COMMUNITIES = "Research communities",
RESULT = "Research product",
@ -786,6 +791,7 @@ export enum OpenaireEntities {
PROJECT = "Project",
ORGANIZATION = "Organization",
DATASOURCE = "Datasource",
SERVICE = "Service",
COMMUNITY = "Research community",
RESULTS_FILE = "research-products",
@ -796,4 +802,5 @@ export enum OpenaireEntities {
PROJECTS_FILE = "projects",
ORGANIZATIONS_FILE = "organizations",
DATASOURCES_FILE = "datasources",
SERVICES_FILE = "services",
}

View File

@ -60,6 +60,9 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
} else if (this.result.resultType == "dataprovider") {
this.urlParam = "datasourceId";
this.url = properties.searchLinkToDataProvider.split('?')[0];
} else if (this.result.resultType == "service") {
this.urlParam = "serviceId";
this.url = properties.searchLinkToService.split('?')[0];
} else {
this.urlParam = "id";
this.url = properties.searchLinkToResult.split('?')[0];
@ -127,6 +130,8 @@ export class ResultPreviewComponent implements OnInit, OnChanges {
return this.openaireEntities.OTHER_SINGULAR;
} else if (type === "dataprovider") {
return this.openaireEntities.DATASOURCE;
} else if (type === "service") {
return this.openaireEntities.SERVICE;
} else if (type === "publication") {
return this.openaireEntities.PUBLICATION;
} else if (type === "software") {