From b62551e642e939ee56497332c985cdf912fed1cd Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Mon, 25 Jul 2022 15:13:18 +0300 Subject: [PATCH] add 'develop' menu entry and page, update submodules --- src/app/app-routing.module.ts | 4 + src/app/app.component.ts | 4 + src/app/develop/develop.component.ts | 120 +++++++++++++++++++++++++ src/app/develop/develop.module.ts | 22 +++++ src/app/subjects/subjects.component.ts | 2 - src/assets/common-assets | 2 +- 6 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 src/app/develop/develop.component.ts create mode 100644 src/app/develop/develop.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 7eed1f9..d101932 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -41,6 +41,10 @@ const routes: Routes = [ {path: 'curators', loadChildren: () => import('./curators/curators.module').then(m => m.CuratorsModule), canActivate: [IsCommunity]}, {path: 'subjects', loadChildren: () => import('./subjects/subjects.module').then(m => m.SubjectsModule), canActivate: [IsCommunity]}, {path: 'myCommunities', loadChildren: () => import('./my-communities/my-communities.module').then(m => m.MyCommunitiesModule)}, + { + path: 'develop', + loadChildren: () => import('./develop/develop.module').then(m => m.DevelopModule), canActivate: [IsCommunity] + }, /** Testing Page for help contents */ {path: 'helper-test', loadChildren: () => import('./helper-test/helper-test.module').then(m => m.HelperTestModule)}, /** Landing Pages */ diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2824b00..a8fd095 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -351,6 +351,10 @@ export class AppComponent implements OnInit, OnDestroy { new MenuItem("", "Projects and funding Opportunities", "", "/projects", false, [], ["/projects"], {}), ] }); + this.menuItems.push({ + rootItem: new MenuItem("develop", "Develop", "", "/develop", false, [], null, {}), + items: [] + }); if (this.isManager) { this.menuItems.push( { diff --git a/src/app/develop/develop.component.ts b/src/app/develop/develop.component.ts new file mode 100644 index 0000000..c41170b --- /dev/null +++ b/src/app/develop/develop.component.ts @@ -0,0 +1,120 @@ +import {Component, OnDestroy, OnInit} from "@angular/core"; +import {CommunityInfo} from "../openaireLibrary/connect/community/communityInfo"; +import {CommunityService} from "../openaireLibrary/connect/community/community.service"; +import {Subscription} from "rxjs"; +import {Meta, Title} from "@angular/platform-browser"; +import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; +import {properties} from "../../environments/environment"; +import {Router} from "@angular/router"; +import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; +import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; + +@Component({ + selector: 'develop', + template: ` +
+
+

Help developers
with OpenAIRE APIs.

+
+
+
+
+
+
+ +
+

For {{openaireEntities.RESULTS | lowercase}}

+
+ For {{openaireEntities.RESULTS | lowercase}} ({{openaireEntities.PUBLICATIONS | lowercase}}, {{openaireEntities.DATASETS | lowercase}}, {{openaireEntities.SOFTWARE | lowercase}} and {{openaireEntities.OTHER | lowercase}}) you can use the Selective Access APIs by adding the community parameter. +
+ + + Selective Access APIs + + +
+
+
+ APIs +
+
+
+
+
+
+
Request examples:
+
    +
  • + Access “{{openaireEntities.PUBLICATIONS}}”
    + GET + https://api.openaire.eu/search/publications?community={{community.communityId}} +
  • +
  • + Access “Open Access {{openaireEntities.PUBLICATIONS}}”
    + GET + http://api.openaire.eu/search/publications?community={{community.communityId}}&OA=true +
  • +
  • + Access “{{openaireEntities.DATASETS}}”
    + GET + https://api.openaire.eu/search/datasets?community={{community.communityId}} +
  • +
  • + Access “{{openaireEntities.SOFTWARE}}”
    + GET + https://api.openaire.eu/search/software?community={{community.communityId}} +
  • +
  • + Access “{{openaireEntities.OTHER}}”
    + GET + https://api.openaire.eu/search/other?community={{community.communityId}} +
  • +
+
+
+
+
+ ` +}) +export class DevelopComponent implements OnInit, OnDestroy { + + public community: CommunityInfo; + public openaireEntities = OpenaireEntities; + public properties: EnvProperties = properties; + + private subscriptions: any[] = []; + + constructor(private communityService: CommunityService, + private seoService: SEOService, + private _meta: Meta, + private _router: Router, + private _title: Title) { + } + + ngOnInit() { + this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => { + this.community = community; + if (this.community) { + /* Metadata */ + const url = properties.domain + properties.baseLink + this._router.url; + this.seoService.createLinkForCanonicalURL(url, false); + this._meta.updateTag({content: url}, "property='og:url'"); + const description = "Develop | " + this.community.shortTitle; + const title = "Develop | " + this.community.shortTitle; + this._meta.updateTag({content: description}, "name='description'"); + this._meta.updateTag({content: description}, "property='og:description'"); + this._meta.updateTag({content: title}, "property='og:title'"); + this._title.setTitle(title); + } + })); + } + + ngOnDestroy() { + this.subscriptions.forEach(subscription => { + if (subscription instanceof Subscription) { + subscription.unsubscribe(); + } + }); + } +} diff --git a/src/app/develop/develop.module.ts b/src/app/develop/develop.module.ts new file mode 100644 index 0000000..597018a --- /dev/null +++ b/src/app/develop/develop.module.ts @@ -0,0 +1,22 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {DevelopComponent} from "./develop.component"; +import {RouterModule} from "@angular/router"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {PageContentModule} from "../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module"; +import {IconsModule} from "../openaireLibrary/utils/icons/icons.module"; + +@NgModule({ + declarations: [DevelopComponent], + imports: [CommonModule, RouterModule.forChild([ + { + path: '', + component: DevelopComponent, + canDeactivate: [PreviousRouteRecorder] + }, + ]), PageContentModule, IconsModule], + exports: [DevelopComponent] +}) +export class DevelopModule { + +} diff --git a/src/app/subjects/subjects.component.ts b/src/app/subjects/subjects.component.ts index ba87365..eebbe7a 100644 --- a/src/app/subjects/subjects.component.ts +++ b/src/app/subjects/subjects.component.ts @@ -148,7 +148,6 @@ export class SubjectsComponent { //this.getDivContents(); this.getPageContents(); this.subjects = community.subjects; - console.log(this.subjects); this.subjects.sort((a,b) => { if(!a || a.toLocaleUpperCase() < b.toLocaleUpperCase()) { return -1; @@ -158,7 +157,6 @@ export class SubjectsComponent { return 0; }); this.groupSubjects(); - console.log(this.subjects); this.showLoading = false; } })); diff --git a/src/assets/common-assets b/src/assets/common-assets index f10d1dd..d689686 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit f10d1dd1350f2da69eecb3bb43880c0de4705399 +Subproject commit d689686aa89aadae1e58b315fe4aa8e720b320b5