diff --git a/error/errorPage.component.ts b/error/errorPage.component.ts index c20eab39..189d691f 100644 --- a/error/errorPage.component.ts +++ b/error/errorPage.component.ts @@ -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(); diff --git a/landingPages/dataProvider/dataProvider.component.html b/landingPages/dataProvider/dataProvider.component.html index 201b07af..e97c8941 100644 --- a/landingPages/dataProvider/dataProvider.component.html +++ b/landingPages/dataProvider/dataProvider.component.html @@ -18,7 +18,7 @@
@@ -45,7 +45,7 @@
-
+
@@ -75,7 +75,7 @@
+ [properties]="properties" [entityType]="getTypeName()" [fields]="feedbackFields" + [(showForm)]="showFeedback"> diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index b7f3d57a..3b86e354 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -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; + } } diff --git a/landingPages/dataProvider/dataProvider.service.ts b/landingPages/dataProvider/dataProvider.service.ts index 91bb5934..3ed5b775 100644 --- a/landingPages/dataProvider/dataProvider.service.ts +++ b/landingPages/dataProvider/dataProvider.service.ts @@ -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) diff --git a/searchPages/find/searchAll.component.html b/searchPages/find/searchAll.component.html index abf6e745..23651c47 100644 --- a/searchPages/find/searchAll.component.html +++ b/searchPages/find/searchAll.component.html @@ -53,6 +53,14 @@ ({{fetchDataproviders.searchUtils.totalResults | number}}) +
  • + + {{servicesName}} + + ({{fetchServices.searchUtils.totalResults | number}}) + +
  • @@ -82,3 +90,9 @@ (searchPageUpdates)="activeEntityUpdate($event)" simpleSearchLink="/search/find" [customFilter]="customFilter"> + + + \ No newline at end of file diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts index 69c6c565..1857bb44 100644 --- a/searchPages/find/searchAll.component.ts +++ b/searchPages/find/searchAll.component.ts @@ -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(); } diff --git a/searchPages/searchDataProviders.component.ts b/searchPages/searchDataProviders.component.ts index 4a46fbb3..95f053dc 100644 --- a/searchPages/searchDataProviders.component.ts +++ b/searchPages/searchDataProviders.component.ts @@ -19,13 +19,13 @@ import {properties} from "../../../environments/environment"; 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") { diff --git a/searchPages/searchUtils/entitiesSelection.component.ts b/searchPages/searchUtils/entitiesSelection.component.ts index 4778b716..21c6c349 100644 --- a/searchPages/searchUtils/entitiesSelection.component.ts +++ b/searchPages/searchUtils/entitiesSelection.component.ts @@ -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); } diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index 45fc59da..b961b16a 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -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 diff --git a/searchPages/searchUtils/quick-selections.component.ts b/searchPages/searchUtils/quick-selections.component.ts index 9cb6e7db..7c4d778f 100644 --- a/searchPages/searchUtils/quick-selections.component.ts +++ b/searchPages/searchUtils/quick-selections.component.ts @@ -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"); } diff --git a/services/searchDataproviders.service.ts b/services/searchDataproviders.service.ts index d4a98fcb..fdae6660 100644 --- a/services/searchDataproviders.service.ts +++ b/services/searchDataproviders.service.ts @@ -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; } diff --git a/utils/entities/adminTool/portal.ts b/utils/entities/adminTool/portal.ts index e883e76b..0c7f62c7 100644 --- a/utils/entities/adminTool/portal.ts +++ b/utils/entities/adminTool/portal.ts @@ -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 diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts index f6b1a2fb..dcc85cd0 100644 --- a/utils/properties/env-properties.ts +++ b/utils/properties/env-properties.ts @@ -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 diff --git a/utils/properties/searchFields.ts b/utils/properties/searchFields.ts index 893d0279..f65f5089 100644 --- a/utils/properties/searchFields.ts +++ b/utils/properties/searchFields.ts @@ -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", } diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index 3f8e2bed..bc8a1263 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -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") {