Production release February 2024 [EXPLORE] #31
|
@ -111,9 +111,11 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy {
|
||||||
this.updateUrl(this.url);
|
this.updateUrl(this.url);
|
||||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||||
|
|
||||||
|
if(properties.adminToolsPortalType !== "explore") {
|
||||||
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||||
this.pageContents = contents;
|
this.pageContents = contents;
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(res => {
|
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(res => {
|
||||||
this.lastIndexDate = res;
|
this.lastIndexDate = res;
|
||||||
}));
|
}));
|
||||||
|
|
|
@ -87,9 +87,11 @@ export class LinkingGenericComponent {
|
||||||
|
|
||||||
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe());
|
||||||
|
|
||||||
|
if(properties.adminToolsPortalType !== "explore") {
|
||||||
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => {
|
||||||
this.pageContents = contents;
|
this.pageContents = contents;
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if( typeof localStorage !== 'undefined') {
|
if( typeof localStorage !== 'undefined') {
|
||||||
|
@ -164,19 +166,19 @@ export class LinkingGenericComponent {
|
||||||
stepHasChanged(stepId){
|
stepHasChanged(stepId){
|
||||||
|
|
||||||
if(stepId == 'source'){
|
if(stepId == 'source'){
|
||||||
console.log("show source")
|
// console.log("show source")
|
||||||
this.showOptions.showSource();
|
this.showOptions.showSource();
|
||||||
}else if(stepId == 'target'){
|
}else if(stepId == 'target'){
|
||||||
console.log("show target")
|
// console.log("show target")
|
||||||
this.showOptions.show = this.showOptions.linkTo;
|
this.showOptions.show = this.showOptions.linkTo;
|
||||||
this.showOptions.showLinkTo();
|
this.showOptions.showLinkTo();
|
||||||
}else if(stepId == 'claim'){
|
}else if(stepId == 'claim'){
|
||||||
console.log("show target")
|
// console.log("show target")
|
||||||
this.showOptions.show = 'claim';
|
this.showOptions.show = 'claim';
|
||||||
}
|
}
|
||||||
this.cdr.detectChanges();
|
this.cdr.detectChanges();
|
||||||
HelperFunctions.scroll(true);
|
HelperFunctions.scroll(true);
|
||||||
console.log('stepHasChanged', stepId, this.showOptions.show)
|
// console.log('stepHasChanged', stepId, this.showOptions.show)
|
||||||
}
|
}
|
||||||
|
|
||||||
stepStatus(stepId){
|
stepStatus(stepId){
|
||||||
|
|
|
@ -206,8 +206,10 @@ export class DataProviderComponent {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
if(properties.adminToolsPortalType !== "explore") {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
|
}
|
||||||
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
||||||
|
|
|
@ -172,8 +172,10 @@ export class OrganizationComponent {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
if(properties.adminToolsPortalType !== "explore") {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
|
}
|
||||||
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
|
|
||||||
|
|
|
@ -218,8 +218,10 @@ export class ProjectComponent {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
if(properties.adminToolsPortalType !== "explore") {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
|
}
|
||||||
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url);
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||||
|
|
|
@ -213,8 +213,10 @@ export class ResultLandingComponent {
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
if(properties.adminToolsPortalType !== "explore") {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
|
}
|
||||||
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
|
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||||
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
||||||
|
|
|
@ -33,6 +33,7 @@ import {NewSearchPageComponent, SearchForm} from "../searchUtils/newSearchPage.c
|
||||||
import {properties} from "../../../../environments/environment";
|
import {properties} from "../../../../environments/environment";
|
||||||
import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
|
import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component";
|
||||||
import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service";
|
import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service";
|
||||||
|
import {GroupedRequestsService} from "../../services/groupedRequests.service";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'search-all',
|
selector: 'search-all',
|
||||||
|
@ -41,8 +42,9 @@ import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.ser
|
||||||
export class SearchAllComponent {
|
export class SearchAllComponent {
|
||||||
isMobile: boolean = false;
|
isMobile: boolean = false;
|
||||||
|
|
||||||
reload:{result:boolean, projects:boolean, datasources: boolean, services: boolean, organizations:boolean} =
|
reload:{result:boolean, projects:boolean, datasources: boolean, services: boolean, organizations:boolean, all: boolean} =
|
||||||
{result:true, projects:true, datasources: true, services: true, organizations:true};
|
{result:true, projects:true, datasources: true, services: true, organizations: true, all: true};
|
||||||
|
allCounts = null;
|
||||||
public pageTitle = "Search in OpenAIRE"
|
public pageTitle = "Search in OpenAIRE"
|
||||||
public keyword: string = "";
|
public keyword: string = "";
|
||||||
public publications: string[];
|
public publications: string[];
|
||||||
|
@ -126,6 +128,7 @@ export class SearchAllComponent {
|
||||||
private _searchProjectsService: SearchProjectsService,
|
private _searchProjectsService: SearchProjectsService,
|
||||||
private _searchOrganizationsService: SearchOrganizationsService,
|
private _searchOrganizationsService: SearchOrganizationsService,
|
||||||
private _refineFieldResultsService: RefineFieldResultsService,
|
private _refineFieldResultsService: RefineFieldResultsService,
|
||||||
|
private groupedRequestsService: GroupedRequestsService,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
private _meta: Meta,
|
private _meta: Meta,
|
||||||
private _title: Title,
|
private _title: Title,
|
||||||
|
@ -216,11 +219,13 @@ export class SearchAllComponent {
|
||||||
|
|
||||||
loadAll() {
|
loadAll() {
|
||||||
this.reloadTabs();
|
this.reloadTabs();
|
||||||
|
|
||||||
|
this.subs.push(this.route.params.subscribe(params => {
|
||||||
this.subs.push(this.route.queryParams.subscribe(queryParams => {
|
this.subs.push(this.route.queryParams.subscribe(queryParams => {
|
||||||
this.parameters = Object.assign({}, queryParams);
|
this.parameters = Object.assign({}, queryParams);
|
||||||
this.keyword = (queryParams['keyword']) ? queryParams['keyword'] : (queryParams["q"] ? queryParams["q"] : (queryParams["f0"] && queryParams["f0"] == "q" && queryParams["fv0"]?queryParams["fv0"]:""));
|
this.keyword = (queryParams['keyword']) ? queryParams['keyword'] : (queryParams["q"] ? queryParams["q"] : (queryParams["f0"] && queryParams["f0"] == "q" && queryParams["fv0"]?queryParams["fv0"]:""));
|
||||||
this.selectedFields[0].value = StringUtils.URIDecode(this.keyword);
|
this.selectedFields[0].value = StringUtils.URIDecode(this.keyword);
|
||||||
this.quickFilter.selected = ((queryParams['qf']== undefined || queryParams["qf"] == "true") == true);
|
// this.quickFilter.selected = ((queryParams['qf']== undefined || queryParams["qf"] == "true") == true);
|
||||||
if (queryParams["type"] && queryParams["type"].length > 0) {
|
if (queryParams["type"] && queryParams["type"].length > 0) {
|
||||||
this.resultTypes['publication'] = (queryParams["type"].split(",").indexOf("publications") != -1);
|
this.resultTypes['publication'] = (queryParams["type"].split(",").indexOf("publications") != -1);
|
||||||
this.resultTypes['dataset'] = (queryParams["type"].split(",").indexOf("datasets") != -1);
|
this.resultTypes['dataset'] = (queryParams["type"].split(",").indexOf("datasets") != -1);
|
||||||
|
@ -232,7 +237,8 @@ export class SearchAllComponent {
|
||||||
active = ((["result","projects","organizations","datasources","services"]).indexOf(queryParams["active"])!= -1)?queryParams["active"]:null;
|
active = ((["result","projects","organizations","datasources","services"]).indexOf(queryParams["active"])!= -1)?queryParams["active"]:null;
|
||||||
delete this.parameters['active'];
|
delete this.parameters['active'];
|
||||||
}
|
}
|
||||||
this.subs.push(this.route.params.subscribe(params => {
|
|
||||||
|
if(this.activeEntity == null) {
|
||||||
if (this.activeEntity == null && (!params["entity"] || params["entity"].length == 0)) {
|
if (this.activeEntity == null && (!params["entity"] || params["entity"].length == 0)) {
|
||||||
if (active) {
|
if (active) {
|
||||||
this.activeEntity = active;
|
this.activeEntity = active;
|
||||||
|
@ -255,6 +261,7 @@ export class SearchAllComponent {
|
||||||
}
|
}
|
||||||
this.activeEntity = ((["result", "projects", "organizations", "datasources", "services"]).indexOf(entity) != -1) ? entity : this.getDefaultEntityToShow();
|
this.activeEntity = ((["result", "projects", "organizations", "datasources", "services"]).indexOf(entity) != -1) ? entity : this.getDefaultEntityToShow();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (this.activeEntity == "result") {
|
if (this.activeEntity == "result") {
|
||||||
this.searchResults();
|
this.searchResults();
|
||||||
} else if (this.activeEntity == "projects") {
|
} else if (this.activeEntity == "projects") {
|
||||||
|
@ -409,21 +416,28 @@ export class SearchAllComponent {
|
||||||
|
|
||||||
private count() {
|
private count() {
|
||||||
var refineParams = null;
|
var refineParams = null;
|
||||||
|
let groupedQuery: boolean = false;
|
||||||
|
let reload = JSON.parse(JSON.stringify(this.reload));
|
||||||
if (this.customFilter) {
|
if (this.customFilter) {
|
||||||
refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
refineParams = (refineParams ? (refineParams + '&') : '') + "&fq=" + StringUtils.URIEncode(this.customFilter.queryFieldName + " exact " + StringUtils.quote((this.customFilter.valueId)));
|
||||||
|
} else if(!this.keyword || this.keyword.length == 0) {
|
||||||
|
groupedQuery = true;
|
||||||
}
|
}
|
||||||
if (this.activeEntity != "result" && this.reload["result"] && (this.showPublications || this.showSoftware || this.datasets || this.showOrps)) {
|
if (this.activeEntity != "result" && this.reload["result"] && (this.showPublications || this.showSoftware || this.datasets || this.showOrps)) {
|
||||||
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
|
||||||
this.reload["result"] = false;
|
this.reload["result"] = false;
|
||||||
this.fetchPublications.results = [];
|
this.fetchPublications.results = [];
|
||||||
|
if(!groupedQuery) {
|
||||||
//Add Open Access Filter
|
//Add Open Access Filter
|
||||||
this.subs.push(this.numOfSearchResults(this.fetchPublications, (refineParams ? (refineParams + '&') : '') + (this.openAccess ? "&fq=resultbestaccessright%20exact%20%22Open%20Access%22" : "")));
|
this.subs.push(this.numOfSearchResults(this.fetchPublications, (refineParams ? (refineParams ) : '') ));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.activeEntity != "projects" && this.reload["projects"] && this.showProjects) {
|
if (this.activeEntity != "projects" && this.reload["projects"] && this.showProjects) {
|
||||||
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
this.fetchProjects.searchUtils.status = this.errorCodes.LOADING;
|
||||||
this.fetchProjects.results = [];
|
this.fetchProjects.results = [];
|
||||||
this.reload["projects"] = false;
|
this.reload["projects"] = false;
|
||||||
|
if(!groupedQuery) {
|
||||||
this.subs.push(this._searchProjectsService.numOfSearchProjects2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("project", this.keyword, "q", "=") : "", this.properties, refineParams).subscribe(
|
this.subs.push(this._searchProjectsService.numOfSearchProjects2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("project", this.keyword, "q", "=") : "", this.properties, refineParams).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.fetchProjects.searchUtils.totalResults = data;
|
this.fetchProjects.searchUtils.totalResults = data;
|
||||||
|
@ -440,9 +454,11 @@ export class SearchAllComponent {
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (this.activeEntity != "datasources" && this.reload["datasources"] && this.showDataProviders) {
|
if (this.activeEntity != "datasources" && this.reload["datasources"] && this.showDataProviders) {
|
||||||
this.fetchDataproviders.results = [];
|
this.fetchDataproviders.results = [];
|
||||||
this.reload["datasources"] = false;
|
this.reload["datasources"] = false;
|
||||||
|
if(!groupedQuery) {
|
||||||
// this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams);
|
// this.fetchDataproviders.getNumForSearch(this.keyword, this.properties, refineParams);
|
||||||
this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("dataprovider", this.keyword, "q", "=") : "", this.properties, refineParams).subscribe(
|
this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("dataprovider", this.keyword, "q", "=") : "", this.properties, refineParams).subscribe(
|
||||||
data => {
|
data => {
|
||||||
|
@ -460,9 +476,11 @@ export class SearchAllComponent {
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (this.activeEntity != "services" && this.reload["services"] && this.showServices) {
|
if (this.activeEntity != "services" && this.reload["services"] && this.showServices) {
|
||||||
this.fetchServices.results = [];
|
this.fetchServices.results = [];
|
||||||
this.reload["services"] = false;
|
this.reload["services"] = false;
|
||||||
|
if(!groupedQuery) {
|
||||||
this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("service", this.keyword, "q", "=") : "", this.properties, refineParams, "services").subscribe(
|
this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("service", this.keyword, "q", "=") : "", this.properties, refineParams, "services").subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.fetchServices.searchUtils.totalResults = data;
|
this.fetchServices.searchUtils.totalResults = data;
|
||||||
|
@ -479,10 +497,12 @@ export class SearchAllComponent {
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (this.activeEntity != "organizations" && this.reload["organizations"] && this.showOrganizations) {
|
if (this.activeEntity != "organizations" && this.reload["organizations"] && this.showOrganizations) {
|
||||||
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
||||||
this.fetchOrganizations.results = [];
|
this.fetchOrganizations.results = [];
|
||||||
this.reload["organizations"] = false;
|
this.reload["organizations"] = false;
|
||||||
|
if(!groupedQuery) {
|
||||||
this.subs.push(this._searchOrganizationsService.numOfSearchOrganizations2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("organizations", this.keyword, "q", "=") : "", this.properties, refineParams).subscribe(
|
this.subs.push(this._searchOrganizationsService.numOfSearchOrganizations2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("organizations", this.keyword, "q", "=") : "", this.properties, refineParams).subscribe(
|
||||||
data => {
|
data => {
|
||||||
this.fetchOrganizations.searchUtils.totalResults = data;
|
this.fetchOrganizations.searchUtils.totalResults = data;
|
||||||
|
@ -500,29 +520,72 @@ export class SearchAllComponent {
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(groupedQuery && (reload["result"] || reload["datasources"] || reload["projects"] || reload["organizations"])) {
|
||||||
|
if(this.reload["all"]) {
|
||||||
|
this.reload["all"] = false;
|
||||||
|
this.subs.push(this.groupedRequestsService.search().subscribe(
|
||||||
|
data => {
|
||||||
|
this.allCounts = data;
|
||||||
|
this.setDefaultCounts();
|
||||||
|
},
|
||||||
|
err => {
|
||||||
|
this.handleError("Error getting number of search entities", err);
|
||||||
|
this.numErrorReturned(this.fetchPublications);
|
||||||
|
this.numErrorReturned(this.fetchDataproviders);
|
||||||
|
this.numErrorReturned(this.fetchOrganizations);
|
||||||
|
this.numErrorReturned(this.fetchProjects);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
this.setDefaultCounts();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private numOfSearchResults(fetchClass: FetchResearchResults, refineParams): Subscription {
|
private numOfSearchResults(fetchClass: FetchResearchResults, refineParams): Subscription {
|
||||||
return this._searchResearchResultsService.numOfResearchOutcomes(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("result",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
|
return this._searchResearchResultsService.numOfResearchOutcomes(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("result",this.keyword,"q","="):"", this.properties, refineParams).subscribe(
|
||||||
data => {
|
data => {
|
||||||
fetchClass.searchUtils.totalResults = data;
|
this.numReturned(fetchClass, data);
|
||||||
fetchClass.searchUtils.status = this.errorCodes.DONE;
|
|
||||||
if (fetchClass.searchUtils.totalResults == 0) {
|
|
||||||
fetchClass.searchUtils.status = this.errorCodes.NONE;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
this.handleError("Error getting number of research results", err);
|
this.handleError("Error getting number of research results", err);
|
||||||
fetchClass.searchUtils.status = this.errorCodes.ERROR;
|
this.numErrorReturned(fetchClass);
|
||||||
fetchClass.searchUtils.totalResults = null;
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private setDefaultCounts() {
|
||||||
|
if (this.activeEntity != "result" && this.allCounts.hasOwnProperty("results") && this.allCounts['results'] > 0) {
|
||||||
|
this.numReturned(this.fetchPublications, this.allCounts['results']);
|
||||||
|
}
|
||||||
|
if (this.allCounts.hasOwnProperty(this.activeEntity != "datasources" && "datasources") && this.allCounts['datasources'] > 0) {
|
||||||
|
this.numReturned(this.fetchDataproviders, this.allCounts['datasources']);
|
||||||
|
}
|
||||||
|
if (this.allCounts.hasOwnProperty(this.activeEntity != "organizations" && "organizations") && this.allCounts['organizations'] > 0) {
|
||||||
|
this.numReturned(this.fetchOrganizations, this.allCounts['organizations']);
|
||||||
|
}
|
||||||
|
if (this.allCounts.hasOwnProperty(this.activeEntity != "projects" && "projects") && this.allCounts['projects'] > 0) {
|
||||||
|
this.numReturned(this.fetchProjects, this.allCounts['projects']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private numReturned(fetchClass, num) {
|
||||||
|
fetchClass.searchUtils.totalResults = num;
|
||||||
|
fetchClass.searchUtils.status = this.errorCodes.DONE;
|
||||||
|
if (fetchClass.searchUtils.totalResults == 0) {
|
||||||
|
fetchClass.searchUtils.status = this.errorCodes.NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private numErrorReturned(fetchClass) {
|
||||||
|
fetchClass.searchUtils.status = this.errorCodes.ERROR;
|
||||||
|
fetchClass.searchUtils.totalResults = null;
|
||||||
|
}
|
||||||
|
|
||||||
private reloadTabs() {
|
private reloadTabs() {
|
||||||
this.reload = {result:true, projects:true, datasources: true, services: true, organizations:true};
|
this.reload = {result:true, projects:true, datasources: true, services: true, organizations:true, all: !this.allCounts};
|
||||||
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
this.fetchOrganizations.searchUtils.status = this.errorCodes.LOADING;
|
||||||
this.fetchDataproviders.searchUtils.status = this.errorCodes.LOADING;
|
this.fetchDataproviders.searchUtils.status = this.errorCodes.LOADING;
|
||||||
this.fetchServices.searchUtils.status = this.errorCodes.LOADING;
|
this.fetchServices.searchUtils.status = this.errorCodes.LOADING;
|
||||||
|
|
|
@ -24,13 +24,15 @@ import {PreviousRouteRecorder} from "../../utils/piwik/previousRouteRecorder.gua
|
||||||
import {BreadcrumbsModule} from "../../utils/breadcrumbs/breadcrumbs.module";
|
import {BreadcrumbsModule} from "../../utils/breadcrumbs/breadcrumbs.module";
|
||||||
import {SliderTabsModule} from "../../sharedComponents/tabs/slider-tabs.module";
|
import {SliderTabsModule} from "../../sharedComponents/tabs/slider-tabs.module";
|
||||||
import {NumberRoundModule} from "../../utils/pipes/number-round.module";
|
import {NumberRoundModule} from "../../utils/pipes/number-round.module";
|
||||||
|
import {GroupedRequestsServiceModule} from "../../services/groupedRequestsService.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
CommonModule, FormsModule, RouterModule,
|
CommonModule, FormsModule, RouterModule,
|
||||||
DataProvidersServiceModule, ProjectsServiceModule,
|
DataProvidersServiceModule, ProjectsServiceModule,
|
||||||
SearchResearchResultsServiceModule, OrganizationsServiceModule,
|
SearchResearchResultsServiceModule, OrganizationsServiceModule,
|
||||||
SearchResultsModule, PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, AdvancedSearchFormModule, SearchResearchResultsModule, SearchProjectsModule, SearchOrganizationsModule, SearchDataProvidersModule, BreadcrumbsModule, SliderTabsModule, NumberRoundModule
|
SearchResultsModule, PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, AdvancedSearchFormModule, SearchResearchResultsModule, SearchProjectsModule, SearchOrganizationsModule, SearchDataProvidersModule, BreadcrumbsModule, SliderTabsModule, NumberRoundModule,
|
||||||
|
GroupedRequestsServiceModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SearchAllComponent
|
SearchAllComponent
|
||||||
|
|
|
@ -175,8 +175,10 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
if(properties.adminToolsPortalType !== "explore") {
|
||||||
//this.getDivContents();
|
//this.getDivContents();
|
||||||
this.getPageContents();
|
this.getPageContents();
|
||||||
|
}
|
||||||
this.pagingLimit = this.properties.pagingLimit;
|
this.pagingLimit = this.properties.pagingLimit;
|
||||||
this.resultsPerPage = this.properties.resultsPerPage;
|
this.resultsPerPage = this.properties.resultsPerPage;
|
||||||
this.csvLimit = this.properties.csvLimit;
|
this.csvLimit = this.properties.csvLimit;
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
import {Injectable} from "@angular/core";
|
||||||
|
import {HttpClient} from "@angular/common/http";
|
||||||
|
import {map} from "rxjs/operators";
|
||||||
|
import {properties} from "../../../environments/environment";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class GroupedRequestsService {
|
||||||
|
constructor(private http: HttpClient = null) {}
|
||||||
|
|
||||||
|
home(): any {
|
||||||
|
let url = properties.utilsService+"/explore/home";
|
||||||
|
|
||||||
|
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
.pipe(map(res => res));
|
||||||
|
}
|
||||||
|
|
||||||
|
search(): any {
|
||||||
|
let url = properties.utilsService+"/explore/search";
|
||||||
|
|
||||||
|
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
.pipe(map(res => res));
|
||||||
|
}
|
||||||
|
|
||||||
|
funders(): any {
|
||||||
|
let url = properties.utilsService+"/explore/funders";
|
||||||
|
|
||||||
|
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
.pipe(map(res => res));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
import { NgModule} from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import {GroupedRequestsService} from "./groupedRequests.service";
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule, FormsModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
GroupedRequestsService
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
export class GroupedRequestsServiceModule { }
|
|
@ -57,7 +57,8 @@ export class RefineFieldResultsService {
|
||||||
getField (link:string,fieldName:string, properties:EnvProperties):any{
|
getField (link:string,fieldName:string, properties:EnvProperties):any{
|
||||||
let url = link+"&refine=true&page=1&size=0";
|
let url = link+"&refine=true&page=1&size=0";
|
||||||
|
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
|
return this.http.get((properties.useLongCache && link.includes("sf=") && !link.includes("fq="))? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
.pipe(map(res => res['refineResults']))
|
.pipe(map(res => res['refineResults']))
|
||||||
.pipe(map(res => this.parse(res,fieldName)));
|
.pipe(map(res => this.parse(res,fieldName)));
|
||||||
|
|
|
@ -47,7 +47,8 @@ export class SearchDataprovidersService {
|
||||||
url += "&page="+(page-1)+"&size="+size;
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
url += minRef ? "&minRef=true" : "";
|
url += minRef ? "&minRef=true" : "";
|
||||||
|
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
|
return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
|
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,8 @@ export class SearchOrganizationsService {
|
||||||
url += "&page="+(page-1)+"&size="+size;
|
url += "&page="+(page-1)+"&size="+size;
|
||||||
url += minRef ? "&minRef=true" : "";
|
url += minRef ? "&minRef=true" : "";
|
||||||
|
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
|
return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
|
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]));
|
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")]));
|
||||||
|
|
|
@ -70,7 +70,8 @@ export class SearchProjectsService {
|
||||||
url += minRef ? "&minRef=true" : "";
|
url += minRef ? "&minRef=true" : "";
|
||||||
|
|
||||||
// url += "&format=json";
|
// url += "&format=json";
|
||||||
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
// return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
|
||||||
|
return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
//.map(res => <any> res.json())
|
//.map(res => <any> res.json())
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]));
|
.pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "project")]));
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,8 @@ export class SearchResearchResultsService {
|
||||||
url += minRef ? "&minRef=true" : "";
|
url += minRef ? "&minRef=true" : "";
|
||||||
// url += "&format=json";
|
// url += "&format=json";
|
||||||
|
|
||||||
return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
// return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
|
return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
|
||||||
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
.pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {BehaviorSubject, Observable, Subscription, zip} from 'rxjs';
|
||||||
import {RouterHelper} from "../../utils/routerHelper.class";
|
import {RouterHelper} from "../../utils/routerHelper.class";
|
||||||
import {OpenaireEntities} from "../../utils/properties/searchFields";
|
import {OpenaireEntities} from "../../utils/properties/searchFields";
|
||||||
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
|
import {SearchOrganizationsService} from '../../services/searchOrganizations.service';
|
||||||
|
import {GroupedRequestsService} from "../../services/groupedRequests.service";
|
||||||
|
|
||||||
export interface Numbers {
|
export interface Numbers {
|
||||||
publicationsSize?: NumberSize;
|
publicationsSize?: NumberSize;
|
||||||
|
@ -74,7 +75,8 @@ export class NumbersComponent implements OnInit, OnDestroy {
|
||||||
constructor(private searchResearchResultsService: SearchResearchResultsService,
|
constructor(private searchResearchResultsService: SearchResearchResultsService,
|
||||||
private searchDataprovidersService: SearchDataprovidersService,
|
private searchDataprovidersService: SearchDataprovidersService,
|
||||||
private refineFieldResultsService: RefineFieldResultsService,
|
private refineFieldResultsService: RefineFieldResultsService,
|
||||||
private _searchOrganizationsService: SearchOrganizationsService) {
|
private _searchOrganizationsService: SearchOrganizationsService,
|
||||||
|
private groupedRequestsService: GroupedRequestsService) {
|
||||||
this.emptySubject = new BehaviorSubject<number>(0);
|
this.emptySubject = new BehaviorSubject<number>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,8 +93,8 @@ export class NumbersComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
let refineParams = (this.refineValue) ? ('&fq=' + this.refineValue) : null;
|
let refineParams = (this.refineValue) ? ('&fq=' + this.refineValue) : null;
|
||||||
|
|
||||||
|
if (refineParams) {
|
||||||
let mergedFundersSet = new Set<string>();
|
let mergedFundersSet = new Set<string>();
|
||||||
|
|
||||||
this.subs.push(zip(
|
this.subs.push(zip(
|
||||||
(getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
|
(getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
|
||||||
(getDatasets) ? this.searchResearchResultsService.numOfSearchResults('dataset', '', this.properties, refineParams) : this.empty,
|
(getDatasets) ? this.searchResearchResultsService.numOfSearchResults('dataset', '', this.properties, refineParams) : this.empty,
|
||||||
|
@ -154,11 +156,50 @@ export class NumbersComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.numbers.mergedFundersSize = NumberUtils.roundNumber(mergedFundersSet.size);
|
this.numbers.mergedFundersSize = NumberUtils.roundNumber(mergedFundersSet.size);
|
||||||
|
}
|
||||||
|
), err => {
|
||||||
|
this.handleError('Error getting numbers', err);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.subs.push(this.groupedRequestsService.home().subscribe((data: any[]) => {
|
||||||
|
if (data) {
|
||||||
|
if (data.hasOwnProperty("publications") && data['publications'] > 0) {
|
||||||
|
this.numbers.publicationsSize = NumberUtils.roundNumber(data['publications']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("datasets") && data['datasets'] > 0) {
|
||||||
|
this.numbers.datasetsSize = NumberUtils.roundNumber(data['datasets']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("datasetsInterlinked") && data['datasetsInterlinked'] > 0) {
|
||||||
|
this.numbers.datasetsLinkedSize = NumberUtils.roundNumber(data['datasetsInterlinked']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("software") && data['software'] > 0) {
|
||||||
|
this.numbers.softwareSize = NumberUtils.roundNumber(data['software']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("softwareInterlinked") && data['softwareInterlinked'] > 0) {
|
||||||
|
this.numbers.softwareLinkedSize = NumberUtils.roundNumber(data['softwareInterlinked']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("other") && data['other'] > 0) {
|
||||||
|
this.numbers.otherSize = NumberUtils.roundNumber(data['other']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("projects") && data['projects'] > 0) {
|
||||||
|
this.numbers.projectsSize = NumberUtils.roundNumber(data['projects']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("funders") && data['funders'] > 0) {
|
||||||
|
this.numbers.mergedFundersSize = NumberUtils.roundNumber(data['funders']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("datasources") && data['datasources'] > 0) {
|
||||||
|
this.numbers.datasourcesSize = NumberUtils.roundNumber(data['datasources']);
|
||||||
|
}
|
||||||
|
if (data.hasOwnProperty("organizations") && data['organizations'] > 0) {
|
||||||
|
this.numbers.organizationsSize = NumberUtils.roundNumber(data['organizations']);
|
||||||
|
}
|
||||||
|
}
|
||||||
this.results.emit(this.numbers);
|
this.results.emit(this.numbers);
|
||||||
}, err => {
|
}, err => {
|
||||||
this.handleError('Error getting numbers', err);
|
this.handleError('Error getting numbers', err);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.subs.forEach(sub => {
|
this.subs.forEach(sub => {
|
||||||
|
|
|
@ -9,9 +9,10 @@ import {SearchDataprovidersService} from '../../services/searchDataproviders.ser
|
||||||
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
|
import {RefineFieldResultsService} from '../../services/refineFieldResults.service';
|
||||||
import {LoadingModule} from '../../utils/loading/loading.module';
|
import {LoadingModule} from '../../utils/loading/loading.module';
|
||||||
import {RouterModule} from "@angular/router";
|
import {RouterModule} from "@angular/router";
|
||||||
|
import {GroupedRequestsServiceModule} from "../../services/groupedRequestsService.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [CommonModule, IconsModule, LoadingModule, RouterModule],
|
imports: [CommonModule, IconsModule, LoadingModule, RouterModule, GroupedRequestsServiceModule],
|
||||||
declarations: [NumbersComponent],
|
declarations: [NumbersComponent],
|
||||||
exports: [NumbersComponent],
|
exports: [NumbersComponent],
|
||||||
providers: [SearchResearchResultsService, SearchDataprovidersService, RefineFieldResultsService]
|
providers: [SearchResearchResultsService, SearchDataprovidersService, RefineFieldResultsService]
|
||||||
|
|
Loading…
Reference in New Issue