From 83acc14d3b8c35a52d90a74de26fc1a33b4b0b5c Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 9 Feb 2023 16:31:54 +0200 Subject: [PATCH 01/22] 1. Update library and assets. 2. Add deleteAthorizationLevel for managers with value manager. --- src/app/openaireLibrary | 2 +- src/app/pages/users/users-managers/users-managers.component.ts | 3 ++- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index acdba43..c53806f 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit acdba43c8bc8244f59e32e450f0dd106bb397037 +Subproject commit c53806f5b33c2fc218b35b2ac8af30e1daa663d2 diff --git a/src/app/pages/users/users-managers/users-managers.component.ts b/src/app/pages/users/users-managers/users-managers.component.ts index 7cf7554..634cd2d 100644 --- a/src/app/pages/users/users-managers/users-managers.component.ts +++ b/src/app/pages/users/users-managers/users-managers.component.ts @@ -12,7 +12,8 @@ import {CommunityInfo} from "../../../openaireLibrary/connect/community/communit selector: 'users-managers', template: ` + [link]="link" [role]="'manager'" [deleteAuthorizationLevel]="'manager'" + [message]="message" [emailComposer]="emailComposer">
Admin Dashboard - Manage Users
diff --git a/src/assets/common-assets b/src/assets/common-assets index fdcbc17..8c62240 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit fdcbc17b88deb76cee2cd4432282468be9f56b7e +Subproject commit 8c62240a403dd8a592eac78d565b185b3b1043c0 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 99ecab0..5b838cf 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 99ecab0b4e9ceed21424c8fa26ef270b4695b11e +Subproject commit 5b838cfc1c31fb2766a7cdd27734b8b78393e2e6 From 39aad35c4742732d3d7583c4c0b1a5bdd1945eab Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 1 Mar 2023 16:25:54 +0200 Subject: [PATCH 02/22] Move community info options to sidebar and delete internal tabs --- src/app/app.component.html | 5 ++- src/app/app.component.ts | 21 ++++++++-- src/app/openaireLibrary | 2 +- .../affiliations/affiliations.component.html | 1 - .../pages/affiliations/affiliations.module.ts | 3 +- .../community-info.component.ts | 42 ------------------- .../community-info/community-info.module.ts | 14 ------- .../profile/profile.component.ts | 1 - .../community-info/profile/profile.module.ts | 4 +- .../communityContentProviders.module.ts | 2 - .../remove-content-providers.component.html | 1 - .../customization.component.html | 27 +++++------- .../projects/communityProjects.module.ts | 2 - .../projects/remove-projects.component.html | 1 - .../subjects-edit-form.component.html | 1 - .../subjects-edit-form.module.ts | 5 ++- .../manage-zenodo-communities.component.html | 1 - .../zenodo-communities.module.ts | 3 +- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 20 files changed, 39 insertions(+), 101 deletions(-) delete mode 100644 src/app/pages/community-info/community-info.component.ts delete mode 100644 src/app/pages/community-info/community-info.module.ts diff --git a/src/app/app.component.html b/src/app/app.component.html index 9971650..4fb73af 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -2,12 +2,13 @@
-
diff --git a/src/app/pages/affiliations/affiliations.module.ts b/src/app/pages/affiliations/affiliations.module.ts index 3c5142c..7bafd2d 100644 --- a/src/app/pages/affiliations/affiliations.module.ts +++ b/src/app/pages/affiliations/affiliations.module.ts @@ -11,7 +11,6 @@ import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.mod import {UtilitiesService} from '../../openaireLibrary/services/utilities.service'; import {InputModule} from "../../openaireLibrary/sharedComponents/input/input.module"; import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module"; -import {CommunityInfoModule} from "../community-info/community-info.module"; import {IconsModule} from "../../openaireLibrary/utils/icons/icons.module"; import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-load-paging.module"; import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module"; @@ -22,7 +21,7 @@ import {PagingModule} from "../../openaireLibrary/utils/paging.module"; @NgModule({ imports: [ AffiliationsRoutingModule, CommonModule, FormsModule, RouterModule, - AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, CommunityInfoModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule + AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule ], declarations: [ AffiliationsComponent diff --git a/src/app/pages/community-info/community-info.component.ts b/src/app/pages/community-info/community-info.component.ts deleted file mode 100644 index 87d9c03..0000000 --- a/src/app/pages/community-info/community-info.component.ts +++ /dev/null @@ -1,42 +0,0 @@ -import {Component, Input, OnInit} from '@angular/core'; -import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo'; -import {CommunityService} from '../../openaireLibrary/connect/community/community.service'; -import {Subscription} from 'rxjs'; -import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields"; - -@Component({ - selector: 'community-info', - template: ` - - ` -}) -export class CommunityInfoComponent implements OnInit { - @Input() - public type: string; - @Input() - public tab: "profile"| "organizations" | "projects" | "content-providers" | "subjects" | "zenodo-communities" = 'profile'; - public community: CommunityInfo; - public openAIREEntities = OpenaireEntities; - private sub; - - constructor(private communityService: CommunityService) { - } - - ngOnInit() { - this.sub =this.communityService.getCommunityAsObservable().subscribe(community => { - this.community = community; - }); - } - ngOnDestroy() { - if (this.sub instanceof Subscription) { - this.sub.unsubscribe(); - } - } -} diff --git a/src/app/pages/community-info/community-info.module.ts b/src/app/pages/community-info/community-info.module.ts deleted file mode 100644 index 13be1fe..0000000 --- a/src/app/pages/community-info/community-info.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import {NgModule} from '@angular/core'; -import {RouterModule} from "@angular/router"; -import {CommonModule} from "@angular/common"; -import {CommunityInfoComponent} from "./community-info.component"; - -@NgModule({ - imports: [ - CommonModule, RouterModule - ], - declarations: [CommunityInfoComponent], - exports: [CommunityInfoComponent] -}) -export class CommunityInfoModule { -} diff --git a/src/app/pages/community-info/profile/profile.component.ts b/src/app/pages/community-info/profile/profile.component.ts index cdb91de..f46641d 100644 --- a/src/app/pages/community-info/profile/profile.component.ts +++ b/src/app/pages/community-info/profile/profile.component.ts @@ -20,7 +20,6 @@ import {Subscription} from "rxjs";

{{community.shortTitle}}

-
diff --git a/src/app/pages/community-info/profile/profile.module.ts b/src/app/pages/community-info/profile/profile.module.ts index ca8e55a..c1ee1ca 100644 --- a/src/app/pages/community-info/profile/profile.module.ts +++ b/src/app/pages/community-info/profile/profile.module.ts @@ -5,7 +5,6 @@ import {PageContentModule} from "../../../openaireLibrary/dashboard/sharedCompon import {ProfileComponent} from "./profile.component"; import {EditCommunityModule} from "./edit-community/edit-community.module"; import {LoadingModule} from "../../../openaireLibrary/utils/loading/loading.module"; -import {CommunityInfoModule} from "../community-info.module"; @NgModule({ imports: [ @@ -17,8 +16,7 @@ import {CommunityInfoModule} from "../community-info.module"; ]), PageContentModule, EditCommunityModule, - LoadingModule, - CommunityInfoModule, + LoadingModule ], declarations: [ProfileComponent], exports: [ProfileComponent] diff --git a/src/app/pages/content-providers/communityContentProviders.module.ts b/src/app/pages/content-providers/communityContentProviders.module.ts index 5d29600..4a0708e 100644 --- a/src/app/pages/content-providers/communityContentProviders.module.ts +++ b/src/app/pages/content-providers/communityContentProviders.module.ts @@ -10,7 +10,6 @@ import {ErrorMessagesModule} from '../../openaireLibrary/utils/errorMessages.mod import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module'; import {CommonModule} from '@angular/common'; import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module"; -import {CommunityInfoModule} from "../community-info/community-info.module"; import {InputModule} from "../../openaireLibrary/sharedComponents/input/input.module"; import {SearchInputModule} from "../../openaireLibrary/sharedComponents/search-input/search-input.module"; import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-load-paging.module"; @@ -42,7 +41,6 @@ import {CriteriaModule} from "./criteria/criteria.module"; AlertModalModule, SearchDataprovidersServiceModule, PageContentModule, - CommunityInfoModule, InputModule, SearchInputModule, RouterModule.forChild([ diff --git a/src/app/pages/content-providers/remove-content-providers.component.html b/src/app/pages/content-providers/remove-content-providers.component.html index d921b24..4dcd4b4 100644 --- a/src/app/pages/content-providers/remove-content-providers.component.html +++ b/src/app/pages/content-providers/remove-content-providers.component.html @@ -7,7 +7,6 @@

{{community.shortTitle}}

-
diff --git a/src/app/pages/customization/customization.component.html b/src/app/pages/customization/customization.component.html index 1f11504..f532290 100644 --- a/src/app/pages/customization/customization.component.html +++ b/src/app/pages/customization/customization.component.html @@ -1,16 +1,14 @@
diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html index bb4547e..7170888 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html @@ -7,7 +7,6 @@

{{community.shortTitle}}

-
diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.module.ts b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.module.ts index 28af737..f778ab0 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.module.ts +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.module.ts @@ -13,14 +13,15 @@ import {AlertModalModule} from '../../../openaireLibrary/utils/modal/alertModal. import {NoLoadPaging} from '../../../openaireLibrary/searchPages/searchUtils/no-load-paging.module'; import {LoadingModule} from '../../../openaireLibrary/utils/loading/loading.module'; import {InputModule} from '../../../openaireLibrary/sharedComponents/input/input.module'; -import {CommunityInfoModule} from '../../community-info/community-info.module'; import {SearchInputModule} from '../../../openaireLibrary/sharedComponents/search-input/search-input.module'; import {FullScreenModalModule} from 'src/app/openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.module'; import {PagingModule} from "../../../openaireLibrary/utils/paging.module"; @NgModule({ imports: [ - SubjectsEditFormRoutingModule, CommonModule, FormsModule, RouterModule, PageContentModule, IconsModule, AlertModalModule, NoLoadPaging, LoadingModule, InputModule, CommunityInfoModule, SearchInputModule, FullScreenModalModule, PagingModule + SubjectsEditFormRoutingModule, CommonModule, FormsModule, RouterModule, + PageContentModule, IconsModule, AlertModalModule, NoLoadPaging, LoadingModule, InputModule, + SearchInputModule, FullScreenModalModule, PagingModule ], declarations: [ SubjectsEditFormComponent diff --git a/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html b/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html index 1dd174e..62669ed 100644 --- a/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html +++ b/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html @@ -7,7 +7,6 @@

{{community.shortTitle}}

-
diff --git a/src/app/pages/zenodo-communities/zenodo-communities.module.ts b/src/app/pages/zenodo-communities/zenodo-communities.module.ts index 5f2f20a..59f1ed6 100644 --- a/src/app/pages/zenodo-communities/zenodo-communities.module.ts +++ b/src/app/pages/zenodo-communities/zenodo-communities.module.ts @@ -10,7 +10,6 @@ import {ManageZenodoCommunitiesService} from '../../services/manageZenodoCommuni import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module'; import {ZenodoCommunitiesRoutingModule} from './zenodo-communities-routing.module'; -import {CommunityInfoModule} from '../community-info/community-info.module'; import {SearchInputModule} from '../../openaireLibrary/sharedComponents/search-input/search-input.module'; import {IconsModule} from '../../openaireLibrary/utils/icons/icons.module'; import {NoLoadPaging} from '../../openaireLibrary/searchPages/searchUtils/no-load-paging.module'; @@ -24,7 +23,7 @@ import {PagingModule} from "../../openaireLibrary/utils/paging.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule, - AlertModalModule, ZenodoCommunitiesRoutingModule, CommunityInfoModule, PageContentModule, SearchInputModule, IconsModule, NoLoadPaging, LoadingModule, FullScreenModalModule, HTMLToStringPipeModule, PagingModule + AlertModalModule, ZenodoCommunitiesRoutingModule, PageContentModule, SearchInputModule, IconsModule, NoLoadPaging, LoadingModule, FullScreenModalModule, HTMLToStringPipeModule, PagingModule ], declarations: [ ManageZenodoCommunitiesComponent, ZenodoCommunitiesComponent, AddZenodoCommunitiesComponent, PreviewZenodoCommunityComponent diff --git a/src/assets/common-assets b/src/assets/common-assets index 8c62240..071385b 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 8c62240a403dd8a592eac78d565b185b3b1043c0 +Subproject commit 071385b36c9b9c65d6d081d6468aeea2bf01ffbf diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 5b838cf..a72ea0d 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 5b838cfc1c31fb2766a7cdd27734b8b78393e2e6 +Subproject commit a72ea0d0c9d0b490de6c77a238d501ee75216960 From 400c0d8dcea2b7c674f9ca402fc499dba314f770 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 1 Mar 2023 16:40:01 +0200 Subject: [PATCH 03/22] Remove offcanvas flip from navbar inputs. --- src/app/app.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/app.component.html b/src/app/app.component.html index 4fb73af..c6796f9 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -6,7 +6,7 @@ [class.sidebar_hover]="hover"> + [userMenuItems]=userMenuItems [menuItems]="menuItems" [user]="user">
From 798746e0415561d94c7ad430d48f7d3dd11cfebd Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 2 Mar 2023 16:53:21 +0200 Subject: [PATCH 04/22] Update libraries before make new branches --- src/app/openaireLibrary | 2 +- src/assets/common-assets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 886b50a..799a62a 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 886b50a52c93163113ed6583faf8b054d9390731 +Subproject commit 799a62afc5c3c752d6b4e3f9e2c6d87433d6a4ad diff --git a/src/assets/common-assets b/src/assets/common-assets index 071385b..e0c850a 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 071385b36c9b9c65d6d081d6468aeea2bf01ffbf +Subproject commit e0c850adad45d61fe7e07f340eea2dc7870ff3c9 From d9b4be9a5c4dda8150e1880b6ffc449a1327358c Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 9 Mar 2023 00:26:06 +0200 Subject: [PATCH 05/22] Criteria: Change criteria in order to be a generic component. --- src/app/openaireLibrary | 2 +- .../pages/content-providers/criteria-utils.ts | 6 +- .../criteria/criteria.component.html | 210 +++++++++--------- .../criteria/criteria.component.less | 7 +- .../criteria/criteria.component.ts | 172 +++++++------- .../manage-content-providers.component.ts | 38 +++- 6 files changed, 224 insertions(+), 211 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 799a62a..1d2a0ef 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 799a62afc5c3c752d6b4e3f9e2c6d87433d6a4ad +Subproject commit 1d2a0effa840836cbb26334eabd9e1ea3752b455 diff --git a/src/app/pages/content-providers/criteria-utils.ts b/src/app/pages/content-providers/criteria-utils.ts index 4d7b0b9..ff010a6 100644 --- a/src/app/pages/content-providers/criteria-utils.ts +++ b/src/app/pages/content-providers/criteria-utils.ts @@ -2,11 +2,13 @@ import {Option} from "../../openaireLibrary/sharedComponents/input/input.compone export class CriteriaUtils { public static readonly fields: Option[] = [ - {value: 'title', label: 'Title'}, {value: 'author', label: 'Author\'s name'}, + {value: 'title', label: 'Title'}, {value: 'orcid', label: 'Author\'s ORCID'}, {value: 'contributor', label: 'Contributor'}, - {value: 'description', label: 'Description'} + {value: 'description', label: 'Description'}, + {value: 'subject', label: 'Subject'}, + {value: 'fos', label: 'Field of Science'} ] public static readonly verbs: Option[] = [ diff --git a/src/app/pages/content-providers/criteria/criteria.component.html b/src/app/pages/content-providers/criteria/criteria.component.html index 67e837c..65a9fd7 100644 --- a/src/app/pages/content-providers/criteria/criteria.component.html +++ b/src/app/pages/content-providers/criteria/criteria.component.html @@ -3,118 +3,114 @@
-
+
+
+
No filters for {{dataProvider}}.
+
If no filters are specified, all {{openaireEntities.RESULTS | lowercase}} of this {{openaireEntities.DATASOURCE | lowercase}} will be included in your + {{openaireEntities.COMMUNITY | lowercase}}. +
+
+
+
+
    +
  • +
    +

    + {{i + 1}} +

    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    +
  • +
+
+
+
+ -
-
No filters for {{dataProvider.officialname}}.
-
If no filters are specified, all {{openaireEntities.RESULTS | lowercase}} of this {{openaireEntities.DATASOURCE | lowercase}} will be included in your - {{openaireEntities.COMMUNITY | lowercase}}. -
-
-
-
- - -
    -
  • -
    -

    - {{getIndex(i) + 1}} -

    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    - -
    -
    -
  • -
-
- - -
-
-
diff --git a/src/app/pages/content-providers/criteria/criteria.component.less b/src/app/pages/content-providers/criteria/criteria.component.less index 6bec815..1d3f7ca 100644 --- a/src/app/pages/content-providers/criteria/criteria.component.less +++ b/src/app/pages/content-providers/criteria/criteria.component.less @@ -1,8 +1,7 @@ -@import (reference) "~src/assets/openaire-theme/less/_import-variables.less"; +.criteria { + padding-right: 20px; +} .criterion { - border: @global-border solid @global-border-width; - border-radius: @global-border-radius; max-height: 400px; - overflow: auto; } diff --git a/src/app/pages/content-providers/criteria/criteria.component.ts b/src/app/pages/content-providers/criteria/criteria.component.ts index 8ae1e24..88ae678 100644 --- a/src/app/pages/content-providers/criteria/criteria.component.ts +++ b/src/app/pages/content-providers/criteria/criteria.component.ts @@ -1,13 +1,16 @@ -import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; -import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; import { - Constraint, - ContentProvider, - Criteria, - SelectionCriteria -} from '../../../openaireLibrary/utils/entities/contentProvider'; + AfterViewInit, + ChangeDetectorRef, + Component, + Input, + OnChanges, + OnDestroy, + OnInit, + SimpleChanges +} from '@angular/core'; +import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; +import {Constraint, Criteria, SelectionCriteria} from '../../../openaireLibrary/utils/entities/contentProvider'; import {AbstractControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, Validators} from '@angular/forms'; -import {ManageCommunityContentProvidersService} from '../../../services/manageContentProviders.service'; import {properties} from "../../../../environments/environment"; import {Option} from "../../../openaireLibrary/sharedComponents/input/input.component"; import {MatSlideToggleChange} from "@angular/material/slide-toggle"; @@ -15,79 +18,97 @@ import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.cl import {CriteriaUtils} from "../criteria-utils"; import {NotificationHandler} from "../../../openaireLibrary/utils/notification-handler"; import {OpenaireEntities} from "../../../openaireLibrary/utils/properties/searchFields"; +import {ISVocabulariesService} from "../../../openaireLibrary/utils/staticAutoComplete/ISVocabularies.service"; +import {Subscription} from "rxjs"; @Component({ selector: 'criteria', templateUrl: 'criteria.component.html', styleUrls: ['criteria.component.less'] }) -export class CriteriaComponent implements OnInit { +export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDestroy { @Input() - public dataProvider: ContentProvider; - public selectionCriteria: UntypedFormGroup; + public dataProvider: string; + @Input() + public selectionCriteria: SelectionCriteria; + @Input() + public height: number = 0; + public maxHeight: number = 0; + public selectionCriteriaForm: UntypedFormGroup; public properties: EnvProperties = properties; public fields: Option[] = CriteriaUtils.fields; public verbs: Option[] = CriteriaUtils.verbs; + public fos: string[] = []; public loading = true; - /** Paging */ - public page: number = 1; - public pageSize: number = 5; public openaireEntities = OpenaireEntities; + private subscriptions: any[] = []; - constructor(private manageCommunityContentProvidersService: ManageCommunityContentProvidersService, - private cdr: ChangeDetectorRef, + constructor(private cdr: ChangeDetectorRef, private vocabulariesService: ISVocabulariesService, private fb: UntypedFormBuilder) { } 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); + })); } - reset() { - this.page = 1; - if (this.dataProvider) { - this.selectionCriteria = this.fb.group({ - criteria: this.fb.array([]) - }); - let selectionCriteria = this.dataProvider.selectioncriteria; - if (selectionCriteria) { - selectionCriteria.criteria.forEach(criterion => { - let constraintArray: UntypedFormArray = this.fb.array([]); - criterion.constraint.forEach(constraint => { - constraintArray.push(this.fb.group({ - field: this.fb.control(constraint.field, Validators.required), - verb: this.fb.control(this.removeSuffix(constraint.verb), Validators.required), - value: this.fb.control(constraint.value, Validators.required), - verb_suffix: this.fb.control(this.getSuffix(constraint.verb)) - })); - }); - this.criteria.push(this.fb.group({ - constraint: constraintArray - })); - }); + ngOnChanges(changes: SimpleChanges) { + this.calculateMaxHeight(); + } + + ngAfterViewInit() { + this.calculateMaxHeight(); + } + + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscription) { + subscription.unsubscribe(); + } + }); + } + + calculateMaxHeight() { + if(this.height) { + if(this.height > 0) { + /* Element height - section (70 + 70) - margins(20 + 20) - button height(42) */ + this.maxHeight = this.height - 140 - 40 - 42; + this.cdr.detectChanges(); } } } - get disabled() { - return this.loading || !this.dirty || this.selectionCriteria.invalid; - } - - get currentPage(): AbstractControl[] { - if (this.criteria) { - return this.criteria.controls.slice((this.page - 1) * this.pageSize, this.page * this.pageSize); - } else { - return []; + reset() { + 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 => { + constraintArray.push(this.fb.group({ + field: this.fb.control(constraint.field, Validators.required), + verb: this.fb.control(this.removeSuffix(constraint.verb), Validators.required), + value: this.fb.control(constraint.value, Validators.required), + verb_suffix: this.fb.control(this.getSuffix(constraint.verb)) + })); + }); + this.criteria.push(this.fb.group({ + constraint: constraintArray + })); + }); } } - getIndex(index: number): number { - return (this.page - 1)*this.pageSize + index; + get disabled() { + return this.loading || !this.dirty || this.selectionCriteriaForm.invalid; } public get criteria(): UntypedFormArray { - return this.selectionCriteria.get('criteria') as UntypedFormArray; + return this.selectionCriteriaForm.get('criteria') as UntypedFormArray; } public getConstraint(i: number): UntypedFormArray { @@ -103,11 +124,9 @@ export class CriteriaComponent implements OnInit { verb_suffix: this.fb.control('_caseinsensitive') }) ]); - this.criteria.insert(0, this.fb.group({ - constraint: constraintArray - })); - this.page = 1; + this.criteria.push(this.fb.group({constraint: constraintArray})); this.cdr.detectChanges(); + document.getElementById('criterion-' + (this.criteria.length - 1).toString()).scrollIntoView({behavior: 'smooth'}); } public addConstraint(i: number) { @@ -126,25 +145,22 @@ export class CriteriaComponent implements OnInit { constraintArray.removeAt(j); if (constraintArray.length === 0) { this.criteria.removeAt(i); - while(this.currentPage.length === 0 && this.page > 0) { - this.page--; - } } this.cdr.detectChanges(); } - get dataProviderCriteria(): Criteria[] { - return (this.dataProvider && this.dataProvider.selectioncriteria && this.dataProvider.selectioncriteria.criteria)?this.dataProvider.selectioncriteria.criteria:[]; + get criteriaArray(): Criteria[] { + return (this.selectionCriteria?.criteria) ? this.selectionCriteria?.criteria : []; } - + get dirty() { - if(!this.dataProvider || !this.criteria) { + if (!this.dataProvider || !this.criteria) { return false; - } else if(this.criteria.length !== this.dataProviderCriteria.length) { + } else if (this.criteria.length !== this.criteriaArray.length) { return true; } else { - return this.dataProviderCriteria.filter((criterion, i) => { - if(criterion.constraint.length !== this.getConstraint(i).length) { + return this.criteriaArray.filter((criterion, i) => { + if (criterion.constraint.length !== this.getConstraint(i).length) { return true; } else { let temp = this.getConstraint(i).value; @@ -156,23 +172,10 @@ export class CriteriaComponent implements OnInit { } } - save(callback: Function = null) { - if (this.selectionCriteria.valid) { + save(callback: (selectionCriteria) => void = null) { + if (this.selectionCriteriaForm.valid) { this.loading = true; - this.dataProvider.selectioncriteria = this.parseForm(this.selectionCriteria.value); - this.manageCommunityContentProvidersService.saveContentProvider(this.properties, this.dataProvider).subscribe(() => { - this.reset(); - if(callback) { - callback(); - } - this.loading = false; - NotificationHandler.rise('Filters have been successfully updated'); - }, error => { - this.loading = false; - this.handeError('An error has been occurred. Try again later!', error); - }); - } else { - this.handeError('An error has been occurred. Try again later!'); + callback(this.parseForm(this.selectionCriteriaForm.value)); } } @@ -182,7 +185,7 @@ export class CriteriaComponent implements OnInit { } caseSensitive(event: MatSlideToggleChange, constraint: AbstractControl) { - if(event.checked) { + if (event.checked) { constraint.get('verb_suffix').setValue(''); } else { constraint.get('verb_suffix').setValue('_caseinsensitive'); @@ -194,7 +197,7 @@ export class CriteriaComponent implements OnInit { } getSuffix(verb: string) { - if(verb.includes('_caseinsensitive')) { + if (verb.includes('_caseinsensitive')) { return '_caseinsensitive'; } else { return ''; @@ -215,9 +218,4 @@ export class CriteriaComponent implements OnInit { }) return selectionCriteria; } - - public updatePage(event) { - this.page = event.value; - HelperFunctions.scroll(); - } } diff --git a/src/app/pages/content-providers/manage-content-providers.component.ts b/src/app/pages/content-providers/manage-content-providers.component.ts index 263e1f6..4d3a4d6 100644 --- a/src/app/pages/content-providers/manage-content-providers.component.ts +++ b/src/app/pages/content-providers/manage-content-providers.component.ts @@ -1,4 +1,4 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; +import {ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core'; import {RemoveContentProvidersComponent} from './remove-content-providers.component'; import {Title} from '@angular/platform-browser'; import { @@ -13,6 +13,8 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit import {ContentProvider} from "../../openaireLibrary/utils/entities/contentProvider"; import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields"; import {CriteriaComponent} from "./criteria/criteria.component"; +import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler"; +import {ManageCommunityContentProvidersService} from "../../services/manageContentProviders.service"; @Component({ selector: 'manage-content-providers', @@ -24,12 +26,16 @@ import {CriteriaComponent} from "./criteria/criteria.component"; (communityContentProvidersChanged)="communityContentProvidersChanged($event)"> - - -
- + +
+
` @@ -46,10 +52,12 @@ export class ManageContentProvidersComponent implements OnInit { public body: string = "Send from page"; public properties: EnvProperties = properties; public community: CommunityInfo; - public contentProvider: ContentProvider; + public dataProvider: ContentProvider; constructor(private title: Title, - private communityService: CommunityService) { + private cdr: ChangeDetectorRef, + private communityService: CommunityService, + private manageCommunityContentProvidersService: ManageCommunityContentProvidersService) { } ngOnInit() { @@ -80,17 +88,27 @@ export class ManageContentProvidersComponent implements OnInit { } public openCriteria(contentProvider: ContentProvider) { - this.contentProvider = contentProvider; + this.dataProvider = contentProvider; this.filtersModal.title = 'Filters'; this.filtersModal.okButtonText = "Save"; this.filtersModal.back = true; this.filtersModal.okButton = true; this.filtersModal.open(); + this.cdr.detectChanges(); } public saveCriteria() { - let callback: Function = () => { - this.removeContentProvidersComponent.getCommunityContentProviders(); + let callback = (selectionCriteria): void => { + this.dataProvider.selectioncriteria = selectionCriteria; + this.manageCommunityContentProvidersService.saveContentProvider(this.properties, this.dataProvider).subscribe(() => { + this.criteria.reset(); + this.removeContentProvidersComponent.getCommunityContentProviders(); + this.criteria.loading = false; + NotificationHandler.rise('Filters have been successfully updated'); + }, error => { + this.criteria.loading = false; + this.criteria.handeError('An error has been occurred. Try again later!', error); + }); } this.removeContentProvidersComponent.loading = true; this.criteria.save(callback); From a83852cffdd79cc5b9ac803fa0e2f0d4215b06e4 Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Thu, 9 Mar 2023 16:30:13 +0200 Subject: [PATCH 06/22] WIP - add sdg/fos as subjects for community admin dashboards --- src/app/openaireLibrary | 2 +- .../subjects-edit-form.component.html | 326 ++++++++++++++++-- .../subjects-edit-form.component.ts | 247 ++++++++++--- .../subjects-edit-form.module.ts | 4 +- 4 files changed, 491 insertions(+), 88 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 1d2a0ef..efc2d6c 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 1d2a0effa840836cbb26334eabd9e1ea3752b455 +Subproject commit efc2d6c47b1c8e81150274589550b26c25b6eb8f diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html index 7170888..5b9bf10 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html @@ -1,5 +1,5 @@
-
+ +
@@ -37,6 +36,7 @@
+
No subjects @@ -45,6 +45,228 @@
+ +
    +
  • + +
    + +
    + +
    +
    +
    +
    {{item.group}}
    +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    + +
    +
    +
    + +
    +
    +
    +
    {{groupedAllSubjects[index].group}}
    + +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    +
    + +
    +
    +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    +
    +
    +
    +
    +
    +
    +
    +
  • +
  • + +
    + +
    + +
    +
    +
    +
    {{item.group}}
    +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    + +
    +
    +
    + +
    +
    +
    +
    {{groupedSubjects[index].group}}
    + +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    +
    + +
    +
    +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    +
    +
    +
    +
    +
    +
    +
    +
  • +
  • + +
    + +
    + +
    +
    +
    +
    {{item.group}}
    +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    + +
    +
    +
    + +
    +
    +
    +
    {{groupedSdg[index].group}}
    + +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    +
    + +
    +
    +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    +
    +
    +
    +
    +
    +
    +
    +
  • +
  • + +
    + +
    + +
    +
    +
    +
    {{item.group}}
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    + +
    +
    +
    + +
    +
    +
    +
    {{groupedFos[index].group}}
    + +
    + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} +
    +
    + +
    +
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    +
    +
    +
    +
    +
    +
    +
  • +
+
+
- - -
- -
-
-
-
- + + + + + -
- + +
+ + {{subject}} + + +
+ +
  • + +
  • +
  • + +
  • + +
    -
    +
    + +
    Separate subjects with commas
    -
    -
    No subjects - for {{community.shortTitle}} - found -
    -
    -
    - -
      -
    • - -
      - -
      - -
      -
      -
      -
      {{item.group}}
      -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      - -
      -
      -
      - -
      -
      -
      -
      {{groupedAllSubjects[index].group}}
      - -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      -
      - -
      -
      -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      -
      -
      -
      -
      -
      -
      -
      -
    • -
    • - -
      - -
      - -
      -
      -
      -
      {{item.group}}
      -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      - -
      -
      -
      - -
      -
      -
      -
      {{groupedSubjects[index].group}}
      - -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      -
      - -
      -
      -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      -
      -
      -
      -
      -
      -
      -
      -
    • -
    • - -
      - -
      - -
      -
      -
      -
      {{item.group}}
      -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      - -
      -
      -
      - -
      -
      -
      -
      {{groupedSdg[index].group}}
      - -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      -
      - -
      -
      -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      -
      -
      -
      -
      -
      -
      -
      -
    • -
    • - -
      - -
      - -
      -
      -
      -
      {{item.group}}
      -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      - -
      -
      -
      - -
      -
      -
      -
      {{groupedFos[index].group}}
      - -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      -
      - -
      -
      -
      - - {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} - -
      -
      -
      -
      -
      -
      -
      -
      -
    • -
    -
    - +
    + + +
    +
    -
    - +
    {{groupedAllSubjects[indexAll].group}}
    + +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    + +
    +
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    +
    +
    +
    +
    +
    + + +
  • + +
    + +
    + +
    +
    +
    +
    {{item.group}}
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    -
    -
  • -
    -
    -
    - - -
    -
    --> -
    -
    +
    + +
    +
    +
    +
    {{groupedSubjects[indexSubjects]?.group}}
    + +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    + +
    +
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    +
    +
    +
    +
    +
    +
    + +
  • + +
    + +
    + +
    +
    +
    +
    {{item.group}}
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    + +
    +
    +
    + +
    +
    +
    +
    {{groupedSdg[indexSdg].group}}
    + +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    + +
    +
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    +
    +
    +
    +
    +
    +
    +
  • +
  • + +
    + +
    + +
    +
    +
    +
    {{item.group}}
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    + +
    +
    +
    + +
    +
    +
    +
    {{groupedFos[indexFos].group}}
    + +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    + +
    +
    +
    + + {{subItem.length > maxCharacters ? subItem.substring(0,maxCharacters)+'...' : subItem}} + +
    +
    +
    +
    +
    +
    +
    +
    +
  • + +
    +
    + - -
    - -
      -
    • -
      -
      - -
      -
      Separate subjects with commas
      -
      - -
      - - {{subject}} - - -
      -
    • -
    • - -
    • -
    • - -
    • -
    -
    -
    - + \ No newline at end of file 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 5917599..a9d1ffc 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 @@ -1,6 +1,6 @@ import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {UntypedFormArray, UntypedFormBuilder, UntypedFormControl} from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute} from '@angular/router'; import {CommunityService} from '../../../openaireLibrary/connect/community/community.service'; import {SubjectsService} from '../subjects.service'; import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; @@ -24,72 +24,81 @@ declare var UIkit: any; templateUrl: './subjects-edit-form.component.html', }) export class SubjectsEditFormComponent implements OnInit { + properties: EnvProperties = properties; + communityId: string = null; + community: CommunityInfo = null; + showLoading = 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 = []; - index: number = 0; subjectsLimit: number = 6; - public maxCharacters: number = 25; - displayedAllSubjects = []; - displayedSubjects = []; - displayedSdg = []; - displayedFos = []; - hasChanges: boolean = false; + maxCharacters: number = 25; + activeTab: 'all' | 'freeText' | 'sdg' | 'fos' = 'all'; + indexAll: number = 0; + indexSubjects: number = 0; + indexSdg: number = 0; + indexFos: number = 0; - myForm = new UntypedFormArray([]); - public showLoading = true; - public res = []; - params: any; - public communityId: string = null; - public community: CommunityInfo = null; - public properties: EnvProperties = properties; - public edit = null; - public originalSubjects = []; + @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; @ViewChild('editModal') editModal: AlertModal; @ViewChild('deleteModal') deleteModal: AlertModal; @ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent; @ViewChild('modalTabs') modalTabs: ElementRef; - page = 1; - size = 10; - selectedSubjects = []; - isEditModal: boolean = false; - public selectedKeyword: string; - @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; - public filterForm: UntypedFormControl; - private subscriptions: any[] = []; - @ViewChild('sdgSelection') sdgSelection: SdgSelectionComponent; @ViewChild('fosSelection') fosSelection: FosSelectionComponent; - /*//Check again functionality to enable page - subjectsPage; - @ViewChild('enablePageModal') enablePageModal: AlertModal;*/ onEnter: () => void = () => { this.addSubjectsIntoList(); } - constructor(private element: ElementRef, - private route: ActivatedRoute, - private _router: Router, + constructor(private route: ActivatedRoute, public _fb: UntypedFormBuilder, private title: Title, - // private _helpContentService: HelpContentService, private _communityService: CommunityService, private _subjectsService: SubjectsService, - private _clearCacheService: ClearCacheService - ) { - } - + private _clearCacheService: ClearCacheService) { + } ngOnInit() { this.filterForm = this._fb.control(''); this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => { - this.community.subjects = this.originalSubjects.filter(subject => { + 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 => { @@ -112,21 +121,15 @@ export class SubjectsEditFormComponent implements OnInit { } return 0; }); - // assigning values 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]; - // grouping eveything for 'All' view this.groupSubjects(this.displayedAllSubjects, 'all'); - - this.originalSubjects = []; - for (let i = 0; i < this.community.subjects.length; i++) { - this.originalSubjects.push(this.community.subjects[i]); - } - if (this.community.subjects.length === 0) { - this.community.subjects.push(''); - } + 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.showLoading = false; }, error => this.handleUpdateError('System error retrieving community profile', error) @@ -149,6 +152,8 @@ export class SubjectsEditFormComponent implements OnInit { } 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(); @@ -165,6 +170,8 @@ export class SubjectsEditFormComponent implements OnInit { } } if(type === 'freeText') { + this.indexSubjects = 0; + this.activeTab = 'freeText'; this.groupedSubjects = Object.values( subjects.reduce((acc, subject) => { let firstLetter = subject[0].toLocaleUpperCase(); @@ -181,6 +188,8 @@ export class SubjectsEditFormComponent implements OnInit { } } if(type === 'sdg') { + this.indexSdg = 0; + this.activeTab = 'sdg'; this.groupedSdg = Object.values( subjects.reduce((acc, subject) => { let firstLetter = subject[0].toLocaleUpperCase(); @@ -197,6 +206,8 @@ export class SubjectsEditFormComponent implements OnInit { } } if(type === 'fos') { + this.indexFos = 0; + this.activeTab = 'fos'; this.groupedFos = Object.values( subjects.reduce((acc, subject) => { let key = subject.substring(0,2).toLocaleUpperCase(); @@ -216,7 +227,15 @@ export class SubjectsEditFormComponent implements OnInit { public changeDisplayedSubjects(i, group) { this.subjectsColumns = []; - this.index = i; + 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); } @@ -230,19 +249,6 @@ export class SubjectsEditFormComponent implements OnInit { this.subjectsColumns = columns; } - private removeModalOpen(subject: string, i: any) { - this.selectedSubjects = [subject]; - this.reset(['']); - this.deleteModal.cancelButton = true; - this.deleteModal.okButton = true; - this.deleteModal.alertTitle = 'Delete Subject'; - this.deleteModal.message = 'Are you sure you want to delete this subject?'; - this.deleteModal.okButtonText = 'Yes'; - this.deleteModal.cancelButtonText = 'No'; - this.deleteModal.open(); - } - - public getSubjectsExistOnlyInFirst(firstArray: string[], secondArray: string[]): string[] { const difference = []; for (let i = 0; i < firstArray.length; i++) { @@ -333,24 +339,7 @@ export class SubjectsEditFormComponent implements OnInit { } }); this._communityService.updateSubjects(this.community.subjects, this.community.fos, this.community.sdg); - - // this.originalSubjects = []; - // for (let i = 0; i < this.community.subjects.length; i++) { - // this.originalSubjects.push(this.community.subjects[i]); - // } - // this.originalSubjects.sort((n1,n2)=> { - // if (n1.toLowerCase() > n2.toLowerCase()) { - // return 1; - // } - // if (n1.toLowerCase() < n2.toLowerCase()) { - // return -1; - // } - // return 0; - // }); - // this.community.subjects = this.originalSubjects.filter(subject => { - // return !this.filterForm.value || subject.toLowerCase().indexOf(this.filterForm.value.toLowerCase()) != -1 - // }).sort(); - // this._clearCacheService.purgeBrowserCache("Subjects "+message, this.communityId); + this._clearCacheService.purgeBrowserCache("Subjects "+message, this.communityId); NotificationHandler.rise('Subjects successfully ' + message + '!') this.showLoading = false; } @@ -386,112 +375,4 @@ export class SubjectsEditFormComponent implements OnInit { return false; } } - - public addSubjectInForm() { - this.myForm.push(new UntypedFormControl('')); - } - - public removeSubjectInForm(i: number) { - this.myForm.removeAt(i); - } - - public reset(subjects: string[]) { - this.myForm = new UntypedFormArray([]); - for (let subject in subjects) { - this.myForm.push(new UntypedFormControl('')); - } - this.myForm.patchValue(subjects); - } - - newSubject() { - this.isEditModal = false; - this.selectedSubjects = []; - this.reset([]); - this.fullscreen.title = "Add/Edit Subjects"; - this.fullscreen.okButtonText = "Save"; - this.fullscreen.back = true; - this.fullscreen.okButton = true; - this.fullscreen.open(); - } - - get currentPage() { - if(this.community.subjects) { - return this.community.subjects.slice((this.page - 1) * this.size, this.page * this.size); - } else { - return []; - } - } - - public updatePage(event) { - this.page = event.value; - HelperFunctions.scroll(); - } - - public editSubject(subject: string) { - this.isEditModal = true; - this.selectedSubjects = [subject]; - this.reset([subject]); - this.fullscreen.title = "Edit Subject"; - this.fullscreen.okButtonText = "Save"; - this.fullscreen.back = true; - this.fullscreen.okButton = true; - this.fullscreen.open(); - } - - - private formModalOpen(title: string, yesBtn: string) { - this.editModal.okButtonLeft = false; - this.editModal.cancelButton = true; - this.editModal.okButton = true; - this.editModal.alertTitle = title; - this.editModal.okButtonText = yesBtn; - this.editModal.open(); - } - - public onSearchClose() { - this.selectedKeyword = this.filterForm.value; - } - - public resetInput() { - this.selectedKeyword = null; - this.searchInputComponent.reset() - } - - /* - //Check again functionality to enable page - private getSubjectsPageStatus() { - this._helpContentService.getCommunityPagesByRoute(this.communityId, '/subjects', this.properties.adminToolsAPIURL).subscribe((page) => { - this.subjectsPage = page; - }); - } - - public get subjectsEnabled(): boolean { - return !this.subjectsPage || this.subjectsPage.isEnabled; - } - enablePage() { - this._helpContentService.togglePages(this.communityId, [this.subjectsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => { - this.subjectsPage.isEnabled = true; - UIkit.notification('Curators Page has been enabled successfully', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); - },error => { - this.subjectsPage.isEnabled = false; - UIkit.notification('An error occured', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - }); - } - - private curatorsEnabledOpen() { - this.enablePageModal.okButtonLeft = false; - this.enablePageModal.alertTitle = 'Enable Subjects Page'; - this.enablePageModal.okButtonText = 'Yes'; - this.enablePageModal.cancelButtonText = 'No'; - this.enablePageModal.open(); - }*/ - } From a3563ad1ef46e99439fff3d7faff6e3baf4c198e Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Wed, 15 Mar 2023 12:03:16 +0200 Subject: [PATCH 10/22] fix wrong condition statement for edit modal --- .../subjects-edit-form/subjects-edit-form.component.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html index 9b1d7f7..1c9bbb3 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html @@ -275,13 +275,13 @@
    From f50525bcef78c50ccaee5e5c9f703d477ee0b5ea Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 27 Mar 2023 15:34:27 +0300 Subject: [PATCH 11/22] 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 e0a8127..461e4ac 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit e0a81273535091b8d1f4755acc8b6975c9904a02 +Subproject commit 461e4ac4ed542e4a24b4151eadb28e4c4283d5e2 diff --git a/src/assets/common-assets b/src/assets/common-assets index 95c2b50..ca209a5 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 95c2b50a57696a80dd3dd376880f26cb21d65817 +Subproject commit ca209a54baaa2d9e0004613a68088fdcf4bee43a diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index c4e2781..f264617 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit c4e2781acc42f281265a70d6cd75616cdd6fa762 +Subproject commit f264617e5ab356c4279ee1ef1819db434fec4fba From 3f4a4b3501a0f7e7daada8a544fddab630e21ae0 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 28 Mar 2023 12:08:55 +0300 Subject: [PATCH 12/22] Updating openaireLibrary - before BETA deploy --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 461e4ac..f1f8246 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 461e4ac4ed542e4a24b4151eadb28e4c4283d5e2 +Subproject commit f1f824674d1431ca1d4e6c31d720d3e36b153d1e From f4b54fa7455f1e3e80032002abb4f4da3d659586 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 4 Apr 2023 10:49:59 +0300 Subject: [PATCH 13/22] Update UIkit to 3.12.2. Add Subjects: Cliking add will add the input value also. --- package.json | 4 ++-- src/app/openaireLibrary | 2 +- .../subjects-edit-form/subjects-edit-form.component.html | 4 ++-- .../subjects-edit-form/subjects-edit-form.component.ts | 9 ++++++--- src/assets/openaire-theme | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 56cc303..6c7140d 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "sass-loader": "7.3.1", "ts-md5": "^1.2.0", "tslib": "^2.0.0", - "uikit": "3.12.0", + "uikit": "3.12.2", "zone.js": "~0.11.4" }, "devDependencies": { @@ -64,4 +64,4 @@ "ts-node": "~7.0.0", "typescript": "~4.6.4" } -} \ No newline at end of file +} diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index f1f8246..7ecb56e 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit f1f824674d1431ca1d4e6c31d720d3e36b153d1e +Subproject commit 7ecb56ec9883e78cc6039c6094e60975176c7b57 diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html index 1c9bbb3..803a79a 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html @@ -287,7 +287,7 @@
    • -
      @@ -313,4 +313,4 @@
    -
    \ No newline at end of file + 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 a9d1ffc..cf4bd6d 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 @@ -16,6 +16,7 @@ import {NotificationHandler} from "../../../openaireLibrary/utils/notification-h import {ClearCacheService} from "../../../openaireLibrary/services/clear-cache.service"; import {SdgSelectionComponent} from '../../../openaireLibrary/sdg/sdg-selection/sdg-selection.component'; import {FosSelectionComponent} from '../../../openaireLibrary/fos/fos-selection/fos-selection.component'; +import {InputComponent} from "../../../openaireLibrary/sharedComponents/input/input.component"; declare var UIkit: any; @@ -55,7 +56,7 @@ export class SubjectsEditFormComponent implements OnInit { indexSdg: number = 0; indexFos: number = 0; - @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; + @ViewChild('addSubjectsInput') addSubjectsInput: InputComponent; @ViewChild('editModal') editModal: AlertModal; @ViewChild('deleteModal') deleteModal: AlertModal; @ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent; @@ -274,8 +275,10 @@ export class SubjectsEditFormComponent implements OnInit { } public addSubjectsIntoList() { - const subjectsFromUserInput = this.subjectsForm.getRawValue(); - subjectsFromUserInput.forEach(element => { + if(this.addSubjectsInput.searchControl.getRawValue()) { + this.addSubjectsInput.add(null, true); + } + this.subjectsForm.getRawValue().forEach(element => { this.displayedSubjects.unshift(element); }); this.subjectsForm.clear(); diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index f264617..aa1e6c9 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit f264617e5ab356c4279ee1ef1819db434fec4fba +Subproject commit aa1e6c9df390a4ba0919b5f8591374f7eec75089 From c174ad17c5a7c21970ad5bd72f1490ef7c58ea83 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 25 Apr 2023 17:08:31 +0300 Subject: [PATCH 14/22] Update uikit to version 3.13.0 --- package.json | 4 ++-- src/app/openaireLibrary | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6c7140d..07b80b7 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "sass-loader": "7.3.1", "ts-md5": "^1.2.0", "tslib": "^2.0.0", - "uikit": "3.12.2", + "uikit": "3.13.0", "zone.js": "~0.11.4" }, "devDependencies": { @@ -51,7 +51,7 @@ "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.11.1", - "@types/ckeditor": "^4.9.10", + "@types/ckeditor": "^4.9.10", "codelyzer": "^6.0.0", "jasmine-core": "~3.8.0", "jasmine-spec-reporter": "~5.0.0", diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 7ecb56e..c547dfa 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 7ecb56ec9883e78cc6039c6094e60975176c7b57 +Subproject commit c547dfa9453b9a68befb41f447d8c410eb7aea2c From 871523cbbb7e84a9f5ec569fe1373097f090015d Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 26 Apr 2023 11:45:54 +0300 Subject: [PATCH 15/22] [Connect Admin | develop]: community.service.ts: Renamed "advancedConstraint" to "advancedConstraints" (coming from community API). --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index c547dfa..058d30f 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit c547dfa9453b9a68befb41f447d8c410eb7aea2c +Subproject commit 058d30f4c1cddb8c5b5e967393aee09847ef2d83 From 8712f6cae57b156194c28be385ee5a9c2ebfae32 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 2 May 2023 13:24:06 +0300 Subject: [PATCH 16/22] Updating openaireLibrary before beta release --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 058d30f..3be6013 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 058d30f4c1cddb8c5b5e967393aee09847ef2d83 +Subproject commit 3be6013644a90d9a49c08a71c75fb7549d8b3e69 From ffa7ab71a0dfd858dbeb91e480752dd70cdec6b2 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 2 May 2023 18:12:18 +0300 Subject: [PATCH 17/22] Update Uikit to version 3.13.10. Update library --- package.json | 2 +- src/app/openaireLibrary | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 07b80b7..f82f848 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "sass-loader": "7.3.1", "ts-md5": "^1.2.0", "tslib": "^2.0.0", - "uikit": "3.13.0", + "uikit": "3.13.10", "zone.js": "~0.11.4" }, "devDependencies": { diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 3be6013..bd87a47 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 3be6013644a90d9a49c08a71c75fb7549d8b3e69 +Subproject commit bd87a47795f8f9243e0a1129d715fcb96cf9b714 From ced4fe404d8151044434a061cf09d52701a1652e Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 3 May 2023 17:00:14 +0300 Subject: [PATCH 18/22] Fix margins in subjects --- src/app/openaireLibrary | 2 +- .../advanced-criteria.component.ts | 3 +-- .../subjects-edit-form.component.html | 16 ++++++++-------- .../subjects-edit-form.component.ts | 12 ++++++------ 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index bd87a47..c321390 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit bd87a47795f8f9243e0a1129d715fcb96cf9b714 +Subproject commit c321390ccbbe72515f336830c3aa54e3156379ef diff --git a/src/app/pages/advanced-criteria/advanced-criteria.component.ts b/src/app/pages/advanced-criteria/advanced-criteria.component.ts index 07ae3f8..1294a59 100644 --- a/src/app/pages/advanced-criteria/advanced-criteria.component.ts +++ b/src/app/pages/advanced-criteria/advanced-criteria.component.ts @@ -2,14 +2,13 @@ import {ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild} from "@angul import {CommunityService} from "../../openaireLibrary/connect/community/community.service"; import {AdvancedCriteriaService} from "./advanced-criteria.service"; import {Subscription} from "rxjs"; -import {ContentProvider, SelectionCriteria} from "../../openaireLibrary/utils/entities/contentProvider"; +import {SelectionCriteria} from "../../openaireLibrary/utils/entities/contentProvider"; import { FullScreenModalComponent } from "../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component"; import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler"; import {CriteriaComponent} from "../content-providers/criteria/criteria.component"; import {CriteriaUtils} from "../content-providers/criteria-utils"; -import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields"; import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo"; @Component({ diff --git a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html index 803a79a..d3a5f63 100644 --- a/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html +++ b/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.component.html @@ -1,13 +1,13 @@
    -
    -
    -
    -
    +
    +
    +
    +
    -
    +
    -
    +
    No subjects
    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 cf4bd6d..443c001 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 @@ -28,7 +28,7 @@ export class SubjectsEditFormComponent implements OnInit { properties: EnvProperties = properties; communityId: string = null; community: CommunityInfo = null; - showLoading = true; + loading = true; params: any; private subscriptions: any[] = []; @@ -105,7 +105,7 @@ export class SubjectsEditFormComponent implements OnInit { params => { this.communityId = params['community']; this.title.setTitle(this.communityId.toUpperCase() + ' | Subjects'); - this.showLoading = true; + this.loading = true; this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe( community => { this.community = community; @@ -131,7 +131,7 @@ export class SubjectsEditFormComponent implements OnInit { this.originalSubjects = HelperFunctions.copy(this.displayedSubjects); this.originalSdg = HelperFunctions.copy(this.displayedSdg); this.originalFos = HelperFunctions.copy(this.displayedFos); - this.showLoading = false; + this.loading = false; }, error => this.handleUpdateError('System error retrieving community profile', error) )); @@ -305,7 +305,7 @@ export class SubjectsEditFormComponent implements OnInit { public saveSubjects(subjects, displayedSubjects, type: string) { if (this.communityId != null && this.communityId !== '') { - this.showLoading = true; + this.loading = true; const subjectsToDeleteAr = this.getSubjectsExistOnlyInFirst(subjects, displayedSubjects); const subjectsToAddAr = this.getSubjectsExistOnlyInFirst(displayedSubjects, subjects); const subjectsToDelete = this.getNonEmptyItems(subjectsToDeleteAr); @@ -328,7 +328,7 @@ export class SubjectsEditFormComponent implements OnInit { console.error(error) } NotificationHandler.rise(message, 'danger'); - this.showLoading = false; + this.loading = false; } afterUpdateActions(response, message: string) { @@ -344,7 +344,7 @@ export class SubjectsEditFormComponent implements OnInit { 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.showLoading = false; + this.loading = false; } From 3b4ea6102c5eb3aa90f0c50f1ff609282a6f6b4c Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 3 May 2023 17:07:39 +0300 Subject: [PATCH 19/22] Add message for file size limit in background-upload. --- .../background-upload.component.ts | 124 ++++++++++-------- 1 file changed, 67 insertions(+), 57 deletions(-) diff --git a/src/app/pages/customization/background-upload.component.ts b/src/app/pages/customization/background-upload.component.ts index 996b407..c5886a3 100644 --- a/src/app/pages/customization/background-upload.component.ts +++ b/src/app/pages/customization/background-upload.component.ts @@ -9,60 +9,64 @@ declare var UIkit; selector: 'background-upload', template: ` -
    +
    - upload image + upload image
    - -
    -
    + +
    +
    - - - -
    + + +
    +
    position
    -
    -
    - +
    +
    +
    - + `, - styles:[` - .upload{ - border: 1px dotted grey; - } + styles: [` + .upload { + border: 1px dotted grey; + } `] }) export class BackgroundUploadComponent implements OnInit { - @Input() label:string = ""; + @Input() label: string = ""; @Input() background; @Input() oldBackground; // @Input() light:boolean; - @Input() communityId:string = ""; - + @Input() communityId: string = ""; + public file: File; // public photo: string | ArrayBuffer; private maxsize: number = 2000 * 1024; properties; private subscriptions: any[] = []; - - + + constructor(private utilsService: UtilitiesService) { } - - + + ngOnInit() { this.properties = properties; } + ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscription) { @@ -70,30 +74,29 @@ export class BackgroundUploadComponent implements OnInit { } }); } - + removePhoto() { - - if (typeof document != 'undefined') { - (document.getElementById("photo")).value = ""; - } - // this.initPhoto(); + + if (typeof document != 'undefined') { + (document.getElementById("photo")).value = ""; + } + // this.initPhoto(); console.log(this.background.imageFile + " " + this.oldBackground.imageFile) - if(this.background.imageFile != this.oldBackground.imageFile){ - this.deletePhoto(); - } - this.background.imageFile = null; - this.file = null; - + if (this.background.imageFile != this.oldBackground.imageFile) { + this.deletePhoto(); + } + this.background.imageFile = null; + this.file = null; + } - - - + + public deletePhoto() { if (this.background.imageFile) { - this.subscriptions.push(this.utilsService.deletePhoto(properties.utilsService + '/delete/community/' + this.communityId + "/" +this.background.imageFile).subscribe()); + this.subscriptions.push(this.utilsService.deletePhoto(properties.utilsService + '/delete/community/' + this.communityId + "/" + this.background.imageFile).subscribe()); } } - + fileChangeEvent(event) { if (event.target.files && event.target.files[0]) { this.file = event.target.files[0]; @@ -105,7 +108,7 @@ export class BackgroundUploadComponent implements OnInit { }); this.removePhoto(); } else if (this.file.size > this.maxsize) { - UIkit.notification('File exceeds size\'s limit ('+this.maxsize/1024+'KB)! ', { + UIkit.notification('File exceeds size\'s limit (' + this.maxsize / 1024 + 'KB)! ', { status: 'danger', timeout: 6000, pos: 'bottom-right' @@ -122,27 +125,34 @@ export class BackgroundUploadComponent implements OnInit { } } } - + public save() { if (this.file) { - this.subscriptions.push(this.utilsService.uploadPhoto(this.properties.utilsService + "/upload/community/"+ this.communityId + "/" + encodeURIComponent(this.communityId+"-"+this.label)+"?big=1", this.file).subscribe(res => { + this.subscriptions.push(this.utilsService.uploadPhoto(this.properties.utilsService + "/upload/community/" + this.communityId + "/" + encodeURIComponent(this.communityId + "-" + this.label) + "?big=1", this.file).subscribe(res => { this.deletePhoto(); this.removePhoto(); this.background.imageFile = res.filename; - + }, error => { - UIkit.notification("An error has been occurred during upload your image. Try again later", { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + if (error.error.message) { + UIkit.notification('The maximum size of an image is 1MB, please check if your file exceeds this limit.', { + status: 'danger', + timeout: 6000, + pos: 'bottom-right' + }); + } else { + UIkit.notification("An error has been occurred during upload your image. Try again later", { + status: 'danger', + timeout: 6000, + pos: 'bottom-right' + }); + } })); } } - - getUrl() - { - return "url('" +(this.background.imageFile.indexOf('data:')==-1?(this.properties.utilsService + - '/download/'+this.background.imageFile):this.background.imageFile) +"')"; + + getUrl() { + return "url('" + (this.background.imageFile.indexOf('data:') == -1 ? (this.properties.utilsService + + '/download/' + this.background.imageFile) : this.background.imageFile) + "')"; } } From 07ef246d73b605f25182a1a1bdf432f657fcc0ac Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 11 May 2023 12:32:16 +0300 Subject: [PATCH 20/22] Add icons in manage-communities module. Update library and openaire-theme --- src/app/openaireLibrary | 2 +- src/app/pages/manage-communities/manage-communities.module.ts | 4 ++-- src/assets/openaire-theme | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index c321390..6be478c 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit c321390ccbbe72515f336830c3aa54e3156379ef +Subproject commit 6be478cacc13f3c5e6808d4d5dc358eb53be1faf diff --git a/src/app/pages/manage-communities/manage-communities.module.ts b/src/app/pages/manage-communities/manage-communities.module.ts index 7bce658..33494ae 100644 --- a/src/app/pages/manage-communities/manage-communities.module.ts +++ b/src/app/pages/manage-communities/manage-communities.module.ts @@ -10,7 +10,7 @@ import {UrlPrefixModule} from '../../openaireLibrary/utils/pipes/url-prefix.modu import {CommunitiesService} from '../../openaireLibrary/connect/communities/communities.service'; import {IconsModule} from '../../openaireLibrary/utils/icons/icons.module'; import {IconsService} from '../../openaireLibrary/utils/icons/icons.service'; -import {earth} from '../../openaireLibrary/utils/icons/icons'; +import {earth, incognito, restricted} from '../../openaireLibrary/utils/icons/icons'; import {LogoUrlPipeModule} from "../../openaireLibrary/utils/pipes/logoUrlPipe.module"; import {SearchInputModule} from '../../openaireLibrary/sharedComponents/search-input/search-input.module'; @@ -24,6 +24,6 @@ import {SearchInputModule} from '../../openaireLibrary/sharedComponents/search-i }) export class ManageCommunitiesModule { constructor(private iconsService: IconsService) { - this.iconsService.registerIcons([earth]); + this.iconsService.registerIcons([earth, restricted, incognito]); } } diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index aa1e6c9..c92a0de 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit aa1e6c9df390a4ba0919b5f8591374f7eec75089 +Subproject commit c92a0dea1b7fc51f0cf272f8d4343735d000a23b From 3b6bebc2f10bb4a7758a6a2536657adbc61954d9 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 24 May 2023 13:09:58 +0300 Subject: [PATCH 21/22] Updating libraries before beta & prod release --- src/app/openaireLibrary | 2 +- src/assets/common-assets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 6be478c..2b83920 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 6be478cacc13f3c5e6808d4d5dc358eb53be1faf +Subproject commit 2b83920bc46f634921aeae2d7a05e49608047cb7 diff --git a/src/assets/common-assets b/src/assets/common-assets index ca209a5..f15bbfa 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit ca209a54baaa2d9e0004613a68088fdcf4bee43a +Subproject commit f15bbfa7265f170e06b256f086f2acedfa3f72e0 From 508b8120b8b9178d8c4e7f1620bb370864d02452 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 25 May 2023 17:35:38 +0300 Subject: [PATCH 22/22] Update library, assets and theme. --- 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 6be478c..39a7ed5 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 6be478cacc13f3c5e6808d4d5dc358eb53be1faf +Subproject commit 39a7ed58be27513c05598edc18cf095eb5b044c5 diff --git a/src/assets/common-assets b/src/assets/common-assets index ca209a5..f15bbfa 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit ca209a54baaa2d9e0004613a68088fdcf4bee43a +Subproject commit f15bbfa7265f170e06b256f086f2acedfa3f72e0 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index c92a0de..468b2b0 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit c92a0dea1b7fc51f0cf272f8d4343735d000a23b +Subproject commit 468b2b008f474c88dacc52991a5231693833f1f9