add 'develop' menu entry and page, update submodules

This commit is contained in:
Alex Martzios 2022-07-25 15:13:18 +03:00
parent a8c28d91f4
commit b62551e642
6 changed files with 151 additions and 3 deletions

View File

@ -41,6 +41,10 @@ const routes: Routes = [
{path: 'curators', loadChildren: () => import('./curators/curators.module').then(m => m.CuratorsModule), canActivate: [IsCommunity]}, {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: '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: '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 */ /** Testing Page for help contents */
{path: 'helper-test', loadChildren: () => import('./helper-test/helper-test.module').then(m => m.HelperTestModule)}, {path: 'helper-test', loadChildren: () => import('./helper-test/helper-test.module').then(m => m.HelperTestModule)},
/** Landing Pages */ /** Landing Pages */

View File

@ -351,6 +351,10 @@ export class AppComponent implements OnInit, OnDestroy {
new MenuItem("", "Projects and funding Opportunities", "", "/projects", false, [], ["/projects"], {}), new MenuItem("", "Projects and funding Opportunities", "", "/projects", false, [], ["/projects"], {}),
] ]
}); });
this.menuItems.push({
rootItem: new MenuItem("develop", "Develop", "", "/develop", false, [], null, {}),
items: []
});
if (this.isManager) { if (this.isManager) {
this.menuItems.push( this.menuItems.push(
{ {

View File

@ -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: `
<div class="uk-section">
<div class="uk-container uk-container-large">
<h1>Help developers <br> with OpenAIRE APIs<span class="uk-text-primary">.</span></h1>
</div>
<div class="uk-section uk-container uk-container-large">
<div class="uk-grid uk-grid-large uk-child-width-1-2@m" uk-grid>
<div class="uk-text-center uk-margin-large-top">
<div class="uk-width-2-3@m uk-margin-auto@m">
<div class="uk-icon-bg-shadow uk-icon-bg-shadow-large uk-margin-auto">
<icon name="description" customClass="uk-text-background" [flex]="true" ratio="2.5" type="outlined" visuallyHidden="For {{openaireEntities.RESULTS}}"></icon>
</div>
<h3>For {{openaireEntities.RESULTS | lowercase}}</h3>
<div class="uk-margin-bottom">
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.
</div>
<a class="uk-display-inline-block uk-button uk-button-text"
href="https://graph.openaire.eu/develop/api.html" target="_blank">
<span class="uk-flex uk-flex-middle">
<span>Selective Access APIs</span>
</span>
</a>
</div>
</div>
<div class="uk-flex uk-flex-center">
<img src="assets/common-assets/apis.svg" alt="APIs" loading="lazy">
</div>
</div>
</div>
<div class="uk-section uk-container uk-container-large">
<div class="uk-width-1-2@m uk-margin-auto@m">
<div>
<div>Request examples:</div>
<ul class="uk-list uk-list-large uk-list-bullet uk-list-primary">
<li>
<span class="uk-text-bold">Access {{openaireEntities.PUBLICATIONS}}</span><br>
<span class="uk-text-bold uk-margin-small-right">GET</span>
<span class="">https://api.openaire.eu/search/publications?community={{community.communityId}}</span>
</li>
<li>
<span class="uk-text-bold">Access Open Access {{openaireEntities.PUBLICATIONS}}</span><br>
<span class="uk-text-bold uk-margin-small-right">GET</span>
<span class="uk-text-break">http://api.openaire.eu/search/publications?community={{community.communityId}}&OA=true</span>
</li>
<li>
<span class="uk-text-bold">Access {{openaireEntities.DATASETS}}</span><br>
<span class="uk-text-bold uk-margin-small-right">GET</span>
<span class="uk-text-break">https://api.openaire.eu/search/datasets?community={{community.communityId}}</span>
</li>
<li>
<span class="uk-text-bold">Access {{openaireEntities.SOFTWARE}}</span><br>
<span class="uk-text-bold uk-margin-small-right">GET</span>
<span class="uk-text-break">https://api.openaire.eu/search/software?community={{community.communityId}}</span>
</li>
<li>
<span class="uk-text-bold">Access {{openaireEntities.OTHER}}</span><br>
<span class="uk-text-bold uk-margin-small-right">GET</span>
<span class="uk-text-break">https://api.openaire.eu/search/other?community={{community.communityId}}</span>
</li>
</ul>
</div>
</div>
</div>
</div>
`
})
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();
}
});
}
}

View File

@ -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 {
}

View File

@ -148,7 +148,6 @@ export class SubjectsComponent {
//this.getDivContents(); //this.getDivContents();
this.getPageContents(); this.getPageContents();
this.subjects = community.subjects; this.subjects = community.subjects;
console.log(this.subjects);
this.subjects.sort((a,b) => { this.subjects.sort((a,b) => {
if(!a || a.toLocaleUpperCase() < b.toLocaleUpperCase()) { if(!a || a.toLocaleUpperCase() < b.toLocaleUpperCase()) {
return -1; return -1;
@ -158,7 +157,6 @@ export class SubjectsComponent {
return 0; return 0;
}); });
this.groupSubjects(); this.groupSubjects();
console.log(this.subjects);
this.showLoading = false; this.showLoading = false;
} }
})); }));

@ -1 +1 @@
Subproject commit f10d1dd1350f2da69eecb3bb43880c0de4705399 Subproject commit d689686aa89aadae1e58b315fe4aa8e720b320b5