diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html index bdcc74b3..94034a2e 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/claims/claim-utils/displayClaims/displayClaims.component.html @@ -56,57 +56,76 @@
No links found
- +
+ +
+ diff --git a/claims/claim-utils/displayClaims/displayClaims.component.less b/claims/claim-utils/displayClaims/displayClaims.component.less index 0eadec18..e322586c 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.less +++ b/claims/claim-utils/displayClaims/displayClaims.component.less @@ -4,14 +4,4 @@ position: relative; padding: 0 20px; height: 100%; - - &::before { - content: ''; - position: absolute; - top: 0; - left: 50%; - right: 0; - bottom: 0; - border-left: @global-border-width solid @global-border; - } } diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index 9e5ccf97..8f24cf4d 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -52,6 +52,7 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { lastIndexDate = null; public filterForm: FormGroup; public entities: string[] = []; + selected = []; allOptions: Option[] = [ {label: OpenaireEntities.PUBLICATIONS, value: "publication"}, @@ -310,23 +311,34 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { } isSelected(value: string) { - return this.filterForm && this.filterForm.get('entities').value.find(entity => entity === value) + return this.filterForm && this.filterForm.get('entities').value.find(entity => entity === value); } - deleteOpen(index: number) { + deleteOpen(index: number = null) { this.index = index; this.deleteModal.alertTitle = 'Delete Confirmation'; - this.deleteModal.message = 'Are you sure you want to delete this link?'; + this.deleteModal.message = 'Are you sure you want to delete ' + (this.index != null ? '1' : this.selected.length) + ' link(s)?'; this.deleteModal.okButtonText = 'Yes'; this.deleteModal.open(); } delete() { - this.subscriptions.push(this._claimService.deleteBulk([this.claims[this.index].id], this.properties.claimsAPIURL).subscribe( + let claimsToBeDeleted = ((this.index != null) ? [this.claims[this.index].id] : this.selected.map(claim => claim.id)); + console.log(claimsToBeDeleted); + this.subscriptions.push(this._claimService.deleteBulk(claimsToBeDeleted, this.properties.claimsAPIURL).subscribe( res => { - this.claims.splice(this.index, 1); - this.resultsNum = this.resultsNum - 1; - NotificationHandler.rise('Link has been deleted successfully'); + if (this.index != null) { + this.claims.splice(this.index, 1); + this.resultsNum = this.resultsNum - 1; + NotificationHandler.rise('Link has been deleted successfully'); + } else { + claimsToBeDeleted.forEach(claimId => { + this.claims.splice(this.claims.findIndex((id) => id == claimId), 1); + }); + this.resultsNum = this.resultsNum - claimsToBeDeleted.length; + NotificationHandler.rise(claimsToBeDeleted.length + ' links have been deleted successfully'); + } + this.selected = []; let goToPage = this.page; if (this.totalPages(this.resultsNum) < this.page && this.page > 0) { goToPage = this.page - 1; @@ -334,7 +346,8 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { this.goTo(goToPage); }, err => { this.handleErrors(err, "Error deleting claim with id: " + this.claims[this.index].id); - })); + } + )); } pageChange($event) { @@ -362,7 +375,44 @@ export class DisplayClaimsComponent implements OnInit, OnDestroy { } return totalPages; } - + + selectClaim(item: any, event) { + let value = event.currentTarget.checked; + if (value) { + this.selected.push(item); + } else { + for (var _i = 0; _i < this.selected.length; _i++) { + let claim = this.selected[_i]; + if (claim['id'] == item.id) { + this.selected.splice(_i, 1); + } + } + } + } + + selectAll(event) { + let value = event.currentTarget.checked; + if (value) { + this.selected = []; + for (let _i = 0; _i < this.claims.length; _i++) { + let claim = this.claims[_i]; + this.selected.push(claim); + } + } else { + this.selected = []; + } + } + + isSelectedClaim(id: string) { + for (let _i = 0; _i < this.selected.length; _i++) { + let claim = this.selected[_i]; + if (claim['id'] == id) { + return true; + } + } + return false; + } + private updateDescription(description: string) { this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "property='og:description'"); diff --git a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts index 6102d684..547e4c16 100644 --- a/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/claimEntityFormatter.component.ts @@ -15,21 +15,22 @@ import {StringUtils} from "../../../utils/string-utils.class";
{{getEntityName(type)}}
-
- Link to: +
+ Link to:
-
- Link to: +
+ Link to:
-
- Link to: - {{entity.title}} +
+ Link to: +
+ {{entity.title}} +
` }) diff --git a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts index 92557d9a..14ee0e60 100644 --- a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts @@ -20,7 +20,7 @@ import {properties} from "../../../../../environments/environment"; - Funder: {{project['funderName']}} + Funder: {{project['funderName']}} ` }) diff --git a/dashboard/sharedComponents/sidebar/layout.service.ts b/dashboard/sharedComponents/sidebar/layout.service.ts index 17657431..dc515f81 100644 --- a/dashboard/sharedComponents/sidebar/layout.service.ts +++ b/dashboard/sharedComponents/sidebar/layout.service.ts @@ -88,6 +88,10 @@ export class LayoutService { * Handle it manually in the component, it doesn't use data * */ private rootClassSubject: BehaviorSubject = new BehaviorSubject(null); + /** + * Display help pop-up on non-admin pages. (default true for the rest of the pages) + * */ + private hasHelpPopUpSubject: BehaviorSubject = new BehaviorSubject(true); private subscriptions: any[] = []; ngOnDestroy() { @@ -343,4 +347,12 @@ export class LayoutService { this.rootClassSubject.next(value); } } + + get hasHelpPopUp(): Observable { + return this.hasHelpPopUpSubject.asObservable(); + } + + setHasHelpPopUp(value: boolean) { + this.hasHelpPopUpSubject.next(value); + } } diff --git a/landingPages/result/resultLanding.module.ts b/landingPages/result/resultLanding.module.ts index 8554f354..2d7dfc11 100644 --- a/landingPages/result/resultLanding.module.ts +++ b/landingPages/result/resultLanding.module.ts @@ -26,7 +26,6 @@ import {ResultPreviewModule} from "../../utils/result-preview/result-preview.mod import {FeedbackModule} from "../feedback/feedback.module"; import {TabsModule} from "../../utils/tabs/tabs.module"; import {LoadingModule} from "../../utils/loading/loading.module"; -import {OrcidModule} from "../../orcid/orcid.module"; import {IconsModule} from "../../utils/icons/icons.module"; import {IconsService} from "../../utils/icons/icons.service"; import {cite, fire, graph, landmark, link, link_to, quotes, rocket, versions} from "../../utils/icons/icons"; @@ -38,6 +37,7 @@ import {FullScreenModalModule} from "../../utils/modal/full-screen-modal/full-sc 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"; @NgModule({ imports: [ @@ -47,7 +47,7 @@ import {ResultLandingRoutingModule} from "./resultLanding-routing.module"; AltMetricsModule, Schema2jsonldModule, SEOServiceModule, DeletedByInferenceModule, ShowAuthorsModule, HelperModule, ResultLandingUtilsModule, AlertModalModule, LandingHeaderModule, NoLoadPaging, ResultPreviewModule, FeedbackModule, TabsModule, LoadingModule, - OrcidModule, IconsModule, InputModule, EGIDataTransferModule, RecaptchaModule, + OrcidCoreModule, IconsModule, InputModule, EGIDataTransferModule, RecaptchaModule, SdgFosSuggestModule, FullScreenModalModule, SafeHtmlPipeModule, EntityActionsModule ], declarations: [ diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index 6f2a2951..152cda48 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -234,6 +234,7 @@ export class Role { } public static mapType(type: string, communityMap: boolean = true): string { + type = type.replace(this.GROUP, ''); if (type == "ri" && communityMap) { type = "community"; } else if (type == "organization") { diff --git a/monitor-admin/topic/indicators.component.html b/monitor-admin/topic/indicators.component.html index 05144592..b9bce2df 100644 --- a/monitor-admin/topic/indicators.component.html +++ b/monitor-admin/topic/indicators.component.html @@ -14,16 +14,6 @@ (click)="deleteSectionOpen(number, i, 'number', 'delete')"> - - - - - - - - - -
@@ -113,16 +103,6 @@ (click)="deleteSectionOpen(chart, i, 'chart', 'delete')"> - - - - - - - - - -
- @@ -219,13 +198,16 @@ +
+ +
-
- -
+
+ +
@@ -440,8 +422,6 @@ - -
@@ -462,25 +442,10 @@
Indicators of all profiles based on this default indicator, will be deleted as well.
- - - Are you sure you want to proceed?
-
@@ -490,20 +455,9 @@
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 30343944..46119354 100644 --- a/monitor-admin/topic/indicators.component.ts +++ b/monitor-admin/topic/indicators.component.ts @@ -86,8 +86,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple public safeUrls: Map = new Map([]); public numberResponses: Map = new Map(); public numberResults: Map = new Map(); - /** Import / Export Indicators */ - importLoading: boolean = false; + public loading: boolean = false; @ViewChild('editChartModal', {static: true}) editChartModal: AlertModal; @ViewChild('editNumberModal', {static: true}) editNumberModal: AlertModal; @ViewChild('deleteModal', {static: true}) deleteModal: AlertModal; @@ -354,7 +353,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple 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.stakeholder.topics[this.topicIndex].categories[this.categoryIndex].subCategories[this.subcategoryIndex] && !this.loading; } public get numberIndicatorPaths(): UntypedFormArray { @@ -504,16 +503,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple 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.isStakeholderParametersValid(indicatorPath)) { - // default profile - if (this.stakeholder.defaultId == null) { - this.urlParameterizedMessage = "This indicator couldn't be generated properly. Stakeholders based on this profile may not inherit the data correctly." - } else { - this.urlParameterizedMessage = "This indicator couldn't be generated properly. Please make sure chart data is for the current stakeholder." - } - } else { - this.urlParameterizedMessage = null; - } this.checkForSchemaEnhancements(this.numberIndicatorPaths.at(index).get('url').value); if (this.indicator.indicatorPaths[index]) { this.indicator.indicatorPaths[index] = indicatorPath; @@ -574,16 +563,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple 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); - if (!this.isStakeholderParametersValid(indicatorPath)) { - // default profile - if (this.stakeholder.defaultId == null) { - this.urlParameterizedMessage = "This chart couldn't be generated properly. Stakeholders based on this profile may not inherit the data correctly." - } else { - this.urlParameterizedMessage = "This chart couldn't be generated properly. Please make sure chart data is for the current stakeholder." - } - } else { - this.urlParameterizedMessage = null; - } 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)); @@ -601,12 +580,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple } } - private isStakeholderParametersValid(indicatorPath: IndicatorPath) { - return !((indicatorPath.chartObject && Object.keys(indicatorPath.parameters).indexOf("index_id") == -1 && Object.keys(indicatorPath.parameters).indexOf("index_name") == -1 && Object.keys(indicatorPath.parameters).indexOf("index_shortName") == -1) - || (!indicatorPath.chartObject && indicatorPath.url.indexOf("index_id") == -1 && indicatorPath.url.indexOf("index_name") == -1 && (indicatorPath.url).indexOf("index_shortName") == -1)); - - } - private getJsonPathAsFormArray(indicatorPath: IndicatorPath): UntypedFormArray { let jsonPath = this.fb.array([]); if (indicatorPath.jsonPath) { @@ -900,19 +873,22 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple }); } } - this.editing = false; - this.importLoading = false; + this.finish(); NotificationHandler.rise('Indicators have been imported successfully!'); }, error => { this.chartIndicatorFb = null; NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); - this.editing = false; - this.importLoading = false; + this.finish(); })); } + finish() { + this.editing = false; + this.loading = false; + } + reorderIndicators(sectionId: string, type: IndicatorType, reorder: Reorder) { this.editing = true; let path = [ @@ -1159,24 +1135,6 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple })); } - // deleteNumberSectionOpen(section: Section, index: number) { - // this.section = section; - // this.index = index; - // this.deleteNumberSectionModal.alertTitle = 'Delete Section'; - // this.deleteNumberSectionModal.cancelButtonText = 'No'; - // this.deleteNumberSectionModal.okButtonText = 'Yes'; - // this.deleteNumberSectionModal.open(); - // } - // - // deleteChartSectionOpen(section: Section, index: number) { - // this.section = section; - // this.index = index; - // this.deleteChartSectionModal.alertTitle = 'Delete Section'; - // this.deleteChartSectionModal.cancelButtonText = 'No'; - // this.deleteChartSectionModal.okButtonText = 'Yes'; - // this.deleteChartSectionModal.open(); - // } - deleteSectionOpen(section: Section, index: number, type: IndicatorType, childrenAction: string = null) { if (!this.editing && !section.defaultId) { this.sectionTypeToDelete = type; @@ -1256,11 +1214,19 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple return charts; } - importIndicatorsAndSave(charts: any[]) { + importIndicatorsAndSave(stakeholder: Stakeholder, charts: any[]) { let sectionsToSave: Section[] = []; let countIndicators = 0; + 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, + pos: 'bottom-right' + }); + this.finish(); + return; + } // name description additionalDescription, height, width, visibility - let noValidParams = 0; let duplicates = 0; charts = this.migrateFromOldImportJsonFile(charts); for (let chart of charts) { @@ -1290,13 +1256,12 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple timeout: 6000, pos: 'bottom-right' }); - this.editing = false; - this.importLoading = false; + this.finish(); break; } if (chart.type == "chart") { - indicatorPath = this.indicatorUtils.generateIndicatorByChartUrl(this.indicatorUtils.getChartSource(chart.url), chart.url, chart.type, this.stakeholder); + 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)) { @@ -1304,10 +1269,9 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple exists = true; } } - } } else if (chart.type == "number") { - indicatorPath = this.indicatorUtils.generateIndicatorByNumberUrl(this.indicatorUtils.getNumberSource(chart.url), chart.url, this.stakeholder, + 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) { @@ -1316,20 +1280,14 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple exists = true; } } - } } - if (!this.isStakeholderParametersValid(indicatorPath)) { - noValidParams++; - } 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]); sectionsToSave[chart['sectionIndex']].indicators.push(i); countIndicators++; } - } - if (duplicates > 0) { UIkit.notification(duplicates + " urls already exist and will not be imported!", { status: 'warning', @@ -1337,19 +1295,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple pos: 'bottom-right' }); } - if (noValidParams > 0 && !(this.stakeholder.type == 'country')) { - let noValidMessage = "Some indicators couldn't be generated properly. Please make sure chart data is for the current stakeholder."; - if (this.stakeholder.defaultId == null) { - noValidMessage = "Some indicators couldn't be generated properly. Stakeholders based on this profile may not inherit the data correctly."; - } - UIkit.notification(noValidMessage, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - this.editing = false; - this.importLoading = false; - } else if (sectionsToSave.length > 0 && countIndicators > 0) { + if (sectionsToSave.length > 0 && countIndicators > 0) { this.saveIndicators(sectionsToSave.filter(section => !!section)); } if (sectionsToSave.length == 0 || countIndicators == 0) { @@ -1358,8 +1304,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple timeout: 6000, pos: 'bottom-right' }); - this.editing = false; - this.importLoading = false; + this.finish(); } } @@ -1408,8 +1353,12 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple let topic = this.stakeholder ? this.stakeholder.topics[this.topicIndex] : null; let category = topic ? topic.categories[this.categoryIndex] : null; let subCategory = category ? category.subCategories[subcategoryIndex] : null; - - var jsonFileUrl = window.URL.createObjectURL(new Blob([JSON.stringify(indicators)], {type: 'application/json'})); + let json = { + stakeholder: HelperFunctions.copy(this.stakeholder), + indicators: indicators + } + delete json.stakeholder.topics; + var jsonFileUrl = window.URL.createObjectURL(new Blob([JSON.stringify(json)], {type: 'application/json'})); var a = window.document.createElement('a'); window.document.body.appendChild(a); a.setAttribute('style', 'display: none'); @@ -1418,14 +1367,13 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple a.click(); window.URL.revokeObjectURL(jsonFileUrl); a.remove(); // remove the element - - this.editing = false; + this.finish(); } fileChangeEvent(fileInput: any, index) { this.index = index; this.editing = true; - this.importLoading = true; + this.loading = true; this.filesToUpload = >fileInput.target.files; this.upload(); } @@ -1438,8 +1386,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple timeout: 6000, pos: 'bottom-right' }); - this.editing = false; - this.importLoading = false; + this.finish(); return; } else { if (this.filesToUpload[0].name.indexOf(".json") == -1 || (this.filesToUpload[0].type != "application/json")) { @@ -1449,27 +1396,30 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple timeout: 6000, pos: 'bottom-right' }); - this.editing = false; - this.importLoading = false; + this.finish(); return; } } this.makeFileRequest(this.properties.utilsService + '/upload?type=json', [], this.filesToUpload).then(async (result: string) => { - - let json_result = JSON.parse(result); - + let json = JSON.parse(result); // validate file - if (!json_result || json_result.length == 0) { + if(json && Array.isArray(json)) { + UIkit.notification("This file is not supported any more. Please export indicators and try again!", { + status: 'danger', + timeout: 6000, + pos: 'bottom-right' + }); + this.finish(); + } else if (!json || json?.indicators.length == 0) { UIkit.notification("Importing file is empty", { status: 'danger', timeout: 6000, pos: 'bottom-right' }); - this.editing = false; - this.importLoading = false; + this.finish(); } else { - this.importIndicatorsAndSave(json_result); + this.importIndicatorsAndSave(json.stakeholder, json.indicators); } }, (error) => { console.error("Error importing files", error); @@ -1478,8 +1428,7 @@ export class IndicatorsComponent extends IndicatorStakeholderBaseComponent imple timeout: 6000, pos: 'bottom-right' }); - this.editing = false; - this.importLoading = false; + this.finish(); }); } diff --git a/orcid/my-orcid-links/searchMyOrcidResults.module.ts b/orcid/my-orcid-links/searchMyOrcidResults.module.ts index 87ce11d0..66cf5358 100644 --- a/orcid/my-orcid-links/searchMyOrcidResults.module.ts +++ b/orcid/my-orcid-links/searchMyOrcidResults.module.ts @@ -6,15 +6,15 @@ import {RouterModule} from '@angular/router'; import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module"; import {ErrorMessagesModule} from "../../utils/errorMessages.module"; import {searcMyOrcidResultsComponent} from "./searchMyOrcidResults.component"; -import {OrcidModule} from "../orcid.module"; import {NoLoadPaging} from "../../searchPages/searchUtils/no-load-paging.module"; import {PagingModule} from "../../utils/paging.module"; +import {OrcidCoreModule} from "../orcid-core.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, ErrorMessagesModule, - ResultPreviewModule, OrcidModule, NoLoadPaging, PagingModule + ResultPreviewModule, OrcidCoreModule, NoLoadPaging, PagingModule ], declarations: [ searcMyOrcidResultsComponent diff --git a/orcid/orcid-core.module.ts b/orcid/orcid-core.module.ts new file mode 100644 index 00000000..eda20ab1 --- /dev/null +++ b/orcid/orcid-core.module.ts @@ -0,0 +1,43 @@ +import {NgModule} from '@angular/core'; +import {CommonModule} from '@angular/common'; + +import {RouterModule} from '@angular/router'; + +import {OrcidComponent} from './orcid.component'; +import {OrcidService} from './orcid.service'; +import {OrcidWorkComponent} from './orcid-work.component'; +import {AlertModalModule} from '../utils/modal/alertModal.module'; +import {ResultLandingService} from '../landingPages/result/resultLanding.service'; +import {LoadingModule} from '../utils/loading/loading.module'; +import {ResultLandingUtilsModule} from '../landingPages/landing-utils/resultLandingUtils.module'; +import {IconsModule} from '../utils/icons/icons.module'; +import {IconsService} from "../utils/icons/icons.service"; +import {orcid_add, orcid_bin} from "../utils/icons/icons"; +import {FullScreenModalModule} from "../utils/modal/full-screen-modal/full-screen-modal.module"; +import {LogServiceModule} from "../utils/log/LogService.module"; +import {OrcidRoutingModule} from "./orcid-routing.module"; + +@NgModule({ + imports: [ + CommonModule, RouterModule, AlertModalModule, LoadingModule, ResultLandingUtilsModule, + IconsModule, FullScreenModalModule, LogServiceModule + ], + declarations: [ + OrcidComponent, + OrcidWorkComponent + ], + providers:[ + OrcidService, ResultLandingService + ], + exports: [ + OrcidComponent, + OrcidWorkComponent + ] +}) + + +export class OrcidCoreModule{ + constructor(private iconsService: IconsService) { + this.iconsService.registerIcons([orcid_add, orcid_bin]) + } +} diff --git a/orcid/orcid.module.ts b/orcid/orcid.module.ts index 54bae78b..5743c46a 100644 --- a/orcid/orcid.module.ts +++ b/orcid/orcid.module.ts @@ -1,43 +1,15 @@ import {NgModule} from '@angular/core'; -import {CommonModule} from '@angular/common'; - -import {RouterModule} from '@angular/router'; - -import {OrcidComponent} from './orcid.component'; -import {OrcidService} from './orcid.service'; -import {OrcidWorkComponent} from './orcid-work.component'; -import {AlertModalModule} from '../utils/modal/alertModal.module'; -import {ResultLandingService} from '../landingPages/result/resultLanding.service'; -import {LoadingModule} from '../utils/loading/loading.module'; -import {ResultLandingUtilsModule} from '../landingPages/landing-utils/resultLandingUtils.module'; -import {IconsModule} from '../utils/icons/icons.module'; import {IconsService} from "../utils/icons/icons.service"; import {orcid_add, orcid_bin} from "../utils/icons/icons"; -import {FullScreenModalModule} from "../utils/modal/full-screen-modal/full-screen-modal.module"; -import {LogServiceModule} from "../utils/log/LogService.module"; import {OrcidRoutingModule} from "./orcid-routing.module"; +import {OrcidCoreModule} from "./orcid-core.module"; +import {OrcidComponent} from "./orcid.component"; @NgModule({ - imports: [ - CommonModule, RouterModule, OrcidRoutingModule, AlertModalModule, LoadingModule, ResultLandingUtilsModule, - IconsModule, FullScreenModalModule, LogServiceModule - ], - declarations: [ - OrcidComponent, - OrcidWorkComponent - ], - providers:[ - OrcidService, ResultLandingService - ], - exports: [ - OrcidComponent, - OrcidWorkComponent - ] + imports: [OrcidCoreModule, OrcidRoutingModule], + exports: [OrcidComponent] }) export class OrcidModule{ - constructor(private iconsService: IconsService) { - this.iconsService.registerIcons([orcid_add, orcid_bin]) - } } diff --git a/role-verification/role-verification.component.ts b/role-verification/role-verification.component.ts index 416c2624..1b54fe75 100644 --- a/role-verification/role-verification.component.ts +++ b/role-verification/role-verification.component.ts @@ -93,6 +93,8 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit, public userInfoLinkPrefix = ''; @Input() public userInfoLink = null; + @Input() + public relativeTo: ActivatedRoute = this._route; public user: User; public verification: any; public code: UntypedFormControl; @@ -150,7 +152,7 @@ export class RoleVerificationComponent extends BaseComponent implements OnInit, 'errorCode': LoginErrorCodes.NOT_LOGIN, 'redirectUrl': this._router.url }, - relativeTo: this._route + relativeTo: this.relativeTo }); } } else if(this.isMember) { diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 3e49a7cc..aadcd730 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -133,7 +133,14 @@ export class SearchResearchResultsService { return this.http.get((properties.useLongCache && size == 0 && !params && (!refineQuery || !refineQuery.includes("fq="))) ? (properties.cacheUrl + encodeURIComponent(url)) : url) .pipe(map(res => [res['meta'].total, this.parseResults(resultType, res['results'], properties), RefineResultsUtils.parse(res['refineResults'], refineFields, "publication")])); } + countResults(field:string,value:string): any { + let url = properties.utilsService + "/portals/countResults"; + if (field && value) { + url += "?field=" + encodeURIComponent(field) + "&value="+encodeURIComponent(value); + } + return this.http.get((properties.useLongCache ) ? (properties.cacheUrl + encodeURIComponent(url)) : url); + } searchResultForEntity(resultType: string, params: string, page: number, size: number, properties: EnvProperties): any { let link = properties.searchAPIURLLAst; //let url = link+params+"/"+this.getEntityQueryName(resultType,true)+ "?format=json"; diff --git a/sharedComponents/menu.ts b/sharedComponents/menu.ts index e3b38e60..b4328834 100644 --- a/sharedComponents/menu.ts +++ b/sharedComponents/menu.ts @@ -23,10 +23,11 @@ export class MenuItem { isFeatured: boolean; isActive: boolean; target: string = "_blank"; + badge?: string = ""; // used only for RDGraph portal (FAIRCORE4EOSC) constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params, icon: Icon = null, fragment = null, customClass = null, routeActive = null, - target: string = "_blank", type: string = "internal", isFeatured: boolean = false, items: MenuItem[] = []) { + target: string = "_blank", type: string = "internal", isFeatured: boolean = false, items: MenuItem[] = [], badge: string = "") { this._id = id; this.title = title; this.url = url; @@ -43,6 +44,7 @@ export class MenuItem { this.target = target; this.type = type; this.isFeatured = isFeatured; + this.badge = badge; } public static isTheActiveMenu(menu: MenuItem, currentRoute: any, activeMenuItem: string = ""): boolean { diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 7f502eab..a0147369 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -41,7 +41,9 @@ {{menu.title}} + [fragment]="menu.fragment"> + {{menu.badge}} + {{menu.title}} {{menu.title}} - {{menu.title}} + + {{menu.badge}} + {{menu.title}}
diff --git a/sharedComponents/tabs/slider-tabs.component.ts b/sharedComponents/tabs/slider-tabs.component.ts index d4246f23..666f90a2 100644 --- a/sharedComponents/tabs/slider-tabs.component.ts +++ b/sharedComponents/tabs/slider-tabs.component.ts @@ -6,11 +6,14 @@ import { ElementRef, EventEmitter, Input, OnDestroy, Output, QueryList, - ViewChild + ViewChild, + Inject, + PLATFORM_ID } from "@angular/core"; import {SliderTabComponent} from "./slider-tab.component"; import {ActivatedRoute, Router} from "@angular/router"; import {Subscription} from "rxjs"; +import {isPlatformServer} from "@angular/common"; import Timeout = NodeJS.Timeout; declare var UIkit; @@ -20,7 +23,7 @@ declare var UIkit; template: `
-
+
- - + + + +
`, }) @@ -112,6 +117,11 @@ export class SliderTabsComponent implements AfterViewInit, OnDestroy { * */ @Input() public flexPosition: 'center' | 'left' | 'right' = 'left'; + /** + * Set a class for the container + * */ + @Input() + public containerClass: string; /** * Set a class above tabs * */ @@ -138,10 +148,13 @@ export class SliderTabsComponent implements AfterViewInit, OnDestroy { private subscriptions: any[] = []; private observer: IntersectionObserver; private timeout: Timeout; + isServer: boolean; constructor(private route: ActivatedRoute, private router: Router, - private cdr: ChangeDetectorRef) { + private cdr: ChangeDetectorRef, + @Inject(PLATFORM_ID) private platform: any) { + this.isServer = isPlatformServer(this.platform); } ngAfterViewInit() { @@ -164,7 +177,7 @@ export class SliderTabsComponent implements AfterViewInit, OnDestroy { } }); if (this.type === 'static') { - let tabs = UIkit.tab(this.tabsElement.nativeElement, {connect: this.connect}); + let tabs = UIkit.switcher(this.tabsElement.nativeElement, {connect: this.connect}); tabs.show(this.activeIndex); if (this.connect.includes('#')) { this.scrollToStart(); diff --git a/utils/properties/searchFields.base.ts b/utils/properties/searchFields.base.ts index 79ece5b3..98c6a020 100644 --- a/utils/properties/searchFields.base.ts +++ b/utils/properties/searchFields.base.ts @@ -333,6 +333,14 @@ export class SearchFieldsBase { operator: "pf", equalityOperator: " = ", filterType: "triplet" + }, + ["haslicense"]: { + name: "License", + type: "triplet", + param: "haslicense", + operator: "hl", + equalityOperator: " = ", + filterType: "triplet" } }; @@ -369,6 +377,11 @@ export class SearchFieldsBase { { name: "All", id: "", count: "0" }, { name: "Yes", id: "true", count: "0" }, { name: "No", id: "false", count: "0" } + ], + ["haslicense"]: [ + { name: "All", id: "", count: "0" }, + { name: "Yes", id: "true", count: "0" }, + { name: "No", id: "false", count: "0" } ] }; diff --git a/utils/result-preview/result-preview.module.ts b/utils/result-preview/result-preview.module.ts index 5ad90baf..12726cc6 100644 --- a/utils/result-preview/result-preview.module.ts +++ b/utils/result-preview/result-preview.module.ts @@ -4,15 +4,15 @@ import {ResultPreviewComponent} from "./result-preview.component"; import {RouterModule} from "@angular/router"; import {ShowAuthorsModule} from "../authors/showAuthors.module"; import {ResultLandingUtilsModule} from "../../landingPages/landing-utils/resultLandingUtils.module"; -import {OrcidModule} from "../../orcid/orcid.module"; import {IconsModule} from "../icons/icons.module"; import {IconsService} from "../icons/icons.service"; import {cite, fire, landmark, link, link_to, quotes, rocket} from "../icons/icons"; import {EntityActionsModule} from "../entity-actions/entity-actions.module"; import {EntityMetadataModule} from "../../landingPages/landing-utils/entity-metadata.module"; +import {OrcidCoreModule} from "../../orcid/orcid-core.module"; @NgModule({ - imports: [CommonModule, RouterModule, ShowAuthorsModule, ResultLandingUtilsModule, OrcidModule, IconsModule, EntityActionsModule, EntityMetadataModule], + imports: [CommonModule, RouterModule, ShowAuthorsModule, ResultLandingUtilsModule, OrcidCoreModule, IconsModule, EntityActionsModule, EntityMetadataModule], declarations: [ResultPreviewComponent], exports: [ResultPreviewComponent] })