From e4a9f8be64abd374224077f677495aa7b0d98e8a Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Thu, 31 Mar 2022 14:57:13 +0300 Subject: [PATCH] finish SDGs component functionallity and styles and start on FOS component --- explore/src/app/app-routing.module.ts | 1 + explore/src/app/fos/fos-routing.module.ts | 13 +++++ explore/src/app/fos/fos.component.css | 0 explore/src/app/fos/fos.component.html | 60 +++++++++++++++++++++++ explore/src/app/fos/fos.component.ts | 44 +++++++++++++++++ explore/src/app/fos/fos.module.ts | 28 +++++++++++ explore/src/app/openaireLibrary | 2 +- explore/src/app/sdg/sdg.component.html | 57 +++++++++++---------- explore/src/app/sdg/sdg.component.ts | 41 +++++++++++++--- explore/src/app/sdg/sdg.module.ts | 5 +- explore/src/assets/common-assets | 2 +- explore/src/assets/openaire-theme | 2 +- 12 files changed, 219 insertions(+), 36 deletions(-) create mode 100644 explore/src/app/fos/fos-routing.module.ts create mode 100644 explore/src/app/fos/fos.component.css create mode 100644 explore/src/app/fos/fos.component.html create mode 100644 explore/src/app/fos/fos.component.ts create mode 100644 explore/src/app/fos/fos.module.ts diff --git a/explore/src/app/app-routing.module.ts b/explore/src/app/app-routing.module.ts index 435ee50d..5d6dec08 100644 --- a/explore/src/app/app-routing.module.ts +++ b/explore/src/app/app-routing.module.ts @@ -10,6 +10,7 @@ const routes: Routes = [ {path: 'home', redirectTo: '', pathMatch: 'full'}, {path: 'mail-preferences', loadChildren: () => import('./userEmailPreferences/mailPrefs.module').then(m => m.LibMailPrefsModule)}, {path: 'sdg', loadChildren: () => import('./sdg/sdg.module').then(m => m.SdgModule)}, + {path: 'fos', loadChildren: () => import('./fos/fos.module').then(m => m.FosModule)}, // ORCID Pages {path: 'orcid', loadChildren: () => import('./orcid/orcid.module').then(m => m.LibOrcidModule)}, {path: 'my-orcid-links', loadChildren: () => import('./orcid/my-orcid-links/myOrcidLinks.module').then(m => m.LibMyOrcidLinksModule)}, diff --git a/explore/src/app/fos/fos-routing.module.ts b/explore/src/app/fos/fos-routing.module.ts new file mode 100644 index 00000000..b0bc5bf0 --- /dev/null +++ b/explore/src/app/fos/fos-routing.module.ts @@ -0,0 +1,13 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; + +import {FosComponent} from './fos.component'; +import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; +@NgModule({ + imports: [ + RouterModule.forChild([ + { path: '', component: FosComponent, canDeactivate: [PreviousRouteRecorder] } + ]) + ] +}) +export class FosRoutingModule { } diff --git a/explore/src/app/fos/fos.component.css b/explore/src/app/fos/fos.component.css new file mode 100644 index 00000000..e69de29b diff --git a/explore/src/app/fos/fos.component.html b/explore/src/app/fos/fos.component.html new file mode 100644 index 00000000..5c3c01dd --- /dev/null +++ b/explore/src/app/fos/fos.component.html @@ -0,0 +1,60 @@ + +
+
+ +
+
+
+
+
+

Fields of Science and Technology.

+
+ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. +
+
+ + + Learn More + + +
+
+
+ +
+
+
+
+
+
+ +
+
+
+
+ +
+
+

{{fos[index].id}}

+
+
+
+
+

{{child.id}}

+
+ {{subChild.id}} +
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/explore/src/app/fos/fos.component.ts b/explore/src/app/fos/fos.component.ts new file mode 100644 index 00000000..8bb4145c --- /dev/null +++ b/explore/src/app/fos/fos.component.ts @@ -0,0 +1,44 @@ +import {HttpClient} from "@angular/common/http"; +import {Component, OnDestroy, OnInit} from "@angular/core"; +import {Subscription} from "rxjs"; + +import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; +import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; +import {properties} from "src/environments/environment"; + +@Component({ + selector: 'fos', + templateUrl: 'fos.component.html', + styleUrls: ['fos.component.css'] +}) +export class FosComponent implements OnInit, OnDestroy { + + public fos: any = []; + public index: number = 0; + + properties: EnvProperties = properties; + public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'FOS'}]; + + subscriptions: Subscription[] = []; + + constructor( + private httpClient: HttpClient + ) {} + + ngOnInit() { + this.httpClient.get('/assets/vocabulary/fos.json').subscribe(data => { + this.fos = data['fos']; + }); + } + + public ngOnDestroy() { + for (let sub of this.subscriptions) { + sub.unsubscribe(); + } + } + + changeDisplayedFos(i) { + this.index = i; + // console.log(this.fos[this.index]); + } +} \ No newline at end of file diff --git a/explore/src/app/fos/fos.module.ts b/explore/src/app/fos/fos.module.ts new file mode 100644 index 00000000..55b9acef --- /dev/null +++ b/explore/src/app/fos/fos.module.ts @@ -0,0 +1,28 @@ +import {CommonModule} from "@angular/common"; +import {NgModule} from "@angular/core"; +import {FormsModule} from "@angular/forms"; +import {RouterModule} from "@angular/router"; +import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; +import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; + +import {FosRoutingModule} from './fos-routing.module'; +import {FosComponent} from './fos.component'; + +@NgModule({ + imports: [ + CommonModule, FormsModule, RouterModule, + FosRoutingModule, BreadcrumbsModule + ], + declarations: [ + FosComponent + ], + providers: [ + PreviousRouteRecorder + ], + exports: [ + FosComponent + ] +}) +export class FosModule { + +} \ No newline at end of file diff --git a/explore/src/app/openaireLibrary b/explore/src/app/openaireLibrary index d26f56e2..da6f220a 160000 --- a/explore/src/app/openaireLibrary +++ b/explore/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit d26f56e260a01fdcca40a5fa495c1f67f6b19b9b +Subproject commit da6f220ae077f8f62cb11a65b33d7091efea486f diff --git a/explore/src/app/sdg/sdg.component.html b/explore/src/app/sdg/sdg.component.html index 16304a84..b5980226 100644 --- a/explore/src/app/sdg/sdg.component.html +++ b/explore/src/app/sdg/sdg.component.html @@ -6,17 +6,19 @@
-
+

Lorem ipsum dolor sit amet, consetetur.

We have implemented the UN Sustainable Development Goals ( SDGs) as a
classification scheme covering areas of research associated with one or more SDGs
(the majority of the SDGs are interrelated). The scheme uses automated allocation
of the 17 SDGs and their associated targets and indicators to all fitting documents in
Dimensions thereby addressing research areas aligned to the goals.
- - - Learn More - - +
@@ -24,27 +26,32 @@
-
-
- -
-
- \ No newline at end of file diff --git a/explore/src/app/sdg/sdg.component.ts b/explore/src/app/sdg/sdg.component.ts index 6b74068b..51863c12 100644 --- a/explore/src/app/sdg/sdg.component.ts +++ b/explore/src/app/sdg/sdg.component.ts @@ -1,28 +1,55 @@ import {HttpClient} from "@angular/common/http"; -import {Component, OnInit} from "@angular/core"; +import {Component, OnDestroy, OnInit} from "@angular/core"; +import {Subscription} from "rxjs"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; +import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; +import {properties} from "src/environments/environment"; +import {RefineFieldResultsService} from "../openaireLibrary/services/refineFieldResults.service"; @Component({ selector: 'sdg', templateUrl: 'sdg.component.html', styleUrls: ['sdg.component.css'] }) -export class SdgComponent implements OnInit { +export class SdgComponent implements OnInit, OnDestroy { - public sdgs: any = []; + private sdgs: any = []; + private sdgsResearchOutcomes: any = []; + public displayedSdgs: any = []; + public loading: boolean; + properties: EnvProperties = properties; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'SDG'}]; + subscriptions: Subscription[] = []; + constructor( - private httpClient: HttpClient + private httpClient: HttpClient, private refineFieldResultsService: RefineFieldResultsService ) {} ngOnInit() { + this.loading = true; this.httpClient.get('/assets/vocabulary/sdg.json').subscribe(data => { - // console.log(data['sdg']); this.sdgs = data['sdg']; - console.log(this.sdgs); - }) + }); + this.refineFieldResultsService.getRefineFieldsResultsByEntityName(['sdg'], 'result', this.properties, null).subscribe(data => { + this.sdgsResearchOutcomes = data[1][0].values; + let merged =[]; + for(let i=0; i innerItem.id === this.sdgs[i].id)) + }); + } + this.displayedSdgs = merged; + this.loading = false; + }); } + + public ngOnDestroy() { + for (let sub of this.subscriptions) { + sub.unsubscribe(); + } + } } \ No newline at end of file diff --git a/explore/src/app/sdg/sdg.module.ts b/explore/src/app/sdg/sdg.module.ts index 330c5d85..560340a3 100644 --- a/explore/src/app/sdg/sdg.module.ts +++ b/explore/src/app/sdg/sdg.module.ts @@ -4,6 +4,8 @@ import {FormsModule} from "@angular/forms"; import {RouterModule} from "@angular/router"; import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard"; import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; +import {RefineFieldResultsServiceModule} from "../openaireLibrary/services/refineFieldResultsService.module"; +import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module"; import {SdgRoutingModule} from './sdg-routing.module'; import {SdgComponent} from './sdg.component'; @@ -11,7 +13,8 @@ import {SdgComponent} from './sdg.component'; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, - SdgRoutingModule, BreadcrumbsModule + SdgRoutingModule, BreadcrumbsModule, RefineFieldResultsServiceModule, + LoadingModule ], declarations: [ SdgComponent diff --git a/explore/src/assets/common-assets b/explore/src/assets/common-assets index 776ba071..bbad5016 160000 --- a/explore/src/assets/common-assets +++ b/explore/src/assets/common-assets @@ -1 +1 @@ -Subproject commit 776ba07197e4cf73e98890bd4213a32183ea19d2 +Subproject commit bbad5016c9a712348c5056c3b2709e4baaf27d69 diff --git a/explore/src/assets/openaire-theme b/explore/src/assets/openaire-theme index 3b700ea4..ca92c36b 160000 --- a/explore/src/assets/openaire-theme +++ b/explore/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit 3b700ea4c14ba05d1f8c2cf3ef3253623eda55f3 +Subproject commit ca92c36bad13d0be11514abf7786f1e476ae7f5e