From fbe514b74086c61dbfc3b8647b9eea458b34139d Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 7 Feb 2024 22:50:13 +0200 Subject: [PATCH 1/8] [grouped-queries | DONE | CHANGED] Added groupedRequests.service.ts & groupedRequestsService.module.ts to call endpoints for grouped queries of each page | numbers.component.ts: Replaced queries of numbers (in Home page) with grouped query for home page of EXPLORE | searchAll.component.ts: Replaced count queries of each entity (in Search page) with grouped query for Search page of EXPLORE --- searchPages/find/searchAll.component.ts | 273 +++++++++++------- searchPages/find/searchAll.module.ts | 4 +- services/groupedRequests.service.ts | 30 ++ services/groupedRequestsService.module.ts | 19 ++ sharedComponents/numbers/numbers.component.ts | 175 +++++++---- sharedComponents/numbers/numbers.module.ts | 3 +- 6 files changed, 336 insertions(+), 168 deletions(-) create mode 100644 services/groupedRequests.service.ts create mode 100644 services/groupedRequestsService.module.ts diff --git a/searchPages/find/searchAll.component.ts b/searchPages/find/searchAll.component.ts index cea70fd9..27af8480 100644 --- a/searchPages/find/searchAll.component.ts +++ b/searchPages/find/searchAll.component.ts @@ -33,6 +33,7 @@ import {NewSearchPageComponent, SearchForm} from "../searchUtils/newSearchPage.c import {properties} from "../../../../environments/environment"; import {Breadcrumb} from "../../utils/breadcrumbs/breadcrumbs.component"; import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service"; +import {GroupedRequestsService} from "../../services/groupedRequests.service"; @Component({ selector: 'search-all', @@ -41,8 +42,9 @@ import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.ser export class SearchAllComponent { isMobile: boolean = false; - reload:{result:boolean, projects:boolean, datasources: boolean, services: boolean, organizations:boolean} = - {result:true, projects:true, datasources: true, services: true, organizations:true}; + reload:{result:boolean, projects:boolean, datasources: boolean, services: boolean, organizations:boolean, all: boolean} = + {result:true, projects:true, datasources: true, services: true, organizations: true, all: true}; + allCounts = null; public pageTitle = "Search in OpenAIRE" public keyword: string = ""; public publications: string[]; @@ -126,6 +128,7 @@ export class SearchAllComponent { private _searchProjectsService: SearchProjectsService, private _searchOrganizationsService: SearchOrganizationsService, private _refineFieldResultsService: RefineFieldResultsService, + private groupedRequestsService: GroupedRequestsService, private location: Location, private _meta: Meta, private _title: Title, @@ -216,44 +219,48 @@ export class SearchAllComponent { loadAll() { this.reloadTabs(); - this.subs.push(this.route.queryParams.subscribe(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.selectedFields[0].value = StringUtils.URIDecode(this.keyword); - this.quickFilter.selected = ((queryParams['qf']== undefined || queryParams["qf"] == "true") == true); - if (queryParams["type"] && queryParams["type"].length > 0) { - this.resultTypes['publication'] = (queryParams["type"].split(",").indexOf("publications") != -1); - this.resultTypes['dataset'] = (queryParams["type"].split(",").indexOf("datasets") != -1); - this.resultTypes['software'] = (queryParams["type"].split(",").indexOf("software") != -1); - this.resultTypes['other'] = (queryParams["type"].split(",").indexOf("other") != -1); - } - let active = null; - if (queryParams["active"] && queryParams["active"].length > 0) { - active = ((["result","projects","organizations","datasources","services"]).indexOf(queryParams["active"])!= -1)?queryParams["active"]:null; - delete this.parameters['active']; - } + this.subs.push(this.route.params.subscribe(params => { - if(this.activeEntity == null && (!params["entity"] || params["entity"].length == 0)){ - if (active) { - this.activeEntity = active; - if((typeof document !== 'undefined')){ - if (active == "result") { - active = "research-outcomes"; + this.subs.push(this.route.queryParams.subscribe(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.selectedFields[0].value = StringUtils.URIDecode(this.keyword); + // this.quickFilter.selected = ((queryParams['qf']== undefined || queryParams["qf"] == "true") == true); + if (queryParams["type"] && queryParams["type"].length > 0) { + this.resultTypes['publication'] = (queryParams["type"].split(",").indexOf("publications") != -1); + this.resultTypes['dataset'] = (queryParams["type"].split(",").indexOf("datasets") != -1); + this.resultTypes['software'] = (queryParams["type"].split(",").indexOf("software") != -1); + this.resultTypes['other'] = (queryParams["type"].split(",").indexOf("other") != -1); + } + let active = null; + if (queryParams["active"] && queryParams["active"].length > 0) { + active = ((["result","projects","organizations","datasources","services"]).indexOf(queryParams["active"])!= -1)?queryParams["active"]:null; + delete this.parameters['active']; + } + + if(this.activeEntity == null) { + if (this.activeEntity == null && (!params["entity"] || params["entity"].length == 0)) { + if (active) { + this.activeEntity = active; + if ((typeof document !== 'undefined')) { + if (active == "result") { + active = "research-outcomes"; + } + let query = location.search.replace(/(active=)([^&]*)&?/, ''); + this.location.go(location.pathname + '/' + active, query == '?' ? '' : query); } - let query = location.search.replace(/(active=)([^&]*)&?/, ''); - this.location.go(location.pathname + '/' + active, query == '?' ? '' : query); + } else { + this.activeEntity = this.getDefaultEntityToShow(); } - } else { - this.activeEntity = this.getDefaultEntityToShow(); + } else if (params["entity"] && params["entity"].length > 0) { + let entity = params["entity"]; + if (entity == "research-outcomes") { + entity = "result"; + } else if (entity == "dataproviders") { + entity = "datasources"; + } + this.activeEntity = ((["result", "projects", "organizations", "datasources", "services"]).indexOf(entity) != -1) ? entity : this.getDefaultEntityToShow(); } - } else if(params["entity"] && params["entity"].length > 0 ){ - let entity = params["entity"]; - if(entity == "research-outcomes") { - entity = "result"; - } else if (entity == "dataproviders") { - entity = "datasources"; - } - this.activeEntity = ((["result","projects","organizations","datasources","services"]).indexOf(entity)!= -1)?entity:this.getDefaultEntityToShow(); } if (this.activeEntity == "result") { this.searchResults(); @@ -409,120 +416,176 @@ export class SearchAllComponent { private count() { var refineParams = null; + let groupedQuery: boolean = false; + let reload = JSON.parse(JSON.stringify(this.reload)); if (this.customFilter) { 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)) { this.fetchPublications.searchUtils.status = this.errorCodes.LOADING; this.reload["result"] = false; this.fetchPublications.results = []; - //Add Open Access Filter - this.subs.push(this.numOfSearchResults(this.fetchPublications, (refineParams ? (refineParams + '&') : '') + (this.openAccess ? "&fq=resultbestaccessright%20exact%20%22Open%20Access%22" : ""))); + if(!groupedQuery) { + //Add Open Access Filter + this.subs.push(this.numOfSearchResults(this.fetchPublications, (refineParams ? (refineParams ) : '') )); + } } if (this.activeEntity != "projects" && this.reload["projects"] && this.showProjects) { this.fetchProjects.searchUtils.status = this.errorCodes.LOADING; this.fetchProjects.results = []; this.reload["projects"] = false; - this.subs.push(this._searchProjectsService.numOfSearchProjects2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("project",this.keyword,"q","="):"", this.properties, refineParams).subscribe( - data => { - this.fetchProjects.searchUtils.totalResults = data; - this.fetchProjects.searchUtils.status = this.errorCodes.DONE; - if (this.fetchProjects.searchUtils.totalResults == 0) { - this.fetchProjects.searchUtils.status = this.errorCodes.NONE; + if(!groupedQuery) { + this.subs.push(this._searchProjectsService.numOfSearchProjects2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("project", this.keyword, "q", "=") : "", this.properties, refineParams).subscribe( + data => { + this.fetchProjects.searchUtils.totalResults = data; + this.fetchProjects.searchUtils.status = this.errorCodes.DONE; + if (this.fetchProjects.searchUtils.totalResults == 0) { + this.fetchProjects.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + //console.log(err); + this.handleError("Error getting number of " + OpenaireEntities.PROJECTS, err); + this.fetchProjects.searchUtils.status = this.errorCodes.ERROR; + this.fetchProjects.searchUtils.totalResults = null; } - }, - err => { - //console.log(err); - this.handleError("Error getting number of "+OpenaireEntities.PROJECTS, err); - this.fetchProjects.searchUtils.status = this.errorCodes.ERROR; - this.fetchProjects.searchUtils.totalResults = null; - } - )); + )); + } } if (this.activeEntity != "datasources" && this.reload["datasources"] && this.showDataProviders) { this.fetchDataproviders.results = []; this.reload["datasources"] = false; - // 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( - data => { - this.fetchDataproviders.searchUtils.totalResults = data; - this.fetchDataproviders.searchUtils.status = this.errorCodes.DONE; - if (this.fetchDataproviders.searchUtils.totalResults == 0) { - this.fetchDataproviders.searchUtils.status = this.errorCodes.NONE; + if(!groupedQuery) { + // 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( + data => { + this.fetchDataproviders.searchUtils.totalResults = data; + this.fetchDataproviders.searchUtils.status = this.errorCodes.DONE; + if (this.fetchDataproviders.searchUtils.totalResults == 0) { + this.fetchDataproviders.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + //console.log(err); + this.handleError("Error getting number of " + OpenaireEntities.DATASOURCES, err); + this.fetchDataproviders.searchUtils.status = this.errorCodes.ERROR; + this.fetchDataproviders.searchUtils.totalResults = null; } - }, - err => { - //console.log(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("service",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; + if(!groupedQuery) { + this.subs.push(this._searchDataprovidersService.numOfSearchDataproviders2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("service", 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; } - }, - 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 = []; this.reload["organizations"] = false; - this.subs.push(this._searchOrganizationsService.numOfSearchOrganizations2(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("organizations",this.keyword,"q","="):"", this.properties, refineParams).subscribe( - data => { - this.fetchOrganizations.searchUtils.totalResults = data; - this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE; - if (this.fetchOrganizations.searchUtils.totalResults == 0) { - this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE; - } - }, - err => { - //console.log(err); - this.handleError("Error getting number of "+OpenaireEntities.ORGANIZATIONS, err); - this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR; - this.fetchOrganizations.searchUtils.totalResults = null; + if(!groupedQuery) { + this.subs.push(this._searchOrganizationsService.numOfSearchOrganizations2(this.keyword.length > 0 ? NewSearchPageComponent.createKeywordQuery("organizations", this.keyword, "q", "=") : "", this.properties, refineParams).subscribe( + data => { + this.fetchOrganizations.searchUtils.totalResults = data; + this.fetchOrganizations.searchUtils.status = this.errorCodes.DONE; + if (this.fetchOrganizations.searchUtils.totalResults == 0) { + this.fetchOrganizations.searchUtils.status = this.errorCodes.NONE; + } + }, + err => { + //console.log(err); + this.handleError("Error getting number of " + OpenaireEntities.ORGANIZATIONS, err); + this.fetchOrganizations.searchUtils.status = this.errorCodes.ERROR; + this.fetchOrganizations.searchUtils.totalResults = null; - } - )); + } + )); + } } - + 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 { return this._searchResearchResultsService.numOfResearchOutcomes(this.keyword.length>0?NewSearchPageComponent.createKeywordQuery("result",this.keyword,"q","="):"", this.properties, refineParams).subscribe( data => { - fetchClass.searchUtils.totalResults = data; - fetchClass.searchUtils.status = this.errorCodes.DONE; - if (fetchClass.searchUtils.totalResults == 0) { - fetchClass.searchUtils.status = this.errorCodes.NONE; - } + this.numReturned(fetchClass, data); }, err => { this.handleError("Error getting number of research results", err); - fetchClass.searchUtils.status = this.errorCodes.ERROR; - fetchClass.searchUtils.totalResults = null; + this.numErrorReturned(fetchClass); } ); } + 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() { - 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.fetchDataproviders.searchUtils.status = this.errorCodes.LOADING; this.fetchServices.searchUtils.status = this.errorCodes.LOADING; diff --git a/searchPages/find/searchAll.module.ts b/searchPages/find/searchAll.module.ts index 692e5743..e35f830f 100644 --- a/searchPages/find/searchAll.module.ts +++ b/searchPages/find/searchAll.module.ts @@ -24,13 +24,15 @@ import {PreviousRouteRecorder} from "../../utils/piwik/previousRouteRecorder.gua import {BreadcrumbsModule} from "../../utils/breadcrumbs/breadcrumbs.module"; import {SliderTabsModule} from "../../sharedComponents/tabs/slider-tabs.module"; import {NumberRoundModule} from "../../utils/pipes/number-round.module"; +import {GroupedRequestsServiceModule} from "../../services/groupedRequestsService.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, DataProvidersServiceModule, ProjectsServiceModule, 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: [ SearchAllComponent diff --git a/services/groupedRequests.service.ts b/services/groupedRequests.service.ts new file mode 100644 index 00000000..bdd11af0 --- /dev/null +++ b/services/groupedRequests.service.ts @@ -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)); + } +} \ No newline at end of file diff --git a/services/groupedRequestsService.module.ts b/services/groupedRequestsService.module.ts new file mode 100644 index 00000000..48292a84 --- /dev/null +++ b/services/groupedRequestsService.module.ts @@ -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 { } diff --git a/sharedComponents/numbers/numbers.component.ts b/sharedComponents/numbers/numbers.component.ts index bd83f769..e54982e0 100644 --- a/sharedComponents/numbers/numbers.component.ts +++ b/sharedComponents/numbers/numbers.component.ts @@ -9,6 +9,7 @@ import {BehaviorSubject, Observable, Subscription, zip} from 'rxjs'; import {RouterHelper} from "../../utils/routerHelper.class"; import {OpenaireEntities} from "../../utils/properties/searchFields"; import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; +import {GroupedRequestsService} from "../../services/groupedRequests.service"; export interface Numbers { publicationsSize?: NumberSize; @@ -74,7 +75,8 @@ export class NumbersComponent implements OnInit, OnDestroy { constructor(private searchResearchResultsService: SearchResearchResultsService, private searchDataprovidersService: SearchDataprovidersService, private refineFieldResultsService: RefineFieldResultsService, - private _searchOrganizationsService: SearchOrganizationsService) { + private _searchOrganizationsService: SearchOrganizationsService, + private groupedRequestsService: GroupedRequestsService) { this.emptySubject = new BehaviorSubject(0); } @@ -91,69 +93,120 @@ export class NumbersComponent implements OnInit, OnDestroy { } let refineParams = (this.refineValue) ? ('&fq=' + this.refineValue) : null; - let mergedFundersSet = new Set(); + // let mergedFundersSet = new Set(); - this.subs.push(zip( - (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, - (getDatasets) ? this.searchResearchResultsService.numOfSearchResults('dataset', '', this.properties, refineParams) : this.empty, - (getDatasetsLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties) : this.empty, - (getSoftware) ? this.searchResearchResultsService.numOfSearchResults('software', '', this.properties, refineParams) : this.empty, - (getSoftwareLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties) : this.empty, - (getOther) ? this.searchResearchResultsService.numOfSearchResults('other', '', this.properties, refineParams) : this.empty, - (getProjects) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties, refineParams) : this.empty, - (getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty, - (getOrganizations) ? this._searchOrganizationsService.numOfSearchOrganizations2('', this.properties, refineParams) : this.empty, - (getPublications && getDatasets && getSoftware && getOther) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams) : this.empty, - ).subscribe((data: any[]) => { - if (data[0] && data[0] > 0) { - this.numbers.publicationsSize = NumberUtils.roundNumber(data[0]); - } - if (data[1] && data[1] > 0) { - this.numbers.datasetsSize = NumberUtils.roundNumber(data[1]); - } - if (data[2] && data[2] > 0) { - this.numbers.datasetsLinkedSize = NumberUtils.roundNumber(data[2]); - } - if (data[3] && data[3] > 0) { - this.numbers.softwareSize = NumberUtils.roundNumber(data[3]); - } - if (data[4] && data[4] > 0) { - this.numbers.softwareLinkedSize = NumberUtils.roundNumber(data[4]); - } - if (data[5] && data[5] > 0) { - this.numbers.otherSize = NumberUtils.roundNumber(data[5]); - } - if (data[6][0] && data[6][0] > 0) { - this.numbers.projectsSize = NumberUtils.roundNumber(data[6][0]); - } - if (data[6][1] && data[6][1].length > 0 && data[6][1][0].filterId == 'funder' && data[6][1][0].values) { - this.numbers.fundersSize = NumberUtils.roundNumber(data[6][1][0].values.length); + // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); + // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); + // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); + // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); + // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); + // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); + // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); - let queriedFunders = data[6][1][0].values; - queriedFunders.forEach(queriedFunder => { - if(+queriedFunder.number > 1) { - if (!mergedFundersSet.has(queriedFunder.id)) { - mergedFundersSet.add(queriedFunder.id); - } - } - }); - } - if (data[7] && data[7] > 0) { - this.numbers.datasourcesSize = NumberUtils.roundNumber(data[7]); - } - if (data[8] && data[8] > 0) { - this.numbers.organizationsSize = NumberUtils.roundNumber(data[8]); - } - if (data[9][1] && data[9][1].length > 0 && data[9][1][0].filterId == 'relfunder' && data[9][1][0].values) { - let queriedFunders = data[9][1][0].values; - queriedFunders.forEach(queriedFunder => { - if (!mergedFundersSet.has(queriedFunder.id)) { - mergedFundersSet.add(queriedFunder.id); - } - }); - } - this.numbers.mergedFundersSize = NumberUtils.roundNumber(mergedFundersSet.size); + // this.subs.push(zip( + // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, + // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, + // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, + // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, + // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, + // // (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, + // (getDatasetsLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties) : this.empty, + // (getSoftware) ? this.searchResearchResultsService.numOfSearchResults('software', '', this.properties, refineParams) : this.empty, + // (getSoftwareLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties) : this.empty, + // (getOther) ? this.searchResearchResultsService.numOfSearchResults('other', '', this.properties, refineParams) : this.empty, + // (getProjects) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties, refineParams) : this.empty, + // (getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty, + // (getOrganizations) ? this._searchOrganizationsService.numOfSearchOrganizations2('', this.properties, refineParams) : this.empty, + // (getPublications && getDatasets && getSoftware && getOther) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams) : this.empty, + // ).subscribe((data: any[]) => { + // if (data[0] && data[0] > 0) { + // this.numbers.publicationsSize = NumberUtils.roundNumber(data[0]); + // } + // if (data[1] && data[1] > 0) { + // this.numbers.datasetsSize = NumberUtils.roundNumber(data[1]); + // } + // if (data[2] && data[2] > 0) { + // this.numbers.datasetsLinkedSize = NumberUtils.roundNumber(data[2]); + // } + // if (data[3] && data[3] > 0) { + // this.numbers.softwareSize = NumberUtils.roundNumber(data[3]); + // } + // if (data[4] && data[4] > 0) { + // this.numbers.softwareLinkedSize = NumberUtils.roundNumber(data[4]); + // } + // if (data[5] && data[5] > 0) { + // this.numbers.otherSize = NumberUtils.roundNumber(data[5]); + // } + // if (data[6][0] && data[6][0] > 0) { + // this.numbers.projectsSize = NumberUtils.roundNumber(data[6][0]); + // } + // if (data[6][1] && data[6][1].length > 0 && data[6][1][0].filterId == 'funder' && data[6][1][0].values) { + // this.numbers.fundersSize = NumberUtils.roundNumber(data[6][1][0].values.length); + // + // let queriedFunders = data[6][1][0].values; + // queriedFunders.forEach(queriedFunder => { + // if(+queriedFunder.number > 1) { + // if (!mergedFundersSet.has(queriedFunder.id)) { + // mergedFundersSet.add(queriedFunder.id); + // } + // } + // }); + // } + // if (data[7] && data[7] > 0) { + // this.numbers.datasourcesSize = NumberUtils.roundNumber(data[7]); + // } + // if (data[8] && data[8] > 0) { + // this.numbers.organizationsSize = NumberUtils.roundNumber(data[8]); + // } + // if (data[9][1] && data[9][1].length > 0 && data[9][1][0].filterId == 'relfunder' && data[9][1][0].values) { + // let queriedFunders = data[9][1][0].values; + // queriedFunders.forEach(queriedFunder => { + // if (!mergedFundersSet.has(queriedFunder.id)) { + // mergedFundersSet.add(queriedFunder.id); + // } + // }); + // } + // + // this.numbers.mergedFundersSize = NumberUtils.roundNumber(mergedFundersSet.size); + + + + 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); }, err => { this.handleError('Error getting numbers', err); diff --git a/sharedComponents/numbers/numbers.module.ts b/sharedComponents/numbers/numbers.module.ts index 72d30e26..9bb3f4d6 100644 --- a/sharedComponents/numbers/numbers.module.ts +++ b/sharedComponents/numbers/numbers.module.ts @@ -9,9 +9,10 @@ import {SearchDataprovidersService} from '../../services/searchDataproviders.ser import {RefineFieldResultsService} from '../../services/refineFieldResults.service'; import {LoadingModule} from '../../utils/loading/loading.module'; import {RouterModule} from "@angular/router"; +import {GroupedRequestsServiceModule} from "../../services/groupedRequestsService.module"; @NgModule({ - imports: [CommonModule, IconsModule, LoadingModule, RouterModule], + imports: [CommonModule, IconsModule, LoadingModule, RouterModule, GroupedRequestsServiceModule], declarations: [NumbersComponent], exports: [NumbersComponent], providers: [SearchResearchResultsService, SearchDataprovidersService, RefineFieldResultsService] From b89278af70db59e7a3d59ca4410d8d168375cb4f Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 8 Feb 2024 14:19:26 +0200 Subject: [PATCH 2/8] [develop | DONE | CHANGED]: Do not request page help contents (helptexts) in EXPLORE. (FILES: displayClaims.component.ts & linkingGeneric.component.ts & dataProvider.component.ts & organization.component.ts & project.component.ts & resultLanding.component.ts & newSearchPage.component.ts) --- .../displayClaims/displayClaims.component.ts | 10 ++++++---- claims/linking/linkingGeneric.component.ts | 10 ++++++---- landingPages/dataProvider/dataProvider.component.ts | 6 ++++-- landingPages/organization/organization.component.ts | 6 ++++-- landingPages/project/project.component.ts | 6 ++++-- landingPages/result/resultLanding.component.ts | 6 ++++-- searchPages/searchUtils/newSearchPage.component.ts | 6 ++++-- 7 files changed, 32 insertions(+), 18 deletions(-) diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index 837b0d83..9e5ccf97 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -110,10 +110,12 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { this.updateDescription(description); this.updateUrl(this.url); this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); - - this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { - this.pageContents = contents; - })); + + if(properties.adminToolsPortalType !== "explore") { + this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { + this.pageContents = contents; + })); + } this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(res => { this.lastIndexDate = res; })); diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index e2149bb0..31b76062 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -87,9 +87,11 @@ export class LinkingGenericComponent { 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.pageContents = contents; }) + } if( typeof localStorage !== 'undefined') { @@ -164,19 +166,19 @@ export class LinkingGenericComponent { stepHasChanged(stepId){ if(stepId == 'source'){ - console.log("show source") + // console.log("show source") this.showOptions.showSource(); }else if(stepId == 'target'){ - console.log("show target") + // console.log("show target") this.showOptions.show = this.showOptions.linkTo; this.showOptions.showLinkTo(); }else if(stepId == 'claim'){ - console.log("show target") + // console.log("show target") this.showOptions.show = 'claim'; } this.cdr.detectChanges(); HelperFunctions.scroll(true); - console.log('stepHasChanged', stepId, this.showOptions.show) + // console.log('stepHasChanged', stepId, this.showOptions.show) } stepStatus(stepId){ diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index baebcd09..a4afbb28 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -206,8 +206,10 @@ export class DataProviderComponent { } })); } - //this.getDivContents(); - this.getPageContents(); + if(properties.adminToolsPortalType !== "explore") { + //this.getDivContents(); + this.getPageContents(); + } this.updateUrl(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 => { diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index c2109ef0..814d7bb9 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -172,8 +172,10 @@ export class OrganizationComponent { } })); } - //this.getDivContents(); - this.getPageContents(); + if(properties.adminToolsPortalType !== "explore") { + //this.getDivContents(); + this.getPageContents(); + } this.updateUrl(this.properties.domain + this.properties.baseLink + this._router.url); this.seoService.createLinkForCanonicalURL(this.properties.domain +this.properties.baseLink + this._router.url); diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index bbf26740..ffa9fc65 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -218,8 +218,10 @@ export class ProjectComponent { } })); } - //this.getDivContents(); - this.getPageContents(); + if(properties.adminToolsPortalType !== "explore") { + //this.getDivContents(); + this.getPageContents(); + } this.updateUrl(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 => { diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts index b25b77e5..f51645f3 100644 --- a/landingPages/result/resultLanding.component.ts +++ b/landingPages/result/resultLanding.component.ts @@ -213,8 +213,10 @@ export class ResultLandingComponent { } })); } - //this.getDivContents(); - this.getPageContents(); + if(properties.adminToolsPortalType !== "explore") { + //this.getDivContents(); + this.getPageContents(); + } this.updateUrl(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 => { diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index be34dfef..4bdbdaaf 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -175,8 +175,10 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { } ngOnInit() { - //this.getDivContents(); - this.getPageContents(); + if(properties.adminToolsPortalType !== "explore") { + //this.getDivContents(); + this.getPageContents(); + } this.pagingLimit = this.properties.pagingLimit; this.resultsPerPage = this.properties.resultsPerPage; this.csvLimit = this.properties.csvLimit; From f55107b8d5f3a0a22624121c24abe5a5fc2242b4 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 8 Feb 2024 18:00:40 +0200 Subject: [PATCH 3/8] [develop | DONE | FIXED]: numbers.component.ts: [BUG FIX] Call "groupedRequestsService.home()" when no refineParams, otherwise (e.g. in aggregator), zip multiple queries. --- sharedComponents/numbers/numbers.component.ts | 216 +++++++++--------- 1 file changed, 102 insertions(+), 114 deletions(-) diff --git a/sharedComponents/numbers/numbers.component.ts b/sharedComponents/numbers/numbers.component.ts index e54982e0..7f698643 100644 --- a/sharedComponents/numbers/numbers.component.ts +++ b/sharedComponents/numbers/numbers.component.ts @@ -93,124 +93,112 @@ export class NumbersComponent implements OnInit, OnDestroy { } let refineParams = (this.refineValue) ? ('&fq=' + this.refineValue) : null; - // let mergedFundersSet = new Set(); + if (refineParams) { + let mergedFundersSet = new Set(); + this.subs.push(zip( + (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, + (getDatasets) ? this.searchResearchResultsService.numOfSearchResults('dataset', '', this.properties, refineParams) : this.empty, + (getDatasetsLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties) : this.empty, + (getSoftware) ? this.searchResearchResultsService.numOfSearchResults('software', '', this.properties, refineParams) : this.empty, + (getSoftwareLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties) : this.empty, + (getOther) ? this.searchResearchResultsService.numOfSearchResults('other', '', this.properties, refineParams) : this.empty, + (getProjects) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties, refineParams) : this.empty, + (getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty, + (getOrganizations) ? this._searchOrganizationsService.numOfSearchOrganizations2('', this.properties, refineParams) : this.empty, + (getPublications && getDatasets && getSoftware && getOther) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams) : this.empty, + ).subscribe((data: any[]) => { + if (data[0] && data[0] > 0) { + this.numbers.publicationsSize = NumberUtils.roundNumber(data[0]); + } + if (data[1] && data[1] > 0) { + this.numbers.datasetsSize = NumberUtils.roundNumber(data[1]); + } + if (data[2] && data[2] > 0) { + this.numbers.datasetsLinkedSize = NumberUtils.roundNumber(data[2]); + } + if (data[3] && data[3] > 0) { + this.numbers.softwareSize = NumberUtils.roundNumber(data[3]); + } + if (data[4] && data[4] > 0) { + this.numbers.softwareLinkedSize = NumberUtils.roundNumber(data[4]); + } + if (data[5] && data[5] > 0) { + this.numbers.otherSize = NumberUtils.roundNumber(data[5]); + } + if (data[6][0] && data[6][0] > 0) { + this.numbers.projectsSize = NumberUtils.roundNumber(data[6][0]); + } + if (data[6][1] && data[6][1].length > 0 && data[6][1][0].filterId == 'funder' && data[6][1][0].values) { + this.numbers.fundersSize = NumberUtils.roundNumber(data[6][1][0].values.length); - // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); - // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); - // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); - // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); - // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); - // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); - // this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {})); + let queriedFunders = data[6][1][0].values; + queriedFunders.forEach(queriedFunder => { + if (+queriedFunder.number > 1) { + if (!mergedFundersSet.has(queriedFunder.id)) { + mergedFundersSet.add(queriedFunder.id); + } + } + }); + } + if (data[7] && data[7] > 0) { + this.numbers.datasourcesSize = NumberUtils.roundNumber(data[7]); + } + if (data[8] && data[8] > 0) { + this.numbers.organizationsSize = NumberUtils.roundNumber(data[8]); + } + if (data[9][1] && data[9][1].length > 0 && data[9][1][0].filterId == 'relfunder' && data[9][1][0].values) { + let queriedFunders = data[9][1][0].values; + queriedFunders.forEach(queriedFunder => { + if (!mergedFundersSet.has(queriedFunder.id)) { + mergedFundersSet.add(queriedFunder.id); + } + }); + } - - // this.subs.push(zip( - // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, - // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, - // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, - // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, - // // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty, - // // (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, - // (getDatasetsLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties) : this.empty, - // (getSoftware) ? this.searchResearchResultsService.numOfSearchResults('software', '', this.properties, refineParams) : this.empty, - // (getSoftwareLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties) : this.empty, - // (getOther) ? this.searchResearchResultsService.numOfSearchResults('other', '', this.properties, refineParams) : this.empty, - // (getProjects) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties, refineParams) : this.empty, - // (getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty, - // (getOrganizations) ? this._searchOrganizationsService.numOfSearchOrganizations2('', this.properties, refineParams) : this.empty, - // (getPublications && getDatasets && getSoftware && getOther) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams) : this.empty, - // ).subscribe((data: any[]) => { - // if (data[0] && data[0] > 0) { - // this.numbers.publicationsSize = NumberUtils.roundNumber(data[0]); - // } - // if (data[1] && data[1] > 0) { - // this.numbers.datasetsSize = NumberUtils.roundNumber(data[1]); - // } - // if (data[2] && data[2] > 0) { - // this.numbers.datasetsLinkedSize = NumberUtils.roundNumber(data[2]); - // } - // if (data[3] && data[3] > 0) { - // this.numbers.softwareSize = NumberUtils.roundNumber(data[3]); - // } - // if (data[4] && data[4] > 0) { - // this.numbers.softwareLinkedSize = NumberUtils.roundNumber(data[4]); - // } - // if (data[5] && data[5] > 0) { - // this.numbers.otherSize = NumberUtils.roundNumber(data[5]); - // } - // if (data[6][0] && data[6][0] > 0) { - // this.numbers.projectsSize = NumberUtils.roundNumber(data[6][0]); - // } - // if (data[6][1] && data[6][1].length > 0 && data[6][1][0].filterId == 'funder' && data[6][1][0].values) { - // this.numbers.fundersSize = NumberUtils.roundNumber(data[6][1][0].values.length); - // - // let queriedFunders = data[6][1][0].values; - // queriedFunders.forEach(queriedFunder => { - // if(+queriedFunder.number > 1) { - // if (!mergedFundersSet.has(queriedFunder.id)) { - // mergedFundersSet.add(queriedFunder.id); - // } - // } - // }); - // } - // if (data[7] && data[7] > 0) { - // this.numbers.datasourcesSize = NumberUtils.roundNumber(data[7]); - // } - // if (data[8] && data[8] > 0) { - // this.numbers.organizationsSize = NumberUtils.roundNumber(data[8]); - // } - // if (data[9][1] && data[9][1].length > 0 && data[9][1][0].filterId == 'relfunder' && data[9][1][0].values) { - // let queriedFunders = data[9][1][0].values; - // queriedFunders.forEach(queriedFunder => { - // if (!mergedFundersSet.has(queriedFunder.id)) { - // mergedFundersSet.add(queriedFunder.id); - // } - // }); - // } - // - // this.numbers.mergedFundersSize = NumberUtils.roundNumber(mergedFundersSet.size); - - - - 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']); + this.numbers.mergedFundersSize = NumberUtils.roundNumber(mergedFundersSet.size); } - if(data.hasOwnProperty("datasets") && data['datasets'] > 0) { - this.numbers.datasetsSize = NumberUtils.roundNumber(data['datasets']); + ), 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']); + } } - 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); - }, err => { - this.handleError('Error getting numbers', err); - })); + this.results.emit(this.numbers); + }, err => { + this.handleError('Error getting numbers', err); + })); + } } ngOnDestroy() { From a7294685fb4ad530d1d1fbca75edd5bb0f691eff Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 8 Feb 2024 18:05:27 +0200 Subject: [PATCH 4/8] [develop | DONE | CHANGED]: refineFieldResults.service.ts & searchDataproviders.service.ts & searchOrganizations.service.ts & searchProjects.service.ts & searchResearchResults.service.ts: Set cache for default refine queries (without keywords or filters) - not in deposit and datasource specific pages. --- services/refineFieldResults.service.ts | 3 ++- services/searchDataproviders.service.ts | 5 +++-- services/searchOrganizations.service.ts | 5 +++-- services/searchProjects.service.ts | 5 +++-- services/searchResearchResults.service.ts | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/services/refineFieldResults.service.ts b/services/refineFieldResults.service.ts index af653a28..0e70a6f6 100644 --- a/services/refineFieldResults.service.ts +++ b/services/refineFieldResults.service.ts @@ -57,7 +57,8 @@ export class RefineFieldResultsService { getField (link:string,fieldName:string, properties:EnvProperties):any{ 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 => res.json()) .pipe(map(res => res['refineResults'])) .pipe(map(res => this.parse(res,fieldName))); diff --git a/services/searchDataproviders.service.ts b/services/searchDataproviders.service.ts index 1ae052b5..0277841c 100644 --- a/services/searchDataproviders.service.ts +++ b/services/searchDataproviders.service.ts @@ -47,8 +47,9 @@ export class SearchDataprovidersService { url += "&page="+(page-1)+"&size="+size; url += minRef ? "&minRef=true" : ""; - return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) - .pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")])); + // 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")])); } searchDataprovidersForDeposit (id: string,type:string, page: number, size: number, properties:EnvProperties):any { diff --git a/services/searchOrganizations.service.ts b/services/searchOrganizations.service.ts index b71f4e09..488b0e87 100644 --- a/services/searchOrganizations.service.ts +++ b/services/searchOrganizations.service.ts @@ -80,8 +80,9 @@ export class SearchOrganizationsService { url += "&page="+(page-1)+"&size="+size; url += minRef ? "&minRef=true" : ""; - return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) - //.map(res => res.json()) + // 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 => res.json()) .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "organization")])); } diff --git a/services/searchProjects.service.ts b/services/searchProjects.service.ts index 8e2fa14d..e9c48eaa 100644 --- a/services/searchProjects.service.ts +++ b/services/searchProjects.service.ts @@ -70,8 +70,9 @@ export class SearchProjectsService { url += minRef ? "&minRef=true" : ""; // url += "&format=json"; - return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) - //.map(res => res.json()) + // 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 => res.json()) .pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "project")])); } diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 62329217..d916157a 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -129,7 +129,8 @@ export class SearchResearchResultsService { url += minRef ? "&minRef=true" : ""; // 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")])); } From 87fb82042162eb04989d7e352e1b4d7f0077d006 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 30 Nov 2023 14:20:00 +0200 Subject: [PATCH 5/8] [angular-16-irish-monitor | WIP]: Add role group before type of an entity. (cherry picked from commit 65f8676a0800997f7e8a5c24f96a050bdb65504e) --- .../users/role-users/role-users.component.ts | 10 +---- login/utils/helper.class.ts | 3 +- .../role-verification.component.ts | 38 +++++++++---------- services/user-registry.service.ts | 11 +++--- 4 files changed, 28 insertions(+), 34 deletions(-) diff --git a/dashboard/users/role-users/role-users.component.ts b/dashboard/users/role-users/role-users.component.ts index 665a8303..ac0961a9 100644 --- a/dashboard/users/role-users/role-users.component.ts +++ b/dashboard/users/role-users/role-users.component.ts @@ -8,14 +8,7 @@ import { SimpleChanges, ViewChild } from '@angular/core'; -import { - UntypedFormArray, - UntypedFormBuilder, - UntypedFormControl, - UntypedFormGroup, - ValidatorFn, - Validators -} from '@angular/forms'; +import {UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, ValidatorFn, Validators} from '@angular/forms'; import {AlertModal} from "../../../utils/modal/alert"; import {UserRegistryService} from "../../../services/user-registry.service"; import {EnvProperties} from "../../../utils/properties/env-properties"; @@ -29,7 +22,6 @@ import {forkJoin, of, Subscription} from "rxjs"; import {NotificationHandler} from "../../../utils/notification-handler"; import {ClearCacheService} from "../../../services/clear-cache.service"; import {catchError, map, tap} from "rxjs/operators"; -import notification = CKEDITOR.plugins.notification; import {InputComponent} from "../../../sharedComponents/input/input.component"; class InvitationResponse { diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index 8fdd6229..f33c67e6 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -206,6 +206,7 @@ export class COOKIE { } export class Role { + public static GROUP = ''; public static PORTAL_ADMIN = 'PORTAL_ADMINISTRATOR'; public static REGISTERED_USER = 'REGISTERED_USER'; public static ANONYMOUS_USER = 'ROLE_ANONYMOUS'; @@ -219,7 +220,7 @@ export class Role { } else if (type == "organization") { type = "institution"; } - return type; + return Role.GROUP + type; } /** diff --git a/role-verification/role-verification.component.ts b/role-verification/role-verification.component.ts index c4a9a71a..29d993dc 100644 --- a/role-verification/role-verification.component.ts +++ b/role-verification/role-verification.component.ts @@ -1,5 +1,5 @@ import {AfterViewInit, ChangeDetectorRef, Component, Input, OnDestroy, OnInit, ViewChild} from "@angular/core"; -import {User} from "../login/utils/helper.class"; +import {Role, User} from "../login/utils/helper.class"; import {ActivatedRoute, Router} from "@angular/router"; import {UserManagementService} from "../services/user-management.service"; import {UserRegistryService} from "../services/user-registry.service"; @@ -11,6 +11,7 @@ import {properties} from "../../../environments/environment"; import {EmailService} from "../utils/email/email.service"; import {Composer} from "../utils/email/composer"; import {ClearCacheService} from "../services/clear-cache.service"; +import {BaseComponent} from "../sharedComponents/base/base.component"; @Component({ selector: 'role-verification', @@ -77,11 +78,13 @@ import {ClearCacheService} from "../services/clear-cache.service"; ` }) -export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewInit { +export class RoleVerificationComponent extends BaseComponent implements OnInit, AfterViewInit { @Input() public id: string; @Input() - public type: string; + set type(type: string) { + this._type = Role.GROUP + type; + } @Input() public name: string; @Input() @@ -93,7 +96,7 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn public user: User; public verification: any; public code: UntypedFormControl; - private subscriptions: any[] = []; + private _type: string; private paramsSubscription: Subscription; @ViewChild('managerModal') managerModal: AlertModal; @ViewChild('memberModal') memberModal: AlertModal; @@ -102,14 +105,15 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn public loading: boolean = false; public isMember: boolean = false; - constructor(private route: ActivatedRoute, - private router: Router, + constructor(protected _route: ActivatedRoute, + protected _router: Router, private fb: UntypedFormBuilder, private emailService: EmailService, private userManagementService: UserManagementService, private userRegistryService: UserRegistryService, private clearCacheService: ClearCacheService, private cdr: ChangeDetectorRef) { + super(); } ngOnInit() { @@ -119,14 +123,14 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn ngAfterViewInit() { this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.user = user; - this.paramsSubscription = this.route.queryParams.subscribe(params => { + this.paramsSubscription = this._route.queryParams.subscribe(params => { if (params) { this.cdr.detectChanges(); if(params['verify'] && !this.isMember) { if (this.user) { this.subscriptions.push(this.userRegistryService.getInvitation(params['verify']).subscribe(verification => { this.verification = verification; - if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this.type === this.verification.type) { + if (this.user.email === this.verification.email.toLowerCase() && this.id === this.verification.entity && this._type === this.verification.type) { if (this.verification.verificationType === 'manager') { this.openManagerModal(); } else if (this.verification.verificationType === 'member') { @@ -141,12 +145,12 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn this.openErrorModal(); })); } else { - this.router.navigate(['user-info'], { + this._router.navigate(['user-info'], { queryParams: { 'errorCode': LoginErrorCodes.NOT_LOGIN, - 'redirectUrl': this.router.url + 'redirectUrl': this._router.url }, - relativeTo: this.route + relativeTo: this._route }); } } else if(this.isMember) { @@ -161,14 +165,10 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn } ngOnDestroy() { + super.ngOnDestroy(); if (this.paramsSubscription instanceof Subscription) { this.paramsSubscription.unsubscribe(); } - this.subscriptions.forEach(subscription => { - if (subscription instanceof Subscriber) { - subscription.unsubscribe(); - } - }); } public openManagerModal() { @@ -216,9 +216,9 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn if (this.paramsSubscription instanceof Subscription) { this.paramsSubscription.unsubscribe(); } - if (this.service === "monitor") { + if (this.service === "monitor" ) { this.loading = false; - this.router.navigate(['/admin/' + this.verification.entity]); + this._router.navigate(['/admin/' + this.verification.entity]); } else { this.subscriptions.push(this.emailService.notifyManagers(this.id, 'manager', Composer.composeEmailToInformOldManagersForTheNewOnes(this.name, this.id)).subscribe(() => { @@ -275,6 +275,6 @@ export class RoleVerificationComponent implements OnInit, OnDestroy, AfterViewIn cancel() { this.isMember = false; - this.router.navigate([]); + this._router.navigate([]); } } diff --git a/services/user-registry.service.ts b/services/user-registry.service.ts index 0e8db8ea..561e7da8 100644 --- a/services/user-registry.service.ts +++ b/services/user-registry.service.ts @@ -4,6 +4,7 @@ import {Observable} from 'rxjs'; import {properties} from '../../../environments/environment'; import {CustomOptions} from './servicesUtils/customOptions.class'; import {map} from 'rxjs/operators'; +import {Role} from "../login/utils/helper.class"; @Injectable({ providedIn: 'root' @@ -14,7 +15,7 @@ export class UserRegistryService { } public createRole(type: string, id: string): Observable { - return this.http.post(properties.registryUrl + 'create/' + type + '/' + id, null, + return this.http.post(properties.registryUrl + 'create/' + Role.GROUP + type + '/' + id, null, CustomOptions.registryOptions()).pipe(map((response: any) => response.response)); } @@ -35,12 +36,12 @@ export class UserRegistryService { public remove(type: string, id: string, email: string, role: "member" | "manager" = "manager"): Observable { return this.http.delete(properties.registryUrl + - type + '/' + id + '/' + role + '/' + encodeURIComponent(email), CustomOptions.registryOptions()); + Role.GROUP + type + '/' + id + '/' + role + '/' + encodeURIComponent(email), CustomOptions.registryOptions()); } public invite(type: string, id: string, details: any, role: "member" | "manager" = "manager"): Observable { return this.http.post(properties.registryUrl + 'invite/' + - type + '/' + id + '/' + role, details, + Role.GROUP + type + '/' + id + '/' + role, details, CustomOptions.registryOptions()).pipe(map((response: any) => response.response)); } @@ -58,7 +59,7 @@ export class UserRegistryService { } public getActive(type: string, id: string, role: "member" | "manager" = "manager"): Observable { - let url = properties.registryUrl + type + '/' + id + "/" + role + 's'; + let url = properties.registryUrl + Role.GROUP + type + '/' + id + "/" + role + 's'; return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url, CustomOptions.registryOptions()).pipe(map((response:any) => response.response), map(users => { if(users.length > 0 && !users[0].email) { @@ -70,7 +71,7 @@ export class UserRegistryService { } public getPending(type: string, id: string, role: "member" | "manager" = "manager"): Observable { - let url = properties.registryUrl + 'invite/' +type + '/' +id + "/" + role + 's/'; + let url = properties.registryUrl + 'invite/' + Role.GROUP + type + '/' +id + "/" + role + 's/'; return this.http.get((properties.useCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url, CustomOptions.registryOptions()).pipe(map((response: any) => response.response)); } From 0fe358c781378f6942dc9216a8f867467c58a5d2 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 24 Nov 2023 10:51:22 +0200 Subject: [PATCH 6/8] [angular-16-irish-monitor]: Add rootClass subject in layout service. (cherry picked from commit 246cafa43fead561c5d08ea3329c503e3fdb8b11) --- .../sharedComponents/sidebar/layout.service.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index 02754405..29b83bd0 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -83,7 +83,11 @@ export class LayoutService { * Add hasStickyHeaderOnMobile: true in order to activate uk-sticky in header of mobile/tablet devices. * */ private hasStickyHeaderOnMobileSubject: BehaviorSubject = new BehaviorSubject(false); - + /** + * Add a class in root element of the html. (For different theme apply) + * Handle it manually in the component, it doesn't use data + * */ + private rootClassSubject: BehaviorSubject = new BehaviorSubject(null); private subscriptions: any[] = []; ngOnDestroy() { @@ -329,4 +333,12 @@ export class LayoutService { setHasStickyHeaderOnMobile(value: boolean) { this.hasStickyHeaderOnMobileSubject.next(value); } + + get rootClass(): Observable { + return this.rootClassSubject.asObservable(); + } + + setRootClass(value: string = null): void { + this.rootClassSubject.next(value); + } } From 3d08ffeb529dd905ada1ec8eefd969877601c698 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 12 Jan 2024 09:15:04 +0200 Subject: [PATCH 7/8] [angular-16-irish-monitor]: Fix cancel invitation method of a user. Set rootClass only if it is changed. (cherry picked from commit ba1a3b9e62447d95318c73a54c1b37b4e1ac73fb) --- dashboard/sharedComponents/sidebar/layout.service.ts | 4 +++- services/user-registry.service.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index 29b83bd0..17657431 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -339,6 +339,8 @@ export class LayoutService { } setRootClass(value: string = null): void { - this.rootClassSubject.next(value); + if(this.rootClassSubject.value != value) { + this.rootClassSubject.next(value); + } } } diff --git a/services/user-registry.service.ts b/services/user-registry.service.ts index 561e7da8..e81cf626 100644 --- a/services/user-registry.service.ts +++ b/services/user-registry.service.ts @@ -78,7 +78,7 @@ export class UserRegistryService { public cancelInvitation(type: string, id: string, email: string, role: "member" | "manager" = "manager"): Observable { return this.http.delete(properties.registryUrl + 'invite/' + - type + '/' + id + '/' + role + '/' + encodeURIComponent(email), + Role.GROUP + type + '/' + id + '/' + role + '/' + encodeURIComponent(email), CustomOptions.registryOptions()); } } From 1cfe22f406d3a74ce0cf73a50ec19824331a6447 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 12 Feb 2024 14:46:06 +0200 Subject: [PATCH 8/8] [develop]: Remove deposit class from deposit first page. --- deposit/depositFirstPage.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deposit/depositFirstPage.component.ts b/deposit/depositFirstPage.component.ts index 4b8fa3e7..03704688 100644 --- a/deposit/depositFirstPage.component.ts +++ b/deposit/depositFirstPage.component.ts @@ -15,7 +15,7 @@ import {FullScreenModalComponent} from '../utils/modal/full-screen-modal/full-sc @Component({ selector: 'deposit-first-page', template: ` -
+