From b0b277278e273318688e44252ef19bc9dac82159 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 8 Jun 2023 13:24:46 +0300 Subject: [PATCH 01/10] fix issue with datasource criteria form #8790 --- .../content-providers/criteria/criteria.component.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/pages/content-providers/criteria/criteria.component.ts b/src/app/pages/content-providers/criteria/criteria.component.ts index 41a54ae..db9fcea 100644 --- a/src/app/pages/content-providers/criteria/criteria.component.ts +++ b/src/app/pages/content-providers/criteria/criteria.component.ts @@ -49,7 +49,6 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe } ngOnInit() { - this.reset(); this.loading = false; this.subscriptions.push(this.vocabulariesService.getVocabularyByType('fos', null, properties).subscribe((fos: any[]) => { this.fos = fos.map(element => element.id); @@ -60,6 +59,9 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe } ngOnChanges(changes: SimpleChanges) { + if(changes.selectionCriteria){ + this.reset(); + } this.calculateMaxHeight(); } @@ -86,10 +88,11 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe } reset() { + this.selectionCriteriaForm = this.fb.group({ + criteria: this.fb.array([]) + }); if (this.selectionCriteria?.criteria) { - this.selectionCriteriaForm = this.fb.group({ - criteria: this.fb.array([]) - }); + this.selectionCriteria.criteria.forEach(criterion => { let constraintArray: UntypedFormArray = this.fb.array([]); criterion.constraint.forEach(constraint => { From 1320fb7a75372e6e6632eeef890e153d96149241 Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 9 Jun 2023 13:58:35 +0300 Subject: [PATCH 02/10] Customization configuration: add fontsDarkMode attribute for hero section --- .../background-upload.component.ts | 3 +- .../pages/customization/color.component.ts | 2 +- .../customization.component.html | 32 ++++++++++++++++--- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/app/pages/customization/background-upload.component.ts b/src/app/pages/customization/background-upload.component.ts index c5886a3..e7d3ef5 100644 --- a/src/app/pages/customization/background-upload.component.ts +++ b/src/app/pages/customization/background-upload.component.ts @@ -26,6 +26,7 @@ declare var UIkit; class="uk-float-right uk-border-rounded uk-margin-top uk-margin-right uk-background-muted uk-button uk-button-link"> +
Lorem ipsum dolor sit amet...
@@ -51,7 +52,7 @@ export class BackgroundUploadComponent implements OnInit { @Input() oldBackground; // @Input() light:boolean; @Input() communityId: string = ""; - + @Input() light:boolean; //fonts mode public file: File; // public photo: string | ArrayBuffer; private maxsize: number = 2000 * 1024; diff --git a/src/app/pages/customization/color.component.ts b/src/app/pages/customization/color.component.ts index f2fb9cd..094100e 100644 --- a/src/app/pages/customization/color.component.ts +++ b/src/app/pages/customization/color.component.ts @@ -17,7 +17,7 @@ import {CustomizationOptions} from '../../openaireLibrary/connect/community/Cust
-
Contrast ratio may be too low.
+
Contrast ratio may be too low.
`, styles:[ ` diff --git a/src/app/pages/customization/customization.component.html b/src/app/pages/customization/customization.component.html index f532290..62831e6 100644 --- a/src/app/pages/customization/customization.component.html +++ b/src/app/pages/customization/customization.component.html @@ -207,11 +207,35 @@ -
- Hero section image +
+ Hero section +
+
+ Fonts + + + +
+
+ Dark mode + + + + +
+
From 946c4f62c43c95d992124649fc31f72342148368 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 20 Jun 2023 09:41:41 +0300 Subject: [PATCH 03/10] Update library before release --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index ddcdd79..db55273 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit ddcdd79204fccfd2e3c9aabfa9bd031d1e768f6b +Subproject commit db55273b685a7f0fc6ca7e79cd20d7cf68d6747a From fa6f55e772fcddd8c39dda2820b35ce884de737b Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 23 Jun 2023 15:27:08 +0300 Subject: [PATCH 04/10] Updating openaireLibrary and openaire-theme before beta & prod release --- src/app/openaireLibrary | 2 +- src/assets/openaire-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 3ee89e2..56428d0 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 3ee89e2bcae313a1ac82cfb678c4476ec1e9905f +Subproject commit 56428d0daed8726c9c70c8b7dad8f11b4ed604b8 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 468b2b0..af77de7 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 468b2b008f474c88dacc52991a5231693833f1f9 +Subproject commit af77de7b79bb7cbbdca3c3c9ea51d35eea06de5f From 82eec379f2e177a48d97968790f523709d002eac Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Fri, 23 Jun 2023 16:24:48 +0300 Subject: [PATCH 05/10] Updating libraries before prod release --- src/app/openaireLibrary | 2 +- src/assets/openaire-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index db55273..56428d0 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit db55273b685a7f0fc6ca7e79cd20d7cf68d6747a +Subproject commit 56428d0daed8726c9c70c8b7dad8f11b4ed604b8 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index a5b03a9..64c5ed3 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit a5b03a914c98c4478d758f58a8ceacc8f3c0611a +Subproject commit 64c5ed3d459df4947b0ab93917960c7fb8d1e507 From 94fc9bda53b2ee9ee20fb21ba6cc4589a3df47e8 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 26 Jun 2023 15:10:00 +0300 Subject: [PATCH 06/10] Update libraries --- src/app/openaireLibrary | 2 +- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 56428d0..0face4b 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 56428d0daed8726c9c70c8b7dad8f11b4ed604b8 +Subproject commit 0face4b57f291ea0168fe0d8fe32b51ebb1850d8 diff --git a/src/assets/common-assets b/src/assets/common-assets index f15bbfa..39cb4e5 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit f15bbfa7265f170e06b256f086f2acedfa3f72e0 +Subproject commit 39cb4e56d0320975fbd08fb5e9c68b87b0c82a10 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index af77de7..1e06310 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit af77de7b79bb7cbbdca3c3c9ea51d35eea06de5f +Subproject commit 1e06310b8b2b56f131754eaded615b6cf32c5848 From 500dd61f9baf713e88258119c56e8cc784e7e14d Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 27 Jun 2023 12:39:52 +0300 Subject: [PATCH 07/10] Update library. Fix an expression error in advanced-criteria. Add message if there are no subjects in each category. --- src/app/openaireLibrary | 2 +- .../advanced-criteria.component.ts | 2 +- .../subjects-edit-form.component.html | 43 +- .../subjects-edit-form.component.ts | 682 +++++++++--------- 4 files changed, 376 insertions(+), 353 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 0face4b..8d8eda4 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 0face4b57f291ea0168fe0d8fe32b51ebb1850d8 +Subproject commit 8d8eda416b4873c50f689db54444f135396db56d diff --git a/src/app/pages/advanced-criteria/advanced-criteria.component.ts b/src/app/pages/advanced-criteria/advanced-criteria.component.ts index 1294a59..01366f6 100644 --- a/src/app/pages/advanced-criteria/advanced-criteria.component.ts +++ b/src/app/pages/advanced-criteria/advanced-criteria.component.ts @@ -48,7 +48,7 @@ import {CommunityInfo} from "../../openaireLibrary/connect/community/communityIn + [okButtonDisabled]="!criteria || criteria.disabled"> diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts index 443c001..aa852a0 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.ts @@ -10,7 +10,9 @@ import {AlertModal} from '../../../openaireLibrary/utils/modal/alert'; import {SearchInputComponent} from '../../../openaireLibrary/sharedComponents/search-input/search-input.component'; import {forkJoin, Subscription} from 'rxjs'; import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo'; -import {FullScreenModalComponent} from 'src/app/openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component'; +import { + FullScreenModalComponent +} from 'src/app/openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component'; import {HelperFunctions} from 'src/app/openaireLibrary/utils/HelperFunctions.class'; import {NotificationHandler} from "../../../openaireLibrary/utils/notification-handler"; import {ClearCacheService} from "../../../openaireLibrary/services/clear-cache.service"; @@ -21,361 +23,361 @@ import {InputComponent} from "../../../openaireLibrary/sharedComponents/input/in declare var UIkit: any; @Component({ - selector: 'subjects-edit-form', - templateUrl: './subjects-edit-form.component.html', + selector: 'subjects-edit-form', + templateUrl: './subjects-edit-form.component.html', }) export class SubjectsEditFormComponent implements OnInit { - properties: EnvProperties = properties; - communityId: string = null; - community: CommunityInfo = null; - loading = true; - params: any; - private subscriptions: any[] = []; + properties: EnvProperties = properties; + communityId: string = null; + community: CommunityInfo = null; + loading = true; + params: any; + private subscriptions: any[] = []; - filterForm: UntypedFormControl; - subjectsForm = new UntypedFormArray([]); - hasChanges: boolean = false; - originalAllSubjects = []; - originalSubjects = []; - originalSdg = []; - originalFos = []; - displayedAllSubjects = []; - displayedSubjects = []; - displayedSdg = []; - displayedFos = []; - groupedAllSubjects = []; - groupedSubjects = []; - groupedSdg = []; - groupedFos = []; - subjectsColumns = []; - subjectsLimit: number = 6; - maxCharacters: number = 25; - activeTab: 'all' | 'freeText' | 'sdg' | 'fos' = 'all'; - indexAll: number = 0; - indexSubjects: number = 0; - indexSdg: number = 0; - indexFos: number = 0; + filterForm: UntypedFormControl; + subjectsForm = new UntypedFormArray([]); + hasChanges: boolean = false; + originalAllSubjects = []; + originalSubjects = []; + originalSdg = []; + originalFos = []; + displayedAllSubjects = []; + displayedSubjects = []; + displayedSdg = []; + displayedFos = []; + groupedAllSubjects = []; + groupedSubjects = []; + groupedSdg = []; + groupedFos = []; + subjectsColumns = []; + subjectsLimit: number = 6; + maxCharacters: number = 25; + activeTab: 'all' | 'freeText' | 'sdg' | 'fos' = 'all'; + indexAll: number = 0; + indexSubjects: number = 0; + indexSdg: number = 0; + indexFos: number = 0; - @ViewChild('addSubjectsInput') addSubjectsInput: InputComponent; - @ViewChild('editModal') editModal: AlertModal; - @ViewChild('deleteModal') deleteModal: AlertModal; - @ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent; - @ViewChild('modalTabs') modalTabs: ElementRef; - @ViewChild('sdgSelection') sdgSelection: SdgSelectionComponent; - @ViewChild('fosSelection') fosSelection: FosSelectionComponent; + @ViewChild('addSubjectsInput') addSubjectsInput: InputComponent; + @ViewChild('editModal') editModal: AlertModal; + @ViewChild('deleteModal') deleteModal: AlertModal; + @ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent; + @ViewChild('modalTabs') modalTabs: ElementRef; + @ViewChild('sdgSelection') sdgSelection: SdgSelectionComponent; + @ViewChild('fosSelection') fosSelection: FosSelectionComponent; - onEnter: () => void = () => { - this.addSubjectsIntoList(); - } - - constructor(private route: ActivatedRoute, - public _fb: UntypedFormBuilder, - private title: Title, - private _communityService: CommunityService, - private _subjectsService: SubjectsService, - private _clearCacheService: ClearCacheService) { - } - - ngOnInit() { - this.filterForm = this._fb.control(''); - this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => { - this.displayedAllSubjects = this.originalAllSubjects.filter(subject => { - return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1 - }); - this.displayedSubjects = this.originalSubjects.filter(subject => { - return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1 - }); - this.displayedSdg = this.originalSdg.filter(subject => { - return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1 - }); - this.displayedFos = this.originalFos.filter(subject => { - return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1 - }); - if(this.activeTab === 'all') { - this.groupSubjects(this.displayedAllSubjects, 'all'); - } else if(this.activeTab === 'freeText') { - this.groupSubjects(this.displayedSubjects, 'freeText'); - } else if(this.activeTab === 'sdg') { - this.groupSubjects(this.displayedSdg, 'sdg'); - } else if(this.activeTab === 'fos') { - this.groupSubjects(this.displayedFos, 'fos'); - } - })); - this.subscriptions.push(this.route.params.subscribe( - params => { - this.communityId = params['community']; - this.title.setTitle(this.communityId.toUpperCase() + ' | Subjects'); - this.loading = true; - this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe( - community => { - this.community = community; - this.params = { - community: encodeURIComponent( - '"' + community.queryId + '"') - }; - this.community.subjects.sort((n1,n2)=> { - if (n1.toLowerCase() > n2.toLowerCase()) { - return 1; - } - if (n1.toLowerCase() < n2.toLowerCase()) { - return -1; - } - return 0; + onEnter: () => void = () => { + this.addSubjectsIntoList(); + } + + constructor(private route: ActivatedRoute, + public _fb: UntypedFormBuilder, + private title: Title, + private _communityService: CommunityService, + private _subjectsService: SubjectsService, + private _clearCacheService: ClearCacheService) { + } + + ngOnInit() { + this.filterForm = this._fb.control(''); + this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => { + this.displayedAllSubjects = this.originalAllSubjects.filter(subject => { + return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1 }); - this.displayedSubjects = HelperFunctions.copy(this.community.subjects); - this.displayedSdg = this.community.sdg; - this.displayedFos = this.community.fos; - this.displayedAllSubjects = [...this.displayedSubjects, ...this.displayedSdg, ...this.displayedFos]; - this.groupSubjects(this.displayedAllSubjects, 'all'); - this.originalAllSubjects = HelperFunctions.copy(this.displayedAllSubjects); - this.originalSubjects = HelperFunctions.copy(this.displayedSubjects); - this.originalSdg = HelperFunctions.copy(this.displayedSdg); - this.originalFos = HelperFunctions.copy(this.displayedFos); - this.loading = false; - }, - error => this.handleUpdateError('System error retrieving community profile', error) - )); - })); - - } - - ngOnDestroy() { - this.subscriptions.forEach(subscription => { - if (subscription instanceof Subscription) { - subscription.unsubscribe(); - } - }); - } + this.displayedSubjects = this.originalSubjects.filter(subject => { + return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1 + }); + this.displayedSdg = this.originalSdg.filter(subject => { + return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1 + }); + this.displayedFos = this.originalFos.filter(subject => { + return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1 + }); + if (this.activeTab === 'all') { + this.groupSubjects(this.displayedAllSubjects, 'all'); + } else if (this.activeTab === 'freeText') { + this.groupSubjects(this.displayedSubjects, 'freeText'); + } else if (this.activeTab === 'sdg') { + this.groupSubjects(this.displayedSdg, 'sdg'); + } else if (this.activeTab === 'fos') { + this.groupSubjects(this.displayedFos, 'fos'); + } + })); + this.subscriptions.push(this.route.params.subscribe( + params => { + this.communityId = params['community']; + this.title.setTitle(this.communityId.toUpperCase() + ' | Subjects'); + this.loading = true; + this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe( + community => { + this.community = community; + this.params = { + community: encodeURIComponent( + '"' + community.queryId + '"') + }; + this.community.subjects.sort((n1, n2) => { + if (n1.toLowerCase() > n2.toLowerCase()) { + return 1; + } + if (n1.toLowerCase() < n2.toLowerCase()) { + return -1; + } + return 0; + }); + this.displayedSubjects = HelperFunctions.copy(this.community.subjects); + this.displayedSdg = this.community.sdg; + this.displayedFos = this.community.fos; + this.displayedAllSubjects = [...this.displayedSubjects, ...this.displayedSdg, ...this.displayedFos]; + this.groupSubjects(this.displayedAllSubjects, 'all'); + this.originalAllSubjects = HelperFunctions.copy(this.displayedAllSubjects); + this.originalSubjects = HelperFunctions.copy(this.displayedSubjects); + this.originalSdg = HelperFunctions.copy(this.displayedSdg); + this.originalFos = HelperFunctions.copy(this.displayedFos); + this.loading = false; + }, + error => this.handleUpdateError('System error retrieving community profile', error) + )); + })); - public groupSubjects(subjects: string[], type: string) { - if(subjects.length === 0) { - return []; - } - subjects.sort((a, b) => a.localeCompare(b)); - if(type === 'all') { - this.indexAll = 0; - this.activeTab = 'all'; - this.groupedAllSubjects = Object.values( - subjects.reduce((acc, subject) => { - let firstLetter = subject[0].toLocaleUpperCase(); - if(!acc[firstLetter]) { - acc[firstLetter] = {group: firstLetter, data: [subject]}; - } else { - acc[firstLetter].data.push(subject); - } - return acc; - },{}) - ) - if(subjects.length > 1) { - this.groupedAllSubjects.unshift({group: 'All', data: subjects}); - } - } - if(type === 'freeText') { - this.indexSubjects = 0; - this.activeTab = 'freeText'; - this.groupedSubjects = Object.values( - subjects.reduce((acc, subject) => { - let firstLetter = subject[0].toLocaleUpperCase(); - if(!acc[firstLetter]) { - acc[firstLetter] = {group: firstLetter, data: [subject]}; - } else { - acc[firstLetter].data.push(subject); - } - return acc; - },{}) - ) - if(subjects.length > 1) { - this.groupedSubjects.unshift({group: 'All', data: subjects}); - } - } - if(type === 'sdg') { - this.indexSdg = 0; - this.activeTab = 'sdg'; - this.groupedSdg = Object.values( - subjects.reduce((acc, subject) => { - let firstLetter = subject[0].toLocaleUpperCase(); - if(!acc[firstLetter]) { - acc[firstLetter] = {group: firstLetter, data: [subject]}; - } else { - acc[firstLetter].data.push(subject); - } - return acc; - },{}) - ) - if(subjects.length > 1) { - this.groupedSdg.unshift({group: 'All', data: subjects}); - } - } - if(type === 'fos') { - this.indexFos = 0; - this.activeTab = 'fos'; - this.groupedFos = Object.values( - subjects.reduce((acc, subject) => { - let key = subject.substring(0,2).toLocaleUpperCase(); - if(!acc[key]) { - acc[key] = {group: key, data: [subject]}; - } else { - acc[key].data.push(subject); - } - return acc; - },{}) - ) - if(subjects.length > 1) { - this.groupedFos.unshift({group: 'All', data: subjects}); - } - } - } - - public changeDisplayedSubjects(i, group) { - this.subjectsColumns = []; - if(this.activeTab === 'all') { - this.indexAll = i; - } else if(this.activeTab === 'freeText') { - this.indexSubjects = i; - } else if(this.activeTab === 'sdg') { - this.indexSdg = i; - } else if(this.activeTab === 'fos') { - this.indexFos = i; } - if(group.data.length > this.subjectsLimit && group.group != 'All') { - this.divideSubjects(group); - } - } - public divideSubjects(group) { - let columns = []; - for(let i = 0; i < (group.data.length / this.subjectsLimit); i++) { - columns.push(group.data.slice(i * this.subjectsLimit, ((i + 1) * this.subjectsLimit))); - } - this.subjectsColumns = columns; - } - - public getSubjectsExistOnlyInFirst(firstArray: string[], secondArray: string[]): string[] { - const difference = []; - for (let i = 0; i < firstArray.length; i++) { - if (secondArray.indexOf(firstArray[i]) === -1) { - difference.push(firstArray[i]); - } + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscription) { + subscription.unsubscribe(); + } + }); } - return difference; - } - public editAllSubjects() { - UIkit.tab(this.modalTabs.nativeElement).show(0); - this.displayedSubjects = HelperFunctions.copy(this.community.subjects); - this.sdgSelection.reset(); - this.sdgSelection.sdgs.markAsPristine(); - this.fosSelection.reset(); - this.fosSelection.fosOptions.markAsPristine(); - this.fullscreen.title = "Add/Edit Subjects"; - this.fullscreen.okButtonText = "Save"; - this.fullscreen.back = true; - this.fullscreen.okButton = true; - this.fullscreen.open(); - } + public groupSubjects(subjects: string[], type: string) { + if (subjects.length === 0) { + return []; + } + subjects.sort((a, b) => a.localeCompare(b)); + if (type === 'all') { + this.indexAll = 0; + this.activeTab = 'all'; + this.groupedAllSubjects = Object.values( + subjects.reduce((acc, subject) => { + let firstLetter = subject[0].toLocaleUpperCase(); + if (!acc[firstLetter]) { + acc[firstLetter] = {group: firstLetter, data: [subject]}; + } else { + acc[firstLetter].data.push(subject); + } + return acc; + }, {}) + ) + if (subjects.length > 1) { + this.groupedAllSubjects.unshift({group: 'All', data: subjects}); + } + } + if (type === 'freeText') { + this.indexSubjects = 0; + this.activeTab = 'freeText'; + this.groupedSubjects = Object.values( + subjects.reduce((acc, subject) => { + let firstLetter = subject[0].toLocaleUpperCase(); + if (!acc[firstLetter]) { + acc[firstLetter] = {group: firstLetter, data: [subject]}; + } else { + acc[firstLetter].data.push(subject); + } + return acc; + }, {}) + ) + if (subjects.length > 1) { + this.groupedSubjects.unshift({group: 'All', data: subjects}); + } + } + if (type === 'sdg') { + this.indexSdg = 0; + this.activeTab = 'sdg'; + this.groupedSdg = Object.values( + subjects.reduce((acc, subject) => { + let firstLetter = subject[0].toLocaleUpperCase(); + if (!acc[firstLetter]) { + acc[firstLetter] = {group: firstLetter, data: [subject]}; + } else { + acc[firstLetter].data.push(subject); + } + return acc; + }, {}) + ) + if (subjects.length > 1) { + this.groupedSdg.unshift({group: 'All', data: subjects}); + } + } + if (type === 'fos') { + this.indexFos = 0; + this.activeTab = 'fos'; + this.groupedFos = Object.values( + subjects.reduce((acc, subject) => { + let key = subject.substring(0, 2).toLocaleUpperCase(); + if (!acc[key]) { + acc[key] = {group: key, data: [subject]}; + } else { + acc[key].data.push(subject); + } + return acc; + }, {}) + ) + if (subjects.length > 1) { + this.groupedFos.unshift({group: 'All', data: subjects}); + } + } + } - public addSubjectsIntoList() { - if(this.addSubjectsInput.searchControl.getRawValue()) { - this.addSubjectsInput.add(null, true); - } - this.subjectsForm.getRawValue().forEach(element => { - this.displayedSubjects.unshift(element); - }); - this.subjectsForm.clear(); - this.hasChanges = true; - } + public changeDisplayedSubjects(i, group) { + this.subjectsColumns = []; + if (this.activeTab === 'all') { + this.indexAll = i; + } else if (this.activeTab === 'freeText') { + this.indexSubjects = i; + } else if (this.activeTab === 'sdg') { + this.indexSdg = i; + } else if (this.activeTab === 'fos') { + this.indexFos = i; + } + if (group.data.length > this.subjectsLimit && group.group != 'All') { + this.divideSubjects(group); + } + } - public removeSubjectFromList(i) { - this.displayedSubjects.splice(i, 1); - this.hasChanges = true; - } + public divideSubjects(group) { + let columns = []; + for (let i = 0; i < (group.data.length / this.subjectsLimit); i++) { + columns.push(group.data.slice(i * this.subjectsLimit, ((i + 1) * this.subjectsLimit))); + } + this.subjectsColumns = columns; + } - public saveAllSubjects() { - let selectedSdg = this.sdgSelection.getSelectedSubjects().map(a => a.id); - let selectedFos = this.fosSelection.getSelectedSubjects().map(a => a.id); - let requests = [ - ...this.saveSubjects(this.community.subjects, this.displayedSubjects, 'subjects'), - ...this.saveSubjects(this.community.sdg, selectedSdg, 'sdg'), - ...this.saveSubjects(this.community.fos, selectedFos, 'fos') - ]; - this.subscriptions.push(forkJoin(requests).subscribe(res => { - this.afterUpdateActions(res, "updated"); - })); - } - - public saveSubjects(subjects, displayedSubjects, type: string) { - if (this.communityId != null && this.communityId !== '') { - this.loading = true; - const subjectsToDeleteAr = this.getSubjectsExistOnlyInFirst(subjects, displayedSubjects); - const subjectsToAddAr = this.getSubjectsExistOnlyInFirst(displayedSubjects, subjects); - const subjectsToDelete = this.getNonEmptyItems(subjectsToDeleteAr); - const subjectsToAdd = this.getNonEmptyItems(subjectsToAddAr); - let requests = []; - if (subjectsToDelete.length > 0) { - requests.push(this._subjectsService.removeSubjects( - this.properties.communityAPI + this.communityId + '/' + type, subjectsToDelete)) - } - if (subjectsToAdd.length > 0) { - requests.push(this._subjectsService.addSubjects( - this.properties.communityAPI + this.communityId + '/' + type, subjectsToAdd)) - } - return requests; - } - } - - handleUpdateError(message: string, error = null) { - if(error) { - console.error(error) + public getSubjectsExistOnlyInFirst(firstArray: string[], secondArray: string[]): string[] { + const difference = []; + for (let i = 0; i < firstArray.length; i++) { + if (secondArray.indexOf(firstArray[i]) === -1) { + difference.push(firstArray[i]); + } + } + return difference; } - NotificationHandler.rise(message, 'danger'); - this.loading = false; - } - - afterUpdateActions(response, message: string) { - response.forEach(res => { - if (res.subjects) { - this.community.subjects = res.subjects; - } else if (res.sdg) { - this.community.sdg = res.sdg; - } else if (res.fos) { - this.community.fos = res.fos; - } - }); - this._communityService.updateSubjects(this.community.subjects, this.community.fos, this.community.sdg); - this._clearCacheService.purgeBrowserCache("Subjects "+message, this.communityId); - NotificationHandler.rise('Subjects successfully ' + message + '!') - this.loading = false; - } - - - private getNonEmptyItems(data: string[]): string[] { - const length = data.length; - const arrayNonEmpty = new Array(); - let j = 0; - for (let i = 0; i < length; i++) { - if (this.isEmpty(data[i])) { - } else if (this.isNonEmpty(data[i])) { - arrayNonEmpty[j] = data[i]; - j++; - } + + public editAllSubjects() { + UIkit.tab(this.modalTabs.nativeElement).show(0); + this.displayedSubjects = HelperFunctions.copy(this.community.subjects); + this.sdgSelection.reset(); + this.sdgSelection.sdgs.markAsPristine(); + this.fosSelection.reset(); + this.fosSelection.fosOptions.markAsPristine(); + this.fullscreen.title = "Add/Edit Subjects"; + this.fullscreen.okButtonText = "Save"; + this.fullscreen.back = true; + this.fullscreen.okButton = true; + this.fullscreen.open(); } - return arrayNonEmpty; - } - - - private isEmpty(data: string): boolean { - if (data !== undefined && !data.replace(/\s/g, '').length) { - return true; - } else { - return false; + + public addSubjectsIntoList() { + if (this.addSubjectsInput.searchControl.getRawValue()) { + this.addSubjectsInput.add(null, true); + } + this.subjectsForm.getRawValue().forEach(element => { + this.displayedSubjects.unshift(element); + }); + this.subjectsForm.clear(); + this.hasChanges = true; } - } - - private isNonEmpty(data: string): boolean { - if (data !== undefined && data != null) { - return true; - } else { - return false; + + public removeSubjectFromList(i) { + this.displayedSubjects.splice(i, 1); + this.hasChanges = true; + } + + public saveAllSubjects() { + let selectedSdg = this.sdgSelection.getSelectedSubjects().map(a => a.id); + let selectedFos = this.fosSelection.getSelectedSubjects().map(a => a.id); + let requests = [ + ...this.saveSubjects(this.community.subjects, this.displayedSubjects, 'subjects'), + ...this.saveSubjects(this.community.sdg, selectedSdg, 'sdg'), + ...this.saveSubjects(this.community.fos, selectedFos, 'fos') + ]; + this.subscriptions.push(forkJoin(requests).subscribe(res => { + this.afterUpdateActions(res, "updated"); + })); + } + + public saveSubjects(subjects, displayedSubjects, type: string) { + if (this.communityId != null && this.communityId !== '') { + this.loading = true; + const subjectsToDeleteAr = this.getSubjectsExistOnlyInFirst(subjects, displayedSubjects); + const subjectsToAddAr = this.getSubjectsExistOnlyInFirst(displayedSubjects, subjects); + const subjectsToDelete = this.getNonEmptyItems(subjectsToDeleteAr); + const subjectsToAdd = this.getNonEmptyItems(subjectsToAddAr); + let requests = []; + if (subjectsToDelete.length > 0) { + requests.push(this._subjectsService.removeSubjects( + this.properties.communityAPI + this.communityId + '/' + type, subjectsToDelete)) + } + if (subjectsToAdd.length > 0) { + requests.push(this._subjectsService.addSubjects( + this.properties.communityAPI + this.communityId + '/' + type, subjectsToAdd)) + } + return requests; + } + } + + handleUpdateError(message: string, error = null) { + if (error) { + console.error(error) + } + NotificationHandler.rise(message, 'danger'); + this.loading = false; + } + + afterUpdateActions(response, message: string) { + response.forEach(res => { + if (res.subjects) { + this.community.subjects = res.subjects; + } else if (res.sdg) { + this.community.sdg = res.sdg; + } else if (res.fos) { + this.community.fos = res.fos; + } + }); + this._communityService.updateSubjects(this.community.subjects, this.community.fos, this.community.sdg); + this._clearCacheService.purgeBrowserCache("Subjects " + message, this.communityId); + NotificationHandler.rise('Subjects successfully ' + message + '!') + this.loading = false; + } + + + private getNonEmptyItems(data: string[]): string[] { + const length = data.length; + const arrayNonEmpty = new Array(); + let j = 0; + for (let i = 0; i < length; i++) { + if (this.isEmpty(data[i])) { + } else if (this.isNonEmpty(data[i])) { + arrayNonEmpty[j] = data[i]; + j++; + } + } + return arrayNonEmpty; + } + + + private isEmpty(data: string): boolean { + if (data !== undefined && !data.replace(/\s/g, '').length) { + return true; + } else { + return false; + } + } + + private isNonEmpty(data: string): boolean { + if (data !== undefined && data != null) { + return true; + } else { + return false; + } } - } } From a79fd13a17a2d50d1b2684802b56eaa538f926ed Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 14 Jul 2023 12:12:32 +0300 Subject: [PATCH 08/10] Update piwik with the new methods --- src/app/app.component.ts | 4 ++-- src/app/openaireLibrary | 2 +- src/app/pages/stats/stats.component.ts | 2 +- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 5bb21a9..399c9ba 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -126,7 +126,7 @@ export class AppComponent implements OnInit { this.subscriptions.push(this.data.subscribe(data => { if(data && data.portal) { this.setProperties(data.portal); - this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity); + this.configurationService.initPortal(this.properties, this.properties.adminToolsCommunity); } })); this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { @@ -172,7 +172,7 @@ export class AppComponent implements OnInit { } else { ConnectHelper.setPortalTypeFromPid(id); } - this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity); + this.configurationService.initPortal(this.properties, this.properties.adminToolsCommunity); } public get open() { diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 8d8eda4..5645dee 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 8d8eda416b4873c50f689db54444f135396db56d +Subproject commit 5645deec97d1bd3cb35cec792ac8dc963c0f4d8a diff --git a/src/app/pages/stats/stats.component.ts b/src/app/pages/stats/stats.component.ts index 73ed26e..6d81836 100644 --- a/src/app/pages/stats/stats.component.ts +++ b/src/app/pages/stats/stats.component.ts @@ -133,7 +133,7 @@ export class StatsComponent implements OnInit { this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); } else { //console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`); - this.configService.communityInformationState.subscribe( + this.configService.portalAsObservable.subscribe( res => { console.debug(res); if(res) { diff --git a/src/assets/common-assets b/src/assets/common-assets index 39cb4e5..2fd5784 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 39cb4e56d0320975fbd08fb5e9c68b87b0c82a10 +Subproject commit 2fd57843f85125e54adfb95b35776755037ea359 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 1e06310..2fffe0f 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 1e06310b8b2b56f131754eaded615b6cf32c5848 +Subproject commit 2fffe0fa672adcf5577461d10c30e34b00308c85 From fb6f4232736e316316b9b377c240bc7c896e6da6 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Fri, 4 Aug 2023 10:47:39 +0300 Subject: [PATCH 09/10] Update libraries --- src/app/openaireLibrary | 2 +- src/assets/openaire-theme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 5645dee..a53c4e9 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 5645deec97d1bd3cb35cec792ac8dc963c0f4d8a +Subproject commit a53c4e90d099d0bf3919df55edceaf7f793427d0 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 2fffe0f..5268f27 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 2fffe0fa672adcf5577461d10c30e34b00308c85 +Subproject commit 5268f277246347aad42349a06eecb915a452841b From 93efde0b076eaceb608dc19cc6669c55e530e7f8 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 29 Aug 2023 11:22:27 +0300 Subject: [PATCH 10/10] Fix criteria disabled condition because of null in selectionCriteria. --- src/app/openaireLibrary | 2 +- src/app/pages/content-providers/criteria/criteria.component.ts | 2 +- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index a53c4e9..1b98944 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit a53c4e90d099d0bf3919df55edceaf7f793427d0 +Subproject commit 1b989441db0b1f808d1b626d3588901d54ffaf90 diff --git a/src/app/pages/content-providers/criteria/criteria.component.ts b/src/app/pages/content-providers/criteria/criteria.component.ts index db9fcea..0549ace 100644 --- a/src/app/pages/content-providers/criteria/criteria.component.ts +++ b/src/app/pages/content-providers/criteria/criteria.component.ts @@ -161,7 +161,7 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe } get dirty() { - if (!this.selectionCriteria || !this.criteria) { + if (!this.selectionCriteria && !this.criteria) { return false; } else if (this.criteria.length !== this.criteriaArray.length) { return true; diff --git a/src/assets/common-assets b/src/assets/common-assets index 2fd5784..d18e0a7 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 2fd57843f85125e54adfb95b35776755037ea359 +Subproject commit d18e0a7e43e5ab74649481ecbf352ba49893c66f diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 5268f27..2df4b37 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 5268f277246347aad42349a06eecb915a452841b +Subproject commit 2df4b377a3e89b7dd26a011a2e1e1f07fdcedf2a