From 95097beaae3682b7d7d5e826670fa96e7a5880ff Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 21 Mar 2024 09:46:11 +0200 Subject: [PATCH 01/64] [develop | DONE | FIXED] linking update parsing of the datacite API --- .../service/searchDatacite.service.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/claims/claim-utils/service/searchDatacite.service.ts b/claims/claim-utils/service/searchDatacite.service.ts index 4361462f..a6d9cc8b 100644 --- a/claims/claim-utils/service/searchDatacite.service.ts +++ b/claims/claim-utils/service/searchDatacite.service.ts @@ -58,22 +58,20 @@ export class SearchDataciteService { entity.result.journal = null; entity.result.DOI = item.attributes.doi; entity.id = item.attributes.doi; - entity.title = item.attributes.title; + entity.title = Array.isArray(item.attributes.titles) && item.attributes.titles[0].title?item.attributes.titles[0].title:null; entity.result.url = properties.doiURL + item.attributes.doi; entity.result.source = 'datacite'; entity.type = 'dataset'; - entity.result.date = item.attributes.published; + entity.result.date = item.attributes.publicationYear; entity.result.accessRights = "OPEN"; - entity.result.publisher = item.attributes['container-title']; + entity.result.publisher = item.attributes['publisher']; entity.result.journal = null; entity.result.record = item; - if (item.attributes.author) { + if (item.attributes.creators) { entity.result.authors = []; - for (let j = 0; j < item.attributes.author.length; j++) { - const author = item.attributes.author[j]; - if(author.family || author.literal) { - entity.result.authors.push((author.family) ? author.family + (author.given ? ', ' + author.given : '') : author.literal); - } + for (let j = 0; j < item.attributes.creators.length; j++) { + const author = item.attributes.creators[j].name; + entity.result.authors.push(author); } } results.push(entity); -- 2.17.1 From d6b924bcaaf54b6a11908fa8d0cfbab065d6bd41 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 21 Mar 2024 09:47:02 +0200 Subject: [PATCH 02/64] [develop | DONE | FIXED] linking update check to decide if claim is pending and show the link to landing --- claims/claim-utils/displayClaims/displayClaims.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index 9e5ccf97..d4204ceb 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -351,7 +351,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { if (claimDateStr < lastUpdateDateStr) { return true; } else { - return claim.target.collectedFrom != "infrastruct_::openaire" && claim.indexed; + return claim.target.collectedFrom != "infrastruct_::openaire"; } } -- 2.17.1 From 78d262dd3b67ceb022cf9a3e5135bcf8466c7f1c Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 2 Apr 2024 10:59:33 +0300 Subject: [PATCH 03/64] [develop | DONE | ADDED]: Added search organizations by PID (ror, isni, wikidata, fundRef). 1. string-utils.class.ts: Added methods "isValidRor()", "isValidIsni()", "isValidWikidata()", "isValidFundRef()" and cases for these new identifiers. 2. newSearchPage.component.ts: In method "createKeywordQuery()", check for PIDs also for organizations entity. 3. environment.ts: Updated property "fundRefURL" to "https://data.crossref.org/fundingdata/funder/" (old: https://api.crossref.org/funders/). --- .../searchUtils/newSearchPage.component.ts | 2 +- utils/properties/environments/environment.ts | 2 +- utils/string-utils.class.ts | 37 +++++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/searchPages/searchUtils/newSearchPage.component.ts b/searchPages/searchUtils/newSearchPage.component.ts index cf9f105a..e8447acb 100644 --- a/searchPages/searchUtils/newSearchPage.component.ts +++ b/searchPages/searchUtils/newSearchPage.component.ts @@ -1085,7 +1085,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges { let params = ""; let doisParams = ""; var DOIs: Identifier[] = Identifier.getIdentifiersFromString(value); - if ((entityType == 'publication' || entityType == 'dataset' || entityType == 'software' || entityType == 'other' || entityType == "result" || entityType == "dataprovider" || entityType == "service")) { + if ((entityType == 'publication' || entityType == 'dataset' || entityType == 'software' || entityType == 'other' || entityType == "result" || entityType == "dataprovider" || entityType == "service" || entityType == "organization")) { for (let identifier of DOIs) { // console.log(identifier) // pidclassid exact \"doi\" and pid exact \"10.1016/j.nima.2015.11.134\" diff --git a/utils/properties/environments/environment.ts b/utils/properties/environments/environment.ts index fb86e5d4..283a1295 100644 --- a/utils/properties/environments/environment.ts +++ b/utils/properties/environments/environment.ts @@ -23,7 +23,7 @@ export let common: EnvProperties = { rorURL: "https://ror.org/", isniURL: "https://isni.org/isni/", wikiDataURL: "https://www.wikidata.org/wiki/", - fundRefURL: "https://api.crossref.org/funders/", + fundRefURL: "https://data.crossref.org/fundingdata/funder/", fairSharingURL: "https://fairsharing.org/", eoscMarketplaceURL: "https://marketplace.eosc-portal.eu/services/", sherpaURL: "http://sherpa.ac.uk/romeo/issn/", diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index cbce9848..3ccf6e6b 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -150,7 +150,7 @@ export class DOI { } export class Identifier { - class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" = null; + class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" | "ror" | "wikidata" | "fundref" | "isni" = null; id: string; public static getDOIsFromString(str: string): string[] { @@ -205,14 +205,22 @@ export class Identifier { return {"class": "re3data", "id": pid}; } else if (Identifier.isValidSwhId(pid)) { return {"class": "swhid", "id": pid}; + } else if (Identifier.isValidRor(pid)) { + return {"class": "ror", "id": pid}; + } else if (Identifier.isValidFundRef(pid)) { + return {"class": "fundref", "id": pid}; + } else if (Identifier.isValidWikidata(pid)) { + return {"class": "wikidata", "id": pid}; + } else if (Identifier.isValidIsni(pid)) { + return {"class": "isni", "id": pid}; } //set it as a doi, to catch the case that doi has not valid format return (strict?null:{"class": "doi", "id": pid}); } public static getPIDFromIdentifiers(identifiers: Map): Identifier { - let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid"]; - if(identifiers) { + let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid", "ror", "wikidata", "fundref", "isni"]; + if(identifiers && identifiers.size > 0) { for (let cl of classes) { if (identifiers.get(cl)) { for (let pid of identifiers.get(cl)) { @@ -258,6 +266,7 @@ export class Identifier { } public static isValidHANDLE(str: string): boolean { + // let exp = /\b[0-9a-zA-Z-]*\/[0-9a-zA-Z-]*$/g; // resolve with url - need to add method for raw value let exp = /^[0-9a-zA-Z-]*\/[0-9a-zA-Z-]*$/g; return str.match(exp) != null; } @@ -272,6 +281,28 @@ export class Identifier { let exp = /swh:1:snp:[0-9a-f]{40}/g; return str.match(exp) != null; } + + public static isValidRor(str: string): boolean { + let exp = /0[a-z|0-9]{6}[0-9]{2}\b/g; + return str.match(exp) != null; + } + + public static isValidIsni(str: string): boolean { + let exp = /^[0]{7}[0-9]{8}[0-9X]$/g; + return str.match(exp) != null; + } + + public static isValidWikidata(str: string): boolean { + let exp = /^Q\d+$/g; + return str.match(exp) != null; + } + + public static isValidFundRef(str: string): boolean { + // let exp = /aaa/g; + let exp = /^[1-9]\d+$/g; + return str.match(exp) != null; + } + } export class StringUtils { -- 2.17.1 From 18791ec9d22d3f30dd895e2e090d154b9e7b75fb Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 2 Apr 2024 13:33:23 +0300 Subject: [PATCH 04/64] [develop | DONE | ADDED]: searchFields.base.ts: Added "pid" field in ORGANIZATION_ADVANCED_FIELDS. --- utils/properties/searchFields.base.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/properties/searchFields.base.ts b/utils/properties/searchFields.base.ts index 98c6a020..1813b1a2 100644 --- a/utils/properties/searchFields.base.ts +++ b/utils/properties/searchFields.base.ts @@ -798,7 +798,7 @@ export class SearchFieldsBase { //ORGANIZATION public ORGANIZATION_REFINE_FIELDS: string[] = ["country"] - public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "country"]; + public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "country", "pid"]; public ORGANIZATION_FIELDS: { [key: string]: FieldDetails } = { ["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null}, @@ -826,6 +826,7 @@ export class SearchFieldsBase { equalityOperator: " exact ", filterType: "checkbox" }, + ["pid"]: {name: "PID", type: "keyword", param: "pid", operator: "pd", equalityOperator: " exact ", filterType: null} }; // public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"]; // public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"]; -- 2.17.1 From 07569f24e16f1818742c41aacd86a6a76ac920af Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 3 Apr 2024 16:16:09 +0300 Subject: [PATCH 05/64] [develop | DONE | FIXED]: resultLanding.component.html & searchResult.component.ts: Added checks for ORCID also for properties.dashboard == "irish". --- landingPages/result/resultLanding.component.html | 6 ++++-- searchPages/searchUtils/searchResult.component.ts | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/landingPages/result/resultLanding.component.html b/landingPages/result/resultLanding.component.html index 3a2de7e2..d99ba7b3 100644 --- a/landingPages/result/resultLanding.component.html +++ b/landingPages/result/resultLanding.component.html @@ -79,7 +79,8 @@ [type]="resultLandingInfo.resultType" [result]="resultLandingInfo" [id]="resultLandingInfo.objIdentifier"> -
@@ -544,7 +545,8 @@

- +
0 && (this.type == "result" || this.type == "publication" || this.type == "dataset" || this.type == "software" || this.type == "other") ) { -- 2.17.1 From dcfc6b0b6a288d5f944efb63f51d8e6d11e5df76 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 4 Apr 2024 16:10:08 +0300 Subject: [PATCH 06/64] [develop | DONE | CHANGED]: searchFields.base.ts: Replace in ORGANIZATION_REFINE_FIELDS and ORGANIZATION_ADVANCED_FIELDS field "country" with "countrynojurisdiction". --- utils/properties/searchFields.base.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/properties/searchFields.base.ts b/utils/properties/searchFields.base.ts index 1813b1a2..a029a42e 100644 --- a/utils/properties/searchFields.base.ts +++ b/utils/properties/searchFields.base.ts @@ -797,8 +797,8 @@ export class SearchFieldsBase { //ORGANIZATION - public ORGANIZATION_REFINE_FIELDS: string[] = ["country"] - public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "country", "pid"]; + public ORGANIZATION_REFINE_FIELDS: string[] = ["countrynojurisdiction"] + public ORGANIZATION_ADVANCED_FIELDS: string[] = ["q", "organizationlegalname", "organizationlegalshortname", "countrynojurisdiction", "pid"]; public ORGANIZATION_FIELDS: { [key: string]: FieldDetails } = { ["q"]: {name: "Any field", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null}, @@ -818,7 +818,7 @@ export class SearchFieldsBase { equalityOperator: "=", filterType: null }, - ["country"]: { + ["countrynojurisdiction"]: { name: "Country", type: "vocabulary", param: "country", @@ -962,7 +962,7 @@ export class SearchFieldsBase { return "and"; } else if (fieldId == "instancetypename" || fieldId == "eoscdatasourcetype" || fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages" - || fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "datasourceodcontenttypes" + || fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "countrynojurisdiction" || fieldId == "datasourceodcontenttypes" || fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") { return "or"; } -- 2.17.1 From c351349f8ee3a130c56dc72b17159f07460c108e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 4 Apr 2024 17:13:56 +0300 Subject: [PATCH 07/64] [develop | DONE | FIXED] newSearchPage.component.html: Added checks, not to show "Filters" column in the search pages, when there are no filters. --- searchPages/searchUtils/newSearchPage.component.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index f9143437..ab005f85 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -288,7 +288,9 @@
-
0) || (staticFilters && staticFilters.length > 0) + || (rangeFilters && rangeFilters.length > 0) || (filters && filters.length > 0))) + && (results.length > 0 || (searchUtils.refineStatus == errorCodes.LOADING && searchUtils.status != errorCodes.LOADING) || (!hideFilters && (existingFiltersWithValues > 0 || (selectedRangeFilters + selectedFilters + selectedTypesNum) > 0))) " class="uk-width-1-4@m search-filters"> -- 2.17.1 From d63092cd9e48b10d130eb52fccfad945e9d785ba Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 5 Apr 2024 10:57:39 +0300 Subject: [PATCH 08/64] [new-order | DONE]: Add new move indicator method when an indicator moved to another section --- monitor-admin/topic/indicators.component.html | 14 ---- monitor-admin/topic/indicators.component.ts | 67 +++++++++++-------- monitor/services/stakeholder.service.ts | 31 +++++---- 3 files changed, 57 insertions(+), 55 deletions(-) diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html index b9bce2df..1f68e246 100644 --- a/monitor-admin/topic/indicators.component.html +++ b/monitor-admin/topic/indicators.component.html @@ -236,13 +236,6 @@
-
-
- There are schema enhancements that can be applied in this query.Apply - now -
-
@@ -373,13 +366,6 @@
-
-
- There are schema enhancements that can be applied in this query. Apply - now -
-
= new BehaviorSubject(null); /** Caches */ public safeUrls: Map = new Map([]); public numberResponses: Map = new Map(); @@ -94,8 +96,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple public sectionTypeToDelete: string; public sectionChildrenActionOnDelete: string; public indicatorChildrenActionOnDelete: string; - urlParameterizedMessage = null; - showCheckForSchemaEnhancements: boolean = false; + public urlParameterizedMessage = null; private notification: Notification; @ViewChild('editNumberNotify', {static: true}) editNumberNotify: NotifyFormComponent; @ViewChild('editChartNotify', {static: true}) editChartNotify: NotifyFormComponent; @@ -124,7 +125,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple private notificationService: NotificationService, private fb: UntypedFormBuilder, protected _router: Router, - private cdr: ChangeDetectorRef, private sanitizer: DomSanitizer) { super() this.filesToUpload = []; @@ -186,7 +186,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } }); if (document !== undefined) { - let callback = (list, type: IndicatorType, action: 'moved' | 'added' | 'removed'): void => { + let callback = (list): string[] => { let items: HTMLCollection = list.current.children; let reordered = []; for (let i = 0; i < items.length; i++) { @@ -194,12 +194,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple reordered.push(items.item(i).id); } } - let reorder: Reorder = { - action: action, - target: list.detail[1].id, - ids: reordered - } - this.reorderIndicators(list.current.id.toString().split('-')[1], type, reorder); + return reordered; }; this.numbers.forEach((section) => { this.subscriptions.push(UIkit.util.on(document, 'start', '#number-' + section._id, (): void => { @@ -209,24 +204,32 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.dragging = false; })); this.subscriptions.push(UIkit.util.on(document, 'moved', '#number-' + section._id, (list): void => { - callback(list, "number", 'moved'); + this.reorderIndicators(section._id, 'number', callback(list)); })); this.subscriptions.push(UIkit.util.on(document, 'added', '#number-' + section._id, (list): void => { - callback(list, "number", 'added'); + this.to.next({id: section._id, indicators: callback(list)}); })); this.subscriptions.push(UIkit.util.on(document, 'removed', '#number-' + section._id, (list): void => { - callback(list, "number", 'removed'); + let sub = this.to.asObservable().subscribe(to => { + if(to) { + let from: SectionInfo = {id: section._id, indicators: callback(list)}; + this.moveIndicator({target: list.detail[1].id, from: from, to: to}); + setTimeout(() => { + sub.unsubscribe(); + }) + } + }) })); }); this.charts.forEach((section) => { this.subscriptions.push(UIkit.util.on(document, 'moved', '#chart-' + section._id, (list): void => { - callback(list, "chart", 'moved'); + this.reorderIndicators(section._id, 'chart', callback(list)); })); this.subscriptions.push(UIkit.util.on(document, 'added', '#chart-' + section._id, (list): void => { - callback(list, "chart", 'added'); + //callback(list, "chart", 'added'); })); this.subscriptions.push(UIkit.util.on(document, 'removed', '#chart-' + section._id, (list): void => { - callback(list, "chart", 'removed'); + // callback(list, "chart", 'removed'); })); }); } @@ -496,14 +499,12 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple let index = this.numberIndicatorPaths.length - 1; if (this.numberIndicatorPaths.at(index).get('url').valid) { this.validateJsonPath(index); - this.checkForSchemaEnhancements(this.numberIndicatorPaths.at(index).get('url').value); } if (this.indicator.defaultId === null) { this.subscriptions.push(this.numberIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => { this.numberIndicatorPaths.at(index).get('result').setValue(null); if (this.numberIndicatorPaths.at(index).get('url').valid) { let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(value), value, this.stakeholder, this.numberIndicatorPaths.at(index).get('jsonPath').value, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(value))); - this.checkForSchemaEnhancements(this.numberIndicatorPaths.at(index).get('url').value); if (this.indicator.indicatorPaths[index]) { this.indicator.indicatorPaths[index] = indicatorPath; } else { @@ -559,11 +560,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple if (disableUrl) { this.chartIndicatorPaths.at(index).get('url').disable(); } else { - this.checkForSchemaEnhancements(this.chartIndicatorPaths.at(index).get('url').value); this.urlSubscriptions.push(this.chartIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => { if (this.chartIndicatorPaths.at(index).get('url').valid) { let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(value), value, this.chartIndicatorPaths.at(index).get('type').value, this.stakeholder); - this.checkForSchemaEnhancements(this.chartIndicatorPaths.at(index).get('url').value); (this.chartIndicatorPaths.at(index) as UntypedFormGroup).get('type').setValue(indicatorPath.type); (this.chartIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath)); if (!this.indicator.indicatorPaths[index]) { @@ -889,7 +888,23 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.loading = false; } - reorderIndicators(sectionId: string, type: IndicatorType, reorder: Reorder) { + moveIndicator(moveIndicator: MoveIndicator) { + this.editing = true; + let path = [ + this.stakeholder._id, + this.stakeholder.topics[this.topicIndex]._id, + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex]._id, + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id + ]; + this.subscriptions.push(this.stakeholderService.moveIndicator(this.properties.monitorServiceAPIURL, path, moveIndicator).subscribe(subCategory => { + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex] = subCategory; + this.setCharts(); + this.setNumbers(); + this.editing = false; + })); + } + + reorderIndicators(sectionId: string, type: IndicatorType, indicators: string[]) { this.editing = true; let path = [ this.stakeholder._id, @@ -898,7 +913,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]._id, sectionId ]; - this.subscriptions.push(this.stakeholderService.reorderIndicators(this.properties.monitorServiceAPIURL, path, reorder, type).subscribe(indicators => { + this.subscriptions.push(this.stakeholderService.reorderIndicators(this.properties.monitorServiceAPIURL, path, indicators).subscribe(indicators => { if (type === 'chart') { this.charts.find(section => section._id === sectionId).indicators = indicators; this.setCharts(); @@ -1191,10 +1206,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple })); } - private checkForSchemaEnhancements(url: string) { - this.showCheckForSchemaEnhancements = this.isAdministrator && url && !this.properties.useOldStatisticsSchema && this.indicatorUtils.checkForSchemaEnhancements(url) && this.properties.dashboard != 'irish'; - } - migrateFromOldImportJsonFile(charts) { // first section contains numbers // second contains charts diff --git a/monitor/services/stakeholder.service.ts b/monitor/services/stakeholder.service.ts index 3f0f3a11..d8b8bf30 100644 --- a/monitor/services/stakeholder.service.ts +++ b/monitor/services/stakeholder.service.ts @@ -1,16 +1,21 @@ import {Injectable} from "@angular/core"; import {HttpClient} from "@angular/common/http"; import {BehaviorSubject, from, Observable, Subscriber} from "rxjs"; -import {Indicator, Section, Stakeholder, StakeholderInfo, Visibility} from "../entities/stakeholder"; +import {Indicator, Section, Stakeholder, StakeholderInfo, SubCategory, Visibility} from "../entities/stakeholder"; import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {map} from "rxjs/operators"; import {properties} from "../../../../environments/environment"; import {CustomOptions} from "../../services/servicesUtils/customOptions.class"; -export interface Reorder { - action: 'moved' | 'added' | 'removed', - target: string, - ids: string[]; +export interface SectionInfo { + id: string; + indicators: string[]; +} + +export interface MoveIndicator { + target: string; + from: SectionInfo; + to: SectionInfo; } @Injectable({ @@ -128,7 +133,6 @@ export class StakeholderService { if (element.alias && element.alias.startsWith('/')) { element.alias = element.alias.slice(1); } - path = HelperFunctions.encodeArray(path); return this.http.post(url + ((path.length > 0) ? '/' : '') + path.join('/') + '/save', element, CustomOptions.registryOptions()).pipe(map(element => { if (path.length === 0) { @@ -140,7 +144,6 @@ export class StakeholderService { } saveBulkElements(url: string, indicators, path: string[] = []): Observable { - path = HelperFunctions.encodeArray(path); return this.http.post(url + ((path.length > 0) ? '/' : '') + path.join('/') + '/save-bulk', indicators, CustomOptions.registryOptions()).pipe(map(element => { if (path.length === 0) { @@ -152,7 +155,6 @@ export class StakeholderService { } saveSection(url: string, element: any, path: string[] = [], index: number = -1): Observable
{ - path = HelperFunctions.encodeArray(path); return this.http.post
(url + ((path.length > 0) ? '/' : '') + path.join('/') + '/save/' + index, element, CustomOptions.registryOptions()).pipe(map(element => { return HelperFunctions.copy(element); @@ -160,7 +162,6 @@ export class StakeholderService { } deleteElement(url: string, path: string[], childrenAction: string = null): Observable { - path = HelperFunctions.encodeArray(path); let params: string = ""; if (childrenAction) { params = "?children=" + childrenAction; @@ -169,17 +170,21 @@ export class StakeholderService { } reorderElements(url: string, path: string[], ids: string[]): Observable { - path = HelperFunctions.encodeArray(path); return this.http.post(url + '/' + path.join('/') + '/reorder', ids, CustomOptions.registryOptions()); } - reorderIndicators(url: string, path: string[], reorder: Reorder, type: string = 'chart'): Observable { - path = HelperFunctions.encodeArray(path); - return this.http.post(url + '/' + path.join('/') + '/' + type + '/reorder', reorder, CustomOptions.registryOptions()).pipe(map(indicators => { + reorderIndicators(url: string, path: string[], indicators: string[]): Observable { + return this.http.post(url + '/' + path.join('/') + '/reorder', indicators, CustomOptions.registryOptions()).pipe(map(indicators => { return HelperFunctions.copy(indicators); })); } + moveIndicator(url: string, path: string[], moveIndicator: MoveIndicator): Observable { + return this.http.post(url + '/' + path.join('/') + '/moveIndicator', moveIndicator, CustomOptions.registryOptions()).pipe(map(subCategory => { + return HelperFunctions.copy(subCategory); + })); + } + getStakeholderAsObservable(): Observable { return this.stakeholderSubject.asObservable(); } -- 2.17.1 From dc1679c56534a505836bc505c75adc3c7ac77fda Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 5 Apr 2024 11:09:16 +0300 Subject: [PATCH 09/64] [develop | DONE | CHANGED]: newSearchPage.component.html: Restored number of results and keyword display & added uk-text-capitalize on selected filter labels. --- .../searchUtils/newSearchPage.component.html | 75 ++++++++++++------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index ab005f85..d59cb0b1 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -1,11 +1,11 @@

-
+
  • - + {{customFilter.valueName}}
  • @@ -15,7 +15,7 @@
  • - + {{type.name}}
- + +
+ +
+ + {{searchUtils.totalResults|number}} + {{type}} + + for + {{searchTerm}} + + + ({{advancedSearchTerms}} rule{{advancedSearchTerms == 1 ? '' : 's'}} applied) + + + + {{oldTotalResults|number}} + {{type}}, page + {{searchUtils.page | number}} + of {{(totalPages(oldTotalResults)|number)}} + +
-
+
+ *ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'" + [isDisabled]="disabled" + [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"> - Data dump + Zenodo dumpData dump
- -
- -
- -
-
+ +
+ class="uk-grid uk-flex-middle uk-child-width-1-1 uk-child-width-1-2@m" uk-grid>
+ class="uk-margin-small-left uk-flex uk-flex-middle" [class.uk-flex-center]="mobile" [class.uk-margin-medium-top]="mobile"> + *ngIf="( entityType !='community' && entityType != 'stakeholder') && usedBy == 'search'" + [isDisabled]="disabled" + [type]="csvPath" [csvParams]="csvParams" [totalResults]="searchUtils.totalResults"> - Data dump + Zenodo dumpData dump
+ +
+ +
+ +
+

For more results please try a new, more specific query

-- 2.17.1 From b71bdfa559a84623bde09f987edc9054a167e588 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 5 Apr 2024 20:13:05 +0300 Subject: [PATCH 10/64] [new-reorder]: Add multi charts in admin indicators (works now only for charts in UI). Deprecated transition-group disable/enable method. --- dashboard/menu/menu.component.ts | 2 - monitor-admin/topic/indicators.component.html | 1025 ++++++++++------- monitor-admin/topic/indicators.component.ts | 130 ++- monitor-admin/topic/topic.component.ts | 30 +- monitor-admin/topic/topic.module.ts | 3 +- monitor-admin/utils/indicator-utils.ts | 10 + monitor/entities/stakeholder.ts | 1 + ...or-indicator-stakeholder-base.component.ts | 28 +- .../transition-group.component.ts | 16 +- 9 files changed, 758 insertions(+), 487 deletions(-) diff --git a/dashboard/menu/menu.component.ts b/dashboard/menu/menu.component.ts index d756a77f..9f89224b 100644 --- a/dashboard/menu/menu.component.ts +++ b/dashboard/menu/menu.component.ts @@ -372,10 +372,8 @@ export class MenuComponent implements OnInit { } public valueChange() { - this.elements.disable(); this.cdr.detectChanges(); this.elements.init(); - this.elements.enable(); } public get displayMenuItems() { diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html index 1f68e246..2b0a57c3 100644 --- a/monitor-admin/topic/indicators.component.html +++ b/monitor-admin/topic/indicators.component.html @@ -1,456 +1,657 @@
-
-
Number Indicators
-
-
-
-
- -
-
-
-
-
- -
-
-
- - - - -
- +
+ +
+ -
-
{{indicator.name}}
-
- - -- -
-
- -
- +
+ +
-
-
- -
-
-
-
Chart Indicators
-
-
-
-
- -
-
-
-
-
- -
-
-
- - - - -
- +
+
-
-
-
- {{indicator.name}} +
+
+
+
+
+ Create a custom indicator +
+
+ Use our advance tool to create a custom Indicator that suit the needs of your + funding + KPI's. +
+
+ +
+
+
+
- -
- -
-
- -
-
-
-
-
-
-
-
-
-
- Create a custom indicator -
-
- Use our advance tool to create a custom Indicator that suit the needs of your funding - KPI's. -
-
- -
-
-
-
+
+ +
-
-
- -
-
+ [large]="true" classTitle="uk-background-primary uk-light" + (alertOutput)="saveIndicator()" + [okDisabled]="numberIndicatorFb && (numberIndicatorFb.invalid || numberIndicatorFb.pristine)">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{urlParameterizedMessage}}
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
- JSON Path -
-
-
- This JSON path is not valid or the result has not been calculated yet. - Please press calculate on box below to see the result. -
-
-
-
-
- - - - - - -
-
- -
-
+
-
- +
+
+
+
+
+
+ +
+
+
+
+
+
+
{{ urlParameterizedMessage }}
+
+
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ JSON Path +
+
+
+ This JSON path is not valid or the result has not been calculated yet. + Please press calculate on box below to see the result. +
+
+
+
+
+ + + + + + +
+
+ +
+
+
+ +
+
-
-
+
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{urlParameterizedMessage}}
+ [okDisabled]="chartIndicatorFb && (chartIndicatorFb.invalid || chartIndicatorFb.pristine)"> +
+ +
+
+
+
+
-
- +
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
- +
-
-
- -
-
- + +
+
+ +
+ You are about to delete + "{{ indicator.name ? indicator.name : (indicator.indicatorPaths[0]?.parameters?.title ? indicator.indicatorPaths[0].parameters.title : '') }} + " indicator permanently. +
+ Indicators of all profiles based on this default indicator, will be deleted as well. +
+ Are you sure you want to proceed? +
- You are about to delete - "{{indicator.name ? indicator.name : (indicator.indicatorPaths[0]?.parameters?.title?indicator.indicatorPaths[0].parameters.title:'')}}" indicator permanently. -
- Indicators of all profiles based on this default indicator, will be deleted as well. -
- Are you sure you want to proceed? -
-
- -
-
- + +
+
+ +
+ You are about to delete this section and its indicators permanently. +
+ Sections of all profiles based on this default section and their contents, will be deleted as well. +
+ Are you sure you want to proceed?
- You are about to delete this section and its indicators permanently. -
- Sections of all profiles based on this default section and their contents, will be deleted as well. -
- Are you sure you want to proceed? -
-
-
- +
+
+ +
-
diff --git a/monitor-admin/topic/indicators.component.ts b/monitor-admin/topic/indicators.component.ts index 62883ae6..42e85ddc 100644 --- a/monitor-admin/topic/indicators.component.ts +++ b/monitor-admin/topic/indicators.component.ts @@ -20,7 +20,7 @@ import { Visibility } from "../../monitor/entities/stakeholder"; import { - AbstractControl, + AbstractControl, FormArray, FormGroup, UntypedFormArray, UntypedFormBuilder, UntypedFormControl, @@ -45,6 +45,7 @@ import {NotificationHandler} from "../../utils/notification-handler"; import {IndicatorStakeholderBaseComponent} from "../utils/stakeholder-base.component"; import {properties} from "../../../../environments/environment"; import {StatsProfilesService} from "../utils/services/stats-profiles.service"; +import {TransitionGroupComponent} from "../../utils/transition-group/transition-group.component"; declare var UIkit; declare var copy; @@ -101,6 +102,8 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple @ViewChild('editNumberNotify', {static: true}) editNumberNotify: NotifyFormComponent; @ViewChild('editChartNotify', {static: true}) editChartNotify: NotifyFormComponent; @ViewChild('deleteNotify', {static: true}) deleteNotify: NotifyFormComponent; + /* Transition Groups */ + @ViewChild('transitionGroup') transitionGroup: TransitionGroupComponent; public isFullscreen: boolean = false; @@ -266,7 +269,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple setNumbers() { this.numberSections = this.fb.array([]); this.numberResults.clear(); - let urls: Map = new Map(); + let urls: Map = new Map(); this.numbers.forEach((section, i) => { this.numberSections.push(this.fb.group({ _id: this.fb.control(section._id), @@ -278,11 +281,13 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple indicators: this.fb.control(section.indicators) })); section.indicators.forEach((number, j) => { - let url = this.indicatorUtils.getFullUrl(this.stakeholder, number.indicatorPaths[0]); - const pair = JSON.stringify([number.indicatorPaths[0].source, url]); - const indexes = urls.get(pair) ? urls.get(pair) : []; - indexes.push([i, j]); - urls.set(pair, indexes); + number.indicatorPaths.forEach((indicatorPath, k) => { + let url = this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath); + const pair = JSON.stringify([indicatorPath.source, url]); + const indexes = urls.get(pair) ? urls.get(pair) : []; + indexes.push([i, j, k]); + urls.set(pair, indexes); + }); }); }); this.numberSubscription.forEach(value => { @@ -304,10 +309,10 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple }); } - private calculateResults(response: any, indexes: [number, number][]) { - indexes.forEach(([i, j]) => { + private calculateResults(response: any, indexes: [number, number, number][]) { + indexes.forEach(([i, j, k]) => { let result = JSON.parse(JSON.stringify(response)); - this.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => { + this.numbers[i].indicators[j].indicatorPaths[k].jsonPath.forEach(jsonPath => { if (result) { result = result[jsonPath]; } @@ -320,7 +325,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } else { result = 0; } - this.numberResults.set(i + '-' + j, result); + this.numberResults.set(i + '-' + j + '-' + k, result); }); } @@ -367,6 +372,14 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple return this.chartIndicatorFb.get('indicatorPaths') as UntypedFormArray; } + public getActiveIndicatorPath(indicator: Indicator) { + if(indicator.activePath) { + return indicator.indicatorPaths[indicator.activePath]; + } else { + return indicator.indicatorPaths[0]; + } + } + public getNumberClassBySize(size: IndicatorSize) { if (size === 'small') { return 'uk-width-medium@m uk-width-1-1'; @@ -579,6 +592,65 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } } + public removeNumberIndicatorPath(index: number) { + this.numberIndicatorPaths.removeAt(index); + this.indicator.indicatorPaths.splice(index, 1); + this.transitionGroup.init(); + if(this.indicator.activePath === index) { + this.activeNumberIndicatorPath(Math.max(0, index - 1)); + } else if(this.indicator.activePath > index) { + this.activeNumberIndicatorPath(this.indicator.activePath - 1); + } + this.numberIndicatorFb.markAsDirty(); + } + + public removeChartIndicatorPath(index: number) { + this.chartIndicatorPaths.removeAt(index); + this.indicator.indicatorPaths.splice(index, 1); + this.transitionGroup.init(); + if(this.indicator.activePath === index) { + this.activeChartIndicatorPath(Math.max(0, index - 1)); + } else if(this.indicator.activePath > index) { + this.activeChartIndicatorPath(this.indicator.activePath - 1); + } + this.chartIndicatorFb.markAsDirty(); + } + + public moveIndicatorPath(form: FormGroup, + indicatorPaths: FormArray, index: number, + newIndex: number = index - 1) { + this.transitionGroup.init(); + let a = indicatorPaths.at(index); + let b = indicatorPaths.at(newIndex); + indicatorPaths.setControl(index , b); + indicatorPaths.setControl(newIndex , a); + HelperFunctions.swap(this.indicator.indicatorPaths, index , newIndex); + if(this.indicator.activePath === index) { + this.indicator.activePath = newIndex; + } else if(this.indicator.activePath === newIndex) { + this.indicator.activePath = index; + } + form.markAsDirty(); + } + + public activeNumberIndicatorPath(index: number) { + let paths = this.numberIndicatorPaths; + if(index == paths.length) { + this.addNumberIndicatorPath(); + this.transitionGroup.init(); + } + this.indicator.activePath = index; + } + + public activeChartIndicatorPath(index: number) { + let paths = this.chartIndicatorPaths; + if(index == paths.length) { + this.addChartIndicatorPath(); + this.transitionGroup.init(); + } + this.indicator.activePath = index; + } + private getJsonPathAsFormArray(indicatorPath: IndicatorPath): UntypedFormArray { let jsonPath = this.fb.array([]); if (indicatorPath.jsonPath) { @@ -1273,25 +1345,29 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple if (chart.type == "chart") { indicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(chart.url), chart.url, chart.type, stakeholder); - for (let section of this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].charts) { - for (let chart of section.indicators) { - if (JSON.stringify(chart.indicatorPaths[0].chartObject) == JSON.stringify(indicatorPath.chartObject)) { - duplicates++; - exists = true; - } - } - } + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].charts.forEach((section: Section) => { + section.indicators.forEach(indicator => { + indicator.indicatorPaths.forEach(path => { + if (JSON.stringify(path.chartObject) == JSON.stringify(indicatorPath.chartObject)) { + duplicates++; + exists = true; + } + }); + }); + }); } else if (chart.type == "number") { indicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(chart.url), chart.url, stakeholder, chart.jsonPath, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(chart.url))); - for (let section of this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].numbers) { - for (let chart of section.indicators) { - if (JSON.stringify(chart.indicatorPaths[0].chartObject) == JSON.stringify(indicatorPath.chartObject)) { - duplicates++; - exists = true; - } - } - } + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].numbers.forEach((section: Section) => { + section.indicators.forEach(indicator => { + indicator.indicatorPaths.forEach(path => { + if (JSON.stringify(path.chartObject) == JSON.stringify(indicatorPath.chartObject)) { + duplicates++; + exists = true; + } + }); + }); + }); } if (!exists) { let i: Indicator = new Indicator(chart.name, chart.description, chart.additionalDescription, chart.type, chart.width, chart.height, this.showVisibility?"RESTRICTED":this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities), [indicatorPath]); diff --git a/monitor-admin/topic/topic.component.ts b/monitor-admin/topic/topic.component.ts index b178eb46..40d128d8 100644 --- a/monitor-admin/topic/topic.component.ts +++ b/monitor-admin/topic/topic.component.ts @@ -242,30 +242,18 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, } topicChanged(callback: Function, save: boolean = false) { - if(this.topics && save) { - this.topics.disable(); - } - if(this.categories) { - this.categories.disable(); - } - if(this.subCategories) { - this.subCategories.disable(); - } if(callback) { callback(); } this.cdr.detectChanges(); if(this.topics && save) { this.topics.init(); - this.topics.enable(); } if(this.categories) { this.categories.init(); - this.categories.enable(); } if(this.subCategories) { this.subCategories.init(); - this.subCategories.enable(); } } @@ -359,6 +347,8 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, this.stakeholder.topics.splice(this.index, 1); if(this.topicIndex === this.index) { this.chooseTopic(Math.max(0, this.index - 1)); + } else if(this.topicIndex > this.index) { + this.chooseTopic(this.topicIndex - 1); } }, true); }; @@ -388,23 +378,15 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, } categoryChanged(callback: Function, save: boolean = false) { - if(this.categories && save) { - this.categories.disable(); - } - if(this.subCategories) { - this.subCategories.disable(); - } if(callback) { callback(); } this.cdr.detectChanges(); if(this.categories && save) { this.categories.init(); - this.categories.enable(); } if(this.subCategories) { this.subCategories.init(); - this.subCategories.enable(); } } @@ -500,6 +482,8 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, this.stakeholder.topics[this.topicIndex].categories.splice(this.index, 1); if(this.categoryIndex === this.index) { this.chooseCategory(Math.max(0, this.index - 1)); + } else if(this.categoryIndex > this.index) { + this.chooseCategory(this.categoryIndex - 1); } }, true); }; @@ -528,16 +512,12 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, } subCategoryChanged(callback: Function, save: boolean = false) { - if(this.subCategories && save) { - this.subCategories.disable(); - } if(callback) { callback(); } this.cdr.detectChanges(); if(this.subCategories && save) { this.subCategories.init(); - this.subCategories.enable(); } } @@ -640,6 +620,8 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories.splice(this.index, 1); if(this.subCategoryIndex === this.index) { this.chooseSubcategory(Math.max(0, this.index - 1)); + } else if(this.subCategoryIndex > this.index) { + this.chooseSubcategory(this.subCategoryIndex - 1); } }, true); }; diff --git a/monitor-admin/topic/topic.module.ts b/monitor-admin/topic/topic.module.ts index 71e9b9d9..4c887228 100644 --- a/monitor-admin/topic/topic.module.ts +++ b/monitor-admin/topic/topic.module.ts @@ -20,11 +20,12 @@ import {TransitionGroupModule} from "../../utils/transition-group/transition-gro import {NumberRoundModule} from "../../utils/pipes/number-round.module"; import {SideBarModule} from "../../dashboard/sharedComponents/sidebar/sideBar.module"; import {SidebarMobileToggleModule} from "../../dashboard/sharedComponents/sidebar/sidebar-mobile-toggle/sidebar-mobile-toggle.module"; +import {SliderTabsModule} from "../../sharedComponents/tabs/slider-tabs.module"; @NgModule({ imports: [ CommonModule, TopicRoutingModule, ClickModule, RouterModule, FormsModule, AlertModalModule, - ReactiveFormsModule, InputModule, IconsModule, PageContentModule, LoadingModule, NotifyFormModule, LogoUrlPipeModule, TransitionGroupModule, NumberRoundModule, SideBarModule, SidebarMobileToggleModule + ReactiveFormsModule, InputModule, IconsModule, PageContentModule, LoadingModule, NotifyFormModule, LogoUrlPipeModule, TransitionGroupModule, NumberRoundModule, SideBarModule, SidebarMobileToggleModule, SliderTabsModule ], declarations: [ TopicComponent, IndicatorsComponent diff --git a/monitor-admin/utils/indicator-utils.ts b/monitor-admin/utils/indicator-utils.ts index 9360c228..832b4894 100644 --- a/monitor-admin/utils/indicator-utils.ts +++ b/monitor-admin/utils/indicator-utils.ts @@ -55,6 +55,8 @@ export class StakeholderConfiguration { {icon: 'incognito', value: "PRIVATE", label: 'Private'}, ]; public static CACHE_INDICATORS: boolean = true; + public static NUMBER_MULTI_INDICATOR_PATHS = false; + public static CHART_MULTI_INDICATOR_PATHS = true; } export class StakeholderUtils { @@ -82,6 +84,14 @@ export class StakeholderUtils { return StakeholderConfiguration.CACHE_INDICATORS; } + get hasMultiNumberIndicatorPaths() { + return StakeholderConfiguration.NUMBER_MULTI_INDICATOR_PATHS; + } + + get hasMultiChartIndicatorPaths() { + return StakeholderConfiguration.CHART_MULTI_INDICATOR_PATHS; + } + visibilityIcon: Map = new Map(this.visibilities.map(option => [option.value, option.icon])); defaultValue(options: Option[]) { diff --git a/monitor/entities/stakeholder.ts b/monitor/entities/stakeholder.ts index 49c8e755..a33506ac 100644 --- a/monitor/entities/stakeholder.ts +++ b/monitor/entities/stakeholder.ts @@ -183,6 +183,7 @@ export class Indicator { visibility: Visibility; defaultId: string; indicatorPaths: IndicatorPath[]; + activePath: number = 0; overlay: Overlay = false; constructor(name: string, description: string, additionalDescription:string, type: IndicatorType, width: IndicatorSize,height: IndicatorSize, visibility: Visibility, indicatorPaths: IndicatorPath[], defaultId: string = null) { diff --git a/monitor/monitor-indicator-stakeholder-base.component.ts b/monitor/monitor-indicator-stakeholder-base.component.ts index 4573dee4..8838d202 100644 --- a/monitor/monitor-indicator-stakeholder-base.component.ts +++ b/monitor/monitor-indicator-stakeholder-base.component.ts @@ -214,15 +214,17 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator (this.periodFilter.selectedFromValue && this.periodFilter.selectedToValue ? " - " : "") + (this.periodFilter.selectedToValue ? this.periodFilter.selectedToValue : "")) : ""); //clear numbers when filters change this.numberResults.clear(); - let urls: Map = new Map(); + let urls: Map = new Map(); this.activeSubCategory.numbers.forEach((section, i) => { section.indicators.forEach((number, j) => { if (this.hasPermission(number.visibility)) { - let url = this.getFullUrl(number.indicatorPaths[0]); - const pair = JSON.stringify([number.indicatorPaths[0].source, url]); - const indexes = urls.get(pair) ? urls.get(pair) : []; - indexes.push([i, j]); - urls.set(pair, indexes); + number.indicatorPaths.forEach((indicatorPath, k) => { + let url = this.getFullUrl(indicatorPath); + const pair = JSON.stringify([indicatorPath.source, url]); + const indexes = urls.get(pair) ? urls.get(pair) : []; + indexes.push([i, j, k]); + urls.set(pair, indexes); + }) } }); }); @@ -231,10 +233,10 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator let activeSubcategory = this.activeSubCategory._id; this.subscriptions.push(this.statisticsService.getNumbers(this.indicatorUtils.getSourceType(pair[0]), pair[1]).subscribe(response => { if(activeSubcategory === this.activeSubCategory._id) { - indexes.forEach(([i, j]) => { + indexes.forEach(([i, j, k]) => { if( this.activeSubCategory?.numbers[i]?.indicators[j]) { let result = JSON.parse(JSON.stringify(response)); - this.activeSubCategory.numbers[i].indicators[j].indicatorPaths[0].jsonPath.forEach(jsonPath => { + this.activeSubCategory.numbers[i].indicators[j].indicatorPaths[k].jsonPath.forEach(jsonPath => { if (result) { result = result[jsonPath]; } @@ -247,7 +249,7 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator } else { result = 0; } - this.numberResults.set(i + '-' + j, result); + this.numberResults.set(i + '-' + j + '-' + k, result); } }); } @@ -255,10 +257,10 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator }); this.activeSubCategory.charts.forEach((section, i) => { section.indicators.forEach((indicator, j) => { - if (indicator.indicatorPaths.length > 0) { - indicator.indicatorPaths[0].safeResourceUrl = this.getUrlByStakeHolder(indicator.indicatorPaths[0]); - this.chartsActiveType.set(i + '-' + j, indicator.indicatorPaths[0]); - } + indicator.indicatorPaths.forEach((indicatorPath, k) => { + indicator.indicatorPaths[k].safeResourceUrl = this.getUrlByStakeHolder(indicator.indicatorPaths[k]); + this.chartsActiveType.set(i + '-' + j + '-' + k, indicator.indicatorPaths[k]); + }); }); }); if (this.cdr && !(this.cdr as ViewRef).destroyed) { diff --git a/utils/transition-group/transition-group.component.ts b/utils/transition-group/transition-group.component.ts index 53530868..8cea910d 100644 --- a/utils/transition-group/transition-group.component.ts +++ b/utils/transition-group/transition-group.component.ts @@ -1,6 +1,6 @@ import {TransitionGroupItemDirective} from "./transition-group-item.directive"; import { - AfterViewInit, + AfterViewInit, ChangeDetectorRef, Component, ContentChildren, ElementRef, Input, @@ -29,15 +29,14 @@ export class TransitionGroupComponent implements AfterViewInit, OnDestroy { @ContentChildren(TransitionGroupItemDirective) items: QueryList; @Input() public id: string; - private disabled: boolean = false; + public size: number; private subscription: Subscription; constructor(public element: ElementRef) {} ngAfterViewInit() { - this.init(); this.subscription = this.items.changes.subscribe(items => { - if(!this.disabled) { + if(items.length === this.size) { items.forEach(item => item.prevPos = item.newPos || item.prevPos); items.forEach(this.runCallback); this.refreshPosition('newPos'); @@ -80,6 +79,7 @@ export class TransitionGroupComponent implements AfterViewInit, OnDestroy { init() { this.refreshPosition('prevPos'); this.refreshPosition('newPos'); + this.size = this.items.length; } runCallback(item: TransitionGroupItemDirective) { @@ -126,17 +126,17 @@ export class TransitionGroupComponent implements AfterViewInit, OnDestroy { /** * Enable transition - * + * @deprecated * */ enable() { - this.disabled = false; + console.debug('Deprecated') } /** * Disable transition - * + * @deprecated * */ disable() { - this.disabled = true; + console.debug('Deprecated') } } -- 2.17.1 From e91830f2f8c1182c6e728f87a03af3a2932d816e Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 5 Apr 2024 20:31:29 +0300 Subject: [PATCH 11/64] [develop]: Monitor base component delete chartsActiveType --- .../monitor-indicator-stakeholder-base.component.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/monitor/monitor-indicator-stakeholder-base.component.ts b/monitor/monitor-indicator-stakeholder-base.component.ts index 8838d202..c6d388e3 100644 --- a/monitor/monitor-indicator-stakeholder-base.component.ts +++ b/monitor/monitor-indicator-stakeholder-base.component.ts @@ -53,7 +53,6 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator minYear = Dates.currentYear - 20; maxYear = Dates.currentYear; public numberResults: Map = new Map(); - public chartsActiveType: Map = new Map(); public clipboard; /** Services */ @@ -259,7 +258,6 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator section.indicators.forEach((indicator, j) => { indicator.indicatorPaths.forEach((indicatorPath, k) => { indicator.indicatorPaths[k].safeResourceUrl = this.getUrlByStakeHolder(indicator.indicatorPaths[k]); - this.chartsActiveType.set(i + '-' + j + '-' + k, indicator.indicatorPaths[k]); }); }); }); @@ -273,10 +271,12 @@ export abstract class MonitorIndicatorStakeholderBaseComponent extends Indicator this.indicatorUtils.getChartUrl(indicatorPath.source, this.getFullUrl(indicatorPath))); } - public setActiveChart(i: number, j: number, type: string) { - let activeChart = this.activeSubCategory.charts[i].indicators[j].indicatorPaths.filter(indicatorPath => indicatorPath.type === type)[0]; - activeChart.safeResourceUrl = this.getUrlByStakeHolder(activeChart); - this.chartsActiveType.set(i + '-' + j, activeChart); + public getActiveIndicatorPath(indicator: Indicator) { + if(indicator.activePath) { + return indicator.indicatorPaths[indicator.activePath]; + } else { + return indicator.indicatorPaths[0]; + } } public filter() { -- 2.17.1 From 4f10c5c5f4a42629ac4eb13f3a1e3977ab353b86 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Sat, 6 Apr 2024 03:10:51 +0300 Subject: [PATCH 12/64] [develop]: Align import/export indicators with multi indicator paths. --- monitor-admin/topic/indicators.component.html | 2 - monitor-admin/topic/indicators.component.ts | 306 +++++++++--------- 2 files changed, 158 insertions(+), 150 deletions(-) diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html index 2b0a57c3..69abb1dd 100644 --- a/monitor-admin/topic/indicators.component.html +++ b/monitor-admin/topic/indicators.component.html @@ -339,7 +339,6 @@
-
{{ urlParameterizedMessage }}
diff --git a/monitor-admin/topic/indicators.component.ts b/monitor-admin/topic/indicators.component.ts index 42e85ddc..9be745ae 100644 --- a/monitor-admin/topic/indicators.component.ts +++ b/monitor-admin/topic/indicators.component.ts @@ -97,7 +97,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple public sectionTypeToDelete: string; public sectionChildrenActionOnDelete: string; public indicatorChildrenActionOnDelete: string; - public urlParameterizedMessage = null; private notification: Notification; @ViewChild('editNumberNotify', {static: true}) editNumberNotify: NotifyFormComponent; @ViewChild('editChartNotify', {static: true}) editChartNotify: NotifyFormComponent; @@ -210,11 +209,11 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.reorderIndicators(section._id, 'number', callback(list)); })); this.subscriptions.push(UIkit.util.on(document, 'added', '#number-' + section._id, (list): void => { - this.to.next({id: section._id, indicators: callback(list)}); + this.to.next({id: section._id, indicators: callback(list)}); })); this.subscriptions.push(UIkit.util.on(document, 'removed', '#number-' + section._id, (list): void => { let sub = this.to.asObservable().subscribe(to => { - if(to) { + if (to) { let from: SectionInfo = {id: section._id, indicators: callback(list)}; this.moveIndicator({target: list.detail[1].id, from: from, to: to}); setTimeout(() => { @@ -232,7 +231,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple //callback(list, "chart", 'added'); })); this.subscriptions.push(UIkit.util.on(document, 'removed', '#chart-' + section._id, (list): void => { - // callback(list, "chart", 'removed'); + // callback(list, "chart", 'removed'); })); }); } @@ -331,8 +330,8 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple get charts(): Section[] { if (this.stakeholder.topics[this.topicIndex] && - this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] && - this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) { + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] && + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) { return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].charts; } else { return []; @@ -341,8 +340,8 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple get numbers(): Section[] { if (this.stakeholder.topics[this.topicIndex] && - this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] && - this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) { + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] && + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex]) { return this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex].numbers; } else { return []; @@ -359,9 +358,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple get canEdit() { return this.stakeholder && - this.stakeholder.topics[this.topicIndex] && - this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] && - this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex] && !this.loading; + this.stakeholder.topics[this.topicIndex] && + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex] && + this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex] && !this.loading; } public get numberIndicatorPaths(): UntypedFormArray { @@ -373,7 +372,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } public getActiveIndicatorPath(indicator: Indicator) { - if(indicator.activePath) { + if (indicator.activePath) { return indicator.indicatorPaths[indicator.activePath]; } else { return indicator.indicatorPaths[0]; @@ -476,7 +475,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } public getParameters(index: number, type: IndicatorType = 'chart'): UntypedFormArray { - if(type === 'chart') { + if (type === 'chart') { return this.chartIndicatorPaths.at(index).get('parameters') as UntypedFormArray; } else { return this.numberIndicatorPaths.at(index).get('parameters') as UntypedFormArray; @@ -489,7 +488,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple private getSecureUrlByStakeHolder(indicatorPath: IndicatorPath) { return this.sanitizer.bypassSecurityTrustResourceUrl( - this.indicatorUtils.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath))); + this.indicatorUtils.getChartUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath))); } private getUrlByStakeHolder(indicatorPath: IndicatorPath) { @@ -501,13 +500,13 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple jsonPath.push(this.fb.control('', Validators.required)); } this.numberIndicatorPaths.push(this.fb.group({ - url: this.fb.control(url, [Validators.required, StringUtils.urlValidator()]), - jsonPath: jsonPath, - result: this.fb.control(0, Validators.required), - source: this.fb.control(source, Validators.required), - parameters: parameters, - format: this.fb.control(format, Validators.required) - } + url: this.fb.control(url, [Validators.required, StringUtils.urlValidator()]), + jsonPath: jsonPath, + result: this.fb.control(0, Validators.required), + source: this.fb.control(source, Validators.required), + parameters: parameters, + format: this.fb.control(format, Validators.required) + } )); let index = this.numberIndicatorPaths.length - 1; if (this.numberIndicatorPaths.at(index).get('url').valid) { @@ -515,45 +514,43 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } if (this.indicator.defaultId === null) { this.subscriptions.push(this.numberIndicatorPaths.at(index).get('url').valueChanges.subscribe(value => { - this.numberIndicatorPaths.at(index).get('result').setValue(null); - if (this.numberIndicatorPaths.at(index).get('url').valid) { - let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(value), value, this.stakeholder, this.numberIndicatorPaths.at(index).get('jsonPath').value, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(value))); - if (this.indicator.indicatorPaths[index]) { - this.indicator.indicatorPaths[index] = indicatorPath; - } else { - this.indicator.indicatorPaths.push(indicatorPath); - } - if (indicatorPath.source) { - this.numberIndicatorPaths.at(index).get('source').setValue(indicatorPath.source); - } - (this.numberIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath)); - if (indicatorPath.jsonPath.length > 1 && this.getJsonPath(index).length == 1) { - let paths = indicatorPath.jsonPath; - for (let i = 0; i < paths.length; i++) { - if (i == this.getJsonPath(index).length) { - this.getJsonPath(index).push(this.fb.control('', Validators.required)); - } + this.numberIndicatorPaths.at(index).get('result').setValue(null); + if (this.numberIndicatorPaths.at(index).get('url').valid) { + let indicatorPath: IndicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(value), value, this.stakeholder, this.numberIndicatorPaths.at(index).get('jsonPath').value, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(value))); + if (this.indicator.indicatorPaths[index]) { + this.indicator.indicatorPaths[index] = indicatorPath; + } else { + this.indicator.indicatorPaths.push(indicatorPath); + } + if (indicatorPath.source) { + this.numberIndicatorPaths.at(index).get('source').setValue(indicatorPath.source); + } + (this.numberIndicatorPaths.at(index) as UntypedFormGroup).setControl('parameters', this.getParametersAsFormArray(indicatorPath)); + if (indicatorPath.jsonPath.length > 1 && this.getJsonPath(index).length == 1) { + let paths = indicatorPath.jsonPath; + for (let i = 0; i < paths.length; i++) { + if (i == this.getJsonPath(index).length) { + this.getJsonPath(index).push(this.fb.control('', Validators.required)); + } + } + this.getJsonPath(index).setValue(paths) } - this.getJsonPath(index).setValue(paths) } - } else { - this.urlParameterizedMessage = null; - } - }) + }) ); this.subscriptions.push(this.numberIndicatorPaths.at(index).get('jsonPath').valueChanges.subscribe(value => { - if (this.indicator.indicatorPaths[index]) { - this.indicator.indicatorPaths[index].jsonPath = value; - } - this.numberIndicatorPaths.at(index).get('result').setValue(null); - }) + if (this.indicator.indicatorPaths[index]) { + this.indicator.indicatorPaths[index].jsonPath = value; + } + this.numberIndicatorPaths.at(index).get('result').setValue(null); + }) ); this.subscriptions.push(this.numberIndicatorPaths.at(index).get('source').valueChanges.subscribe(value => { - if (this.indicator.indicatorPaths[index]) { - this.indicator.indicatorPaths[index].source = value; - } - }) + if (this.indicator.indicatorPaths[index]) { + this.indicator.indicatorPaths[index].source = value; + } + }) ); } else { this.numberIndicatorPaths.at(index).get('url').disable(); @@ -564,10 +561,10 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple public addChartIndicatorPath(value: string = '', parameters: UntypedFormArray = new UntypedFormArray([]), disableUrl: boolean = false, type: string = null) { this.chartIndicatorPaths.push(this.fb.group({ - url: this.fb.control(value, [Validators.required, StringUtils.urlValidator()]), - parameters: parameters, - type: this.fb.control(type) - } + url: this.fb.control(value, [Validators.required, StringUtils.urlValidator()]), + parameters: parameters, + type: this.fb.control(type) + } )); let index = this.chartIndicatorPaths.length - 1; if (disableUrl) { @@ -585,8 +582,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple indicatorPath.safeResourceUrl = this.indicator.indicatorPaths[index].safeResourceUrl; this.indicator.indicatorPaths[index] = indicatorPath; } - } else { - this.urlParameterizedMessage = null; } })); } @@ -596,9 +591,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.numberIndicatorPaths.removeAt(index); this.indicator.indicatorPaths.splice(index, 1); this.transitionGroup.init(); - if(this.indicator.activePath === index) { + if (this.indicator.activePath === index) { this.activeNumberIndicatorPath(Math.max(0, index - 1)); - } else if(this.indicator.activePath > index) { + } else if (this.indicator.activePath > index) { this.activeNumberIndicatorPath(this.indicator.activePath - 1); } this.numberIndicatorFb.markAsDirty(); @@ -608,9 +603,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.chartIndicatorPaths.removeAt(index); this.indicator.indicatorPaths.splice(index, 1); this.transitionGroup.init(); - if(this.indicator.activePath === index) { + if (this.indicator.activePath === index) { this.activeChartIndicatorPath(Math.max(0, index - 1)); - } else if(this.indicator.activePath > index) { + } else if (this.indicator.activePath > index) { this.activeChartIndicatorPath(this.indicator.activePath - 1); } this.chartIndicatorFb.markAsDirty(); @@ -622,12 +617,12 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.transitionGroup.init(); let a = indicatorPaths.at(index); let b = indicatorPaths.at(newIndex); - indicatorPaths.setControl(index , b); - indicatorPaths.setControl(newIndex , a); - HelperFunctions.swap(this.indicator.indicatorPaths, index , newIndex); - if(this.indicator.activePath === index) { + indicatorPaths.setControl(index, b); + indicatorPaths.setControl(newIndex, a); + HelperFunctions.swap(this.indicator.indicatorPaths, index, newIndex); + if (this.indicator.activePath === index) { this.indicator.activePath = newIndex; - } else if(this.indicator.activePath === newIndex) { + } else if (this.indicator.activePath === newIndex) { this.indicator.activePath = index; } form.markAsDirty(); @@ -635,7 +630,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple public activeNumberIndicatorPath(index: number) { let paths = this.numberIndicatorPaths; - if(index == paths.length) { + if (index == paths.length) { this.addNumberIndicatorPath(); this.transitionGroup.init(); } @@ -644,7 +639,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple public activeChartIndicatorPath(index: number) { let paths = this.chartIndicatorPaths; - if(index == paths.length) { + if (index == paths.length) { this.addChartIndicatorPath(); this.transitionGroup.init(); } @@ -684,7 +679,21 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } public editNumberIndicatorOpen(section: Section, id = null) { - this.urlParameterizedMessage = null; + this.editNumberModal.cancelButtonText = 'Cancel'; + this.editNumberModal.okButtonLeft = false; + this.editNumberModal.alertMessage = false; + if (this.index === -1) { + this.editNumberModal.alertTitle = 'Create a new number indicator'; + this.editNumberModal.okButtonText = 'Save'; + this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); + this.editNumberNotify.reset(this.notification.message); + } else { + this.editNumberModal.alertTitle = 'Edit number indicator\'s information'; + this.editNumberModal.okButtonText = 'Save Changes'; + this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); + this.editNumberNotify.reset(this.notification.message); + } + this.editNumberModal.stayOpen = true; this.section = section; this.index = (id) ? section.indicators.findIndex(value => value._id === id) : -1; if (this.index !== -1) { @@ -726,26 +735,26 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.numberIndicatorFb.get('description').disable(); }, 0); } - this.editNumberModal.cancelButtonText = 'Cancel'; - this.editNumberModal.okButtonLeft = false; - this.editNumberModal.alertMessage = false; - if (this.index === -1) { - this.editNumberModal.alertTitle = 'Create a new number indicator'; - this.editNumberModal.okButtonText = 'Save'; - this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); - this.editNumberNotify.reset(this.notification.message); - } else { - this.editNumberModal.alertTitle = 'Edit number indicator\'s information'; - this.editNumberModal.okButtonText = 'Save Changes'; - this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); - this.editNumberNotify.reset(this.notification.message); - } - this.editNumberModal.stayOpen = true; this.editNumberModal.open(); } public editChartIndicatorOpen(section: Section, id = null) { - this.urlParameterizedMessage = null; + this.editChartModal.cancelButtonText = 'Cancel'; + this.editChartModal.okButtonLeft = false; + this.editChartModal.alertMessage = false; + if (this.index === -1) { + this.editChartModal.alertTitle = 'Create a new chart indicator'; + this.editChartModal.okButtonText = 'Save'; + this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); + this.editChartNotify.reset(this.notification.message); + } else { + this.editChartModal.alertTitle = 'Edit chart indicator\'s information'; + this.editChartModal.okButtonText = 'Save Changes'; + this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); + ; + this.editChartNotify.reset(this.notification.message); + } + this.editChartModal.stayOpen = true; this.urlSubscriptions.forEach(value => { if (value instanceof Subscriber) { value.unsubscribe(); @@ -769,7 +778,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple }); this.indicator.indicatorPaths.forEach(indicatorPath => { this.addChartIndicatorPath(this.getUrlByStakeHolder(indicatorPath), - this.getParametersAsFormArray(indicatorPath), this.indicator.defaultId !== null, indicatorPath.type); + this.getParametersAsFormArray(indicatorPath), this.indicator.defaultId !== null, indicatorPath.type); indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath); }); } else { @@ -792,22 +801,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.chartIndicatorFb.get('description').disable(); }, 0); } - this.editChartModal.cancelButtonText = 'Cancel'; - this.editChartModal.okButtonLeft = false; - this.editChartModal.alertMessage = false; - if (this.index === -1) { - this.editChartModal.alertTitle = 'Create a new chart indicator'; - this.editChartModal.okButtonText = 'Save'; - this.notification = NotificationUtils.createIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); - this.editChartNotify.reset(this.notification.message); - } else { - this.editChartModal.alertTitle = 'Edit chart indicator\'s information'; - this.editChartModal.okButtonText = 'Save Changes'; - this.notification = NotificationUtils.editIndicator(this.user.firstname + ' ' + this.user.lastname, this.stakeholder.name); - ; - this.editChartNotify.reset(this.notification.message); - } - this.editChartModal.stayOpen = true; this.editChartModal.open(); } @@ -907,7 +900,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.setCharts(); this.setNumbers(); this.initReorder(); - if(properties.notificationsAPIURL) { + if (properties.notificationsAPIURL) { this.notification = NotificationUtils.importIndicators(this.user.fullname, this.stakeholder.alias); this.notification.entity = this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index]._id; this.notification.name = this.user.firstname; @@ -999,7 +992,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple hasDifference(index: number, type: IndicatorType = 'chart'): boolean { let hasDifference = false; - if(type === 'chart') { + if (type === 'chart') { this.chartIndicatorPaths.at(index).value.parameters.forEach(parameter => { if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) { hasDifference = true; @@ -1008,7 +1001,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple }); return hasDifference || this.indicator.indicatorPaths[index].safeResourceUrl.toString() !== this.getSecureUrlByStakeHolder(this.indicator.indicatorPaths[index]).toString(); - } else if(type === 'number') { + } else if (type === 'number') { let indicatorPath = this.numberIndicatorPaths.at(index).value; indicatorPath.parameters.forEach(parameter => { if (parameter.value !== this.indicator.indicatorPaths[index].parameters[parameter.key]) { @@ -1029,12 +1022,12 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } refreshIndicator(type: IndicatorType = 'chart') { - if(type === 'chart') { + if (type === 'chart') { this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths, 'chart'); this.indicator.indicatorPaths.forEach(indicatorPath => { indicatorPath.safeResourceUrl = this.getSecureUrlByStakeHolder(indicatorPath); }); - } else if(type === 'number') { + } else if (type === 'number') { this.indicator = this.indicatorUtils.generateIndicatorByForm(this.numberIndicatorFb.value, this.indicator.indicatorPaths, 'number'); this.indicator.indicatorPaths.forEach((indicatorPath, index) => { this.validateJsonPath(index); @@ -1293,6 +1286,11 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple if (chart['sectionIndex'] == null) { chart['sectionIndex'] = chart['type'] == 'chart' ? chartsSection : 0; } + if (chart.url && chart.jsonPath) { + chart.indicatorPaths = [{url: chart.url, jsonPath: chart.jsonPath}]; + } else if(chart.url) { + chart.indicatorPaths = [{url: chart.url}]; + } } return charts; } @@ -1300,7 +1298,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple importIndicatorsAndSave(stakeholder: Stakeholder, charts: any[]) { let sectionsToSave: Section[] = []; let countIndicators = 0; - if(stakeholder.type !== this.stakeholder.type) { + if (stakeholder.type !== this.stakeholder.type) { UIkit.notification("The type of this profile is not the same with the file's one!", { status: 'warning', timeout: 6000, @@ -1313,23 +1311,25 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple let duplicates = 0; charts = this.migrateFromOldImportJsonFile(charts); for (let chart of charts) { - chart.visibility = this.showVisibility?chart.visibility:this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities); + chart.visibility = this.showVisibility ? chart.visibility : this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities); if (!sectionsToSave[chart['sectionIndex']]) { let sectionToSave = new Section(chart['sectionType'] ? chart['sectionType'] : chart['type'], chart['sectionTitle']); sectionToSave.indicators = []; sectionsToSave[chart['sectionIndex']] = sectionToSave; } let exists = false; - let indicatorPath; + let indicatorPaths: IndicatorPath[] = []; // validate indicators' schema from file let invalid_file_message; if (!chart.type) { invalid_file_message = "No indicator type is specified. Type should be chart or number."; } else if (chart.type != "chart" && chart.type != "number") { invalid_file_message = "Invalid indicator type. Type should be chart or number."; - } else if (chart.type == "number" && !chart.jsonPath) { + } else if (chart.indicatorPaths.length === 0) { + invalid_file_message = "No indicator paths are specified." + } else if (chart.type == "number" && chart.indicatorPaths.filter(path => !path.jsonPath).length > 0) { invalid_file_message = "No jsonPath is specified for number indicator." - } else if (!chart.url) { + } else if (chart.indicatorPaths.filter(path => !path.url).length > 0) { invalid_file_message = "No indicator url is specified."; } @@ -1344,33 +1344,38 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } if (chart.type == "chart") { - indicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(chart.url), chart.url, chart.type, stakeholder); + indicatorPaths = chart.indicatorPaths.map(path => this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(path.url), path.url, chart.type, stakeholder)); this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].charts.forEach((section: Section) => { section.indicators.forEach(indicator => { indicator.indicatorPaths.forEach(path => { - if (JSON.stringify(path.chartObject) == JSON.stringify(indicatorPath.chartObject)) { - duplicates++; + let size = indicatorPaths.length; + indicatorPaths = indicatorPaths.filter(indicatorPath => JSON.stringify(path.chartObject) !== JSON.stringify(indicatorPath.chartObject)) + if (indicatorPaths.length < size) { + duplicates = duplicates + (size - indicatorPaths.length); exists = true; } }); }); }); } else if (chart.type == "number") { - indicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(chart.url), chart.url, stakeholder, - chart.jsonPath, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(chart.url))); + indicatorPaths = chart.indicatorPaths.map(path => + this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(path.url), path.url, + stakeholder, path.jsonPath, this.indicatorUtils.numberSources.get(this.indicatorUtils.getNumberSource(path.url)))); this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.index].numbers.forEach((section: Section) => { section.indicators.forEach(indicator => { indicator.indicatorPaths.forEach(path => { - if (JSON.stringify(path.chartObject) == JSON.stringify(indicatorPath.chartObject)) { - duplicates++; + let size = indicatorPaths.length; + indicatorPaths = indicatorPaths.filter(indicatorPath => JSON.stringify(path.chartObject) !== JSON.stringify(indicatorPath.chartObject)) + if (indicatorPaths.length < size) { + duplicates = duplicates + (size - indicatorPaths.length); exists = true; } }); }); }); } - if (!exists) { - let i: Indicator = new Indicator(chart.name, chart.description, chart.additionalDescription, chart.type, chart.width, chart.height, this.showVisibility?"RESTRICTED":this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities), [indicatorPath]); + if (indicatorPaths.length > 0) { + let i: Indicator = new Indicator(chart.name, chart.description, chart.additionalDescription, chart.type, chart.width, chart.height, this.showVisibility ? "RESTRICTED" : this.stakeholderUtils.defaultValue(this.stakeholderUtils.visibilities), indicatorPaths); sectionsToSave[chart['sectionIndex']].indicators.push(i); countIndicators++; } @@ -1402,36 +1407,41 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple let indexIndicator: number = 0; this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[subcategoryIndex].numbers.forEach(section => { section.indicators.forEach(indicator => { - indicator.indicatorPaths.forEach(indicatorPath => { - indicators[indexIndicator] = { - "type": indicator.type, "name": indicator.name, "jsonPath": indicatorPath.jsonPath, - "description": indicator.description, "additionalDescription": indicator.additionalDescription, - "visibility": indicator.visibility, "width": indicator.width, "height": indicator.height, - "url": this.indicatorUtils.getNumberUrl(indicatorPath.source, this.indicatorUtils.getFullUrl(this.stakeholder, indicatorPath)), - "sectionTitle": section.title, - "sectionType": section.type, - "sectionIndex": index - }; - indexIndicator++; - }); + indicators[indexIndicator] = { + "indicatorPaths": indicator.indicatorPaths.map(path => { + return { + jsonPath: path.jsonPath, + url: this.indicatorUtils.getNumberUrl(path.source, this.indicatorUtils.getFullUrl(this.stakeholder, path)) + } + }), + "type": indicator.type, "name": indicator.name, + "description": indicator.description, "additionalDescription": indicator.additionalDescription, + "visibility": indicator.visibility, "width": indicator.width, "height": indicator.height, + "sectionTitle": section.title, + "sectionType": section.type, + "sectionIndex": index + }; + indexIndicator++; }); index++; }); this.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[subcategoryIndex].charts.forEach(section => { section.indicators.forEach(indicator => { - indicator.indicatorPaths.forEach(indicatorPath => { - indicators[indexIndicator] = { - "type": indicator.type, "name": indicator.name, - "description": indicator.description, "additionalDescription": indicator.additionalDescription, - "visibility": indicator.visibility, "width": indicator.width, "height": indicator.height, - "url": this.getUrlByStakeHolder(indicatorPath), - "sectionTitle": section.title, - "sectionType": section.type, - "sectionIndex": index - }; - indexIndicator++; - }); + indicators[indexIndicator] = { + "indicatorPaths": indicator.indicatorPaths.map(path => { + return { + url: this.getUrlByStakeHolder(path) + } + }), + "type": indicator.type, "name": indicator.name, + "description": indicator.description, "additionalDescription": indicator.additionalDescription, + "visibility": indicator.visibility, "width": indicator.width, "height": indicator.height, + "sectionTitle": section.title, + "sectionType": section.type, + "sectionIndex": index + }; + indexIndicator++; }); index++; @@ -1491,7 +1501,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple this.makeFileRequest(this.properties.utilsService + '/upload?type=json', [], this.filesToUpload).then(async (result: string) => { let json = JSON.parse(result); // validate file - if(json && Array.isArray(json)) { + if (json && Array.isArray(json)) { UIkit.notification("This file is not supported any more. Please export indicators and try again!", { status: 'danger', timeout: 6000, -- 2.17.1 From 69cdb2cec2001ece062af3b2b629d2ce9cdf4867 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 8 Apr 2024 14:14:09 +0300 Subject: [PATCH 13/64] [develop]: Add roles in stakeholder configuration to handle naming of roles in different services. --- .../role-users/role-users.component.html | 22 +++++++++---------- .../users/role-users/role-users.component.ts | 17 +++++++++----- monitor-admin/utils/indicator-utils.ts | 10 +++++++++ .../role-verification.component.ts | 6 +++-- utils/email/composer.ts | 7 +++--- 5 files changed, 41 insertions(+), 21 deletions(-) diff --git a/dashboard/users/role-users/role-users.component.html b/dashboard/users/role-users/role-users.component.html index 6fb1d94f..88befe57 100644 --- a/dashboard/users/role-users/role-users.component.html +++ b/dashboard/users/role-users/role-users.component.html @@ -8,26 +8,26 @@
+ [searchControl]="filterForm.get('active')" [expandable]="true" [placeholder]="'Search ' + stakeholderUtils.roles[role] + 's'" searchInputClass="outer">
-

-
+

Profiles

{ - if (key == "index_name") { - indicatorPath.parameters[key] = funder.index_name; - } else if (key == "index_id") { - indicatorPath.parameters[key] = funder.index_id; - } else if (key == "index_shortName") { - indicatorPath.parameters[key] = funder.index_shortName.toLowerCase(); - } - }); - } - } - } - section.indicators = chartsTokeep; - } - for (let section of subCategory.numbers) { - section.defaultId = !isDefault ? section._id : null; - section.stakeholderAlias = funder.alias; - section._id = null; - for (let indicator of section.indicators) { - indicator.defaultId = !isDefault ? indicator._id : null; - indicator._id = null; - } - } - - } - category.subCategories = subTokeep; - } - } - return funder; - } aliasValidatorString(elements: string[]): ValidatorFn { return (control: AbstractControl): { [key: string]: string } | null => { diff --git a/monitor/entities/stakeholder.ts b/monitor/entities/stakeholder.ts index a33506ac..a1670174 100644 --- a/monitor/entities/stakeholder.ts +++ b/monitor/entities/stakeholder.ts @@ -37,6 +37,7 @@ export class Stakeholder { isUpload: boolean = false; description: string; topics: any[]; + copy: boolean = true; details?: any; constructor(_id: string, type: StakeholderType, index_id: string, index_name: string, index_shortName: string, alias: string, visibility: Visibility, logoUrl: string, defaultId: string = null, description: string = null) { @@ -50,6 +51,7 @@ export class Stakeholder { this.visibility = visibility; this.logoUrl = logoUrl; this.description = description; + this.copy = !!this.defaultId && this.defaultId !== '-1'; this.topics = []; } diff --git a/monitor/services/stakeholder.service.ts b/monitor/services/stakeholder.service.ts index d8b8bf30..4c597cd2 100644 --- a/monitor/services/stakeholder.service.ts +++ b/monitor/services/stakeholder.service.ts @@ -116,11 +116,15 @@ export class StakeholderService { })); } - buildStakeholder(url: string, stakeholder: Stakeholder): Observable { + buildStakeholder(url: string, stakeholder: Stakeholder, copyId: string): Observable { if (stakeholder.alias && stakeholder.alias.startsWith('/')) { stakeholder.alias = stakeholder.alias.slice(1); } - return this.http.post(url + '/build-stakeholder', stakeholder, CustomOptions.registryOptions()).pipe(map(stakeholder => { + let copy = { + stakeholder: stakeholder, + copyId: copyId + } + return this.http.post(url + '/build-stakeholder', copy, CustomOptions.registryOptions()).pipe(map(stakeholder => { return HelperFunctions.copy(Stakeholder.checkIsUpload(stakeholder)); })); } @@ -129,12 +133,12 @@ export class StakeholderService { return this.http.post(url + '/' + path.join('/') + '/change-visibility' + '?visibility=' + visibility + (propagate ? '&propagate=true' : ''), null, CustomOptions.registryOptions()); } - saveElement(url: string, element: any, path: string[] = []): Observable { + saveElement(url: string, element: any, path: string[] = [], isFull: boolean = false): Observable { if (element.alias && element.alias.startsWith('/')) { element.alias = element.alias.slice(1); } return this.http.post(url + ((path.length > 0) ? '/' : '') + path.join('/') + - '/save', element, CustomOptions.registryOptions()).pipe(map(element => { + '/save' + (isFull?'/full':''), element, CustomOptions.registryOptions()).pipe(map(element => { if (path.length === 0) { return HelperFunctions.copy(Stakeholder.checkIsUpload(element)); } else { -- 2.17.1 From 438075f8dfca0d78ec9985e08572fd7d2b40ab18 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 12 Apr 2024 11:19:17 +0300 Subject: [PATCH 22/64] [develop | DONE | FIXED]: Fixes on search projects for claims. 1. searchProjects.service.ts: Parse funder name if funder shortname is not available. 2. claimProjectSearchForm.component.ts: a. [BUG FIX] Set filter.countAllValues = filter.values.length; to show filter values without extra "view all" call b. [BUG FIX] Call projectService.advancedSearchProjects instead of projectService.searchProjects to get projects (/resources2 instead of /projects) to get 100 first values by default in facets. --- .../claimProjectSearchForm.component.ts | 98 ++++++++++--------- services/searchProjects.service.ts | 2 +- 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/claims/claim-utils/claimProjectSearchForm.component.ts b/claims/claim-utils/claimProjectSearchForm.component.ts index 01e6d8c0..27ec74d5 100644 --- a/claims/claim-utils/claimProjectSearchForm.component.ts +++ b/claims/claim-utils/claimProjectSearchForm.component.ts @@ -65,35 +65,36 @@ export class ClaimProjectsSearchFormComponent { } search(page,size) { - if(this.keyword.length == 0){ - this.showResults =false; + if (this.keyword.length == 0) { + this.showResults = false; return; } - this.showResults =true; + this.showResults = true; this.openaireResults = []; this.openaireResultsStatus = this.errorCodes.LOADING; this.prevFilters = this.filters; //searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any { - this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe( + this.sub = this._projectService.advancedSearchProjects(this.createOpenaireQueryParams(), page, size, this.properties, (page == 1) ? this.refineFieldsQuery : null, (page == 1) ? this.refineFields : [], this.createOpenaireRefineQuery()).subscribe( + // this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe( data => { - if(data != null) { - this.openaireResultsPage=page; - this.openaireResultsNum = data[0]; - this.openaireResults =ClaimProjectsSearchFormComponent.openaire2ClaimEntity(data[1], this.properties); - if(data[2] && data[2].length > 0){ - this.filters = this.checkSelectedFilters( data[2], this.prevFilters); - } - - this.openaireResultsStatus = this.errorCodes.DONE; - if(this.openaireResultsNum == 0){ - this.openaireResultsStatus = this.errorCodes.NONE; - this.filters = this.checkSelectedFilters( [], this.prevFilters); - } - }else { - this.openaireResultsStatus = this.errorCodes.ERROR; + if (data != null) { + this.openaireResultsPage = page; + this.openaireResultsNum = data[0]; + this.openaireResults = ClaimProjectsSearchFormComponent.openaire2ClaimEntity(data[1], this.properties); + if (data[2] && data[2].length > 0) { + this.filters = this.checkSelectedFilters(data[2], this.prevFilters); } - }, + + this.openaireResultsStatus = this.errorCodes.DONE; + if (this.openaireResultsNum == 0) { + this.openaireResultsStatus = this.errorCodes.NONE; + this.filters = this.checkSelectedFilters([], this.prevFilters); + } + } else { + this.openaireResultsStatus = this.errorCodes.ERROR; + } + }, err => { this.openaireResultsStatus = this.errorCodes.ERROR; //console.log(err.status); @@ -202,12 +203,16 @@ export class ClaimProjectsSearchFormComponent { } - createOpenaireQueryParams():string { + createOpenaireQueryParams(): string { let query = ""; - if(this.keyword.length > 0){ - query += "q=" + StringUtils.quote(StringUtils.URIEncode(this.keyword)); + if (this.keyword.length > 0) { + // query += "q=" + StringUtils.quote(StringUtils.URIEncode(this.keyword)); + query += StringUtils.quote(StringUtils.URIEncode(this.keyword)); } + return query; + } + createOpenaireRefineQuery(): string { /*if(this.startYear.length > 0 ){ query+='&fq=projectstartyear exact \"'+this.startYear+'\"' } @@ -215,30 +220,30 @@ export class ClaimProjectsSearchFormComponent { query+='&fq=projectendyear exact \"'+this.endYear+'\"' }*/ let allFqs = ""; - for (let filter of this.filters){ - if(filter.countSelectedValues > 0){ - let count_selected=0; + for (let filter of this.filters) { + if (filter.countSelectedValues > 0) { + let count_selected = 0; let fq = ""; - for (let value of filter.values){ - if(value.selected == true){ + for (let value of filter.values) { + if (value.selected == true) { count_selected++; - fq+=(fq.length > 0 ? " " + filter.filterOperator + " ":"" ) + filter.filterId + " exact " + (StringUtils.quote(value.id)); + fq += (fq.length > 0 ? " " + filter.filterOperator + " " : "") + filter.filterId + " exact " + (StringUtils.quote(value.id)); } } - if(count_selected > 0){ - fq="&fq="+StringUtils.URIEncode(fq); + if (count_selected > 0) { + fq = "&fq=" + StringUtils.URIEncode(fq); allFqs += fq; } } } - for (let i=0; i=" ,"<=", "and" ) + allFqs += NewSearchPageComponent.createRangeFilterQuery(this.rangeFields[i], filter.selectedFromValue, filter.selectedToValue, " within ", ">=", "<=", "and") } - return query+allFqs; - + return allFqs + "&type=projects"; } + public yearChanged() { this.search(this.page, this.size); @@ -273,20 +278,21 @@ export class ClaimProjectsSearchFormComponent { } } - + filter.countAllValues = filter.values.length; } if(filters.length == 0 ){ - for(let j=0; j< prevFilters.length ; j++){ - let filter = Object.assign({}, prevFilters[j]); - filter.values = []; - for(let filterValue of prevFilters[j].values) { - if(filterValue.selected){ - filterValue.number = 0; - filter.values.push(filterValue); - } - } - filters.push(filter) + for(let j=0; j< prevFilters.length ; j++) { + let filter = Object.assign({}, prevFilters[j]); + filter.values = []; + for (let filterValue of prevFilters[j].values) { + if (filterValue.selected) { + filterValue.number = 0; + filter.values.push(filterValue); } + } + filter.countAllValues = filter.values.length; + filters.push(filter) + } } return filters; } diff --git a/services/searchProjects.service.ts b/services/searchProjects.service.ts index e9c48eaa..6d30b06c 100644 --- a/services/searchProjects.service.ts +++ b/services/searchProjects.service.ts @@ -230,7 +230,7 @@ export class SearchProjectsService { for(let z=0; z Date: Fri, 12 Apr 2024 13:57:56 +0300 Subject: [PATCH 23/64] [develop | DONE | ADDED] topics/indicators: add condition to hide all "edit" actions when stakeholder is NOT a copy --- monitor-admin/topic/indicators.component.html | 52 +++++++++++-------- monitor-admin/topic/indicators.component.ts | 4 ++ monitor-admin/topic/topic.component.html | 32 +++++++----- monitor-admin/topic/topic.component.ts | 4 ++ 4 files changed, 58 insertions(+), 34 deletions(-) diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html index 69abb1dd..9c7f6ca9 100644 --- a/monitor-admin/topic/indicators.component.html +++ b/monitor-admin/topic/indicators.component.html @@ -4,9 +4,9 @@
-
+
- @@ -17,25 +17,29 @@
-
+
{{numberSections.at(i).get('title').value}}
+ [attr.uk-sortable]="isEditable ? 'group: number': null" uk-grid>
- - + + -
    @@ -79,7 +83,7 @@
-
+
-
+
@@ -106,9 +110,9 @@
-
+
- @@ -120,25 +124,29 @@
-
+
{{chartSections.at(i).get('title').value}}
+ [attr.uk-sortable]="isEditable ? 'group: chart': null" uk-grid>
- - + + -
    @@ -214,7 +222,7 @@
-
+
-
+
@@ -288,10 +296,10 @@ class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left" [class.uk-invisible-hover]="indicator.activePath !== i" (click)="$event.stopPropagation();$event.preventDefault()"> - + -
  • @@ -486,10 +494,10 @@ class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left" [class.uk-invisible-hover]="indicator.activePath !== i" (click)="$event.stopPropagation();$event.preventDefault()"> - + -
    diff --git a/landingPages/result/deletedByInference/deletedByInference.service.ts b/landingPages/result/deletedByInference/deletedByInference.service.ts index 5b812e8f..f3b3754c 100644 --- a/landingPages/result/deletedByInference/deletedByInference.service.ts +++ b/landingPages/result/deletedByInference/deletedByInference.service.ts @@ -145,8 +145,7 @@ export class DeletedByInferenceService { if(author.orcid_pending) { author.orcid_pending = author.orcid_pending.toUpperCase(); } - - if(result['authors'][author.rank] && results['authors'][author.rank].fullName == author.content) { + if(result['authors'][author.rank] && result['authors'][author.rank].fullName == author.content) { if(!author.orcid && result['authors'][author.rank].orcid) { author.orcid = result['authors'][author.rank].orcid; } else if(!author.orcid_pending && result['authors'][author.rank].orcid_pending) { diff --git a/orcid/orcid-work.component.ts b/orcid/orcid-work.component.ts index 6153d146..8473be66 100644 --- a/orcid/orcid-work.component.ts +++ b/orcid/orcid-work.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild} from '@angular/core'; +import {ChangeDetectorRef, Component, Input, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from "@angular/router"; import {Subscriber, Subscription} from "rxjs"; import {OrcidService} from "./orcid.service"; @@ -85,7 +85,7 @@ declare var UIkit: any; ORCID  - + ORCID logo  ACTIONS @@ -330,7 +330,8 @@ export class OrcidWorkComponent { private _router: Router, private orcidService: OrcidService, private resultLandingService: ResultLandingService, - private userManagementService: UserManagementService, private _logService: LogService, private _userProfileService: UserProfileService) { + private userManagementService: UserManagementService, private _logService: LogService, private _userProfileService: UserProfileService, + private cdr: ChangeDetectorRef) { if (typeof document !== 'undefined') { this.tokenUrl = properties.orcidTokenURL + "client_id=" + properties.orcidClientId @@ -444,6 +445,8 @@ export class OrcidWorkComponent { this.subscriptions.push(this.orcidService.getPutCode(this.pids).subscribe( putCodes => { this.putCodes = putCodes; + this.cdr.markForCheck(); + // this.cdr.detectChanges(); }, error => { } @@ -525,7 +528,9 @@ export class OrcidWorkComponent { this.putCodes.push("" + response['put-code']); this.creationDates.push(response['created-date']['value']); this.updateDates.push(response['last-modified-date']['value']); - + this.cdr.markForCheck(); + // this.cdr.detectChanges(); + // this.closeGrantModal(); // this.message = "You have successfully added work with pids: "+this.pids+" in your ORCID record!"; this.message = "You have successfully added work \"" + this.resultTitle + "\" in your ORCID record!"; @@ -701,6 +706,8 @@ export class OrcidWorkComponent { deletedAll = false; } else { this.putCodes.splice(i, 1); + this.cdr.markForCheck(); + // this.cdr.detectChanges(); this.creationDates.splice(i, 1); this.updateDates.splice(i, 1); // this.works.splice(i, 1); diff --git a/sdg/sdg.component.html b/sdg/sdg.component.html index 1acb5d08..c1f431fe 100644 --- a/sdg/sdg.component.html +++ b/sdg/sdg.component.html @@ -34,9 +34,9 @@
- + SDGs logo
- + SDGs big logo
@@ -61,7 +61,7 @@
- +
{{sdg.number == null ? '0' : sdg.number | number}} diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 74028ebd..c623abc1 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -311,7 +311,7 @@ target="_blank"> OpenAIRE - Explore.
-
+
@@ -347,7 +347,7 @@
-
+
diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index 33ba74c0..881578d8 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -78,6 +78,7 @@ export class SearchResultComponent implements OnInit, OnChanges { // console.debug(i, this.previewResults[i].orcidPutCodes); } } + this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver); }, error => { } @@ -85,6 +86,26 @@ export class SearchResultComponent implements OnInit, OnChanges { } } + private replacer(key, value) { + if(value instanceof Map) { + return { + dataType: 'Map', + value: Array.from(value.entries()), // or with spread: value: [...value] + }; + } else { + return value; + } + } + + private reviver(key, value) { + if(typeof value === 'object' && value !== null) { + if (value.dataType === 'Map') { + return new Map(value.value); + } + } + return value; + } + public getResultPreview(result: SearchResult): ResultPreview { return ResultPreview.searchResultConvert(result, (result.entityType) ? result.entityType : this.type); } diff --git a/sharedComponents/quick-contact/quick-contact.component.html b/sharedComponents/quick-contact/quick-contact.component.html index d43d55d4..23e3d1ab 100644 --- a/sharedComponents/quick-contact/quick-contact.component.html +++ b/sharedComponents/quick-contact/quick-contact.component.html @@ -12,7 +12,7 @@ Send a message
- + contact person
How can we help? diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 046eb7c0..229ab5f9 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -218,7 +218,7 @@
- + diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index d7a1d0f8..539eccb9 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, OnChanges, OnInit, SimpleChanges} from "@angular/core"; +import {ChangeDetectionStrategy, Component, Input, OnChanges, OnInit, SimpleChanges} from "@angular/core"; import {ResultPreview} from "./result-preview"; import {EnvProperties} from "../properties/env-properties"; import {RouterHelper} from "../routerHelper.class"; @@ -12,7 +12,8 @@ import {NumberUtils} from '../number-utils.class'; @Component({ selector: 'result-preview', templateUrl: 'result-preview.component.html', - styleUrls: ['result-preview.component.less'] + styleUrls: ['result-preview.component.less'], + changeDetection: ChangeDetectionStrategy.OnPush }) export class ResultPreviewComponent implements OnInit, OnChanges { @Input() prevPath: string = ""; @@ -255,4 +256,8 @@ export class ResultPreviewComponent implements OnInit, OnChanges { } return obj; } + + public get countDots() { + return (this.result.oaRoutes.green ? 1 : 0) + (this.result.oaRoutes.oaColor ? 1 : 0) + (this.result.oaRoutes.isInDiamondJournal ? 1 : 0); + } } -- 2.17.1 From c219c8370b223f4f4df2520f2a4ad89dde493637 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 16 Apr 2024 10:07:31 +0300 Subject: [PATCH 26/64] [develop | DONE | REVERTED]: searchResult.component.ts & result-preview.component.html & result-preview.component.ts: Reverted changes regarding changeDetection: ChangeDetectionStrategy.OnPush - should be first introduced in another branch. --- searchPages/searchUtils/searchResult.component.ts | 2 +- utils/result-preview/result-preview.component.html | 2 +- utils/result-preview/result-preview.component.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index 881578d8..d76c1de6 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -78,7 +78,7 @@ export class SearchResultComponent implements OnInit, OnChanges { // console.debug(i, this.previewResults[i].orcidPutCodes); } } - this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver); + // this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver); }, error => { } diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 229ab5f9..046eb7c0 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -218,7 +218,7 @@
- + diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index 539eccb9..ac31bb91 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -13,7 +13,7 @@ import {NumberUtils} from '../number-utils.class'; selector: 'result-preview', templateUrl: 'result-preview.component.html', styleUrls: ['result-preview.component.less'], - changeDetection: ChangeDetectionStrategy.OnPush + // changeDetection: ChangeDetectionStrategy.OnPush }) export class ResultPreviewComponent implements OnInit, OnChanges { @Input() prevPath: string = ""; -- 2.17.1 From 1613916dfdbe1252f0d08f2574ca85f950da3628 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 16 Apr 2024 10:23:07 +0300 Subject: [PATCH 27/64] [on-push-strategy | DONE | CHANGED]: result-preview.component.ts: Set changeDetection: ChangeDetectionStrategy.OnPush | searchResult.component.ts & result-preview.component.html: Redraw html when needed with onPush strategy. --- searchPages/searchUtils/searchResult.component.ts | 2 +- utils/result-preview/result-preview.component.html | 2 +- utils/result-preview/result-preview.component.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts index d76c1de6..881578d8 100644 --- a/searchPages/searchUtils/searchResult.component.ts +++ b/searchPages/searchUtils/searchResult.component.ts @@ -78,7 +78,7 @@ export class SearchResultComponent implements OnInit, OnChanges { // console.debug(i, this.previewResults[i].orcidPutCodes); } } - // this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver); + this.previewResults = JSON.parse(JSON.stringify(this.previewResults, this.replacer), this.reviver); }, error => { } diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 046eb7c0..229ab5f9 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -218,7 +218,7 @@
- + diff --git a/utils/result-preview/result-preview.component.ts b/utils/result-preview/result-preview.component.ts index ac31bb91..539eccb9 100644 --- a/utils/result-preview/result-preview.component.ts +++ b/utils/result-preview/result-preview.component.ts @@ -13,7 +13,7 @@ import {NumberUtils} from '../number-utils.class'; selector: 'result-preview', templateUrl: 'result-preview.component.html', styleUrls: ['result-preview.component.less'], - // changeDetection: ChangeDetectionStrategy.OnPush + changeDetection: ChangeDetectionStrategy.OnPush }) export class ResultPreviewComponent implements OnInit, OnChanges { @Input() prevPath: string = ""; -- 2.17.1 From 4b3e805d311396db3f4ac505fb6b0c93455c8f50 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 16 Apr 2024 11:36:45 +0300 Subject: [PATCH 28/64] [develop | DONE | REVERTED]: searchProjects.service.ts: Revert parsing funder name if funder shortname is not available. --- services/searchProjects.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/searchProjects.service.ts b/services/searchProjects.service.ts index 6d30b06c..e9c48eaa 100644 --- a/services/searchProjects.service.ts +++ b/services/searchProjects.service.ts @@ -230,7 +230,7 @@ export class SearchProjectsService { for(let z=0; z Date: Tue, 16 Apr 2024 11:47:12 +0300 Subject: [PATCH 29/64] [develop | DONE | CHANGED]: In search projects results, show funder name by default, and if not available, show funder short name. 1. searchResult.ts: Added field funderName: string; in class SearchResult. 2. result-preview.ts: Added field funderName: string; in class ResultPreview & in method "searchResultConvert()" set resultPreview.funderName = result.funderName; 3. searchProjects.service.ts: Added parsing of funderName. 4. result-preview.component.html: Show funderName and if not available, show funderShortname. 5. entity-metadata.component.ts: Added check for funders display. --- landingPages/landing-utils/entity-metadata.component.ts | 2 +- services/searchProjects.service.ts | 1 + utils/entities/searchResult.ts | 1 + utils/result-preview/result-preview.component.html | 8 ++++---- utils/result-preview/result-preview.ts | 2 ++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/landingPages/landing-utils/entity-metadata.component.ts b/landingPages/landing-utils/entity-metadata.component.ts index 0378f127..4060446c 100644 --- a/landingPages/landing-utils/entity-metadata.component.ts +++ b/landingPages/landing-utils/entity-metadata.component.ts @@ -295,7 +295,7 @@ export class EntityMetadataComponent { return this.projects.map(project => { let value = project.funderShortname ? project.funderShortname : project.funderName; if (project.acronym || project.title) { - value = value + ' | ' + (project.acronym ? project.acronym : + value = (value ? value + ' | ' : '') + (project.acronym ? project.acronym : (project.title.length > 25 ? (project.title.slice(0, 25) + '...'): project.title)); } // if(project.code) { diff --git a/services/searchProjects.service.ts b/services/searchProjects.service.ts index e9c48eaa..e9e704b9 100644 --- a/services/searchProjects.service.ts +++ b/services/searchProjects.service.ts @@ -231,6 +231,7 @@ export class SearchProjectsService { let fundingData = Array.isArray(resData['fundingtree']) ? resData['fundingtree'][z] : resData['fundingtree']; if(fundingData.hasOwnProperty("funder")) { result['funderShortname'] = fundingData['funder'].shortname; + result['funderName'] = fundingData['funder'].name; result['funderId'] = fundingData['funder'].id; result['jurisdiction'] = (fundingData['funder']['id']['jurisdiction'] )?fundingData['funder']['id']['jurisdiction']:""; diff --git a/utils/entities/searchResult.ts b/utils/entities/searchResult.ts index e59e56f7..ba762833 100644 --- a/utils/entities/searchResult.ts +++ b/utils/entities/searchResult.ts @@ -48,6 +48,7 @@ export class SearchResult { acronym: string; code: string; // callIdentifier?: string; // currently not parsed + funderName: string; funderShortname: string; budget?: string; contribution?: string; diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html index 046eb7c0..70fa4f30 100644 --- a/utils/result-preview/result-preview.component.html +++ b/utils/result-preview/result-preview.component.html @@ -95,12 +95,12 @@
-
- +
+ Funder: - {{result.funderShortname}} + {{result.funderName ? result.funderName : result.funderShortname}} - + {{openaireEntities.PROJECT}} Code: {{result.code}} diff --git a/utils/result-preview/result-preview.ts b/utils/result-preview/result-preview.ts index 542e34f2..c8a38e1d 100644 --- a/utils/result-preview/result-preview.ts +++ b/utils/result-preview/result-preview.ts @@ -123,6 +123,7 @@ export class ResultPreview { acronym: string; code: string; // callIdentifier: string; // currently not parsed + funderName: string; funderShortname: string; budget: string; contribution: string; @@ -188,6 +189,7 @@ export class ResultPreview { resultPreview.acronym = result.acronym; resultPreview.code = result.code; // resultPreview.callIdentifier = result.callIdentifier; // currently not parsed + resultPreview.funderName = result.funderName; resultPreview.funderShortname = result.funderShortname; resultPreview.budget = result.budget; resultPreview.contribution = result.contribution; -- 2.17.1 From b7293411993fc37a422483b092d7cb3cf5ce5efd Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 16 Apr 2024 12:21:02 +0300 Subject: [PATCH 30/64] [develop]: Fix visibility condition in Indicaotrs page --- monitor-admin/topic/indicators.component.html | 16 ++++++---------- monitor-admin/topic/topic.component.html | 10 +++++----- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html index 9c7f6ca9..0b5b1aa1 100644 --- a/monitor-admin/topic/indicators.component.html +++ b/monitor-admin/topic/indicators.component.html @@ -33,13 +33,11 @@ - - + + -
    @@ -140,13 +138,11 @@ - - + + -
      diff --git a/monitor-admin/topic/topic.component.html b/monitor-admin/topic/topic.component.html index c5d7ecb9..c264fee7 100644 --- a/monitor-admin/topic/topic.component.html +++ b/monitor-admin/topic/topic.component.html @@ -30,12 +30,12 @@ (click)="$event.stopPropagation();$event.preventDefault()"> - - + -
        @@ -112,7 +112,7 @@ - @@ -243,7 +243,7 @@ - -- 2.17.1 From cc435043060dec17966eddea9cd5b931d62e8ddc Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 16 Apr 2024 12:28:14 +0300 Subject: [PATCH 31/64] [develop | DONE | ADDED]: Added method get calcCurrentMonth() to calculate and display current month of the project life, if status is on going (project has started and not yet ended). --- .../landing-utils/entity-metadata.component.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/landingPages/landing-utils/entity-metadata.component.ts b/landingPages/landing-utils/entity-metadata.component.ts index 4060446c..d27eb26e 100644 --- a/landingPages/landing-utils/entity-metadata.component.ts +++ b/landingPages/landing-utils/entity-metadata.component.ts @@ -89,7 +89,7 @@ import {RouterHelper} from "../../utils/routerHelper.class"; - {{status}} + {{status}} (M{{calcCurrentMonth}}) {{date | date: 'dd MMM yyyy': 'UTC'}} @@ -364,4 +364,18 @@ export class EntityMetadataComponent { this.projectsModal.open(); } } + + public get calcCurrentMonth() { + let currentDate = new Date(this.currentDate); + let startDate = new Date(this.startDate); + + var months; + months = (currentDate.getFullYear() - startDate.getFullYear()) * 12; + months -= startDate.getMonth(); + months += currentDate.getMonth(); + if(startDate.getDate() > currentDate.getDate()) { + months--; + } + return months <= 0 ? 0 : months+1; + } } \ No newline at end of file -- 2.17.1 From 559220c77c47761d43819bdbaca11b2d849fb053 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 16 Apr 2024 13:25:54 +0300 Subject: [PATCH 32/64] [develop | DONE | CHANGED]: landing.module.ts: Removed TabPagingComponent from declarations and exports | deletedByInference.module.ts: Removed LandingModule from imports | resultLanding.module.ts: Import SearchTabModule | Deleted tabPaging.component.ts. --- landingPages/landing-utils/landing.module.ts | 5 ++-- .../landing-utils/tabPaging.component.ts | 24 ------------------- .../deletedByInference.module.ts | 2 +- landingPages/result/resultLanding.module.ts | 1 + 4 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 landingPages/landing-utils/tabPaging.component.ts diff --git a/landingPages/landing-utils/landing.module.ts b/landingPages/landing-utils/landing.module.ts index 3eedae91..d97b32a0 100644 --- a/landingPages/landing-utils/landing.module.ts +++ b/landingPages/landing-utils/landing.module.ts @@ -5,7 +5,6 @@ import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; -import {TabPagingComponent} from './tabPaging.component'; import {ShowTitleComponent} from './showTitle.component'; import {AddThisComponent} from './addThis.component'; @@ -14,11 +13,11 @@ import {AddThisComponent} from './addThis.component'; CommonModule, FormsModule, RouterModule ], declarations: [ - TabPagingComponent, ShowTitleComponent, AddThisComponent + ShowTitleComponent, AddThisComponent ], providers:[], exports: [ - TabPagingComponent, ShowTitleComponent, AddThisComponent + ShowTitleComponent, AddThisComponent ] }) export class LandingModule { } diff --git a/landingPages/landing-utils/tabPaging.component.ts b/landingPages/landing-utils/tabPaging.component.ts deleted file mode 100644 index 1eb6bd08..00000000 --- a/landingPages/landing-utils/tabPaging.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -import {Component, Input, Output, EventEmitter} from '@angular/core'; - -@Component({ - selector: 'tabPaging', - template: ` - - ` - }) - -export class TabPagingComponent { - @Input() showAll: boolean; - @Input() length: number; - @Output() changeShowAll: EventEmitter = new EventEmitter(); - - constructor () { - } - - ngOnInit() { - } -} diff --git a/landingPages/organization/deletedByInference/deletedByInference.module.ts b/landingPages/organization/deletedByInference/deletedByInference.module.ts index c327c902..eb09712b 100644 --- a/landingPages/organization/deletedByInference/deletedByInference.module.ts +++ b/landingPages/organization/deletedByInference/deletedByInference.module.ts @@ -18,7 +18,7 @@ import {ResultPreviewModule} from "../../../utils/result-preview/result-preview. @NgModule({ imports: [ CommonModule, FormsModule, ResultLandingUtilsModule, - PagingModule, ErrorMessagesModule, ShowAuthorsModule, LandingModule, NoLoadPaging, ResultPreviewModule + PagingModule, ErrorMessagesModule, ShowAuthorsModule, NoLoadPaging, ResultPreviewModule ], declarations: [ OrganizationsDeletedByInferenceComponent diff --git a/landingPages/result/resultLanding.module.ts b/landingPages/result/resultLanding.module.ts index 2d7dfc11..d1792e55 100644 --- a/landingPages/result/resultLanding.module.ts +++ b/landingPages/result/resultLanding.module.ts @@ -38,6 +38,7 @@ import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module'; import {EntityActionsModule} from "../../utils/entity-actions/entity-actions.module"; import {ResultLandingRoutingModule} from "./resultLanding-routing.module"; import {OrcidCoreModule} from "../../orcid/orcid-core.module"; +import {SearchTabModule} from "../../utils/tabs/contents/search-tab.module"; @NgModule({ imports: [ -- 2.17.1 From a2b1bb8f7047042793acb512b0eecbe0b24be051 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 16 Apr 2024 16:08:05 +0300 Subject: [PATCH 33/64] [develop | FIXED | DONE]: Multi indicators paths fix dropdowns --- monitor-admin/topic/indicators.component.html | 22 +++++++++---------- monitor-admin/topic/indicators.component.ts | 20 +++++++++++------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html index 0b5b1aa1..7452df47 100644 --- a/monitor-admin/topic/indicators.component.html +++ b/monitor-admin/topic/indicators.component.html @@ -276,7 +276,7 @@
        -
          +
          • @@ -292,14 +292,13 @@ class="uk-flex uk-flex-column uk-flex-center uk-margin-small-left" [class.uk-invisible-hover]="indicator.activePath !== i" (click)="$event.stopPropagation();$event.preventDefault()"> - + -
            +
            diff --git a/monitor-admin/topic/topic.component.ts b/monitor-admin/topic/topic.component.ts index 9c42c135..a7308db8 100644 --- a/monitor-admin/topic/topic.component.ts +++ b/monitor-admin/topic/topic.component.ts @@ -242,18 +242,30 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, } topicChanged(callback: Function, save: boolean = false) { + if(this.topics && save) { + this.topics.disable(); + } + if(this.categories) { + this.categories.disable(); + } + if(this.subCategories) { + this.subCategories.disable(); + } if(callback) { callback(); } this.cdr.detectChanges(); if(this.topics && save) { this.topics.init(); + this.topics.enable(); } if(this.categories) { this.categories.init(); + this.categories.enable(); } if(this.subCategories) { this.subCategories.init(); + this.subCategories.enable(); } } @@ -378,15 +390,23 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, } categoryChanged(callback: Function, save: boolean = false) { + if(this.categories && save) { + this.categories.disable(); + } + if(this.subCategories) { + this.subCategories.disable(); + } if(callback) { callback(); } this.cdr.detectChanges(); if(this.categories && save) { this.categories.init(); + this.categories.enable(); } if(this.subCategories) { this.subCategories.init(); + this.subCategories.enable(); } } @@ -512,12 +532,16 @@ export class TopicComponent extends StakeholderBaseComponent implements OnInit, } subCategoryChanged(callback: Function, save: boolean = false) { + if(this.subCategories && save) { + this.subCategories.disable(); + } if(callback) { callback(); } this.cdr.detectChanges(); if(this.subCategories && save) { this.subCategories.init(); + this.subCategories.enable(); } } diff --git a/utils/transition-group/transition-group.component.ts b/utils/transition-group/transition-group.component.ts index 8cea910d..e5d9a484 100644 --- a/utils/transition-group/transition-group.component.ts +++ b/utils/transition-group/transition-group.component.ts @@ -30,13 +30,14 @@ export class TransitionGroupComponent implements AfterViewInit, OnDestroy { @Input() public id: string; public size: number; + private disabled: boolean = false; private subscription: Subscription; constructor(public element: ElementRef) {} ngAfterViewInit() { this.subscription = this.items.changes.subscribe(items => { - if(items.length === this.size) { + if(items.length === this.size && !this.disabled) { items.forEach(item => item.prevPos = item.newPos || item.prevPos); items.forEach(this.runCallback); this.refreshPosition('newPos'); @@ -126,17 +127,17 @@ export class TransitionGroupComponent implements AfterViewInit, OnDestroy { /** * Enable transition - * @deprecated + * * */ enable() { - console.debug('Deprecated') + this.disabled = false; } /** * Disable transition - * @deprecated + * * */ disable() { - console.debug('Deprecated') + this.disabled = true; } } -- 2.17.1 From 8a8b58eeaaca3f304b57f54af9c02ba18ad83531 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 9 May 2024 16:44:54 +0300 Subject: [PATCH 50/64] [develop | DONE ADDED] add direct linking for organizations --- claims/claim-utils/claimHelper.class.ts | 14 +++- claims/claim-utils/claims.properties.ts | 20 ++++++ .../displayClaims.component.html | 13 ++-- .../displayClaims/displayClaims.component.ts | 25 ++++--- .../claimEntityFormatter.component.ts | 8 ++- .../claimEntityFormatter.module.ts | 5 +- .../organizationTitleFormatter.component.ts | 18 +++++ claims/claim-utils/service/claims.service.ts | 10 ++- .../directLinking.component.html | 2 +- .../directLinking/directLinking.component.ts | 68 ++++++++++++++----- .../insertClaim/insertClaim.component.ts | 34 +++++++++- claims/linking/linkingGeneric.component.html | 15 ++-- claims/linking/linkingGeneric.component.ts | 6 +- .../selected/ClaimEntityTitle.component.ts | 6 ++ .../selected/metadataPreview.component.html | 21 +++--- .../selected/metadataPreview.component.ts | 2 + .../selected/metadataPreview.module.ts | 17 ++--- 17 files changed, 215 insertions(+), 69 deletions(-) create mode 100644 claims/claim-utils/claims.properties.ts create mode 100644 claims/claim-utils/entityFormatter/organizationTitleFormatter.component.ts diff --git a/claims/claim-utils/claimHelper.class.ts b/claims/claim-utils/claimHelper.class.ts index d3fb38f4..86239830 100644 --- a/claims/claim-utils/claimHelper.class.ts +++ b/claims/claim-utils/claimHelper.class.ts @@ -38,6 +38,12 @@ export class ClaimProject { public fundingLevel0: string; public url: string; } +export class ClaimOrganization { + public name: string; + // public shortName: string; + public url: string; + // public country: string; +} export class ClaimContext { public community: string; @@ -72,6 +78,7 @@ export class ClaimEntity { result: ClaimResult; project: ClaimProject; context: ClaimContext; + organization: ClaimOrganization; constructor() { this.warningMessages = []; @@ -117,7 +124,12 @@ export class ClaimDBContext { title: string; openaireId: string; } - +export class ClaimDBOrganization { + openaireId: string; + name: string; + shortName: string; + country: string; +} export class ClaimDBProject { openaireId: string; name: string; diff --git a/claims/claim-utils/claims.properties.ts b/claims/claim-utils/claims.properties.ts new file mode 100644 index 00000000..4e53a1ab --- /dev/null +++ b/claims/claim-utils/claims.properties.ts @@ -0,0 +1,20 @@ +export class ClaimsProperties{ + ALLOW_ORGANIZATION_LINKING:boolean = false; + INLINE_ENTITY = { + show: true, + guideText : null + } + BASKET ={ + source_title: "Source", + target_title: "Link source to" + } + METADATA_PREVIEW ={ + source_title: "Source", + target_title: "Link to", + edit_source_title: "Edit", + edit_target_title: "Edit", + edit_target_icon: "edit" + } + + +} diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html index 94034a2e..8aa09cae 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/claims/claim-utils/displayClaims/displayClaims.component.html @@ -1,25 +1,27 @@
            -
            +
            -
            +
            -
            -
            +
            -
            +
            +
            + Mine +
            @@ -43,6 +45,7 @@ type="select" [options]="sortOptions">
            +
            diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index 8fd1f4ee..9e9e4648 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -40,7 +40,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { page: number = 1; size: number = 50; keyword: string; // the keyword string to give to the request as parameter - types = ["All", "Project", "Context", "Result", "User"]; + types = ["All", "Project", "Context", "Result", "User", "Organization"]; loading: boolean = false; @Input() fetchBy: string; @Input() fetchId: string; @@ -53,6 +53,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { public filterForm: FormGroup; public entities: string[] = []; selected = []; + mine = false; allOptions: Option[] = [ {label: OpenaireEntities.PUBLICATIONS, value: "publication"}, @@ -133,6 +134,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { this.fetchId = this.fetchId ? this.fetchId : ''; } let page = (params['page'] === undefined) ? 1 : +params['page']; + this.mine = (params['mine'] == 'true' ? true:false); this.keyword = (params['keyword'] ? params['keyword'] : ""); this.filterForm.get('keyword').setValue(this.keyword); this.page = (page <= 0) ? 1 : page; @@ -186,6 +188,16 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId); } ); + } else if (this.fetchBy == "Organization") { + this.subResults = this._claimService.getClaimsByOrganization(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe( + data => { + this.manageAPIData(data); + this.loading = false; + }, + err => { + this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId); + } + ); } else if (this.fetchBy == "User") { this.subResults = this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( data => { @@ -209,7 +221,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { } ); } else if (this.fetchBy == "Context") { - this.subResults = this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + this.subResults = this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe( data => { this.manageAPIData(data); this.loading = false; @@ -220,7 +232,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { } ); } else { - this.subResults = this._claimService.getClaims(this.size, this.page, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + this.subResults = this._claimService.getClaims(this.size, this.page, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL, this.mine).subscribe( data => { this.manageAPIData(data); this.loading = false; @@ -259,15 +271,8 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { types += (types.length > 0 ? ',' : '') + type; } params += (this.entities.length > 0) ? (params.length > 0 ? '&' : '') + "types=" + types : ""; - if (this.isAdmin) { - params += (this.fetchBy == 'All' ? "" : (params.length > 0 ? '&' : '') + "fetchBy=" + this.fetchBy); - params += (this.fetchId == '' ? "" : (params.length > 0 ? '&' : '') + "fetchId=" + this.fetchId); - } params += (this.filterForm.get("sort").value.sort == 'date' && this.filterForm.get("sort").value.descending ? "" : (params.length > 0 ? '&' : '') + "sort=" + this.filterForm.get("sort").value.sort + "-" + this.filterForm.get("sort").value.descending); params += (this.keyword == '' ? "" : (params.length > 0 ? '&' : '') + "keyword=" + this.keyword); - if (this.communityId != null) { - params += "&communityId=" + this.communityId; - } return params; } diff --git a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts index 547e4c16..b1571d34 100644 --- a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts @@ -1,6 +1,6 @@ import {Component, Input} from '@angular/core'; import {EnvProperties} from '../../../utils/properties/env-properties'; -import {ClaimDBContext, ClaimDBProject, ClaimDBResult} from "../claimHelper.class"; +import {ClaimDBContext, ClaimDBOrganization, ClaimDBProject, ClaimDBResult} from "../claimHelper.class"; import {OpenaireEntities} from "../../../utils/properties/searchFields"; import {StringUtils} from "../../../utils/string-utils.class"; @@ -26,6 +26,10 @@ import {StringUtils} from "../../../utils/string-utils.class";
            +
            + Link to: + +
            Link to:
            @@ -36,7 +40,7 @@ import {StringUtils} from "../../../utils/string-utils.class"; }) export class ClaimEntityFormatter { - @Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject; + @Input() entity: ClaimDBResult | ClaimDBContext | ClaimDBProject | ClaimDBOrganization; @Input() type: string; @Input() properties: EnvProperties; @Input() externalPortalUrl: string = null; diff --git a/claims/claim-utils/entityFormatter/claimEntityFormatter.module.ts b/claims/claim-utils/entityFormatter/claimEntityFormatter.module.ts index 620c7f1b..a14f1e27 100644 --- a/claims/claim-utils/entityFormatter/claimEntityFormatter.module.ts +++ b/claims/claim-utils/entityFormatter/claimEntityFormatter.module.ts @@ -5,18 +5,19 @@ import { RouterModule } from '@angular/router'; import {ProjectTitleFormatter} from './projectTitleFormatter.component'; import {PublicationTitleFormatter} from './publicationTitleFormatter.component'; import {ClaimEntityFormatter} from './claimEntityFormatter.component'; +import {OrganizationTitleFormatterComponent} from "./organizationTitleFormatter.component"; @NgModule({ imports: [ CommonModule, RouterModule ], declarations: [ - ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter + ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter, OrganizationTitleFormatterComponent ], providers: [ ], exports: [ - ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter + ProjectTitleFormatter, PublicationTitleFormatter, ClaimEntityFormatter, OrganizationTitleFormatterComponent ] }) diff --git a/claims/claim-utils/entityFormatter/organizationTitleFormatter.component.ts b/claims/claim-utils/entityFormatter/organizationTitleFormatter.component.ts new file mode 100644 index 00000000..4160eac6 --- /dev/null +++ b/claims/claim-utils/entityFormatter/organizationTitleFormatter.component.ts @@ -0,0 +1,18 @@ +import {Component, Input} from '@angular/core'; + +@Component({ + selector: 'organization-title', + template: ` +
            +

            + {{(organization.shortName ? ('[' + organization.shortName + '] ') : '')}}{{organization.name}} +

            +
            + ` +}) + +export class OrganizationTitleFormatterComponent { + @Input() organization: any; + public url: string; + +} diff --git a/claims/claim-utils/service/claims.service.ts b/claims/claim-utils/service/claims.service.ts index d7d46218..54208d7b 100644 --- a/claims/claim-utils/service/claims.service.ts +++ b/claims/claim-utils/service/claims.service.ts @@ -12,8 +12,8 @@ export class ClaimsService { private getClaimRequest(size : number, page : number, url :string, fromCache:boolean):any { return this.http.get(url, CustomOptions.getAuthOptionsWithBody()); } - getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string):any { - let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); + getClaims( size : number, page : number, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string, mine:boolean):any { + let url = apiUrl +"claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types) + (mine?"&mine=true":"") + (mine?"&mine=true":""); return this.getClaimRequest(size,page,url,true); } @@ -23,7 +23,7 @@ export class ClaimsService { return this.getClaimRequest(size,page,url,false); } - getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string , apiUrl:string):any { + getClaimsBycontext( size : number, page : number, contextId:string, keyword:string, sortby: string, descending: boolean, types: string , apiUrl:string, mine:boolean):any { //console.info('ClaimsService: getClaims for context : '+contextId); let url = apiUrl +"contexts/"+contextId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); return this.getClaimRequest(size,page,url,true); @@ -40,6 +40,10 @@ export class ClaimsService { let url = apiUrl +"projects/"+projectId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types); return this.getClaimRequest(size,page,url,true); } + getClaimsByOrganization( size : number, page : number, organizationId:string, keyword:string, sortby: string, descending: boolean, types: string, apiUrl:string, mine:boolean):any { + let url = apiUrl +"organizations/"+organizationId+"/claims"+"?offset="+(size*(page-1) + "&limit="+size)+"&keyword="+keyword+"&sortby="+sortby+"&descending="+descending+(types.length>0?"&"+types:types) + (mine?"&mine=true":""); + return this.getClaimRequest(size,page,url,true); + } deleteClaimById(claimId:string , apiUrl:string):any{ //console.warn('Trying to delete claim with id : '+claimId); diff --git a/claims/directLinking/directLinking.component.html b/claims/directLinking/directLinking.component.html index e05bc3a3..f34e2c57 100644 --- a/claims/directLinking/directLinking.component.html +++ b/claims/directLinking/directLinking.component.html @@ -1,6 +1,6 @@ + pageTitle="Direct Linking" [claimsProperties]="claimsProperties">
            diff --git a/claims/directLinking/directLinking.component.ts b/claims/directLinking/directLinking.component.ts index 70d46032..b74beb83 100644 --- a/claims/directLinking/directLinking.component.ts +++ b/claims/directLinking/directLinking.component.ts @@ -1,7 +1,7 @@ import {Component, Input, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; import {EnvProperties} from '../../utils/properties/env-properties'; -import {ClaimEntity, ClaimProject, ShowOptions} from '../claim-utils/claimHelper.class'; +import {ClaimEntity, ClaimOrganization, ClaimProject, ShowOptions} from '../claim-utils/claimHelper.class'; import {EntitiesSearchService} from '../../utils/entitiesAutoComplete/entitySearch.service'; import {SearchResearchResultsService} from '../../services/searchResearchResults.service'; import {LinkingGenericComponent} from "../linking/linkingGeneric.component"; @@ -11,6 +11,7 @@ import {properties} from "../../../../environments/environment"; import {OpenaireEntities} from "../../utils/properties/searchFields"; import {StringUtils} from "../../utils/string-utils.class"; import {ClaimProjectsSearchFormComponent} from "../claim-utils/claimProjectSearchForm.component"; +import {ClaimsProperties} from "../claim-utils/claims.properties"; @Component({ @@ -24,18 +25,20 @@ export class DirectLinkingComponent { // linkType: string = "project"; // link type (selected in home page) : project, context, software, etc /* url Parameters for inline linking */ - id: string = null; //entity id + @Input() id: string = null; //entity id type: string = null; // entity type (publication or dataset) // linkTo: string = null; // entity type (project or context or entity) // linkToEntities: string[] = []; showOptions:ShowOptions = new ShowOptions(); - validEntityTypes = ["dataset", "publication", "software", "other", "project", "context"]; + validEntityTypes = ["dataset", "publication", "software", "other", "project", "context", "organization"]; sources: ClaimEntity[] = []; inlineEntity: ClaimEntity = null; validInput: boolean = null;//'true; properties: EnvProperties; @Input() communityId: string = null; localStoragePrefix: string = ""; + @Input() organizationClaim: boolean = false; + @Input() claimsProperties:ClaimsProperties; constructor(private _router: Router, private route: ActivatedRoute,private entitySearch:EntitiesSearchService, private _searchResearchResultsService: SearchResearchResultsService) {} subscriptions = []; @@ -48,11 +51,18 @@ export class DirectLinkingComponent { } ngOnInit() { this.properties = properties; - + /* if(!this.claimsProperties){ + this.claimsProperties = new ClaimsProperties(); + }*/ this.subscriptions.push(this.route.queryParams.subscribe(params => { - this.id = params['id']; - this.type = params['type']; - this.showOptions.linkTo = params['linkTo']; + if(this.organizationClaim){ + this.type = "organization"; + this.showOptions.linkTo = "result"; + }else { + this.id = params['id']; + this.type = params['type']; + this.showOptions.linkTo = params['linkTo']; + } if (this.type != null && this.showOptions.linkTo != null) { this.type = (this.validEntityTypes.indexOf(this.type) != -1) ? this.type : 'publication'; this.showOptions.linkTo = (this.validEntityTypes.indexOf(this.showOptions.linkTo) != -1 || this.showOptions.linkTo == "result") ? this.showOptions.linkTo : 'project'; @@ -68,6 +78,8 @@ export class DirectLinkingComponent { if (this.type == "project") { // this.linkType = "project"; this.getProjectById(this.id); + } else if (this.type == "organization") { + this.getOrganizationById(this.id); } else if (this.type == "publication") { this.getResearchResultById("publication", this.id); } else if (this.type == "dataset") { @@ -81,7 +93,7 @@ export class DirectLinkingComponent { } //set which entities it is allowed to link to. // add first the - if(this.type == "project"){ + if(this.type == "project" || this.type == "organization"){ this.showOptions.linkToEntities = ["result"]; this.showOptions.linkTo = "result"; }else{ @@ -95,24 +107,27 @@ export class DirectLinkingComponent { this.showOptions.linkToEntities = ["result","project","context" ]; } + } + + } else { + this.validInput = this.isValidInput(null); + } - } else { - this.validInput = this.isValidInput(null); + })); - } - - })); } isValidInput(result: ClaimEntity) { if (result == null) { return false; - } else if (this.type == "project" && this.showOptions.linkTo != "result") { + } else if (this.type == "organization" && !this.claimsProperties.ALLOW_ORGANIZATION_LINKING) { + return false; + } else if ((this.type == "project" || this.type == "organization") && this.showOptions.linkTo != "result") { return false; } else if (["dataset", "publication", "software", "other"].indexOf(this.type) != -1 && (["project", "context", "result"].indexOf(this.showOptions.linkTo) == -1)) { return false; - } else if (["project", "dataset", "publication", "software", "other"].indexOf(this.type) == -1) { + } else if (["project", "dataset", "publication", "software", "other", "organization"].indexOf(this.type) == -1) { return false; } else { return true; @@ -130,6 +145,17 @@ export class DirectLinkingComponent { this.handleError("Error getting project by id: " + id, err); })); } + getOrganizationById(id: string) { + this.subscriptions.push(this.entitySearch.fetchByType(id,"organization", this.properties).subscribe( + data => { + this.createClaimEntity(data, "organization"); + }, + err => { + this.validInput = this.isValidInput(null); + //console.log("An error occured") + this.handleError("Error getting project by id: " + id, err); + })); + } getResearchResultById(resultType: string, id: string) { this.subscriptions.push(this._searchResearchResultsService.searchById(resultType, id, this.properties).subscribe(data => { @@ -162,7 +188,17 @@ export class DirectLinkingComponent { entity.project.jurisdiction = project.jurisdiction; entity.project.startDate = project.startDate; this.inlineEntity = entity; - }else{ + }else if(type =="organization"){ + let organization = data[0]; + let entity:ClaimEntity = new ClaimEntity(); + entity.id = organization.id; + entity.type = "organization"; + entity.title = organization.label; + entity.organization = new ClaimOrganization(); + // entity.organization.url = properties.searchLinkToOrganization + entity.id; + entity.organization.name = organization.label; + this.inlineEntity = entity; + }else{ results = ClaimResultSearchFormComponent.openaire2ClaimResults(data, this.properties); } diff --git a/claims/linking/insertClaim/insertClaim.component.ts b/claims/linking/insertClaim/insertClaim.component.ts index 0cf983e5..4aebe5f3 100644 --- a/claims/linking/insertClaim/insertClaim.component.ts +++ b/claims/linking/insertClaim/insertClaim.component.ts @@ -176,7 +176,7 @@ export class ClaimInsertComponent { "id": entity.id, "record": ClaimInsertComponent.createDirectClaim(entity, this.sources, idSuffix) }); - } else if (this.inlineEntity) { + } else if (this.inlineEntity && this.inlineEntity.type != "organization") { directclaims.push({ "id": entity.id, "record": ClaimInsertComponent.createDirectClaim(entity, [this.inlineEntity], idSuffix) @@ -193,6 +193,8 @@ export class ClaimInsertComponent { claims.push(ClaimInsertComponent.createContextClaim(result, entity, user.email, dashboard, idSuffix)); } else if (entity.project) { claims.push(ClaimInsertComponent.createProjectClaim(result, entity, user.email, dashboard, idSuffix)); + /* } else if (entity.organization) { + claims.push(ClaimInsertComponent.createOrganizationClaim(result, entity, user.email, dashboard, idSuffix));*/ } this.infoToLog.push([ result.title?result.title: result.id, entity.title?entity.title:entity.id]); @@ -212,6 +214,10 @@ export class ClaimInsertComponent { if (entity.result) { claims.push(ClaimInsertComponent.createProjectClaim(entity, this.inlineEntity, user.email, dashboard, idSuffix)); } + } else if (this.inlineEntity.organization) { + if (entity.result) { + claims.push(ClaimInsertComponent.createOrganizationClaim(entity, this.inlineEntity, user.email, dashboard, idSuffix)); + } } } @@ -385,8 +391,13 @@ export class ClaimInsertComponent { localStorage.removeItem(this.localStoragePrefix + "results"); localStorage.removeItem(this.localStoragePrefix + "claimsJob"); localStorage.removeItem(this.localStoragePrefix + "feedRecordsJob"); - - this._router.navigate([this.properties.myClaimsLink], {queryParams: this.params}); + if(this.properties.myClaimsLink && this.properties.myClaimsLink.indexOf(".") == -1) { + this._router.navigate([this.properties.myClaimsLink], {queryParams: this.params}); + }else if(this.properties.myClaimsLink && this.properties.myClaimsLink.indexOf(".") != -1) { + this._router.navigate([this.properties.myClaimsLink], {relativeTo: this.route}); + }else{ + this._router.navigate(["/"]); + } } } @@ -426,6 +437,23 @@ export class ClaimInsertComponent { idSuffix : idSuffix }; } + private static createOrganizationClaim(resultEntity: ClaimEntity, organizationEntity: ClaimEntity, user: any, dashboard:string, idSuffix:string): ClaimRecord2Insert { + return { + claimedBy: user, + sourceId: organizationEntity.id, + sourceType: "organization", + sourceCollectedFrom: "openaire", + sourceAccessRights: "OPEN", + sourceEmbargoEndDate: "", + targetId: resultEntity.id, + targetType: resultEntity.type, + targetCollectedFrom: resultEntity.result.source, + targetAccessRights: resultEntity.result.accessRights, + targetEmbargoEndDate: ClaimInsertComponent.getEmbargoEndDate(resultEntity), + claimedInDashboard : dashboard, + idSuffix : idSuffix + }; + } private static createResultClaim(inlineResult: ClaimEntity, resultEntity: ClaimEntity, user: string, dashboard:string, idSuffix:string): ClaimRecord2Insert { diff --git a/claims/linking/linkingGeneric.component.html b/claims/linking/linkingGeneric.component.html index 16cb04bf..625d75d0 100644 --- a/claims/linking/linkingGeneric.component.html +++ b/claims/linking/linkingGeneric.component.html @@ -67,18 +67,19 @@ [results]="results" [sources]="sources" [localStoragePrefix]="localStoragePrefix" [inlineEntity]="inlineEntity" [showOptions]="showOptions" [properties]=properties [pageContents]="pageContents" - [defaultColors]="!communityId" [communityId]="communityId" + [defaultColors]="!communityId" [communityId]="communityId" [claimsProperties]="claimsProperties" >
            -
            +
            -

            Link source to

            +

            Link source to

            +
            {{claimsProperties.INLINE_ENTITY.guideText}}
            -
            -
            Source
            +
            +
            {{claimsProperties.BASKET.source_title}}
            -

            +

            -
            Link source to ({{(results.length) | number}})
            +
            {{claimsProperties.BASKET.target_title}} ({{(results.length) | number}})
            diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index 31b76062..a7a18c6d 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -18,6 +18,7 @@ import {RouterHelper} from "../../utils/routerHelper.class"; import { Location } from '@angular/common'; import {LoginErrorCodes} from "../../login/utils/guardHelper.class"; import {UserManagementService} from "../../services/user-management.service"; +import {ClaimsProperties} from "../claim-utils/claims.properties"; @Component({ selector: 'linking-generic', @@ -49,7 +50,7 @@ export class LinkingGenericComponent { public pageContents = null; @Input() breadcrumbs: Breadcrumb[] = []; public routerHelper: RouterHelper = new RouterHelper(); - + @Input() claimsProperties:ClaimsProperties; constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, private _meta: Meta, private _title: Title, private _piwikService:PiwikService, private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef, @@ -58,6 +59,9 @@ export class LinkingGenericComponent { subscriptions = []; ngOnInit() { + /* if(!this.claimsProperties){ + this.claimsProperties = new ClaimsProperties(); + }*/ this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { if (!user) { this.saveStateAndRedirectLogin(); diff --git a/claims/linking/selected/ClaimEntityTitle.component.ts b/claims/linking/selected/ClaimEntityTitle.component.ts index 12231e53..c432a266 100644 --- a/claims/linking/selected/ClaimEntityTitle.component.ts +++ b/claims/linking/selected/ClaimEntityTitle.component.ts @@ -12,6 +12,9 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; assignment_turned_in + + account_balance + people @@ -46,6 +49,9 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; + + {{sliceString(entity.title)}} + {{entity.context.community }} > {{entity.context.category}} > diff --git a/claims/linking/selected/metadataPreview.component.html b/claims/linking/selected/metadataPreview.component.html index a0723118..9a6dd093 100644 --- a/claims/linking/selected/metadataPreview.component.html +++ b/claims/linking/selected/metadataPreview.component.html @@ -6,15 +6,14 @@
            -
            +
            -
            +
            - SOURCES ({{sources.length + (inlineEntity ? 1 : 0) | number}}) + {{claimsProperties.METADATA_PREVIEW.source_title}} ({{sources.length + (inlineEntity ? 1 : 0) | number}}) Edit - sources + uk-icon="pencil" class="uk-margin-xsmall-right">{{claimsProperties.METADATA_PREVIEW.edit_source_title}}
            • @@ -153,13 +152,15 @@
            -
            - LINK TO ({{results.length | number}}) +
            + {{claimsProperties.METADATA_PREVIEW.target_title}} ({{results.length | number}}) +
            diff --git a/claims/linking/selected/metadataPreview.component.ts b/claims/linking/selected/metadataPreview.component.ts index 8aedd081..cd2ce799 100644 --- a/claims/linking/selected/metadataPreview.component.ts +++ b/claims/linking/selected/metadataPreview.component.ts @@ -4,6 +4,7 @@ import {ClaimEntity, ClaimsErrorMessage, Message, ShowOptions} from '../../claim import {EnvProperties} from "../../../utils/properties/env-properties"; import {Dates} from "../../../utils/string-utils.class"; import {HelperFunctions} from "../../../utils/HelperFunctions.class"; +import {ClaimsProperties} from "../../claim-utils/claims.properties"; @Component({ selector: 'metadata-preview', @@ -28,6 +29,7 @@ export class MetadataPreviewComponent { @ViewChild(AlertModal) alertApplyAll; @Input() localStoragePrefix: string = ""; @Input() communityId:string= null; + @Input() claimsProperties:ClaimsProperties; errors:ClaimsErrorMessage[] = []; warnings:Message[] = []; public commonAccessRights = "OPEN"; // for access rights- changes when user apply a change to every entity diff --git a/claims/linking/selected/metadataPreview.module.ts b/claims/linking/selected/metadataPreview.module.ts index 2c7fdb17..7e414381 100644 --- a/claims/linking/selected/metadataPreview.module.ts +++ b/claims/linking/selected/metadataPreview.module.ts @@ -11,16 +11,17 @@ import { MatInputModule } from '@angular/material/input'; import { MatSelectModule } from '@angular/material/select'; import {HelperModule} from "../../../utils/helper/helper.module"; import {SelectedPublicationsModule} from "./selectedResults.module"; +import {IconsModule} from "../../../utils/icons/icons.module"; @NgModule({ - imports: [ - SharedModule, - AlertModalModule, - ClaimEntitiesMetadataModule, - InsertClaimsModule, - MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatSelectModule, - HelperModule, SelectedPublicationsModule - ], + imports: [ + SharedModule, + AlertModalModule, + ClaimEntitiesMetadataModule, + InsertClaimsModule, + MatDatepickerModule, MatNativeDateModule, MatFormFieldModule, MatInputModule, MatSelectModule, + HelperModule, SelectedPublicationsModule, IconsModule + ], declarations: [MetadataPreviewComponent], exports:[MetadataPreviewComponent] }) -- 2.17.1 From c00403a24ceb2593dd054223bd479e8930ddb1bc Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 10 May 2024 11:33:42 +0300 Subject: [PATCH 51/64] [develop | DONE | FIXED] linking initialize properly claims properties when there are not pass as input --- claims/directLinking/directLinking.component.ts | 2 +- claims/linking/linkingGeneric.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/claims/directLinking/directLinking.component.ts b/claims/directLinking/directLinking.component.ts index b74beb83..f84b0e59 100644 --- a/claims/directLinking/directLinking.component.ts +++ b/claims/directLinking/directLinking.component.ts @@ -38,7 +38,7 @@ export class DirectLinkingComponent { @Input() communityId: string = null; localStoragePrefix: string = ""; @Input() organizationClaim: boolean = false; - @Input() claimsProperties:ClaimsProperties; + @Input() claimsProperties:ClaimsProperties = new ClaimsProperties(); constructor(private _router: Router, private route: ActivatedRoute,private entitySearch:EntitiesSearchService, private _searchResearchResultsService: SearchResearchResultsService) {} subscriptions = []; diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index a7a18c6d..b5c0a683 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -50,7 +50,7 @@ export class LinkingGenericComponent { public pageContents = null; @Input() breadcrumbs: Breadcrumb[] = []; public routerHelper: RouterHelper = new RouterHelper(); - @Input() claimsProperties:ClaimsProperties; + @Input() claimsProperties:ClaimsProperties = new ClaimsProperties(); constructor (private _router: Router, private route: ActivatedRoute, private entitySearch:EntitiesSearchService, private _meta: Meta, private _title: Title, private _piwikService:PiwikService, private seoService: SEOService, private helper: HelperService, private cdr: ChangeDetectorRef, -- 2.17.1 From c1a81511844cf5b7f51276b493eb9f85ef8c746f Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 10 May 2024 11:34:17 +0300 Subject: [PATCH 52/64] [develop | DONE | FIXED] linking disable link to unidentified for manage claims page --- .../entityFormatter/projectTitleFormatter.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts index 14ee0e60..75013234 100644 --- a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts @@ -10,10 +10,10 @@ import {properties} from "../../../../../environments/environment";

            - + {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} - + {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}

            -- 2.17.1 From f595ec50359559abe5f7db2103ca962219bc7d2d Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 20 May 2024 15:04:56 +0300 Subject: [PATCH 53/64] [develop | WIP | ADDED]: [DEVELOPMENT ONLY] Added level4 in browse Fields of Science (FoS) 1. smooth-scroll.ts: Get behavior from current navigation > extras > state. 2. fos.component: Display level 4 FoS and handle url fragments and page scrolling accordingly. --- fos/fos.component.html | 116 +++++++++++++++++++++++++++++++++++---- fos/fos.component.ts | 122 ++++++++++++++++++++++++++++++++++------- utils/smooth-scroll.ts | 8 ++- 3 files changed, 210 insertions(+), 36 deletions(-) diff --git a/fos/fos.component.html b/fos/fos.component.html index 1d0c8bf5..5bc80108 100644 --- a/fos/fos.component.html +++ b/fos/fos.component.html @@ -36,9 +36,11 @@
            -
            + +
            -
            + @@ -137,10 +223,16 @@ class="uk-link-text" [innerHTML]="highlightKeyword(subItem.id)"> -
            +
            + +
            + + +
            diff --git a/fos/fos.component.ts b/fos/fos.component.ts index 3065b2c0..e86317ea 100644 --- a/fos/fos.component.ts +++ b/fos/fos.component.ts @@ -16,6 +16,7 @@ import {debounceTime, distinctUntilChanged} from "rxjs/operators"; import Timeout = NodeJS.Timeout; import {ISVocabulariesService} from "../utils/staticAutoComplete/ISVocabularies.service"; import {SearchFields} from "../utils/properties/searchFields"; +import {HelperFunctions} from "../utils/HelperFunctions.class"; declare var UIkit; @@ -28,6 +29,8 @@ export class FosComponent implements OnInit, OnDestroy { public url: string = null; public pageTitle: string = "OpenAIRE | Fields of Science"; public pageDescription: string = "We have integrated a Field-of-Science (FoS) taxonomy into our dataset to organize and discover research more effectively. Using the full capabilities of the OpenAIRE Graph (full-texts, citations, references, venues) we apply AI and bring forward any multidisciplinarity potential."; + public scrollPos = 0; + public selectedParentLevels = []; public fos: any[] = []; public fosOptions: string[] = []; public activeSection: string; @@ -82,21 +85,43 @@ export class FosComponent implements OnInit, OnDestroy { item.classList.remove('uk-active'); }); if (this.route.snapshot.fragment) { - this.activeSection = this.route.snapshot.fragment; - let i = this.fos.findIndex(item => item.id == this.route.snapshot.fragment); - slider.show(i); + let splitFragment = this.route.snapshot.fragment.split("||"); + this.activeSection = this.route.snapshot.fragment.split("||")[0]; + let i = this.fos.findIndex(item => (item.id == this.route.snapshot.fragment || this.route.snapshot.fragment.startsWith(item.id+"||"))); + if(i <0 || i>this.fos.length-1) { + this._router.navigate(['./'], {fragment: "", relativeTo: this.route, state: {disableScroll: true}}); + } else { + if (splitFragment.length > 1) { + let level1 = this.fos[i]; + let level2 = null; + let level3 = null; + if (level1.children) { + level2 = level1.children.find(item => item.code == splitFragment[1]); + if (level2 && level2.children) { + level3 = level2.children.find(item => item.code == splitFragment[2]); + this.selectedParentLevels = [this.fos[i], level2, level3]; + } + } + if(!level2 || !level3) { + this._router.navigate(['./'], {fragment: level1.id, relativeTo: this.route, state: {disableScroll: true}}); + } + } else { + slider.show(i); + } + } } else { this.activeSection = this.fos[0].id; } this.cdr.detectChanges(); }); } + this.subscriptions.push(this.route.fragment.subscribe(fragment => { if(fragment) { - this.activeSection = fragment; + this.activeSection = fragment.split("||")[0]; if(this.tabs) { let slider = UIkit.slider(this.tabs.nativeElement); - let i = this.fos.findIndex(item => item.id == fragment); + let i = this.fos.findIndex(item => (item.id == fragment || fragment.startsWith(item.id+"||"))); slider.show(i); } } else { @@ -105,13 +130,16 @@ export class FosComponent implements OnInit, OnDestroy { })); this.keywordControl = this.fb.control(''); this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => { - this.keyword = value; - this.findMatches(this.keyword); - if (typeof IntersectionObserver !== 'undefined') { - setTimeout(() => { - this.setObserver(); - }); - } + if(this.keyword !== undefined || value) { + this.selectedParentLevels = []; + } + this.keyword = value; + this.findMatches(this.keyword); + if (typeof IntersectionObserver !== 'undefined') { + setTimeout(() => { + this.setObserver(); + }); + } })); }); } @@ -154,11 +182,16 @@ export class FosComponent implements OnInit, OnDestroy { this.fos.forEach(fos => { this.fosOptions.push(fos.id); if(fos.children) { - fos.children.forEach(child => { - this.fosOptions.push(child.id); - if(child.children) { - child.children.forEach(child2 => { - this.fosOptions.push(child2.id); + fos.children.forEach(l2 => { + this.fosOptions.push(l2.id); + if(l2.children) { + l2.children.forEach(l3 => { + this.fosOptions.push(l3.id); + if(l3.children) { + l3.children.forEach(l4 => { + this.fosOptions.push(l4.id); + }) + } }); } }); @@ -170,19 +203,29 @@ export class FosComponent implements OnInit, OnDestroy { this.viewResults = JSON.parse(JSON.stringify(this.fos)); let matchLevel1: boolean = false; let matchLevel2: boolean = false; + let matchLevel3: boolean = false; // 1st level search if(this.viewResults.length) { this.viewResults = this.viewResults.filter(item => { matchLevel1 = !!item.id.includes(value?.toLowerCase()); - // // 2nd level search + // 2nd level search if(item.children?.length && !matchLevel1) { item.children = item.children.filter(subItem => { matchLevel2 = !!subItem.id.includes(value?.toLowerCase()); // 3rd level search if(subItem.children?.length && !matchLevel2) { - subItem.children = subItem.children.filter(subSubItem => subSubItem.id.includes(value?.toLowerCase())); + subItem.children = subItem.children.filter(subSubItem => { + matchLevel3 = subSubItem.id.includes(value?.toLowerCase()); + // 4th level search + if(subSubItem.children?.length && !matchLevel3) { + subSubItem.children = subSubItem.children.filter(level4Item => { + return level4Item.id.toLowerCase().includes(value?.toLowerCase()) + }); + } + return subSubItem.children?.length > 0 || matchLevel3; + }); } - return subItem.children?.length > 0 || matchLevel2; + return subItem.children?.length > 0; }); } return item.children?.length > 0; @@ -191,7 +234,7 @@ export class FosComponent implements OnInit, OnDestroy { } highlightKeyword(name) { - if(name.includes(this.keyword.toLowerCase())) { + if(name.toLowerCase().includes(this.keyword.toLowerCase())) { return name.replace(new RegExp(this.keyword, "gi"), (matchedValue) => `${matchedValue}`); } else { return name; @@ -221,4 +264,41 @@ export class FosComponent implements OnInit, OnDestroy { // return {'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}; return (this.searchFieldsHelper.getFosParameter() == 'foslabel' ? ({'foslabel': this.urlEncodeAndQuote(fos.id+"||"+fos.label)}) : ({'fos': this.urlEncodeAndQuote(fos.id)})); } + + public backClicked() { + let id = this.selectedParentLevels[0].id; + this.selectedParentLevels=[]; + this.cdr.detectChanges(); + + if(this.scrollPos) { + HelperFunctions.scrollTo(0, this.scrollPos); + this._router.navigate(['./'], {fragment: id, relativeTo: this.route, state: {disableScroll: true}}); + } else { + this._router.navigate(['./'], { + fragment: id, + relativeTo: this.route, + state: {disableScroll: false, behavior: 'auto'} + }); + } + + this.cdr.detectChanges(); + if (typeof IntersectionObserver !== 'undefined') { + setTimeout(() => { + this.setObserver(); + }, 200); + } + } + + public moreClicked(level1, level2, level3) { + this.scrollPos = window.scrollY; + + if(this.observer) { + this.observer.disconnect(); + } + this.selectedParentLevels=[level1, level2, level3]; + this.cdr.detectChanges(); + this._router.navigate(['./'], + {fragment: this.selectedParentLevels[0].id+"||"+this.selectedParentLevels[1].code+"||"+this.selectedParentLevels[2].code, + relativeTo: this.route, state: {disableScroll: false, behavior: 'auto'}}); + } } diff --git a/utils/smooth-scroll.ts b/utils/smooth-scroll.ts index c828b450..15400e43 100644 --- a/utils/smooth-scroll.ts +++ b/utils/smooth-scroll.ts @@ -24,10 +24,11 @@ export class SmoothScroll { } else if (event instanceof NavigationEnd) { let headerOffset = (this.layoutService.isMobileValue?0:Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--header-height'))) + 35; if(!this.router.getCurrentNavigation().extras?.state?.disableScroll) { + let behavior = this.router.getCurrentNavigation().extras?.state?.behavior ? this.router.getCurrentNavigation().extras?.state?.behavior : "smooth"; if (this.interval) { clearInterval(this.interval); } - const fragment = router.parseUrl(router.url).fragment; + const fragment = router.parseUrl(routerurl).fragment; if (this.lastComponent !== this.currentComponent) { window.scrollTo({top: 0}); } @@ -48,7 +49,7 @@ export class SmoothScroll { } else { clearInterval(interval); const y = element.getBoundingClientRect().top + window.scrollY + yOffset; - window.scrollTo({top: y, behavior: 'smooth'}); + window.scrollTo({top: y, behavior: behavior}); } }, 50); } @@ -58,7 +59,7 @@ export class SmoothScroll { }, 100); } else { setTimeout( () => { - window.scrollTo({top: 0, behavior: 'smooth'}); + window.scrollTo({top: 0, behavior: behavior}); }, 0); } } @@ -77,3 +78,4 @@ export class SmoothScroll { } } } +. \ No newline at end of file -- 2.17.1 From 1f4c0566c7f4f526124507d5b5ee9b7387893fe8 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 20 May 2024 15:16:00 +0300 Subject: [PATCH 54/64] [develop | DONE | FIXED]: availableOn.component.ts: Removed environment check in
            shown in mobile under fulltext. --- landingPages/landing-utils/availableOn.component.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index 85fef1ea..507afcb8 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -33,8 +33,9 @@ import {RouterHelper} from "../../utils/routerHelper.class";
            -

            -
            +

            +
            +
            -- 2.17.1 From 019530c22255c42b873ebe5eb30616638e4e6d8f Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 20 May 2024 15:17:26 +0300 Subject: [PATCH 55/64] [develop | DONE | FIXED]: parsingFunctions.class.ts: In "parseEoscSubjects()" method, initialize subjects if needed. --- landingPages/landing-utils/parsingFunctions.class.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index 26c1f9d0..00e90aa8 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -665,6 +665,9 @@ export class ParsingFunctions { } if(properties.environment != "production" && classifiedSubjects != null) { + if (subjects == undefined) { + subjects = new Array(); + } for (let classified of classifiedSubjects.keys()) { subjects = subjects.concat(classifiedSubjects.get(classified)); } -- 2.17.1 From d3746b28d0445a5712b2ba3b85a28a110eff87c9 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 20 May 2024 15:18:54 +0300 Subject: [PATCH 56/64] [develop | DONE | CHANGED]: organization.service.ts & searchOrganizations.service.ts: Removed environment check for parsing organization pid. --- services/organization.service.ts | 2 +- services/searchOrganizations.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/organization.service.ts b/services/organization.service.ts index b74bd92f..44a81633 100644 --- a/services/organization.service.ts +++ b/services/organization.service.ts @@ -95,7 +95,7 @@ export class OrganizationService { } } - if(organization['pid'] && properties.environment != "production") { + if(organization['pid']) { this.organizationInfo.identifiers = this.parsingFunctions.parseIdentifiers(organization['pid']); } } diff --git a/services/searchOrganizations.service.ts b/services/searchOrganizations.service.ts index 019b8146..60b4d794 100644 --- a/services/searchOrganizations.service.ts +++ b/services/searchOrganizations.service.ts @@ -175,7 +175,7 @@ export class SearchOrganizationsService { result.country = resData.country.classname; } - if(resData['pid'] && properties.environment != "production") { + if(resData['pid']) { result.identifiers = this.parsingFunctions.parseIdentifiers(resData['pid']); } -- 2.17.1 From 8bcafd30262da4c1fb72733231c23417b03c3822 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 20 May 2024 15:24:04 +0300 Subject: [PATCH 57/64] [develop | DONE | FIXED]: smooth-scroll.ts: Accidental error by mistyping. --- utils/smooth-scroll.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/utils/smooth-scroll.ts b/utils/smooth-scroll.ts index 15400e43..40014030 100644 --- a/utils/smooth-scroll.ts +++ b/utils/smooth-scroll.ts @@ -28,7 +28,7 @@ export class SmoothScroll { if (this.interval) { clearInterval(this.interval); } - const fragment = router.parseUrl(routerurl).fragment; + const fragment = router.parseUrl(router.url).fragment; if (this.lastComponent !== this.currentComponent) { window.scrollTo({top: 0}); } @@ -77,5 +77,4 @@ export class SmoothScroll { clearInterval(this.interval); } } -} -. \ No newline at end of file +} \ No newline at end of file -- 2.17.1 From 2a28cd8ad5e917de507e6c112f9949a18fc263ea Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 20 May 2024 15:59:32 +0300 Subject: [PATCH 58/64] [develop | DONE | CHANGED]: #9764 - searchOrganizations.service.ts: Parse and display organization legalname and legalshortname. --- services/searchOrganizations.service.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/services/searchOrganizations.service.ts b/services/searchOrganizations.service.ts index 60b4d794..2bf09fca 100644 --- a/services/searchOrganizations.service.ts +++ b/services/searchOrganizations.service.ts @@ -100,13 +100,16 @@ export class SearchOrganizationsService { result['title'] = {"name": '', "accessMode": ''}; - if(resData.legalshortname) { - result['title'].name = StringUtils.HTMLToString(String(resData.legalshortname)); - } - if(!result['title'].name || result['title'].name == '') { + if(resData.legalname) { result['title'].name = StringUtils.HTMLToString(String(resData.legalname)); + } else { + result['title'].name = ""; } + if(resData.legalshortname) { + result['acronym'] = StringUtils.HTMLToString(String(resData.legalshortname)); + } + //result['title'].url = OpenaireProperties.getsearchLinkToOrganization(); //result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier']; -- 2.17.1 From dede290a52c1aab54858eab3554dbb8ca92f8475 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 21 May 2024 13:36:12 +0300 Subject: [PATCH 59/64] [develop | DONE | MOVED]: Add browse-stakeholder-base component implemented in Irish. --- .../browse-stakeholder-base.component.ts | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 monitor/browse-stakeholder/browse-stakeholder-base.component.ts diff --git a/monitor/browse-stakeholder/browse-stakeholder-base.component.ts b/monitor/browse-stakeholder/browse-stakeholder-base.component.ts new file mode 100644 index 00000000..4e9eb889 --- /dev/null +++ b/monitor/browse-stakeholder/browse-stakeholder-base.component.ts @@ -0,0 +1,113 @@ +import {ChangeDetectorRef, Directive, OnInit} from "@angular/core"; +import {StakeholderBaseComponent} from "../../monitor-admin/utils/stakeholder-base.component"; +import {OpenaireEntities} from "../../utils/properties/searchFields"; +import {StakeholderType} from "../entities/stakeholder"; +import {Option} from "../../sharedComponents/input/input.component"; +import {FormBuilder, FormControl} from "@angular/forms"; +import {LayoutService} from "../../dashboard/sharedComponents/sidebar/layout.service"; +import {HelperFunctions} from "../../utils/HelperFunctions.class"; +import {debounceTime, distinctUntilChanged} from "rxjs/operators"; + + +@Directive() +export class BrowseStakeholderBaseComponent extends StakeholderBaseComponent implements OnInit { + openaireEntities = OpenaireEntities; + stakeholderType: StakeholderType; + stakeholders: T[] = []; + filteredStakeholders: T[] = []; + showLoading: boolean = true; + isMobile: boolean = false; + + gridView: boolean = true; + sortOptions: Option[] = [ + {value: 'alphAsc', label: 'Alphabetically Asc. (A-Z)'}, + {value: 'alphDsc', label: 'Alphabetically Dsc. (Z-A)'}, + ]; + pageOptions: number[] = [10, 20, 30, 40]; + sortBy: string = null; + currentPage: number = 1; + pageSize: number = 10; + parameters = {}; + keywordControl: FormControl; + hasPublications: boolean = true; + + /* Services */ + protected layoutService: LayoutService; + protected cdr: ChangeDetectorRef; + protected fb: FormBuilder; + + constructor() { + super(); + } + + ngOnInit() { + this.keywordControl = this.fb.control(this._route.snapshot.queryParams.keyword); + this.subscriptions.push(this.layoutService.isMobile.subscribe(isMobile => { + this.isMobile = isMobile; + this.cdr.detectChanges(); + })); + this.stakeholderType = this._route.snapshot.data.type; + if (!this.stakeholderType) { + this.navigateToError(); + } + this.init(); + this.subscriptions.push(this.keywordControl.valueChanges.pipe(debounceTime(200), distinctUntilChanged()).subscribe(value => { + this.filtering(value); + if (value?.length > 0) { + this.parameters['keyword'] = value; + } else { + delete this.parameters['keyword'] + } + this._router.navigate([], {queryParams: this.parameters}); + })); + } + + init() { + this.stakeholders = []; + this.filteredStakeholders = []; + } + + protected filtering(value) { + if (!value) { + this.filteredStakeholders = this.stakeholders; + } else { + this.filteredStakeholders = this.stakeholders.filter(item => (item['name'] && item['name'].toLowerCase().includes(value.toLowerCase())) || (item['alias'] && item['alias'].toLowerCase().includes(value.toLowerCase()))); + } + this.afterStakeholdersInitialized(); + this.currentPage = 1; + } + + sortByChanged() { + switch (this.sortBy) { + case 'alphAsc': + this.stakeholders = this.stakeholders.sort((a, b) => a['name'].localeCompare(b['name'])); + break; + case 'alphDsc': + this.stakeholders = this.stakeholders.sort((a, b) => b['name'].localeCompare(a['name'])); + break; + default: + break; + } + } + + sizeChanged($event) { + this.pageSize = $event; + this.currentPage = 1; + this.afterStakeholdersInitialized(); + } + + updateCurrentPage($event) { + this.currentPage = $event.value; + HelperFunctions.scrollToId('target'); + this.afterStakeholdersInitialized(); + } + + get typeAsLabel() { + return this.stakeholderUtils.types.find(type => type.value === this.stakeholderType).label; + } + + afterStakeholdersInitialized() { + // this is a method that will be overriden from the components extending this base component, if needed + this.showLoading = false; + } +} -- 2.17.1 From 5a912f02b7b8c5ce1805d451f67cd3db728ca985 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 22 May 2024 12:42:21 +0300 Subject: [PATCH 60/64] [Develop]: Advanced search input add on changes reinitialize input style --- .../advanced-search-input.component.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sharedComponents/advanced-search-input/advanced-search-input.component.ts b/sharedComponents/advanced-search-input/advanced-search-input.component.ts index ee420334..49aedc65 100644 --- a/sharedComponents/advanced-search-input/advanced-search-input.component.ts +++ b/sharedComponents/advanced-search-input/advanced-search-input.component.ts @@ -58,15 +58,22 @@ export class AdvancedSearchInputComponent implements AfterContentInit, OnDestroy } ngAfterContentInit() { - this.inputs.forEach(input => { - input.inputClass = 'advanced-search'; - input.selectArrow = null; + this.init(); + this.inputs.changes.subscribe(input => { + this.init(); }); } ngOnDestroy() { } - + + init() { + this.inputs.forEach(input => { + input.inputClass = 'advanced-search'; + input.selectArrow = null; + }); + } + focusNext(input: InputComponent | EntitiesSelectionComponent, event: any = null) { if(!event || !event.init) { setTimeout(() => { -- 2.17.1 From 79b723e75c29460788aabd2d05b23d83b4ed45ea Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 22 May 2024 14:40:42 +0300 Subject: [PATCH 61/64] [develop | DONE | ADDED ] add coins icon --- utils/icons/icons.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/icons/icons.ts b/utils/icons/icons.ts index 0b778656..b1816cdf 100644 --- a/utils/icons/icons.ts +++ b/utils/icons/icons.ts @@ -161,3 +161,8 @@ export const unknown_access: Icon = { name: 'unknown_access', data: '' } + +export const coins: Icon = { + name: 'coins', + data: '' +} -- 2.17.1 From 7a517e49ed60b35bf8168bad2e9a4e7cbeb6d13e Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 22 May 2024 14:48:13 +0300 Subject: [PATCH 62/64] [develop | DONE | CHANGED ] Claims: add 2 steps in Projects form,step 1 to select funder, step 2 search by keyword --- claims/claim-utils/claimHelper.class.ts | 6 +- .../claimProjectSearchForm.component.html | 73 +++-------- .../claimProjectSearchForm.component.ts | 122 +++++++----------- .../claimProjectSearchForm.module.ts | 13 +- .../claimResultSearchForm.component.html | 10 +- .../claimResultSearchForm.module.ts | 3 +- claims/claim-utils/claims.properties.ts | 3 + claims/linking/linkingGeneric.component.ts | 5 +- .../selected/ClaimEntitiesMetadata.module.ts | 12 +- .../ClaimEntityProjectMetadata.component.ts | 22 +++- .../selected/ClaimEntityTitle.component.ts | 35 +++-- 11 files changed, 135 insertions(+), 169 deletions(-) diff --git a/claims/claim-utils/claimHelper.class.ts b/claims/claim-utils/claimHelper.class.ts index 86239830..c9d82250 100644 --- a/claims/claim-utils/claimHelper.class.ts +++ b/claims/claim-utils/claimHelper.class.ts @@ -1,6 +1,7 @@ //Classes used in linking / inlinelinking when selecting an entity import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {OpenaireEntities} from "../../utils/properties/searchFields"; +import {ClaimsProperties} from "./claims.properties"; export class ClaimResult { public source: string; @@ -189,17 +190,18 @@ export class ShowOptions { } - initSelectOptions(){ + initSelectOptions(claimProperties:ClaimsProperties){ let options =[]; if(this.linkToEntities.indexOf('result')!=-1){ options.push({value: 'result',label: OpenaireEntities.RESULTS}) } if(this.linkToEntities.indexOf('project')!=-1){ - options.push({value: 'project',label: OpenaireEntities.PROJECTS}) + options.push({value: 'project',label: claimProperties.SELECT_ENTITIES.projects}) } if(this.linkToEntities.indexOf('context')!=-1){ options.push({value: 'context',label: OpenaireEntities.COMMUNITIES}) } this.selectOptions = options; + console.log(options, claimProperties.SELECT_ENTITIES.projects) } } diff --git a/claims/claim-utils/claimProjectSearchForm.component.html b/claims/claim-utils/claimProjectSearchForm.component.html index 3734b038..8bd0fe4a 100644 --- a/claims/claim-utils/claimProjectSearchForm.component.html +++ b/claims/claim-utils/claimProjectSearchForm.component.html @@ -1,69 +1,25 @@
            -
            + [options]="showOptions.selectOptions" class="uk-width-auto ">
            +
            +
            -
            +
            No {{openaireEntities.PROJECT.toLowerCase()}} results yet...
            Start searching for {{openaireEntities.PROJECTS.toLowerCase()}} to add them in the Basket
            -
            +
            +
            Select funder to proceed +
            +
            +
            -
            - - +
            @@ -104,9 +60,12 @@ role="alert">Service not available
            + role="alert"> + +
            +
            {{selectedFunder.name}} has no projects. Proceed to next step.
            { + for(let v of data[2][0].values){ + let option = {value : v, label: v.name}; + this.funderOptions.push(option); + } + this.openaireResultsStatus = this.errorCodes.DONE; + }, error =>{ + this.openaireResultsStatus = this.errorCodes.ERROR; + }) + } + funderChanged(value){ + this.keyword = "" + this.selectedFunder = value; + this.isNoProjectFunder = this.selectedFunder && this.selectedFunder.number == 1; + this.openaireResults = []; + if(this.isNoProjectFunder){ + this.showResults = true; + this.search(1,1); + }else{ + this.openaireResults = []; + } + } search(page,size) { - if (this.keyword.length == 0) { + /* if (this.keyword.length == 0) { this.showResults = false; return; - } + }*/ this.showResults = true; this.openaireResults = []; this.openaireResultsStatus = this.errorCodes.LOADING; this.prevFilters = this.filters; //searchProjects (params: string, refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties ):any { - this.sub = this._projectService.advancedSearchProjects(this.createOpenaireQueryParams(), page, size, this.properties, (page == 1) ? this.refineFieldsQuery : null, (page == 1) ? this.refineFields : [], this.createOpenaireRefineQuery()).subscribe( + this.sub = this._projectService.advancedSearchProjects(this.createOpenaireQueryParams(), page, size, this.properties, null, [], this.createOpenaireRefineQuery()).subscribe( // this.sub = this._projectService.searchProjects(this.createOpenaireQueryParams(),(page==1)? this.refineFieldsQuery:null, page, size, (page==1)?this.refineFields:[], this.properties).subscribe( data => { if (data != null) { @@ -91,6 +124,9 @@ export class ClaimProjectsSearchFormComponent { this.openaireResultsStatus = this.errorCodes.NONE; this.filters = this.checkSelectedFilters([], this.prevFilters); } + /* if(this.isNoProjectFunder && this.claimResultsComponent){ + this.claimResultsComponent.add(this.openaireResults[0]) + }*/ } else { this.openaireResultsStatus = this.errorCodes.ERROR; } @@ -102,77 +138,14 @@ export class ClaimProjectsSearchFormComponent { } ); } -// select(entity){ -// if(this.selectedProjects.length > 50){ -// UIkit.notification({ -// message : 'Your basket exceeds the number of allowed projects (50)', -// status : 'warning', -// timeout : 1500, -// pos : 'top-center' -// }); -// return; -// } -// this.query = ""; -// // this.searchTermStream.next(this.query); //clear -// entity = entity.value; -// // var project: ClaimProject = new ClaimProject(); -// // project.funderId = entity.funderId; -// // project.funderName = entity.funderName; -// // project.id = entity.id; -// // project.projectName = entity.projectName; -// // project.projectAcronym = entity.projectAcronym; -// // project.startDate = entity.startDate; -// // project.endDate = entity.endDate; -// // project.code = entity.code; -// // project.jurisdiction = entity.jurisdiction; -// // project.fundingLevel0 = entity.fundingLevel0; -// -// -// var index:number =this.selectedProjects.indexOf(entity); -// var found:boolean = false; -// this.warningMessage = ""; -// -// for (var _i = 0; _i < this.selectedProjects.length; _i++) { -// let project = this.selectedProjects[_i]; -// if(entity.id == project.id){ -// found=true; -// this.warningMessage = "Project already in your basket"; -// } -// } -// -// if (!found) { -// this.selectedProjects.push(entity); -// if(this.selectedProjects != null){ -// localStorage.setItem(this.localStoragePrefix + "projects", JSON.stringify(this.selectedProjects)); -// } -// this.projectSelected.emit({ -// value: true -// }); -// -// } -// } -/* static showItem(item):string{ - return ((item.field[1]['@value'])?item.field[1]['@value']+" - ":"" ) + item.field[3]['@value']; - }*/ - remove(item){ + remove(item){ let index:number =this.selectedProjects.indexOf(item); if (index > -1) { this.selectedProjects.splice(index, 1); } } -/* handleClick(event){ - var clickedComponent = event.target; - var inside = false; - do { - if (clickedComponent === this.elementRef.nativeElement) { - inside = true; - } - clickedComponent = clickedComponent.parentNode; - } while (clickedComponent); - - }*/ - static openaire2ClaimEntity(items, properties:EnvProperties){ + static openaire2ClaimEntity(items, properties:EnvProperties){ const projects: ClaimEntity[] = []; for(const item of items){ const entity: ClaimEntity = new ClaimEntity(); @@ -237,6 +210,9 @@ export class ClaimProjectsSearchFormComponent { } } } + if(this.isNoProjectFunder){ + allFqs += "&fq=" + StringUtils.URIEncode( "funder exact " + (StringUtils.quote(this.selectedFunder.id))); ; + } for (let i = 0; i < this.rangeFilters.length; i++) { let filter = this.rangeFilters[i]; //selectedFromValue, selectedToValue, equalityOp, equalityOpFrom, equalityOpTo, filterOp ){ diff --git a/claims/claim-utils/claimProjectSearchForm.module.ts b/claims/claim-utils/claimProjectSearchForm.module.ts index 3d2ace89..c81fcd1c 100644 --- a/claims/claim-utils/claimProjectSearchForm.module.ts +++ b/claims/claim-utils/claimProjectSearchForm.module.ts @@ -17,14 +17,15 @@ import {RangeFilterModule} from "../../utils/rangeFilter/rangeFilter.module"; import {AdvancedSearchInputModule} from "../../sharedComponents/advanced-search-input/advanced-search-input.module"; import {InputModule} from "../../sharedComponents/input/input.module"; import {DropdownFilterModule} from "../../utils/dropdown-filter/dropdown-filter.module"; +import {LoadingModule} from "../../utils/loading/loading.module"; @NgModule({ - imports: [ - SharedModule, CommonModule, - // LoadingModalModule, - ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule, HelperModule, - PagingModule, SearchFilterModule, ClaimResultsModule, RangeFilterModule, AdvancedSearchInputModule, InputModule, DropdownFilterModule - ], + imports: [ + SharedModule, CommonModule, + // LoadingModalModule, + ProjectServiceModule, ProjectsServiceModule, EntitiesAutocompleteModule, HelperModule, + PagingModule, SearchFilterModule, ClaimResultsModule, RangeFilterModule, AdvancedSearchInputModule, InputModule, DropdownFilterModule, LoadingModule + ], providers:[ ], declarations: [ diff --git a/claims/claim-utils/claimResultSearchForm.component.html b/claims/claim-utils/claimResultSearchForm.component.html index fe0ab300..52664c99 100644 --- a/claims/claim-utils/claimResultSearchForm.component.html +++ b/claims/claim-utils/claimResultSearchForm.component.html @@ -51,7 +51,9 @@
            + role="alert"> + +
            Loading...
            + role="alert">
            @@ -177,7 +179,7 @@
            +
            @@ -190,7 +192,7 @@
            + role="alert">
            diff --git a/claims/claim-utils/claimResultSearchForm.module.ts b/claims/claim-utils/claimResultSearchForm.module.ts index 63c4e7b9..7be27ea4 100644 --- a/claims/claim-utils/claimResultSearchForm.module.ts +++ b/claims/claim-utils/claimResultSearchForm.module.ts @@ -22,10 +22,11 @@ import {AdvancedSearchInputModule} from "../../sharedComponents/advanced-search- import {InputModule} from "../../sharedComponents/input/input.module"; import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module"; import {DropdownFilterModule} from "../../utils/dropdown-filter/dropdown-filter.module"; +import {LoadingModule} from "../../utils/loading/loading.module"; @NgModule({ imports: [SharedModule, CommonModule, SearchResearchResultsServiceModule, PagingModule, SearchCrossrefServiceModule, - SearchDataciteServiceModule, HelperModule, SearchFilterModule, ClaimResultsModule, MatSelectModule, QuickSelectionsModule, RangeFilterModule, ClaimProjectsSearchFormModule, AdvancedSearchInputModule, InputModule, SearchInputModule, DropdownFilterModule], + SearchDataciteServiceModule, HelperModule, SearchFilterModule, ClaimResultsModule, MatSelectModule, QuickSelectionsModule, RangeFilterModule, ClaimProjectsSearchFormModule, AdvancedSearchInputModule, InputModule, SearchInputModule, DropdownFilterModule, LoadingModule], providers:[ SearchOrcidService ], diff --git a/claims/claim-utils/claims.properties.ts b/claims/claim-utils/claims.properties.ts index 4e53a1ab..d1c10c5a 100644 --- a/claims/claim-utils/claims.properties.ts +++ b/claims/claim-utils/claims.properties.ts @@ -1,5 +1,8 @@ export class ClaimsProperties{ ALLOW_ORGANIZATION_LINKING:boolean = false; + SELECT_ENTITIES = { + projects:"Funding" + } INLINE_ENTITY = { show: true, guideText : null diff --git a/claims/linking/linkingGeneric.component.ts b/claims/linking/linkingGeneric.component.ts index b5c0a683..229fb9de 100644 --- a/claims/linking/linkingGeneric.component.ts +++ b/claims/linking/linkingGeneric.component.ts @@ -42,7 +42,7 @@ export class LinkingGenericComponent { // show linkToEntities /values: result, project, context @Input() sources:ClaimEntity[] =[]; - properties:EnvProperties; + properties:EnvProperties = properties; public openaireEntities = OpenaireEntities; @Input() localStoragePrefix:string = "linking_"; url=null; @@ -72,14 +72,13 @@ export class LinkingGenericComponent { this.breadcrumbs.push({name: "Link", route: null}); } this.showOptions.show = 'source'; - this.showOptions.initSelectOptions(); + this.showOptions.initSelectOptions(this.claimsProperties); if(this.inlineEntity){ this.showOptions.showLinkTo(); // this.showOptions.basketShowLinksTo = true; this.showOptions.show = this.showOptions.linkTo; } - this.properties = properties; this.url = this.properties.domain + this.properties.baseLink+this._router.url; var description = "Linking is a functionality provided by OpenAIRE, in order to link research results with a project, a research community or other research results."; diff --git a/claims/linking/selected/ClaimEntitiesMetadata.module.ts b/claims/linking/selected/ClaimEntitiesMetadata.module.ts index 444f3f9f..c4116c3c 100644 --- a/claims/linking/selected/ClaimEntitiesMetadata.module.ts +++ b/claims/linking/selected/ClaimEntitiesMetadata.module.ts @@ -3,13 +3,21 @@ import {SharedModule} from '../../../../openaireLibrary/shared/shared.module'; import {ClaimEntityTitleComponent} from "./ClaimEntityTitle.component"; import {ClaimEntityResultMetadataComponent} from "./ClaimEntityResultMetadata.component"; import {ClaimEntityProjectMetadataComponent} from "./ClaimEntityProjectMetadata.component"; +import {IconsService} from "../../../utils/icons/icons.service"; +import {coins} from "../../../utils/icons/icons"; +import {IconsModule} from "../../../utils/icons/icons.module"; @NgModule({ imports: [ - SharedModule + SharedModule, + IconsModule ], declarations: [ ClaimEntityTitleComponent, ClaimEntityResultMetadataComponent, ClaimEntityProjectMetadataComponent ], exports:[ ClaimEntityTitleComponent, ClaimEntityResultMetadataComponent, ClaimEntityProjectMetadataComponent] }) -export class ClaimEntitiesMetadataModule { } +export class ClaimEntitiesMetadataModule { + constructor(private _iconsService:IconsService) { + this._iconsService.registerIcons([coins]) + } +} diff --git a/claims/linking/selected/ClaimEntityProjectMetadata.component.ts b/claims/linking/selected/ClaimEntityProjectMetadata.component.ts index 229ebeca..1d51a233 100644 --- a/claims/linking/selected/ClaimEntityProjectMetadata.component.ts +++ b/claims/linking/selected/ClaimEntityProjectMetadata.component.ts @@ -8,20 +8,28 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; -
            + + funder + + +
            +
            -
            - Funder: {{entity.project.funderName?entity.project.funderName:entity.project.funderShortname}} -
            -
            +
            Project Code: {{entity.project.code}} -
            +
            +
            + Funding: {{entity.project.funderName?entity.project.funderName:entity.project.funderShortname}} +
            +
            `, diff --git a/claims/linking/selected/ClaimEntityTitle.component.ts b/claims/linking/selected/ClaimEntityTitle.component.ts index c432a266..ab5a8db8 100644 --- a/claims/linking/selected/ClaimEntityTitle.component.ts +++ b/claims/linking/selected/ClaimEntityTitle.component.ts @@ -5,19 +5,18 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; selector: 'claim-title', template: `
            - - - insert_drive_file - - - assignment_turned_in - - - account_balance - - - people - + + + + + + + + + + + +
            @@ -30,7 +29,15 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class'; {{entity.title ? sliceString(entity.title) : '[No title available]'}} - + + + {{(entity.project.funderShortname ? '[' + entity.project.funderShortname + '] ' : '') + entity.project.funderName}} + + + {{sliceString(entity.project.funderName)}} + + + -- 2.17.1 From 632d11c82ce696859f01bc0451e815f7231bbf3e Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 22 May 2024 16:50:58 +0300 Subject: [PATCH 63/64] [develop | DONE | FIXED]: showAuthors.component.ts: On destroy of component, delete all elements with "orcid-dropdown" class from "modal-container". --- utils/authors/showAuthors.component.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utils/authors/showAuthors.component.ts b/utils/authors/showAuthors.component.ts index a400b722..be0553ff 100644 --- a/utils/authors/showAuthors.component.ts +++ b/utils/authors/showAuthors.component.ts @@ -170,6 +170,17 @@ export class ShowAuthorsComponent { ngOnInit() {} + ngOnDestroy() { + if(this.orcidDropdown && typeof document !== 'undefined') { + let modal_container = document.getElementById("modal-container"); + modal_container.childNodes.forEach(c=> { + if (c['className'] && c['className'].includes("orcid-dropdown")) { + modal_container.removeChild(c); + } + }); + } + } + public onClick() { if (this.modal) { this.modal.cancel(); -- 2.17.1 From 43990dc582bc5ae679aa513fc1d15f1eb791b3c8 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Thu, 23 May 2024 18:16:07 +0300 Subject: [PATCH 64/64] [develop | DONE | FIXED]: [BUG FIX] showAuthors.component.ts: Remove non existing field from the condition. --- utils/authors/showAuthors.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/authors/showAuthors.component.ts b/utils/authors/showAuthors.component.ts index be0553ff..64857b73 100644 --- a/utils/authors/showAuthors.component.ts +++ b/utils/authors/showAuthors.component.ts @@ -171,7 +171,7 @@ export class ShowAuthorsComponent { ngOnInit() {} ngOnDestroy() { - if(this.orcidDropdown && typeof document !== 'undefined') { + if(typeof document !== 'undefined') { let modal_container = document.getElementById("modal-container"); modal_container.childNodes.forEach(c=> { if (c['className'] && c['className'].includes("orcid-dropdown")) { -- 2.17.1