From 81092cad5081be1eb56ab5f6da330f695e9c5984 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 22 Jan 2024 11:54:12 +0200 Subject: [PATCH 01/24] [plugins-functionality | DONE | FIXED] : changes after merge --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index c2312e2..d0b4fa7 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit c2312e297e32df2925e60641d755494c900abdc5 +Subproject commit d0b4fa7750a8dde3cfa6b5b81c18302380e10c35 From f6a50d81bb3b2e0cd3b5b004d9fdc5afeac25285 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 22 Jan 2024 11:54:22 +0200 Subject: [PATCH 02/24] [plugins-functionality | DONE | FIXED] : changes after merge --- src/app/searchPages/simple/searchDataproviders.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/searchPages/simple/searchDataproviders.component.ts b/src/app/searchPages/simple/searchDataproviders.component.ts index 135a201..a97d3ad 100644 --- a/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/src/app/searchPages/simple/searchDataproviders.component.ts @@ -163,7 +163,7 @@ export class OpenaireSearchDataprovidersComponent { this.searchUtils.totalResults = results.length; this.results = results.slice((this.searchUtils.page - 1) * this.searchUtils.size, this.searchUtils.page *this.searchUtils.size ); this.searchUtils.status = this.results.length == 0 ? this.errorCodes.NONE: this.errorCodes.DONE; - this.searchPage.buildPageURLParameters(this.filters, [], [], false); + this.searchPage.buildPageURLParameters(this.filters, [], false); this.disableForms = false; this.enableSearchView = true; } From 25629733e9dcf3f24792bc006609a94fc2d3f917 Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Mon, 5 Feb 2024 09:42:52 +0200 Subject: [PATCH 03/24] [plugins-functionality | WIP] move curators component in openaireLibrary, update submodules --- .../affiliations/affiliations.component.html | 8 +- src/app/app-routing.module.ts | 2 +- src/app/community/community.module.ts | 11 +- src/app/curators/curators-routing.module.ts | 15 -- src/app/curators/curators.component.html | 152 ----------------- src/app/curators/curators.component.ts | 155 ------------------ src/app/curators/curators.module.ts | 35 ---- src/app/openaireLibrary | 2 +- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 10 files changed, 15 insertions(+), 369 deletions(-) delete mode 100644 src/app/curators/curators-routing.module.ts delete mode 100644 src/app/curators/curators.component.html delete mode 100644 src/app/curators/curators.component.ts delete mode 100644 src/app/curators/curators.module.ts diff --git a/src/app/affiliations/affiliations.component.html b/src/app/affiliations/affiliations.component.html index 6b3c9b5..c8b6e9f 100644 --- a/src/app/affiliations/affiliations.component.html +++ b/src/app/affiliations/affiliations.component.html @@ -37,12 +37,12 @@ -
+
-

+

Supporting Organizations

- Browse all @@ -50,7 +50,7 @@
-
+
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 6fc032e..f8229a9 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -99,7 +99,7 @@ const routes: Routes = [ // }, { path: 'curators', - loadChildren: () => import('./curators/curators.module').then(m => m.CuratorsModule), + loadChildren: () => import('./openaireLibrary/connect/components/curators/curators.module').then(m => m.CuratorsModule), data: {hasQuickContact: false}, canActivate: [IsCommunity] }, { diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts index ae4a3ee..60c02c3 100644 --- a/src/app/community/community.module.ts +++ b/src/app/community/community.module.ts @@ -23,7 +23,7 @@ import { import {SearchProjectsServiceModule} from '../openaireLibrary/connect/projects/searchProjectsService.module'; import {SearchResearchResultsServiceModule} from "../openaireLibrary/services/searchResearchResultsService.module"; import {SearchResultsModule} from "../openaireLibrary/searchPages/searchUtils/searchResults.module"; -import {CuratorsModule} from "../curators/curators.module"; +import {CuratorsModule} from "../openaireLibrary/connect/components/curators/curators.module"; import {AffiliationsModule} from "../affiliations/affiliations.module"; import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module"; import {MatSelectModule} from "@angular/material/select"; @@ -40,6 +40,8 @@ import {InputModule} from '../openaireLibrary/sharedComponents/input/input.modul import {QuickSelectionsModule} from '../openaireLibrary/searchPages/searchUtils/quick-selections.module'; import {IconsModule} from '../openaireLibrary/utils/icons/icons.module'; import {NoLoadPaging} from '../openaireLibrary/searchPages/searchUtils/no-load-paging.module'; +import {NumberRoundModule} from '../openaireLibrary/utils/pipes/number-round.module'; +import {PluginsService} from '../openaireLibrary/services/plugins.service'; @NgModule({ imports: [ @@ -49,16 +51,17 @@ import {NoLoadPaging} from '../openaireLibrary/searchPages/searchUtils/no-load-p SearchResearchResultsServiceModule, SearchResultsModule, CuratorsModule, AffiliationsModule, SEOServiceModule, MatSelectModule, EntitiesSelectionModule, TabsModule, SearchTabModule, ErrorMessagesModule, SafeHtmlPipeModule, ErrorModule, - AdvancedSearchInputModule, InputModule, QuickSelectionsModule, IconsModule, NoLoadPaging + AdvancedSearchInputModule, InputModule, QuickSelectionsModule, IconsModule, NoLoadPaging, NumberRoundModule ], declarations: [ CommunityComponent ], providers:[ - PreviousRouteRecorder, PiwikService + PreviousRouteRecorder, PiwikService, PluginsService ], exports: [ CommunityComponent ] }) -export class CommunityModule { } +export class CommunityModule { +} diff --git a/src/app/curators/curators-routing.module.ts b/src/app/curators/curators-routing.module.ts deleted file mode 100644 index 590a7b7..0000000 --- a/src/app/curators/curators-routing.module.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NgModule} from '@angular/core'; -import { RouterModule } from '@angular/router'; -import {CuratorsComponent} from "./curators.component"; -import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; -import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { path: '', component: CuratorsComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder]} - ]) - ] -}) -export class CuratorsRoutingModule { -} diff --git a/src/app/curators/curators.component.html b/src/app/curators/curators.component.html deleted file mode 100644 index 55f1cd8..0000000 --- a/src/app/curators/curators.component.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - -
-
-
-
-

- {{curatorInModal.name}} -

- Curator Photo - Curator Photo -
-
- -
    -
  • -
    - Biography -
    -
    - {{curatorInModal.bio}} -
    -
  • -
  • -
    -
    - - - - - - -
    -
    -
  • -
-
-
-
-
-
diff --git a/src/app/curators/curators.component.ts b/src/app/curators/curators.component.ts deleted file mode 100644 index 25b62d0..0000000 --- a/src/app/curators/curators.component.ts +++ /dev/null @@ -1,155 +0,0 @@ -import {Component, Input, ViewChild} from '@angular/core'; -import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; -import {CuratorService} from "../openaireLibrary/connect/curators/curator.service"; -import {Curator} from "../openaireLibrary/utils/entities/CuratorInfo"; -import {ActivatedRoute, Router} from "@angular/router"; -import {CommunityService} from "../openaireLibrary/connect/community/community.service"; -import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; -import {Meta, Title} from "@angular/platform-browser"; -import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; -import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service"; -import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; -import {Subscription} from "rxjs"; -import {properties} from "../../environments/environment"; -import {UserRegistryService} from "../openaireLibrary/services/user-registry.service"; -import {FullScreenModalComponent} from '../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component'; -import {CommunityInfo} from "../openaireLibrary/connect/community/communityInfo"; - -@Component({ - selector: 'curators', - templateUrl: './curators.component.html' - -}) -export class CuratorsComponent { - @Input() longView = true; - community: CommunityInfo; - public downloadUrl = null; - public showLoading = true; - - public curators: Curator[] = []; - - public curatorsLimit: number = 5; - public numberOfCurators: number = 5; - - public showMore = []; - public maxCharacters = 450; - public viewingMore: boolean = false; - public curatorInModal; - - public properties: EnvProperties; - public pageContents = null; - public divContents = null; - - public url: string = null; - public pageTitle: string = "Curators"; - - public breadcrumbs: Breadcrumb[] = [{name: 'Home', route: '/'}, {name: 'About - Curators'}]; - - subs: Subscription[] = []; - - @ViewChild('fsModal', { static: true }) fsModal: FullScreenModalComponent; - - constructor(private route: ActivatedRoute, - private curatorsService: CuratorService, - private communityService: CommunityService, - private userRegistryService: UserRegistryService, - private _router: Router, - private helper: HelperService, - private _meta: Meta, - private _title: Title, - private seoService: SEOService, - private _piwikService: PiwikService) { - } - - ngOnInit() { - this.showLoading = true; - this.properties = properties; - this.downloadUrl = this.properties.utilsService + '/download/'; - //if (properties.environment !== 'development') { - if (!this.longView) { - this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => { - if (community) { - this.community = community; - this.getCurators(); - } - })); - } else { - this.subs.push(this.communityService.getCommunityAsObservable().subscribe(community => { - if (community) { - this.community = community; - this.subs.push(this._piwikService.trackView(this.properties, this.pageTitle).subscribe()); - this.url = this.properties.domain + this._router.url; - this.seoService.createLinkForCanonicalURL(this.url); - this.updateUrl(this.url); - this.updateTitle(this.pageTitle); - this.updateDescription("OpenAIRE - Connect, Community Gateway, research community"); - //this.getDivContents(); - this.getPageContents(); - this.getCurators(); - } - })); - } - } - - ngOnDestroy() { - for (let sub of this.subs) { - sub.unsubscribe(); - } - } - - private getCurators() { - this.subs.push(this.curatorsService.getCurators(this.properties, this.community.communityId).subscribe(curators => { - this.curators = curators; - this.showLoading = false; - }, error => { - console.error(error); - this.curators = []; - this.showLoading = false; - })); - } - - private getPageContents() { - this.subs.push(this.helper.getPageHelpContents(this.properties, this.community.communityId, this._router.url).subscribe(contents => { - this.pageContents = contents; - })); - } - - private getDivContents() { - this.subs.push(this.helper.getDivHelpContents(this.properties, this.community.communityId, this._router.url).subscribe(contents => { - this.divContents = contents; - })); - } - - format(name: string) { - if (name) { - return (((name).length > this.maxCharacters) ? (name.substring(0, (this.maxCharacters - ('...').length)) + '...') : name); - } else { - return null; - } - } - - public viewMore() { - this.viewingMore = !this.viewingMore; - } - - public openFsModal(curator) { - this.curatorInModal = curator; - this.fsModal.title = this.community.shortTitle + ' Curator'; - this.fsModal.open(); - } - - private updateDescription(description: string) { - this._meta.updateTag({content: description}, "name='description'"); - this._meta.updateTag({content: description}, "property='og:description'"); - } - - private updateTitle(title: string) { - var _title = ((title.length > 50) ? title.substring(0, 50) : title); - this._title.setTitle(_title); - this._meta.updateTag({content: _title}, "property='og:title'"); - } - - private updateUrl(url: string) { - this._meta.updateTag({content: url}, "property='og:url'"); - } -} diff --git a/src/app/curators/curators.module.ts b/src/app/curators/curators.module.ts deleted file mode 100644 index e86f062..0000000 --- a/src/app/curators/curators.module.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { NgModule} from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { RouterModule } from '@angular/router'; - -import {CuratorsComponent} from './curators.component'; -import {CuratorService} from "../openaireLibrary/connect/curators/curator.service"; -import {CuratorsRoutingModule} from "./curators-routing.module"; -import {AffiliationsModule} from "../affiliations/affiliations.module"; -import {HelperModule} from "../openaireLibrary/utils/helper/helper.module"; -import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; -import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module"; -import {PiwikServiceModule} from "../openaireLibrary/utils/piwik/piwikService.module"; -import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; -import {UrlPrefixModule} from "../openaireLibrary/utils/pipes/url-prefix.module"; -import {LoadingModule} from '../openaireLibrary/utils/loading/loading.module'; -import {FullScreenModalModule} from '../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.module'; - -@NgModule({ - imports: [ - CommonModule, FormsModule, RouterModule, - CuratorsRoutingModule, AffiliationsModule, HelperModule, - Schema2jsonldModule, SEOServiceModule, PiwikServiceModule, - BreadcrumbsModule, UrlPrefixModule, LoadingModule, - FullScreenModalModule - ], - declarations: [ - CuratorsComponent - ], - providers: [CuratorService], - exports: [ - CuratorsComponent - ] -}) -export class CuratorsModule {} diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index d0b4fa7..552edbd 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit d0b4fa7750a8dde3cfa6b5b81c18302380e10c35 +Subproject commit 552edbd0e25e236dc277abcdcc2d953d28bba726 diff --git a/src/assets/common-assets b/src/assets/common-assets index ee22e97..6cef9eb 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit ee22e97b114be823b7ab4e6c41a9cbff93b24e3a +Subproject commit 6cef9ebed0db7ecbcca023bae824239106907960 diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index df6a052..52eca9a 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit df6a0527e9bce69f016da8d28b79885c351104c6 +Subproject commit 52eca9abe84c941a7e78a5690f273d8c8e3194f9 From 82f2baf86550ee46eda469e66ed6aae24083ea0d Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 22 Feb 2024 12:57:52 +0200 Subject: [PATCH 04/24] [plugins-functionality | WIP] move affiliations component to be used in library - plugins --- .../affiliations/affiliations.component.html | 69 ------------------- .../affiliations/affiliations.component.less | 18 ----- .../affiliations/affiliations.component.ts | 58 ---------------- src/app/affiliations/affiliations.module.ts | 26 ------- src/app/community/community.module.ts | 2 +- .../organizations/organizationsPage.module.ts | 2 +- src/assets/common-assets | 2 +- src/assets/openaire-theme | 2 +- 8 files changed, 4 insertions(+), 175 deletions(-) delete mode 100644 src/app/affiliations/affiliations.component.html delete mode 100644 src/app/affiliations/affiliations.component.less delete mode 100644 src/app/affiliations/affiliations.component.ts delete mode 100644 src/app/affiliations/affiliations.module.ts diff --git a/src/app/affiliations/affiliations.component.html b/src/app/affiliations/affiliations.component.html deleted file mode 100644 index c8b6e9f..0000000 --- a/src/app/affiliations/affiliations.component.html +++ /dev/null @@ -1,69 +0,0 @@ - -
- -
-

- {{organization.name}} -

-
-
-
- - - -
-
-
-
- - - - - - -
-
-
-
- -
-
-

- Supporting Organizations -

- - - Browse all - - -
-
-
-
- - - - - - -
-
-
-
-
- - - - diff --git a/src/app/affiliations/affiliations.component.less b/src/app/affiliations/affiliations.component.less deleted file mode 100644 index e7fcafc..0000000 --- a/src/app/affiliations/affiliations.component.less +++ /dev/null @@ -1,18 +0,0 @@ -.affiliationCard { - width: 260px !important; - height: 260px !important; -} - -.supportingOrganizations a { - img, svg { - -webkit-filter: grayscale(1); - filter: grayscale(1); - transition-duration: 0.3s; - } - - &:hover img, svg { - -webkit-filter: grayscale(0); - filter: grayscale(0); - transition-duration: 0.3s; - } -} diff --git a/src/app/affiliations/affiliations.component.ts b/src/app/affiliations/affiliations.component.ts deleted file mode 100644 index e5e043b..0000000 --- a/src/app/affiliations/affiliations.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import {Component, Input} from '@angular/core'; -import {ActivatedRoute} from '@angular/router'; -import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; -import {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service"; -import {Affiliation} from "../openaireLibrary/utils/entities/CuratorInfo"; -import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; -import {Subscriber} from "rxjs"; -import {properties} from "../../environments/environment"; - -@Component({ - selector: 'affiliations', - templateUrl: './affiliations.component.html', - styleUrls: ['./affiliations.component.less'] -}) -export class AffiliationsComponent { - @Input() getAffiliationsFromAPI: boolean = false; - @Input() longView: boolean = false; - @Input() communityFirstPage: boolean = false; - @Input() affiliationsInSlider: number = 5; - @Input() affiliations: Affiliation[] = []; - @Input() sliderOptions = ''; - @Input() arrows = true; - - public showLoading: boolean = false; - public communityId: string; - public properties: EnvProperties = properties; - private subscriptions = []; - - constructor(private route: ActivatedRoute, private affiliationService: AffiliationService) { - } - - public ngOnInit() { - this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); - if (this.getAffiliationsFromAPI) { - this.showLoading = true; - this.affiliationService.initAffiliations(this.communityId); - this.subscriptions.push(this.affiliationService.affiliations.subscribe( - affiliations => { - this.affiliations = affiliations.filter((affiliation) => this.longView || !!affiliation['logo_url']); - this.showLoading = false; - }, - error => { - console.error("Affiliations Component: Error getting affiliations for community with id: " + this.communityId, error); - this.showLoading = false; - } - )); - } - } - - ngOnDestroy() { - this.subscriptions.forEach(subscription => { - if (subscription instanceof Subscriber) { - subscription.unsubscribe(); - } - }); - this.affiliationService.clearSubscriptions(); - } -} diff --git a/src/app/affiliations/affiliations.module.ts b/src/app/affiliations/affiliations.module.ts deleted file mode 100644 index da768dd..0000000 --- a/src/app/affiliations/affiliations.module.ts +++ /dev/null @@ -1,26 +0,0 @@ -import {NgModule} from '@angular/core'; - -import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; -import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard' -import {RouterModule} from '@angular/router'; - -import {AffiliationsComponent} from './affiliations.component'; -import {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service"; -import {CommonModule} from "@angular/common"; -import {UrlPrefixModule} from "../openaireLibrary/utils/pipes/url-prefix.module"; - -@NgModule({ - imports: [ - CommonModule, RouterModule, UrlPrefixModule - ], - declarations: [ - AffiliationsComponent - ], - providers:[PreviousRouteRecorder, IsRouteEnabled, AffiliationService], - exports: [ - AffiliationsComponent - ] -}) - - -export class AffiliationsModule{} diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts index 60c02c3..e142c6b 100644 --- a/src/app/community/community.module.ts +++ b/src/app/community/community.module.ts @@ -24,7 +24,7 @@ import {SearchProjectsServiceModule} from '../openaireLibrary/connect/projects/s import {SearchResearchResultsServiceModule} from "../openaireLibrary/services/searchResearchResultsService.module"; import {SearchResultsModule} from "../openaireLibrary/searchPages/searchUtils/searchResults.module"; import {CuratorsModule} from "../openaireLibrary/connect/components/curators/curators.module"; -import {AffiliationsModule} from "../affiliations/affiliations.module"; +import {AffiliationsModule} from "../openaireLibrary/connect/affiliations/affiliations.module"; import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module"; import {MatSelectModule} from "@angular/material/select"; import {EntitiesSelectionModule} from "../openaireLibrary/searchPages/searchUtils/entitiesSelection.module"; diff --git a/src/app/htmlPages/organizations/organizationsPage.module.ts b/src/app/htmlPages/organizations/organizationsPage.module.ts index ab19356..e504e54 100644 --- a/src/app/htmlPages/organizations/organizationsPage.module.ts +++ b/src/app/htmlPages/organizations/organizationsPage.module.ts @@ -6,7 +6,7 @@ import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard' import {OrganizationsPageComponent} from './organizationsPage.component'; import {OrganizationsPageRoutingModule} from './organizationsPage-routing.module'; -import {AffiliationsModule} from "../../affiliations/affiliations.module"; +import {AffiliationsModule} from "../../openaireLibrary/connect/affiliations/affiliations.module"; import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module"; import {CommonModule} from "@angular/common"; import {HtmlPagesModule} from "../htmlPages.module"; diff --git a/src/assets/common-assets b/src/assets/common-assets index 6cef9eb..651102a 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 6cef9ebed0db7ecbcca023bae824239106907960 +Subproject commit 651102a5ba049b71bed8eb6a85a8d02cefcb24cc diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index 52eca9a..37639ea 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 52eca9abe84c941a7e78a5690f273d8c8e3194f9 +Subproject commit 37639eab68c63a506b7df10c42e3379c4a05d94d From 2b1de70ce0b3772a5ecf412abd2aefd365d24337 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 11 Mar 2024 13:27:27 +0200 Subject: [PATCH 05/24] [plugins-functionality | WIP] --- src/app/community/community.component.html | 849 +----------------- src/app/community/community.component.ts | 644 ++----------- src/app/community/community.module.ts | 4 +- .../simple/searchDataproviders.component.ts | 2 +- src/assets/community.less | 6 + 5 files changed, 82 insertions(+), 1423 deletions(-) diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index 109a9bd..01621df 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -1,837 +1,14 @@ -
- -
-
- - -
-
-
- - -
-
- {{typeName}} -
- - -
-
- - -
- No graphs available -
-
-
-
-
- {{statisticsSum[entity].total|number}} -
-
- Total -
-
-
-
-
-
- {{statisticsSum[entity].projects|number}} -
-
- Total linked projects -
-
-
-
-
-
- {{statisticsSum[entity].open_access|number}} -
-
- Open access -
-
-
-
-
-
- {{statisticsSum[entity].closed_access|number}} -
-
- Closed access -
-
-
-
-
-
- {{statisticsSum[entity].embargo|number}} -
-
- Embargoed -
-
-
-
-
-
- {{statisticsSum[entity].restricted|number}} -
-
- Restricted -
-
-
-
-
-
-
-
-
    -
  • -
    -
    - {{chartsInfoMap[chart].title}} -
    - -
    -
  • -
-
-
-
-
-
-
-
- {{chartsInfoMap[chart].title}} -
- -
-
-
-
-
- -
-
-
-
-

- {{community.shortTitle}} -

-
- {{community.title}} -
- - - - - - - - - - - - - - -
- - -
-
-
-
- -
-
-
-
-
-
- -
-
-
-
- - - - -
-
-
-
-
-
-
-
-
- -
-
-
-
- Created: {{community.date | date:'dd-MMM-yyyy'}} -
- - -
-
-
- - - - -
- -
-
-
-
-
-
-
Subjects
- - - - {{item.value}} - - , - - - -
-
-
-
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
- Browse OpenAIRE Research Graph through a map of the main concepts linked to Coronavirus -
-
- - - Powered by - Opscidia and - OpenAIRE Research Graph - - Visit - - Opscidia Tool - - -
-
-
-
-
-
-
- Featured Datasets -
-
-
-
Here are listed some of the most important energy datasets as selected by energy experts.
-
- Check them if you want to easily explore and visualize the European energy landscape, - using only well-known datasets which you can trust. -
-
- - - - -
-
-
-
-
-
+ +
+
- - - -
- -
- -
-
-
-
-
- No community chosen -
-
- -
-
-
-
-
-
- - -
+ + + + + + + + diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index a4cc69c..289f814 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -24,123 +24,31 @@ import {properties} from "../../environments/environment"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class"; import {OpenaireEntities} from '../openaireLibrary/utils/properties/searchFields'; +import {PluginsService} from "../openaireLibrary/services/plugins.service"; +import {PluginTemplate} from "../openaireLibrary/utils/entities/adminTool/pluginTemplate"; +import {Plugin} from "../openaireLibrary/utils/entities/adminTool/plugin"; +import {PluginUtils} from "../openaireLibrary/dashboard/plugins/utils/pluginUtils"; @Component({ selector: 'community', templateUrl: 'community.component.html', - styles: [ - ` - #mytabs .uk-tab::before { - border-bottom: none; - } - #mytabs::before { - content: ""; - position: absolute; - bottom: 0; - left: 0; - right: 0; - border-bottom: 1px solid #eaeaea; - } - ` - ] + }) export class CommunityComponent { public url: string = null; - - public projectTotal = null; - public contentProviderTotal = null; - - public projectsCalculated: boolean = false; - public contentProvidersCalculated: boolean = false; - - params: any = {}; properties: EnvProperties = properties; - - public errorCodes: ErrorCodes = new ErrorCodes(); - // Request results of each tab only the one time (first time tab is clicked) - private reloadPublications: boolean = true; - private reloadDatasets: boolean = true; - private reloadSoftware: boolean = true; - private reloadOrps: boolean = true; - private reloadFeaturedDatasets: boolean = true; - - // Variables for publications, research data, projects, content providers, related content providers tabs - public fetchPublications: FetchResearchResults; - public fetchDatasets: FetchResearchResults; - public fetchSoftware: FetchResearchResults; - public fetchOrps: FetchResearchResults; - public fetchFeaturedDatasets: FetchResearchResults; - public searchNumber: number = 5; - @Input() communityId = null; public community = null; public portal = null; - - public showLoading: boolean = true; - masterZenodoCommunity = null; - zenodoCommunityIdS = []; - showAllDescription = false; - public thresholdDescription: number = 500; - public descriptionDiff: number = 100; - - page = 1; - size = 5; - - subscribers: number = 0; - - subs: Subscription[] = []; - - displayedAllSubjects = []; - displayedSubjects = []; - displayedSdg = []; - displayedFos = []; - - @ViewChild(StatisticsForDashboardComponent) statistics: StatisticsForDashboardComponent = null; - public activeTab = "summary"; - public show: string = 'overview'; - public analyticsActiveTab: string = ""; - public analyticsChecked: boolean = false; - - searchLinkToResults: string = null; - - searchLinkToProjects: string = null; - searchLinkToDataProviders: string = null; - searchLinkToAdvancedResults: string = null; - shareInZenodoPage: string = null; - public routerHelper: RouterHelper = new RouterHelper(); + subscriptions: Subscription[] = []; private user: User; - selectedEntity = 'result'; - selectedEntitySimpleUrl; - selectedEntityAdvancedUrl; - resultTypes: Filter = { - values: [], - filterId: "type", - countSelectedValues: 0, - filterType: 'checkbox', - originalFilterId: "", - valueIsExact: true, - title: "Type", - filterOperator: "or" - }; - showPublications: boolean = false; - showDatasets: boolean = false; - showSoftware: boolean = false; - showOrp: boolean = false; - showProjects: boolean = false; - showDataProviders: boolean = false; - keyword: string = ""; - customFilter; - placeholderText = "Search by title, author, abstract, DOI, orcid... "; - resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = { - filter: null, - selected: true, - filterId: "resultbestaccessright", - value: "Open Access" - }; - disableSelect: boolean = true; - openaireEntities= OpenaireEntities; + public showLoading = true; + pluginTemplates: PluginTemplate[] = []; + plugins: Plugin[] = []; + public pluginsByPlacement: Map = new Map(); + public pluginUtils = new PluginUtils(); constructor( private element: ElementRef, @@ -152,15 +60,10 @@ export class CommunityComponent { private _piwikService: PiwikService, private config: ConfigurationService, private _communityService: CommunityService, - private _searchCommunityDataprovidersService: SearchCommunityDataprovidersService, - private _searchCommunityProjectsService: SearchCommunityProjectsService, - private _searchResearchResultsService: SearchResearchResultsService, - private _zenodoCommunitieService: ZenodoCommunitiesService, + private seoService: SEOService, private userManagementService: UserManagementService, - private _renderer2: Renderer2, - private cdr: ChangeDetectorRef, - @Inject(DOCUMENT) private _document: Document) { + private _pluginsService:PluginsService) { var description = "OpenAIRE - Connect, Community Dashboard, research community"; var title = "OpenAIRE - Connect"; @@ -169,500 +72,71 @@ export class CommunityComponent { this._meta.updateTag({content: title}, "property='og:title'"); this._title.setTitle(title); - this.fetchPublications = new FetchResearchResults(this._searchResearchResultsService); - this.fetchDatasets = new FetchResearchResults(this._searchResearchResultsService); - this.fetchSoftware = new FetchResearchResults(this._searchResearchResultsService); - this.fetchOrps = new FetchResearchResults(this._searchResearchResultsService); - this.fetchFeaturedDatasets = new FetchResearchResults(this._searchResearchResultsService); - } public ngOnInit() { - this.searchLinkToResults = this.properties.searchLinkToResults; - this.searchLinkToProjects = this.properties.searchLinkToProjects; - this.searchLinkToDataProviders = this.properties.searchLinkToDataProviders; - this.searchLinkToAdvancedResults = this.properties.searchLinkToAdvancedResults; - this.shareInZenodoPage = this.properties.shareInZenodoPage; - this.url = properties.domain + properties.baseLink + this._router.url; + this.url = properties.domain + properties.baseLink + this._router.url; this.seoService.createLinkForCanonicalURL(this.url, false); this._meta.updateTag({content: this.url}, "property='og:url'"); - this.subs.push(this.userManagementService.getUserInfo().subscribe(user => { + this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => { this.user = user; })); - this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, ""); - this.subs.push(this._communityService.getCommunityAsObservable().subscribe( + this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe( community => { this.community = community; if(community && !ConnectHelper.isPrivate(community, this.user)) { - this.displayedSubjects = community.subjects; - this.displayedSdg = community.sdg; - this.displayedFos = community.fos; - this.displayedSubjects.forEach(element => { - this.displayedAllSubjects.push({value: element, type: 'resultsubject'}); - }); - this.displayedSdg.forEach(element => { - this.displayedAllSubjects.push({value: element, type: 'sdg'}); - }); - this.displayedFos.forEach(element => { - this.displayedAllSubjects.push({value: element, type: 'fos'}); - }); - if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) { - this.thresholdDescription = community.description.length; - } - if (this.properties.environment == "development") { - this.params = {communityId: community.communityId}; - } this._meta.updateTag({content: community.description}, "name='description'"); this._meta.updateTag({content: community.description}, "property='og:description'"); this._meta.updateTag({content: community.title}, "property='og:title'"); this._title.setTitle(community.title); - this.subs.push(this._piwikService.trackView(this.properties, community.title).subscribe()); - if (this.community.zenodoCommunity) { - this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.community.zenodoCommunity).subscribe( - result => { - this.masterZenodoCommunity = result; - }, - error => { - this.handleError("Error getting Master Zenodo community with id: " + this.community.zenodoCommunity, error); - } - )); - } - this.zenodoCommunityIdS = this.community.otherZenodoCommunities; + this.subscriptions.push(this._piwikService.trackView(this.properties, community.title).subscribe()); + this.getPagePlugins(); + } })); - this.countResearchResults("publication"); - this.countResearchResults("dataset"); - this.countResearchResults("software"); - this.countResearchResults("other"); - if(this.communityId == "enermaps"){ - this.countResearchResults("dataset", "enermaps::selection" ); - } + } + + getPagePlugins() { + this.showLoading = true; + this.subscriptions.push(this._pluginsService.getPluginTemplatesByPage(this.properties.adminToolsAPIURL, this.community.communityId, "60be1e6832035404d85fdd7e").subscribe( + templates => { + this.pluginTemplates = templates; + + this.subscriptions.push(this._pluginsService.getPluginsByPage(this.properties.adminToolsAPIURL, this.community.communityId, "60be1e6832035404d85fdd7e").subscribe( + plugins => { + this.plugins = plugins; + this.pluginsByPlacement = new Map(); + for(let pos of this.pluginUtils.placementsOptions){ + this.pluginsByPlacement.set(pos.value,[]); + } + let self = this; + this.pluginTemplates.forEach(_ => { + let plugin:Plugin = null; + for(let pl of plugins){ + if (pl.templateId == _._id){ + plugin = pl; + } + } + if(!plugin){ + plugin = new Plugin("", "",_); + this.plugins.push(plugin); + } + plugin.object = PluginUtils.initializeObjectAndCompare(_.code,plugin.object) + this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _ }); + }); + for(let placement of this.pluginUtils.placementsOptions){ + this.pluginsByPlacement.get(placement.value).sort(function (a, b) { + return a.plugin.order - b.plugin.order; + }) + } + console.log(this.pluginsByPlacement.get('top')) + this.showLoading = false; + }, + error => {})); - this.subs.push(this._searchCommunityProjectsService.countTotalProjects(this.properties, this.communityId).subscribe( - projectTotal => { - this.projectTotal = projectTotal; }, - error => { - this.handleError("Error getting number of projects for community with id: " + this.communityId, error); - }, - () => { - this.projectsCalculated = true; - } - )); - - this.subs.push(this._searchCommunityDataprovidersService.countTotalDataproviders(this.properties, this.communityId).subscribe( - contentProviderTotal => { - this.contentProviderTotal = contentProviderTotal; - //console.log(contentProviderTotal); - }, - error => { - this.handleError("Error getting number of content providers for community with id: " + this.communityId, error); - }, - () => { - this.contentProvidersCalculated = true; - } - )); - this.subs.push(this.config.portalAsObservable.subscribe( - res => { - this.portal = res; - - // loading twitter widget script conditionally - if (properties.environment == "development") { - if (this.portal && this.portal.twitterAccount) { - let script = this._renderer2.createElement('script'); - script.charset = "utf-8"; - script.src = "https://platform.twitter.com/widgets.js"; - this._renderer2.appendChild(this._document.body, script); - } - } - }, - error => { - //console.log(error) - this.handleError("Error getting community with id: " + this.communityId, error); - } - )); - this.subs.push(this.config.portalAsObservable.subscribe(data => { - if (data) { - var showEntity = {}; - for (var i = 0; i < data['entities'].length; i++) { - showEntity["" + data['entities'][i]["pid"] + ""] = data['entities'][i]["isEnabled"]; - } - this.showPublications = !!showEntity["publication"]; - this.showDatasets = !!showEntity["dataset"]; - this.showSoftware = !!showEntity["software"]; - this.showOrp = !!showEntity["orp"]; - this.showProjects = !!showEntity["project"]; - this.showDataProviders = !!showEntity["datasource"]; - this.resultTypes.values = []; - if (this.showPublications) { - this.resultTypes.values.push({ - name: this.openaireEntities.PUBLICATIONS, - id: "publications", - selected: false, - number: 0 - }); - } - if (this.showDatasets) { - this.resultTypes.values.push({ - name: this.openaireEntities.DATASETS, - id: "datasets", - selected: false, - number: 0 - }); - } - if (this.showSoftware) { - this.resultTypes.values.push({ - name: this.openaireEntities.SOFTWARE, - id: "software", - selected: false, - number: 0 - }); - } - if (this.showOrp) { - this.resultTypes.values.push({name: this.openaireEntities.OTHER, id: "other", selected: false, number: 0}); - } - } - })); - } - - private searchPublications(page: number, size: number) { - this.setActiveTab("publication"); - - if (this.reloadPublications && - (this.fetchPublications.searchUtils.status == this.errorCodes.LOADING || - (this.fetchPublications.searchUtils.status == this.errorCodes.DONE && this.fetchPublications.searchUtils.totalResults > 0) - ) - ) { - this.fetchPublications.getResultsForCommunity("publication", this.communityId, page, size, this.properties); - } - this.reloadPublications = false; - } - - private searchDatasets(page: number, size: number) { - this.setActiveTab("dataset"); - - if (this.reloadDatasets && - (this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING || - (this.fetchDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchDatasets.searchUtils.totalResults > 0) - ) - ) { - this.fetchDatasets.getResultsForCommunity("dataset", this.communityId, page, size, this.properties); - } - this.reloadDatasets = false; - } - - private searchSoftware(page: number, size: number) { - this.setActiveTab("software"); - - if (this.reloadSoftware && - (this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || - (this.fetchSoftware.searchUtils.status == this.errorCodes.DONE && this.fetchSoftware.searchUtils.totalResults > 0) - ) - ) { - this.fetchSoftware.getResultsForCommunity("software", this.communityId, page, size, this.properties); - } - this.reloadSoftware = false; - } - - private searchOrps(page: number, size: number) { - this.setActiveTab("other"); - - if (this.reloadOrps && - (this.fetchOrps.searchUtils.status == this.errorCodes.LOADING || - (this.fetchOrps.searchUtils.status == this.errorCodes.DONE && this.fetchOrps.searchUtils.totalResults > 0) - ) - ) { - this.fetchOrps.getResultsForCommunity("other", this.communityId, page, size, this.properties); - } - this.reloadOrps = false; - } - private searchFeaturedDatasets(page: number, size: number) { - this.setActiveTab("enermaps"); - if (this.reloadFeaturedDatasets && - (this.fetchFeaturedDatasets.searchUtils.status == this.errorCodes.LOADING || - (this.fetchFeaturedDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchFeaturedDatasets.searchUtils.totalResults > 0) - ) - ) { - this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", this.communityId, page, size, this.properties, "enermaps::selection"); - } - this.reloadFeaturedDatasets = false; - } - - private countResearchResults(resultType: string, contextId = null) { - let fetch: FetchResearchResults; - - if (resultType == "publication") { - fetch = this.fetchPublications; - } else if (resultType == "dataset" && !contextId) { - fetch = this.fetchDatasets; - } else if (resultType == "software") { - fetch = this.fetchSoftware; - } else if (resultType == "other") { - fetch = this.fetchOrps; - } else if (resultType == "dataset" && contextId) { - fetch = this.fetchFeaturedDatasets; - this.fetchFeaturedDatasets.getAllResultsForCommunity("dataset", this.communityId, 0, 0, this.properties, contextId); - return; - } - fetch.getNumForCommunity(resultType, this.communityId, this.properties, contextId); - } - - public ngOnDestroy() { - for (let sub of this.subs) { - sub.unsubscribe(); - } - this.fetchPublications.clearSubscriptions(); - this.fetchDatasets.clearSubscriptions(); - this.fetchOrps.clearSubscriptions(); - this.fetchSoftware.clearSubscriptions(); - this.fetchFeaturedDatasets.clearSubscriptions(); - } - - isEntityEnabled(entity: string) { - return this.portal.entities.some(x => x['pid'] == entity && x['isEnabled'] === true); - } - - isRouteEnabled(route: string) { - return this.portal.pages.some(x => x['route'] == route && x['isEnabled'] === true); - } - - showInvite() { - return this.isManager(); - } - - isManager() { - if (!this.user) { - return false; - } - var email = this.user.email; - var index = -1; - if (email && this.community != null && this.community.managers != null) { - index = this.community.managers.indexOf(email); - } - return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || index != -1; - } - - private handleError(message: string, error) { - console.error("Community (component): " + message, error); - } - - getSearchPlaceHolder() { - var entities = []; - if (this.isEntityEnabled("publication")) { - entities.push("publications"); - } - if (this.isEntityEnabled("dataset")) { - entities.push("research data"); - } - if (this.isEntityEnabled("software")) { - entities.push("software"); - } - if (this.isEntityEnabled("orp")) { - entities.push("other research products"); - } - return "Search" + ((entities.length > 0) ? (" for " + entities.join(', ') + "...") : ""); - } - - countOtherGraphs() { - var count = 0; - if (this.statistics && this.statistics.allowedEntities) { - for (var entity of this.statistics.allowedEntities) { - if (this.statistics.statisticsSum[entity].total > 0 && this.statistics.allowedCharts[entity].length > 0 && this.activeTab != entity) { - count += this.statistics.allowedCharts[entity].length; - } - } - } - return count; - } - - createParams(param) { - return StringUtils.URIEncode(param); - } - - private setActiveTab(entityType: string) { - if (entityType == "other") { - this.activeTab = "orp"; - } else { - this.activeTab = entityType; - } - } - - public getParamsForSearchLink(type: string = "") { - if (type) { - return this.routerHelper.createQueryParams(['type', 'qf', 'sortBy'], [type, 'false', 'resultdateofacceptance,descending']); - } else { - return {}; - } - } - - private getEntityName(entityType: string, plural: boolean, full: boolean): string { - if (entityType == "publication") { - return "publication" + (plural ? "s" : ""); - } else if (entityType == "dataset") { - return (full ? "research data" : ("dataset" + (plural ? "s" : ""))); - } else if (entityType == "software") { - return "software"; - } else if (entityType == "other") { - return (full ? ("other research product" + (plural ? "s" : "")) : "other"); - } - } - - public buildProjectsTooltip(): string { - let tooltipContent: string = "
"; - - if (this.projectTotal != null && this.projectTotal > 0 && this.isEntityEnabled('project') && this.isRouteEnabled(this.searchLinkToProjects)) { - tooltipContent += "Projects"; - } - - tooltipContent += " have been selected as relevant for your community by the gateway curators."; - tooltipContent += "
"; - - return tooltipContent; - } - - public buildContentProvidersTooltip(): string { - let tooltipContent: string = "
"; - - if (this.contentProviderTotal != null && this.contentProviderTotal > 0 && this.isEntityEnabled('datasource') && this.isRouteEnabled(this.searchLinkToDataProviders)) { - tooltipContent += "Content Providers"; - } - - tooltipContent += " have been selected as relevant for your community by the gateway curators."; - tooltipContent += "
"; - - return tooltipContent; - } - - public buildZenodoCommunitiesTooltip(): string { - let tooltipContent: string = "
"; - - tooltipContent += "Zenodo is a catch-all repository for OpenAIRE."; - tooltipContent += "
A Zenodo Community is created and curated by Zenodo users.
"; - tooltipContent += "
"; - - return tooltipContent; - } - - entityChanged($event) { - this.selectedEntity = $event.entity; - this.selectedEntitySimpleUrl = $event.simpleUrl; - this.selectedEntityAdvancedUrl = $event.advancedUrl; - if (this.selectedEntity == 'result') { - this.placeholderText = "Search by title, author, abstract, DOI, orcid... "; - } else if (this.selectedEntity == 'project') { - this.placeholderText = "Search by project title, grant id, funder..."; - } else if (this.selectedEntity == 'dataprovider') { - this.placeholderText = "Search by name..."; - } else { - this.placeholderText = "Search community content"; - } - } - - goTo(simple: boolean) { - let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl; - let parameterNames = []; - let parameterValues = []; - - if (this.selectedEntity == "result" && this.resultsQuickFilter && this.resultsQuickFilter.selected) { - parameterNames.push(this.resultsQuickFilter.filterId); - parameterValues.push('"'+ encodeURIComponent(this.resultsQuickFilter.value)+'"'); - } - - if (this.keyword.length > 0) { - parameterNames.push("fv0"); - parameterValues.push(this.keyword); - parameterNames.push("f0"); - parameterValues.push("q"); - } - this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)}); - } - - public countSubscribersEvent($event) { - this.subscribers = $event.value; - } - - public checkStatistics(type: string) { - return !!(this.isEntityEnabled(type) - && this.statistics && this.statistics.statisticsDisplay && this.statistics.statisticsDisplay.isActive - && this.statistics.statisticsSum && this.statistics.statisticsSum[type] && this.statistics.statisticsSum[type].total > 0 - && - (this.statistics.statisticsDisplay.entities[type].numbers.map['total']['showInMonitor'] - || this.statistics.statisticsDisplay.entities[type].numbers.map['project']['showInMonitor'] - || this.statistics.statisticsDisplay.entities[type].numbers.map['open']['showInMonitor'] - || this.statistics.statisticsDisplay.entities[type].numbers.map['closed']['showInMonitor'] - || this.statistics.statisticsDisplay.entities[type].numbers.map['embargo']['showInMonitor'] - || this.statistics.statisticsDisplay.entities[type].numbers.map['restricted']['showInMonitor'] - || (this.statistics.allowedEntitiesMode['showInMonitor'] - && this.statistics.allowedChartsMode['showInMonitor'][type] - && this.statistics.allowedChartsMode['showInMonitor'][type].length > 0))); - } - - public initializeAnalyticsActiveTab() { - if (!this.analyticsChecked) { - if (this.checkStatistics("publication")) { - this.analyticsActiveTab = "publication"; - } else if (this.checkStatistics("dataset")) { - this.analyticsActiveTab = "dataset"; - } else if (this.checkStatistics("software")) { - this.analyticsActiveTab = "software"; - } else if (this.checkStatistics("orp")) { - this.analyticsActiveTab = "orp"; - } - } - } - - public showAnalyticsTab() { - this.initializeAnalyticsActiveTab(); - return this.analyticsActiveTab; - } - - public onSelectActiveTab(activeTabId) { - if (this.activeTab != "activaTabId") { // tab really changed - if (activeTabId == 'summary') { - this.activeTab = 'summary'; - } else if (activeTabId == 'publications') { - this.show = 'overview'; - this.searchPublications(1, this.searchNumber); - } else if (activeTabId == 'datasets') { - this.show = 'overview'; - this.searchDatasets(1, this.searchNumber); - } else if (activeTabId == 'software') { - this.show = 'overview'; - this.searchSoftware(1, this.searchNumber); - } else if (activeTabId == 'other') { - this.show = 'overview'; - this.searchOrps(1, this.searchNumber); - } else if (activeTabId == 'analytics') { - this.show = 'analysis'; - this.activeTab = 'analytics'; - this.analyticsChecked = true; - } else if (activeTabId == 'mapping') { - this.show = 'mapping'; - this.activeTab = 'mapping'; - } else if (activeTabId == 'enermaps') { - this.show = 'enermaps'; - this.activeTab = 'enermaps'; - this.searchFeaturedDatasets(1, this.fetchFeaturedDatasets.searchUtils.totalResults); - } else if (activeTabId == 'twitter') { - this.show = 'twitter'; - this.activeTab = 'twitter'; - } - } - } - isPrivate(){ - return ConnectHelper.isPrivate(this.community, this.user); - } - - disableSelectChange(event: boolean) { - this.disableSelect = event; - this.cdr.detectChanges(); - } - - public updatePage(event) { - this.page = event.value; - this.fetchFeaturedDatasets.searchUtils.page = event.value; - this.fetchFeaturedDatasets.results = this.fetchFeaturedDatasets.allResults.slice((this.page - 1) * this.searchNumber, this.page * this.searchNumber) ; + error => {})); } } diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts index e142c6b..99f9c0d 100644 --- a/src/app/community/community.module.ts +++ b/src/app/community/community.module.ts @@ -42,6 +42,8 @@ import {IconsModule} from '../openaireLibrary/utils/icons/icons.module'; import {NoLoadPaging} from '../openaireLibrary/searchPages/searchUtils/no-load-paging.module'; import {NumberRoundModule} from '../openaireLibrary/utils/pipes/number-round.module'; import {PluginsService} from '../openaireLibrary/services/plugins.service'; +import {PluginWrapperModule} from "../openaireLibrary/dashboard/plugins/wrapper/plugin-wrapper.module"; +import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module"; @NgModule({ imports: [ @@ -51,7 +53,7 @@ import {PluginsService} from '../openaireLibrary/services/plugins.service'; SearchResearchResultsServiceModule, SearchResultsModule, CuratorsModule, AffiliationsModule, SEOServiceModule, MatSelectModule, EntitiesSelectionModule, TabsModule, SearchTabModule, ErrorMessagesModule, SafeHtmlPipeModule, ErrorModule, - AdvancedSearchInputModule, InputModule, QuickSelectionsModule, IconsModule, NoLoadPaging, NumberRoundModule + AdvancedSearchInputModule, InputModule, QuickSelectionsModule, IconsModule, NoLoadPaging, NumberRoundModule, PluginWrapperModule, LoadingModule ], declarations: [ CommunityComponent diff --git a/src/app/searchPages/simple/searchDataproviders.component.ts b/src/app/searchPages/simple/searchDataproviders.component.ts index a97d3ad..afca040 100644 --- a/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/src/app/searchPages/simple/searchDataproviders.component.ts @@ -163,7 +163,7 @@ export class OpenaireSearchDataprovidersComponent { this.searchUtils.totalResults = results.length; this.results = results.slice((this.searchUtils.page - 1) * this.searchUtils.size, this.searchUtils.page *this.searchUtils.size ); this.searchUtils.status = this.results.length == 0 ? this.errorCodes.NONE: this.errorCodes.DONE; - this.searchPage.buildPageURLParameters(this.filters, [], false); + this.searchPage.buildPageURLParameters(this.filters, [], [], false); this.disableForms = false; this.enableSearchView = true; } diff --git a/src/assets/community.less b/src/assets/community.less index adebe47..6d9ade6 100644 --- a/src/assets/community.less +++ b/src/assets/community.less @@ -61,3 +61,9 @@ .hook-inverse(); } +//services slider +@slider-nav-item-background-active: white; +@slider-nav-item-action-background: rgba(255, 255, 255, 0.5); +slider-container slider-nav-item when (@hero-fonts-mode = light) { + .hook-inverse +} From cfb4d3bc2b5d798bb71ac5d161c49ca1d1207d82 Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 13 Mar 2024 10:33:02 +0200 Subject: [PATCH 06/24] [plugins-functionality | WIP] --- src/app/searchPages/simple/searchProjects.component.ts | 2 +- src/assets/community.less | 4 +++- src/environments/environment.ts | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/searchPages/simple/searchProjects.component.ts b/src/app/searchPages/simple/searchProjects.component.ts index c8cde79..f2eba04 100644 --- a/src/app/searchPages/simple/searchProjects.component.ts +++ b/src/app/searchPages/simple/searchProjects.component.ts @@ -96,7 +96,7 @@ export class OpenaireSearchProjectsComponent { this.searchUtils.validateSize(params['size']); this.keyword = decodeURIComponent(params['fv0']?params['fv0']:(params['keyword']?params['keyword']:'')); this.selectedFields = []; - this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], [], this.fieldIdsMap, this.customFilter, params, "project"); + this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], ["funder"], this.fieldIdsMap, this.customFilter, params, "project"); if(this.initialLoad) { this.initialLoad = false; this._getCommunityFunders(); diff --git a/src/assets/community.less b/src/assets/community.less index 6d9ade6..8413740 100644 --- a/src/assets/community.less +++ b/src/assets/community.less @@ -63,7 +63,9 @@ //services slider @slider-nav-item-background-active: white; -@slider-nav-item-action-background: rgba(255, 255, 255, 0.5); +slider-container slider-nav-item { + background-color:#FFFFFF80; +} slider-container slider-nav-item when (@hero-fonts-mode = light) { .hook-inverse } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 4a8a496..a35c67a 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -19,6 +19,10 @@ let props: EnvProperties = { domain: 'https://beta.connect.openaire.eu', baseLink : "", + adminToolsAPIURL: 'http://scoobydoo.di.uoa.gr:8880/uoa-admin-tools/', + utilsService:"http://scoobydoo.di.uoa.gr:8000", + monitorStatsFrameUrl:"https://stats.madgik.di.uoa.gr/stats-api/", + }; From 44d626d867a40a228b1980ec1a8c645156489a24 Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 15 Mar 2024 20:19:31 +0200 Subject: [PATCH 07/24] [plugins-functionality | WIP] --- src/app/community/community.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 289f814..57893a7 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -100,11 +100,11 @@ export class CommunityComponent { getPagePlugins() { this.showLoading = true; - this.subscriptions.push(this._pluginsService.getPluginTemplatesByPage(this.properties.adminToolsAPIURL, this.community.communityId, "60be1e6832035404d85fdd7e").subscribe( + this.subscriptions.push(this._pluginsService.getPluginTemplatesByPageRoute(this.properties.adminToolsAPIURL, this.community.communityId, this._router.url ).subscribe( templates => { this.pluginTemplates = templates; - this.subscriptions.push(this._pluginsService.getPluginsByPage(this.properties.adminToolsAPIURL, this.community.communityId, "60be1e6832035404d85fdd7e").subscribe( + this.subscriptions.push(this._pluginsService.getPluginsByPageRoute(this.properties.adminToolsAPIURL, this.community.communityId, this._router.url).subscribe( plugins => { this.plugins = plugins; this.pluginsByPlacement = new Map(); From 8456115eb128fd96951d2256891d534e254f6b08 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 21 Mar 2024 09:52:20 +0200 Subject: [PATCH 08/24] [plugins-functionality | WIP] --- src/app/app.component.ts | 2 -- src/app/community/community.component.html | 2 +- src/app/community/community.component.ts | 1 - src/environments/environment.beta.ts | 2 ++ src/environments/environment.prod.ts | 4 +++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 3919236..bbbf31b 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -308,13 +308,11 @@ export class AppComponent implements OnInit, OnDestroy { initAdminToolCommunity(communityId) { if (communityId) { this.properties.adminToolsPortalType = "community"; - this.properties.adminToolsCommunity = communityId; if (this.document) { this.initLayout(communityId); } } else { this.properties.adminToolsPortalType = "connect"; - this.properties.adminToolsCommunity = "connect"; if (this.document) { this.initLayout(this.communityId?this.communityId:'connect'); } diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index 01621df..84fe387 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -6,7 +6,7 @@ + (pluginGroup.template.plan == 'starter'|| pluginGroup.template.plan == community.plan ) && pluginGroup.plugin.active"> diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 57893a7..d3a5f8b 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -131,7 +131,6 @@ export class CommunityComponent { return a.plugin.order - b.plugin.order; }) } - console.log(this.pluginsByPlacement.get('top')) this.showLoading = false; }, error => {})); diff --git a/src/environments/environment.beta.ts b/src/environments/environment.beta.ts index 3f7b05b..a84eab8 100644 --- a/src/environments/environment.beta.ts +++ b/src/environments/environment.beta.ts @@ -14,6 +14,8 @@ let props: EnvProperties = { showAddThis: false, domain: 'https://beta.connect.openaire.eu', baseLink : "", + monitorStatsFrameUrl:"https://beta.services.openaire.eu/stats-tool/" + }; diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 6249155..24f5c59 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -14,7 +14,9 @@ let props: EnvProperties = { showAddThis: false, domain: 'https://connect.openaire.eu', baseLink : "", - hasMachineCache: true + hasMachineCache: true, + monitorStatsFrameUrl:"https://services.openaire.eu/stats-tool/" + }; export let properties: EnvProperties = { From e0bd40c485bc017e46ccccfd3153c28341558d9e Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 27 Mar 2024 09:29:59 +0200 Subject: [PATCH 09/24] [pluginsFunctionality | DONE | ADDED] read parameter and save property forceCacheReload --- src/app/app.component.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index bbbf31b..d43724e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -189,6 +189,7 @@ export class AppComponent implements OnInit, OnDestroy { ngOnInit() { this.subscriptions.push(this.route.queryParams.subscribe(data => { this.previewLayout = (data['previewLayout'] && data['previewLayout'].length > 0 ? data['previewLayout'] : null); + this.properties.forceCacheReload = (data['forceCacheReload'] ? true : false); if (this.properties.environment == "production" || this.properties.environment == "development") { this._meta.updateTag({content: 'all', name: 'robots'}); this.seoService.removeLinkForPrevURL(); From 8f6ca702b13d5aea831469156d65f9ea8b098dd6 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 4 Apr 2024 09:28:59 +0300 Subject: [PATCH 10/24] [pluginsFunctionality | DONE | REMOVED] remove FOS component, use directly the library component - fixes the back issue after click to go to search page --- src/app/app-routing.module.ts | 6 +----- src/app/fos/fos-routing.module.ts | 20 -------------------- src/app/fos/fos.component.ts | 21 --------------------- src/app/fos/fos.module.ts | 27 --------------------------- 4 files changed, 1 insertion(+), 73 deletions(-) delete mode 100644 src/app/fos/fos-routing.module.ts delete mode 100644 src/app/fos/fos.component.ts delete mode 100644 src/app/fos/fos.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 3a83d08..56ec1ae 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -47,11 +47,7 @@ const routes: Routes = [ loadChildren: () => import('./sdg/sdg.module').then(m => m.LibSdgModule), data: {hasQuickContact: false} }, - { - path: 'fields-of-science', - loadChildren: () => import('./fos/fos.module').then(m => m.LibFosModule), - data: {extraOffset: 100, hasQuickContact: false} - }, + {path: 'fields-of-science', loadChildren: () => import('./openaireLibrary/fos/fos.module').then(m => m.FosModule), data: {extraOffset: 100, hasQuickContact: false}}, { path: 'organizations', loadChildren: () => import('./htmlPages/organizations/organizationsPage.module').then(m => m.OrganizationsPageModule), diff --git a/src/app/fos/fos-routing.module.ts b/src/app/fos/fos-routing.module.ts deleted file mode 100644 index fdbb09c..0000000 --- a/src/app/fos/fos-routing.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import {NgModule} from "@angular/core"; -import {RouterModule} from "@angular/router"; -import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; -import {CommunityFosComponent} from "./fos.component"; -import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard"; - -@NgModule({ - imports: [ - RouterModule.forChild([ - { - path: '', - component: CommunityFosComponent, - canActivate: [IsRouteEnabled], - canDeactivate: [PreviousRouteRecorder] - } - ]) - ] -}) -export class LibFosRoutingModule { -} \ No newline at end of file diff --git a/src/app/fos/fos.component.ts b/src/app/fos/fos.component.ts deleted file mode 100644 index 25c0c2d..0000000 --- a/src/app/fos/fos.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import {Component} from "@angular/core"; -import {properties} from "../../environments/environment"; -import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; - -@Component({ - selector: 'community-fos', - template: ` - - ` -}) - -export class CommunityFosComponent { - communityId; - - constructor() { - } - - ngOnInit() { - this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); - } -} diff --git a/src/app/fos/fos.module.ts b/src/app/fos/fos.module.ts deleted file mode 100644 index 5d1d24e..0000000 --- a/src/app/fos/fos.module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {CommonModule} from "@angular/common"; -import {NgModule} from "@angular/core"; -import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; -import {LibFosRoutingModule} from "./fos-routing.module"; -import {FosRoutingModule} from "../openaireLibrary/fos/fos-routing.module"; -import {FosModule} from "../openaireLibrary/fos/fos.module"; -import {CommunityFosComponent} from "./fos.component"; - -@NgModule({ - imports: [ - CommonModule, - LibFosRoutingModule, - FosRoutingModule, - FosModule - ], - declarations: [ - CommunityFosComponent - ], - exports: [ - CommunityFosComponent - ], - providers: [ - PreviousRouteRecorder - ] -}) -export class LibFosModule { -} \ No newline at end of file From 2171875ca5533be54f64d7a2e58e753b0d0c63e8 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 4 Apr 2024 09:29:37 +0300 Subject: [PATCH 11/24] [pluginsFunctionality | DONE | CHANGED] read properly route without parameters --- src/app/community/community.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index d3a5f8b..71ab4bd 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -100,11 +100,11 @@ export class CommunityComponent { getPagePlugins() { this.showLoading = true; - this.subscriptions.push(this._pluginsService.getPluginTemplatesByPageRoute(this.properties.adminToolsAPIURL, this.community.communityId, this._router.url ).subscribe( + this.subscriptions.push(this._pluginsService.getPluginTemplatesByPageRoute(this.properties.adminToolsAPIURL, this.community.communityId, this._router.url.split('?')[0] ).subscribe( templates => { this.pluginTemplates = templates; - this.subscriptions.push(this._pluginsService.getPluginsByPageRoute(this.properties.adminToolsAPIURL, this.community.communityId, this._router.url).subscribe( + this.subscriptions.push(this._pluginsService.getPluginsByPageRoute(this.properties.adminToolsAPIURL, this.community.communityId, this._router.url.split('?')[0]).subscribe( plugins => { this.plugins = plugins; this.pluginsByPlacement = new Map(); From e0242ddace889447617489b93e9b42b557c5d476 Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 24 Apr 2024 13:25:09 +0300 Subject: [PATCH 12/24] [pluginsFunctionality | DONE | FIXED] re-enable piwik tracking --- src/environments/environment.beta.ts | 2 +- src/environments/environment.prod.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/environments/environment.beta.ts b/src/environments/environment.beta.ts index a84eab8..8161ea7 100644 --- a/src/environments/environment.beta.ts +++ b/src/environments/environment.beta.ts @@ -6,7 +6,7 @@ let props: EnvProperties = { dashboard: 'connect', adminToolsPortalType: "connect", adminToolsCommunity: 'connect', - enablePiwikTrack: false, + enablePiwikTrack: true, piwikSiteId: '80', useCache: false, useLongCache: true, diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 24f5c59..40680e5 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -6,7 +6,7 @@ let props: EnvProperties = { dashboard: 'connect', adminToolsPortalType: "connect", adminToolsCommunity: 'connect', - enablePiwikTrack: false, + enablePiwikTrack: true, piwikSiteId: '80', useCache: false, useLongCache: true, From 3e3a98e52270615bdb43ee236cd72eb0a7b648d2 Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 8 May 2024 12:08:21 +0300 Subject: [PATCH 13/24] [pluginsFunctionality | DONE | ADDED] add a test file app.component.spec.ts checking about piwik, run tests on build --- angular.json | 2 +- package.json | 6 +++--- src/app/app.component.spec.ts | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/app/app.component.spec.ts diff --git a/angular.json b/angular.json index 4f72345..b1b21c5 100644 --- a/angular.json +++ b/angular.json @@ -197,7 +197,7 @@ "tsConfig": "src/tsconfig.spec.json", "karmaConfig": "src/karma.conf.js", "styles": [ - "src/styles.css" + "src/styles.less" ], "scripts": [], "assets": [ diff --git a/package.json b/package.json index 3e8abc1..e47956a 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "ng": "ng", "start": "ng serve --disable-host-check --host 0.0.0.0 --port 4200", "build": "ng build", - "build-dev": "ng build --configuration=development", - "build-beta": "ng build --configuration=beta", - "build-prod": "ng build --configuration production", + "build-dev": "ng build --configuration=development && ng test --watch=false", + "build-beta": "ng build --configuration=beta && ng test --watch=false", + "build-prod": "ng build --configuration production && ng test --watch=false", "webpack-bundle-analyzer": "ng build --stats-json && webpack-bundle-analyzer dist/connect/browser/stats.json --host 0.0.0.0", "test": "ng test", "e2e": "ng e2e", diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts new file mode 100644 index 0000000..3c72288 --- /dev/null +++ b/src/app/app.component.spec.ts @@ -0,0 +1,19 @@ +import {TestBed } from '@angular/core/testing'; +import {properties} from "../environments/environment"; + +describe('Environment Configuration', () => { + beforeEach(() => { + TestBed.configureTestingModule({ + }); + }); + + it('should have correct setting for piwik tracking based on environment', () => { + if (properties.environment == "beta" || properties.environment == "production") { + expect(properties.enablePiwikTrack).toBe(true,`Piwik tracking: Expected enablePiwikTrack to be true but it is ${properties.enablePiwikTrack}`); + } else { + expect(properties.enablePiwikTrack).toBe(false, `Piwik tracking: Expected enablePiwikTrack to be false but it is ${properties.enablePiwikTrack}`); + } + }); + + // Add more tests for other properties as needed +}); From 0c92b719b3110ab885a99aa18cb92f26cc34c0b0 Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 9 May 2024 10:18:46 +0300 Subject: [PATCH 14/24] [pluginsFunctionality | DONE | CHANGED] update plan values --- src/app/community/community.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/community/community.component.html b/src/app/community/community.component.html index 84fe387..64ad0fe 100644 --- a/src/app/community/community.component.html +++ b/src/app/community/community.component.html @@ -6,7 +6,7 @@ + (pluginGroup.template.plan == 'Default'|| pluginGroup.template.plan == 'Standard'|| pluginGroup.template.plan == community.plan ) && pluginGroup.plugin.active"> From dee055b392c1d1667fce97ef219e618409cee33c Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 9 May 2024 10:19:12 +0300 Subject: [PATCH 15/24] [pluginsFunctionality | DONE | ADDED] pass helptexts in sdg page --- src/app/sdg/sdg.component.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/app/sdg/sdg.component.ts b/src/app/sdg/sdg.component.ts index 18cbd0c..82a7c37 100644 --- a/src/app/sdg/sdg.component.ts +++ b/src/app/sdg/sdg.component.ts @@ -2,22 +2,41 @@ import {Component} from "@angular/core"; import {properties} from "../../environments/environment"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; +import {Router} from "@angular/router"; +import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; +import {Subscription} from "rxjs"; @Component({ selector: 'community-sdg', template: ` - + ` }) export class CommunitySdgComponent { communityId; customFilter: SearchCustomFilter = null; - - constructor() { + public pageContents = null; + subs: Subscription[] = []; + constructor( + private _router: Router, + private helper: HelperService) { } ngOnInit() { this.communityId = ConnectHelper.getCommunityFromDomain(properties.domain); this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, ""); + this.getPageContents(); + } + ngOnDestroy() { + for (let sub of this.subs) { + sub.unsubscribe(); + } + } + + private getPageContents() { + this.subs.push(this.helper.getPageHelpContents(properties, this.communityId, this._router.url).subscribe(contents => { + this.pageContents = contents; + console.log(this.pageContents) + })); } } From ecd1682cc1fc01d87a94d2fa2ca9503030e58ca5 Mon Sep 17 00:00:00 2001 From: argirok Date: Tue, 14 May 2024 14:51:37 +0300 Subject: [PATCH 16/24] [pluginsFunctionality | DONE | CHANGED] use display title & short title --- src/app/app.component.ts | 6 +++--- .../browse-community.component.html | 14 +++++++------- src/app/community/community.component.ts | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d43724e..d1143c4 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -78,7 +78,7 @@ import {Meta} from "@angular/platform-browser";
@@ -116,7 +116,7 @@ import {Meta} from "@angular/platform-browser"; [contactForm]="contactForm" [sending]="sending">
` @@ -381,7 +381,7 @@ export class AppComponent implements OnInit, OnDestroy { this.header = { // url: 'https://' + (this.properties.environment == 'beta' ? 'beta.' : '') + this.community.id + '.openaire.eu', route: "/", - title: (this.community.shortTitle) ? this.community.shortTitle : this.community.title, + title: (this.community.displayShortTitle) ? this.community.displayShortTitle : this.community.displayTitle, logoUrl: (this.community.isUpload) ? (properties.utilsService + '/download/' + this.community.logoUrl) : (StringUtils.urlPrefix(this.community.logoUrl) + this.community.logoUrl), logoSmallUrl: (this.community.isUpload) ? (properties.utilsService + '/download/' + this.community.logoUrl) : (StringUtils.urlPrefix(this.community.logoUrl) + this.community.logoUrl), position: 'left', diff --git a/src/app/communities/browseCommunity/browse-community.component.html b/src/app/communities/browseCommunity/browse-community.component.html index 414d5ae..04a324e 100644 --- a/src/app/communities/browseCommunity/browse-community.component.html +++ b/src/app/communities/browseCommunity/browse-community.component.html @@ -26,18 +26,18 @@ uk-padding-small uk-padding-remove-vertical uk-margin-top uk-margin-bottom">
{{(community.title)?community.title:community.shortTitle}} logo + alt="{{(community.displayTitle)?community.displayTitle:community.displayShortTitle}} logo" class="uk-height-max-xsmall">
diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 71ab4bd..5a78174 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -88,9 +88,9 @@ export class CommunityComponent { this._meta.updateTag({content: community.description}, "name='description'"); this._meta.updateTag({content: community.description}, "property='og:description'"); - this._meta.updateTag({content: community.title}, "property='og:title'"); - this._title.setTitle(community.title); - this.subscriptions.push(this._piwikService.trackView(this.properties, community.title).subscribe()); + this._meta.updateTag({content: community.displayTitle}, "property='og:title'"); + this._title.setTitle(community.displayTitle); + this.subscriptions.push(this._piwikService.trackView(this.properties, community.displayTitle).subscribe()); this.getPagePlugins(); } From a56e91b7ec0e9ec103dce13a7786ae06f0c1cddb Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 17 May 2024 10:04:58 +0300 Subject: [PATCH 17/24] [pluginsFunctionality | DONE | CHANGED] Deposit: add Suggested repos component and links --- src/app/app-routing.module.ts | 5 + src/app/deposit/deposit.component.ts | 14 +- src/app/deposit/deposit.module.ts | 3 +- .../searchDataprovidersToDeposit.component.ts | 14 +- .../searchDataprovidersToDeposit.module.ts | 3 +- .../suggestedRepositories-routing.module.ts | 16 ++ .../suggestedRepositories.component.html | 78 ++++++ .../suggestedRepositories.component.ts | 141 ++++++++++ .../suggested/suggestedRepositories.module.ts | 38 +++ .../zenodo/shareInZenodo.component.html | 254 +++++++++--------- .../deposit/zenodo/shareInZenodo.module.ts | 3 +- 11 files changed, 440 insertions(+), 129 deletions(-) create mode 100644 src/app/deposit/suggested/suggestedRepositories-routing.module.ts create mode 100644 src/app/deposit/suggested/suggestedRepositories.component.html create mode 100644 src/app/deposit/suggested/suggestedRepositories.component.ts create mode 100644 src/app/deposit/suggested/suggestedRepositories.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 56ec1ae..20c94d9 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -279,6 +279,11 @@ const routes: Routes = [ loadChildren: () => import('./deposit/zenodo/shareInZenodo.module').then(m => m.ShareInZenodoModule), data: {hasQuickContact: false}, canActivate: [CommunityAccessGuard] }, + { + path: 'participate/deposit/suggested', + loadChildren: () => import('./deposit/suggested/suggestedRepositories.module').then(m => m.SuggestedRepositoriesModule), + data: {hasQuickContact: false}, canActivate: [CommunityAccessGuard] + }, /** Linking Pages */ { path: 'myclaims', loadChildren: () => import('./claims/myClaims/myClaims.module').then(m => m.LibMyClaimsModule), diff --git a/src/app/deposit/deposit.component.ts b/src/app/deposit/deposit.component.ts index 1939465..ed0ee19 100644 --- a/src/app/deposit/deposit.component.ts +++ b/src/app/deposit/deposit.component.ts @@ -8,6 +8,7 @@ import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommuni import {CommunityService} from "../openaireLibrary/connect/community/community.service"; import {Subscriber, Subscription} from "rxjs"; import {properties} from "../../environments/environment"; +import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service"; @Component({ selector: 'openaire-deposit', @@ -30,7 +31,8 @@ export class OpenaireDepositComponent { constructor(private route: ActivatedRoute, private _zenodoCommunitieService: ZenodoCommunitiesService, - private _communityService: CommunityService) { + private _communityService: CommunityService, + private searchCommunityDataprovidersService: SearchCommunityDataprovidersService) { this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService); } @@ -46,6 +48,16 @@ export class OpenaireDepositComponent { this.zenodoInformation.url = this.properties.zenodo; this.zenodoInformation.name = "Zenodo"; } + this.subs.push(this.searchCommunityDataprovidersService.searchDataproviders(this.properties, this.communityId, true).subscribe( + res => { + if(res && res.length > 0){ + this.zenodoInformation.hasSuggestedRepositories = true; + } + }, + error => { + console.log(error); + } + )); } })); if (!this.zenodoInformation.shareInZenodoUrl) { diff --git a/src/app/deposit/deposit.module.ts b/src/app/deposit/deposit.module.ts index 7ff01ee..377504a 100644 --- a/src/app/deposit/deposit.module.ts +++ b/src/app/deposit/deposit.module.ts @@ -9,6 +9,7 @@ import {DepositRoutingModule} from "./deposit-routing.module"; import {DepositFirstPageModule} from "../openaireLibrary/deposit/depositFirstPage.module"; import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service"; +import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service"; @NgModule({ imports: [ @@ -21,7 +22,7 @@ import {ZenodoCommunitiesService} from "../openaireLibrary/connect/zenodoCommuni exports: [ OpenaireDepositComponent, ], - providers: [PreviousRouteRecorder, IsRouteEnabled, + providers: [PreviousRouteRecorder, IsRouteEnabled, SearchCommunityDataprovidersService, ZenodoCommunitiesService] }) export class LibDepositModule { } diff --git a/src/app/deposit/searchDataprovidersToDeposit.component.ts b/src/app/deposit/searchDataprovidersToDeposit.component.ts index e7ccca5..54afdf9 100644 --- a/src/app/deposit/searchDataprovidersToDeposit.component.ts +++ b/src/app/deposit/searchDataprovidersToDeposit.component.ts @@ -9,6 +9,7 @@ import {ZenodoInformationClass} from '../openaireLibrary/deposit/utils/zenodoInf import {FetchZenodoInformation} from './utils/fetchZenodoInformation.class'; import {Subscriber, Subscription} from "rxjs"; import {properties} from "../../environments/environment"; +import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service"; @Component({ selector: 'openaire-search-deposit', @@ -28,7 +29,8 @@ export class OpenaireSearchDataprovidersToDepositComponent { constructor(private route: ActivatedRoute, private _zenodoCommunitieService: ZenodoCommunitiesService, - private _communityService: CommunityService) { + private _communityService: CommunityService, + private searchCommunityDataprovidersService: SearchCommunityDataprovidersService) { this.fetchZenodoInformation = new FetchZenodoInformation(this._zenodoCommunitieService); } @@ -44,6 +46,16 @@ export class OpenaireSearchDataprovidersToDepositComponent { this.zenodoInformation.url = this.properties.zenodo; this.zenodoInformation.name = "Zenodo"; } + this.subs.push(this.searchCommunityDataprovidersService.searchDataproviders(this.properties, this.communityId, true).subscribe( + res => { + if(res && res.length > 0){ + this.zenodoInformation.hasSuggestedRepositories = true; + } + }, + error => { + console.log(error); + } + )); } } )); diff --git a/src/app/deposit/searchDataprovidersToDeposit.module.ts b/src/app/deposit/searchDataprovidersToDeposit.module.ts index 3dcecba..04d0ecf 100644 --- a/src/app/deposit/searchDataprovidersToDeposit.module.ts +++ b/src/app/deposit/searchDataprovidersToDeposit.module.ts @@ -9,6 +9,7 @@ import {SearchDataprovidersToDepositModule} from '../openaireLibrary/deposit/sea import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {IsRouteEnabled} from '../openaireLibrary/error/isRouteEnabled.guard'; import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; +import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service"; @NgModule({ imports: [ @@ -23,6 +24,6 @@ import {ZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoC exports: [ OpenaireSearchDataprovidersToDepositComponent, ], - providers: [PreviousRouteRecorder, IsRouteEnabled] + providers: [PreviousRouteRecorder, IsRouteEnabled, SearchCommunityDataprovidersService] }) export class LibSearchDataprovidersToDepositModule { } diff --git a/src/app/deposit/suggested/suggestedRepositories-routing.module.ts b/src/app/deposit/suggested/suggestedRepositories-routing.module.ts new file mode 100644 index 0000000..4f8e43e --- /dev/null +++ b/src/app/deposit/suggested/suggestedRepositories-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {IsRouteEnabled} from "../../openaireLibrary/error/isRouteEnabled.guard"; +import {SuggestedRepositoriesComponent} from "./suggestedRepositories.component"; + +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: SuggestedRepositoriesComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder] } + + ]) + ] +}) +export class SuggestedRepositoriesRoutingModule { } diff --git a/src/app/deposit/suggested/suggestedRepositories.component.html b/src/app/deposit/suggested/suggestedRepositories.component.html new file mode 100644 index 0000000..6f36aa4 --- /dev/null +++ b/src/app/deposit/suggested/suggestedRepositories.component.html @@ -0,0 +1,78 @@ + +
+
+ +
+
+
+ +
+
+

Repositories suggested by the curators.

+ +
+ + + +
+ +
+ +
+
+ {{item.name}} +
+
+
+ + +
+
+
+
+
+
+ +
diff --git a/src/app/deposit/suggested/suggestedRepositories.component.ts b/src/app/deposit/suggested/suggestedRepositories.component.ts new file mode 100644 index 0000000..8da7f59 --- /dev/null +++ b/src/app/deposit/suggested/suggestedRepositories.component.ts @@ -0,0 +1,141 @@ +import {Component} from '@angular/core'; +import {ActivatedRoute, Router} from '@angular/router'; +import {Meta, Title} from '@angular/platform-browser'; +import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; +import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service'; +import {CommunityService} from '../../openaireLibrary/connect/community/community.service'; +import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo'; +import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class'; +import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes'; +import {HelperService} from "../../openaireLibrary/utils/helper/helper.service"; +import {RouterHelper} from "../../openaireLibrary/utils/routerHelper.class"; +import {SEOService} from "../../openaireLibrary/sharedComponents/SEO/SEO.service"; +import {PiwikService} from "../../openaireLibrary/utils/piwik/piwik.service"; +import {Breadcrumb} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; +import {properties} from "../../../environments/environment"; +import {Subscriber, Subscription} from "rxjs"; +import {SearchCommunityDataprovidersService} from "../../openaireLibrary/connect/contentProviders/searchDataproviders.service"; + +@Component({ + selector: 'suggested-repositories', + templateUrl: './suggestedRepositories.component.html' +}) +export class SuggestedRepositoriesComponent { + public url: string = null; + public title: string = "Suggested Repositories"; + properties: EnvProperties = properties; + communityId: string = null; + community: CommunityInfo = null; + public pageContents = null; + public divContents = null; + + + // public warningMessage = ""; + // public infoMessage = ""; + + masterZenodoCommunityId = null; + masterZenodoCommunity = null; + + communityIds = null; + communities = []; + page = 1; + size = 5; + zenodoCommunitiesLoadedCount = 0; + zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass(); + errorCodes: ErrorCodes = new ErrorCodes(); + depositLink = "https://zenodo.org/deposit/new?c="; + depositLearnHowPage: string = null; + public routerHelper: RouterHelper = new RouterHelper(); + breadcrumbs: Breadcrumb[] = []; + + subs: Subscription[] = []; + contentProviders; + + constructor(private route: ActivatedRoute, + private _router: Router, + private _meta: Meta, + private _title: Title, + private _zenodoCommunitieService: ZenodoCommunitiesService, + private _communityService: CommunityService, + private searchCommunityDataprovidersService: SearchCommunityDataprovidersService, + private helper: HelperService, + private _piwikService: PiwikService, + private seoService: SEOService) { + } + + public ngOnInit() { + this.zenodoSearchUtils.status = this.errorCodes.LOADING; + this.url = properties.domain + properties.baseLink + this._router.url; + this.seoService.createLinkForCanonicalURL(this.url, false); + this.updateUrl(this.url); + this.updateTitle(this.title); + this.updateDescription("sugested repositories, deposit"); + this.depositLearnHowPage = this.properties.depositLearnHowPage; + this.breadcrumbs.push({name: 'home', route: '/'}, { + name: "Deposit", + route: this.depositLearnHowPage + }, {name: "Suggested Repositories", route: null}); + //this.getDivContents(); + this.getPageContents(); + this.subs.push(this._communityService.getCommunityAsObservable().subscribe( + community => { + if (community) { + this.communityId = community.communityId; + this.subs.push(this._piwikService.trackView(this.properties, this.title).subscribe()); + this.community = community; + this.masterZenodoCommunityId = this.community.zenodoCommunity; + this.subs.push(this.searchCommunityDataprovidersService.searchDataproviders(this.properties, this.community.communityId, true).subscribe( + res => { + this.contentProviders = res; + this.zenodoSearchUtils.status = this.contentProviders && this.contentProviders.length > 0 ? this.errorCodes.DONE: this.errorCodes.NONE; + }, + error => { + console.log(error); + } + )); + + } + })); + + } + + public ngOnDestroy() { + for (let sub of this.subs) { + if (sub instanceof Subscriber) { + sub.unsubscribe(); + } + } + } + + private updateDescription(description: string) { + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + } + + private updateTitle(title: string) { + var _title = ((title.length > 50) ? title.substring(0, 50) : title); + this._title.setTitle(_title); + this._meta.updateTag({content: _title}, "property='og:title'"); + } + + private updateUrl(url: string) { + this._meta.updateTag({content: url}, "property='og:url'"); + } + + private getPageContents() { + this.subs.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { + this.pageContents = contents; + })); + } + + private getDivContents() { + this.subs.push(this.helper.getDivHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { + this.divContents = contents; + })); + } + + private handleError(message: string, error) { + console.error("Share in Zenodo Page: " + message, error); + } + +} diff --git a/src/app/deposit/suggested/suggestedRepositories.module.ts b/src/app/deposit/suggested/suggestedRepositories.module.ts new file mode 100644 index 0000000..db382e0 --- /dev/null +++ b/src/app/deposit/suggested/suggestedRepositories.module.ts @@ -0,0 +1,38 @@ +import { NgModule} from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import {PreviousRouteRecorder} from '../../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +import {IsRouteEnabled} from '../../openaireLibrary/error/isRouteEnabled.guard' + +import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module'; + +import {RouterModule} from "@angular/router"; +import {HelperModule} from "../../openaireLibrary/utils/helper/helper.module"; +import {PiwikServiceModule} from "../../openaireLibrary/utils/piwik/piwikService.module"; +import {Schema2jsonldModule} from "../../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; +import {SEOServiceModule} from "../../openaireLibrary/sharedComponents/SEO/SEOService.module"; +import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; +import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-load-paging.module"; +import {IconsModule} from 'src/app/openaireLibrary/utils/icons/icons.module'; +import {LoadingModule} from 'src/app/openaireLibrary/utils/loading/loading.module'; +import {SuggestedRepositoriesRoutingModule} from "./suggestedRepositories-routing.module"; +import {SuggestedRepositoriesComponent} from "./suggestedRepositories.component"; +import {SearchCommunityDataprovidersService} from "../../openaireLibrary/connect/contentProviders/searchDataproviders.service"; + +@NgModule({ + imports: [ + CommonModule, SuggestedRepositoriesRoutingModule, ZenodoCommunitiesServiceModule, + RouterModule, HelperModule, LoadingModule, + PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule + ], + declarations: [ + SuggestedRepositoriesComponent + ], + providers:[PreviousRouteRecorder, IsRouteEnabled, SearchCommunityDataprovidersService], + exports: [ + SuggestedRepositoriesComponent + ] +}) + + +export class SuggestedRepositoriesModule {} diff --git a/src/app/deposit/zenodo/shareInZenodo.component.html b/src/app/deposit/zenodo/shareInZenodo.component.html index 4bcd642..1855f6d 100644 --- a/src/app/deposit/zenodo/shareInZenodo.component.html +++ b/src/app/deposit/zenodo/shareInZenodo.component.html @@ -1,150 +1,156 @@
- +
- -
-

Deposit your research in Zenodo.

-
-
Main Zenodo community
-
-
-
-
-
-
- - - -
-
-

- - {{masterZenodoCommunity.title}} - [no name available] - - + +
+
+
+

Deposit your research in Zenodo.

+
+
Main Zenodo community
+
+
+
+
+ + + +
+
+

+ + {{masterZenodoCommunity.title}} + [no name available] + + {{masterZenodoCommunity.title}} [no name available] -

-
- Last update: {{masterZenodoCommunity.date | date:'yyyy/MM/dd'}} -
-
-
-
-

-
-
+

+
+ Last update: {{masterZenodoCommunity.date | date:'yyyy/MM/dd'}} +
+
+
+
+

+
+ -
-
-
- -
-
- - -
-
Other related Zenodo communities
-
Related Zenodo communities
- - - -
- -
-
-
-
-
- - - -
-
-

- - {{communities[this.communityIds[i]].title}} - [no name available] - -

-
- Last update: {{communities[this.communityIds[i]].date | date:'yyyy/MM/dd'}} -
-
-
-
-

-
-
+
+
+
+
+
+ +
+ + +
+
Other related Zenodo communities
+
Related Zenodo communities
+ + + -
-
- +
+
+
+
+ +
+
+
+
diff --git a/src/app/deposit/zenodo/shareInZenodo.module.ts b/src/app/deposit/zenodo/shareInZenodo.module.ts index 12e2201..a657ddb 100644 --- a/src/app/deposit/zenodo/shareInZenodo.module.ts +++ b/src/app/deposit/zenodo/shareInZenodo.module.ts @@ -17,6 +17,7 @@ import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcr import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-load-paging.module"; import {IconsModule} from 'src/app/openaireLibrary/utils/icons/icons.module'; import {LoadingModule} from 'src/app/openaireLibrary/utils/loading/loading.module'; +import {SearchCommunityDataprovidersService} from "../../openaireLibrary/connect/contentProviders/searchDataproviders.service"; @NgModule({ imports: [ @@ -27,7 +28,7 @@ import {LoadingModule} from 'src/app/openaireLibrary/utils/loading/loading.modul declarations: [ ShareInZenodoComponent ], - providers:[PreviousRouteRecorder, IsRouteEnabled], + providers:[PreviousRouteRecorder, IsRouteEnabled, SearchCommunityDataprovidersService], exports: [ ShareInZenodoComponent ] From 04151f5d0bd1526b4088e07a2df8edf6b565b56e Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 30 May 2024 14:51:01 +0300 Subject: [PATCH 18/24] Update library --- src/app/openaireLibrary | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index ead1c8f..04a3916 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit ead1c8f903e414e7951b78d3e2366ab5d90d9ca0 +Subproject commit 04a3916389fd24705b64242dbee69473e044c14b From f769567a7e63bb99405220da5c143464d0477082 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 10 Jun 2024 09:08:32 +0300 Subject: [PATCH 19/24] [pluginsFunctionality | DONE | CHANGED] Deposit add page-enabled check to show links only if page is enabled, updates on the list of zenodo communities that contains master --- .../suggested/suggestedRepositories.component.html | 8 ++++---- src/app/deposit/suggested/suggestedRepositories.module.ts | 3 ++- src/app/deposit/zenodo/shareInZenodo.component.html | 5 +++-- src/app/deposit/zenodo/shareInZenodo.component.ts | 7 +++++-- src/app/deposit/zenodo/shareInZenodo.module.ts | 3 ++- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/app/deposit/suggested/suggestedRepositories.component.html b/src/app/deposit/suggested/suggestedRepositories.component.html index 6f36aa4..7b96e40 100644 --- a/src/app/deposit/suggested/suggestedRepositories.component.html +++ b/src/app/deposit/suggested/suggestedRepositories.component.html @@ -11,22 +11,22 @@

Repositories suggested by the curators.

-
+
Zenodo logo - -
+
OpenAIRE logo diff --git a/src/app/deposit/suggested/suggestedRepositories.module.ts b/src/app/deposit/suggested/suggestedRepositories.module.ts index db382e0..01022e9 100644 --- a/src/app/deposit/suggested/suggestedRepositories.module.ts +++ b/src/app/deposit/suggested/suggestedRepositories.module.ts @@ -18,12 +18,13 @@ import {LoadingModule} from 'src/app/openaireLibrary/utils/loading/loading.modul import {SuggestedRepositoriesRoutingModule} from "./suggestedRepositories-routing.module"; import {SuggestedRepositoriesComponent} from "./suggestedRepositories.component"; import {SearchCommunityDataprovidersService} from "../../openaireLibrary/connect/contentProviders/searchDataproviders.service"; +import {IsPageEnabledModule} from "../../openaireLibrary/utils/isPageEnabled/isPageEnabled.module"; @NgModule({ imports: [ CommonModule, SuggestedRepositoriesRoutingModule, ZenodoCommunitiesServiceModule, RouterModule, HelperModule, LoadingModule, - PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule + PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule, IsPageEnabledModule ], declarations: [ SuggestedRepositoriesComponent diff --git a/src/app/deposit/zenodo/shareInZenodo.component.html b/src/app/deposit/zenodo/shareInZenodo.component.html index 1855f6d..7ad81e5 100644 --- a/src/app/deposit/zenodo/shareInZenodo.component.html +++ b/src/app/deposit/zenodo/shareInZenodo.component.html @@ -61,7 +61,8 @@
-
+ -
+
OpenAIRE logo { this.handleError("Error getting Master Zenodo community with id: " + this.masterZenodoCommunityId, error); - + } )); } this.zenodoSearchUtils.status = this.errorCodes.LOADING; this.communityIds = this.community.otherZenodoCommunities; + if(this.communityIds && this.masterZenodoCommunityId && this.communityIds.indexOf(this.masterZenodoCommunityId) !=-1){ + this.communityIds.splice(this.communityIds.indexOf(this.masterZenodoCommunityId), 1) + } this.zenodoSearchUtils.totalResults = this.communityIds.length; if (this.communityIds.length == 0) { this.zenodoSearchUtils.status = this.errorCodes.NONE; diff --git a/src/app/deposit/zenodo/shareInZenodo.module.ts b/src/app/deposit/zenodo/shareInZenodo.module.ts index a657ddb..a2350da 100644 --- a/src/app/deposit/zenodo/shareInZenodo.module.ts +++ b/src/app/deposit/zenodo/shareInZenodo.module.ts @@ -18,12 +18,13 @@ import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-loa import {IconsModule} from 'src/app/openaireLibrary/utils/icons/icons.module'; import {LoadingModule} from 'src/app/openaireLibrary/utils/loading/loading.module'; import {SearchCommunityDataprovidersService} from "../../openaireLibrary/connect/contentProviders/searchDataproviders.service"; +import {IsPageEnabledModule} from "../../openaireLibrary/utils/isPageEnabled/isPageEnabled.module"; @NgModule({ imports: [ CommonModule, ShareInZenodoRoutingModule, ZenodoCommunitiesServiceModule, RouterModule, HelperModule, LoadingModule, - PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule + PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging, IconsModule, IsPageEnabledModule ], declarations: [ ShareInZenodoComponent From 44e3e7f4bd8ec0bd4655c5b70071614221cf3b10 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 10 Jun 2024 09:09:23 +0300 Subject: [PATCH 20/24] [pluginsFunctionality | DONE | CHANGED] zenodo community code, imports cleanup --- src/app/community/community.component.ts | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 5a78174..2571478 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -1,29 +1,17 @@ -import {ChangeDetectorRef, Component, ElementRef, Inject, Input, Renderer2, ViewChild} from '@angular/core'; +import {Component, ElementRef, Input} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; -import {DOCUMENT, Location} from '@angular/common'; +import {Location} from '@angular/common'; import {Meta, Title} from '@angular/platform-browser'; import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; import {CommunityService} from "../openaireLibrary/connect/community/community.service"; import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service'; import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; -import {ZenodoCommunitiesService} from '../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service'; -import {Session, User} from '../openaireLibrary/login/utils/helper.class'; -import {StatisticsForDashboardComponent} from '../statistics/statistics.component'; -import {StringUtils} from '../openaireLibrary/utils/string-utils.class'; -import {SearchCommunityDataprovidersService} from "../openaireLibrary/connect/contentProviders/searchDataproviders.service"; -import {SearchCommunityProjectsService} from "../openaireLibrary/connect/projects/searchProjects.service"; -import {SearchResearchResultsService} from "../openaireLibrary/services/searchResearchResults.service"; -import {RouterHelper} from "../openaireLibrary/utils/routerHelper.class"; +import {User} from '../openaireLibrary/login/utils/helper.class'; import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; import {UserManagementService} from "../openaireLibrary/services/user-management.service"; -import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; -import {FetchResearchResults} from "../openaireLibrary/utils/fetchEntitiesClasses/fetchResearchResults.class"; -import {ErrorCodes} from "../openaireLibrary/utils/properties/errorCodes"; import {Subscription} from "rxjs"; import {properties} from "../../environments/environment"; import {ConnectHelper} from "../openaireLibrary/connect/connectHelper"; -import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class"; -import {OpenaireEntities} from '../openaireLibrary/utils/properties/searchFields'; import {PluginsService} from "../openaireLibrary/services/plugins.service"; import {PluginTemplate} from "../openaireLibrary/utils/entities/adminTool/pluginTemplate"; import {Plugin} from "../openaireLibrary/utils/entities/adminTool/plugin"; From 8d54218dbbcbe6e193e512478e8d7644d20cc514 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 10 Jun 2024 09:09:48 +0300 Subject: [PATCH 21/24] [pluginsFunctionality | DONE | CHANGED] add required header --- server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.ts b/server.ts index 85915cf..7087769 100644 --- a/server.ts +++ b/server.ts @@ -132,7 +132,7 @@ export function app() { res.header('X-FRAME-OPTIONS', 'allow from ' +req.headers.referer); res.header('Access-Control-Allow-Origin',req.headers.origin); res.header('Access-Control-Allow-Methods', 'GET, HEAD, OPTIONS'); - res.header('Access-Control-Allow-Headers', 'Cache-control, Expires, Pragma'); + res.header('Access-Control-Allow-Headers', 'Cache-control, Expires, Content-Type, Pragma'); res.header('Allow', 'GET, HEAD, OPTIONS'); } else { From a5e43c4bf94640c2138d6d96bf0b9e16d2ea6651 Mon Sep 17 00:00:00 2001 From: argirok Date: Tue, 11 Jun 2024 12:18:46 +0300 Subject: [PATCH 22/24] [pluginsFunctionality | DONE | FIXED] allow multiple custom plugins --- src/app/community/community.component.ts | 36 ++++++++++++++++++------ 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts index 2571478..e064a84 100644 --- a/src/app/community/community.component.ts +++ b/src/app/community/community.component.ts @@ -102,18 +102,36 @@ export class CommunityComponent { let self = this; this.pluginTemplates.forEach(_ => { let plugin:Plugin = null; - for(let pl of plugins){ - if (pl.templateId == _._id){ - plugin = pl; + if(!_.custom) { + for (let pl of plugins) { + if (pl.templateId == _._id) { + plugin = pl; + } + } + if (!plugin) { + plugin = new Plugin("", "", _); + this.plugins.push(plugin); + } + plugin.object = PluginUtils.initializeObjectAndCompare(_.code, plugin.object) + this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _}); + } + }); + //add custom plugins in the list + this.plugins.forEach(_ => { + + if(_.custom == true){ + let customTemplate = null; + this.pluginTemplates.forEach(template => { + if (_.templateId == template._id) { + customTemplate = template; + } + }); + if(customTemplate && customTemplate.custom){ + this.pluginsByPlacement.get(customTemplate.placement).push({plugin: _, template: customTemplate}); } } - if(!plugin){ - plugin = new Plugin("", "",_); - this.plugins.push(plugin); - } - plugin.object = PluginUtils.initializeObjectAndCompare(_.code,plugin.object) - this.pluginsByPlacement.get(plugin.placement).push({plugin: plugin, template: _ }); }); + for(let placement of this.pluginUtils.placementsOptions){ this.pluginsByPlacement.get(placement.value).sort(function (a, b) { return a.plugin.order - b.plugin.order; From 6615e279417a00dbd0915d06d5ffca06a4fcfc0f Mon Sep 17 00:00:00 2001 From: argirok Date: Tue, 11 Jun 2024 14:12:59 +0300 Subject: [PATCH 23/24] [pluginsFunctionality | DONE | CHANGED] add link to name, comment out repository link --- .../deposit/suggested/suggestedRepositories.component.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/deposit/suggested/suggestedRepositories.component.html b/src/app/deposit/suggested/suggestedRepositories.component.html index 7b96e40..d36d811 100644 --- a/src/app/deposit/suggested/suggestedRepositories.component.html +++ b/src/app/deposit/suggested/suggestedRepositories.component.html @@ -54,19 +54,20 @@
From e311db3d7715c18692bdaf123a9f375f2e71defa Mon Sep 17 00:00:00 2001 From: argirok Date: Thu, 13 Jun 2024 09:30:46 +0300 Subject: [PATCH 24/24] [pluginsFunctionality | DONE | CHANGED] Show official name and if not available, show name --- src/app/deposit/suggested/suggestedRepositories.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/deposit/suggested/suggestedRepositories.component.html b/src/app/deposit/suggested/suggestedRepositories.component.html index d36d811..cff2db2 100644 --- a/src/app/deposit/suggested/suggestedRepositories.component.html +++ b/src/app/deposit/suggested/suggestedRepositories.component.html @@ -54,7 +54,7 @@