Revision 57205
Added by Argiro Kokogiannaki over 4 years ago
modules/uoa-monitor-portal/trunk/monitor/webpack.server.config.js | ||
---|---|---|
1 |
// Work around for https://github.com/angular/angular-cli/issues/7200 |
|
2 |
|
|
3 |
const path = require('path'); |
|
4 |
const webpack = require('webpack'); |
|
5 |
|
|
6 |
module.exports = { |
|
7 |
//mode: 'none', |
|
8 |
entry: { |
|
9 |
// This is our Express server for Dynamic universal |
|
10 |
server: './server.ts', |
|
11 |
// This is an example of Static prerendering (generative) |
|
12 |
prerender: './prerender.ts' |
|
13 |
}, |
|
14 |
target: 'node', |
|
15 |
resolve: { extensions: ['.ts', '.js'] }, |
|
16 |
// Make sure we include all node_modules etc |
|
17 |
externals: [/(node_modules|main\..*\.js)/,], |
|
18 |
optimization: { |
|
19 |
minimize: false |
|
20 |
}, |
|
21 |
output: { |
|
22 |
// Puts the output at the root of the dist folder |
|
23 |
path: path.join(__dirname, 'dist'), |
|
24 |
filename: '[name].js' |
|
25 |
}, |
|
26 |
module: { |
|
27 |
rules: [ |
|
28 |
{ test: /\.ts$/, loader: 'ts-loader' } |
|
29 |
,{ |
|
30 |
// Mark files inside `@angular/core` as using SystemJS style dynamic imports. |
|
31 |
// Removing this will cause deprecation warnings to appear. |
|
32 |
test: /(\\|\/)@angular(\\|\/)core(\\|\/).+\.js$/, |
|
33 |
parser: { system: true }, |
|
34 |
}, |
|
35 |
] |
|
36 |
}, |
|
37 |
plugins: [ |
|
38 |
new webpack.ContextReplacementPlugin( |
|
39 |
// fixes WARNING Critical dependency: the request of a dependency is an expression |
|
40 |
/(.+)?angular(\\|\/)core(.+)?/, |
|
41 |
path.join(__dirname, 'src'), // location of your src |
|
42 |
{} // a map of your routes |
|
43 |
), |
|
44 |
new webpack.ContextReplacementPlugin( |
|
45 |
// fixes WARNING Critical dependency: the request of a dependency is an expression |
|
46 |
/(.+)?express(\\|\/)(.+)?/, |
|
47 |
path.join(__dirname, 'src'), |
|
48 |
{} |
|
49 |
) |
|
50 |
] |
|
51 |
} |
modules/uoa-monitor-portal/trunk/monitor/package.json | ||
---|---|---|
1 |
{ |
|
2 |
"name": "openaire-monitor", |
|
3 |
"version": "1.0.0", |
|
4 |
"license": "Openaire", |
|
5 |
"contributors": [ |
|
6 |
"Argiro Kokogiannaki <argirok@di.uoa.gr>", |
|
7 |
"Konstantina Galouni <kgalouni@di.uoa.gr>" |
|
8 |
], |
|
9 |
"scripts": { |
|
10 |
"ng": "ng", |
|
11 |
"start": " ng serve --disable-host-check --host 0.0.0.0", |
|
12 |
"start:ssr": "npm run build:ssr && npm run serve:ssr", |
|
13 |
"start:prerender": "npm run build:prerender && npm run serve:prerender", |
|
14 |
"build": "ng build", |
|
15 |
"build:client-and-server-bundles": "ng build --prod --sourceMap --stats-json=true && ng run ng-universal-demo:server:production", |
|
16 |
"build:prerender": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:prerender", |
|
17 |
"build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server", |
|
18 |
"generate:prerender": "cd dist && node prerender", |
|
19 |
"webpack:server": "webpack --config webpack.server.config.js --progress --colors", |
|
20 |
"serve:prerender": "cd dist/browser && http-server", |
|
21 |
"serve:ssr": "node dist/server" |
|
22 |
}, |
|
23 |
"private": true, |
|
24 |
"dependencies": { |
|
25 |
"@angular/animations": "^7.2.14", |
|
26 |
"@angular/cdk": "^7.3.7", |
|
27 |
"@angular/common": "7.2.14", |
|
28 |
"@angular/compiler": "7.2.14", |
|
29 |
"@angular/core": "7.2.14", |
|
30 |
"@angular/forms": "7.2.14", |
|
31 |
"@angular/http": "7.2.14", |
|
32 |
"@angular/material": "^7.3.7", |
|
33 |
"@angular/platform-browser": "7.2.14", |
|
34 |
"@angular/platform-browser-dynamic": "7.2.14", |
|
35 |
"@angular/platform-server": "7.2.14", |
|
36 |
"@angular/router": "7.2.14", |
|
37 |
"@nguniversal/express-engine": "^6.0.0", |
|
38 |
"@nguniversal/module-map-ngfactory-loader": "^6.0.0", |
|
39 |
"@types/express": "^4.16.1", |
|
40 |
"angular-datatables": "^4.4.1", |
|
41 |
"citation-js": "^0.3.4", |
|
42 |
"clipboard": "^1.5.16", |
|
43 |
"core-js": "^2.4.1", |
|
44 |
"datatables.net": "^1.10.19", |
|
45 |
"datatables.net-dt": "^1.10.19", |
|
46 |
"jquery": "^3.4.1", |
|
47 |
"ngx-json-ld": "0.1.6", |
|
48 |
"prom-client": "^11.3.0", |
|
49 |
"ts-md5": "^1.2.0", |
|
50 |
"tslib": "^1.9.0", |
|
51 |
"wikidata-sdk": "^5.2.9", |
|
52 |
"zone.js": "^0.8.26", |
|
53 |
"ng-recaptcha": "^3.0.5", |
|
54 |
"ng2-ckeditor": "1.1.9" |
|
55 |
}, |
|
56 |
"devDependencies": { |
|
57 |
"@angular-devkit/build-angular": "~0.13.0", |
|
58 |
"@angular/cli": "^7.3.9", |
|
59 |
"@angular/compiler-cli": "7.2.14", |
|
60 |
"@angular/language-service": "7.2.14", |
|
61 |
"@types/datatables.net": "^1.10.17", |
|
62 |
"@types/jquery": "^3.3.29", |
|
63 |
"@types/node": "^8.0.30", |
|
64 |
"cpy-cli": "^1.0.1", |
|
65 |
"http-server": "^0.10.0", |
|
66 |
"reflect-metadata": "^0.1.10", |
|
67 |
"rxjs": "6.5.1", |
|
68 |
"rxjs-compat": "^6.5.1", |
|
69 |
"ts-loader": "^4.2.0", |
|
70 |
"typescript": "3.2.4", |
|
71 |
"webpack-cli": "^3.3.2" |
|
72 |
} |
|
73 |
} |
modules/uoa-monitor-portal/trunk/monitor/tsconfig.json | ||
---|---|---|
1 |
{ |
|
2 |
"compileOnSave": false, |
|
3 |
"compilerOptions": { |
|
4 |
"importHelpers": true, |
|
5 |
"outDir": "./dist/out-tsc", |
|
6 |
"sourceMap": true, |
|
7 |
"declaration": false, |
|
8 |
"moduleResolution": "node", |
|
9 |
"emitDecoratorMetadata": true, |
|
10 |
"experimentalDecorators": true, |
|
11 |
"target": "es5", |
|
12 |
"typeRoots": [ |
|
13 |
"node_modules/@types" |
|
14 |
], |
|
15 |
"lib": [ |
|
16 |
"es2017", |
|
17 |
"dom" |
|
18 |
], |
|
19 |
"module": "es2015", |
|
20 |
"baseUrl": "./" |
|
21 |
} |
|
22 |
} |
modules/uoa-monitor-portal/trunk/monitor/src/app/home/home.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {CommonModule} from '@angular/common'; |
|
3 |
import {FormsModule} from '@angular/forms'; |
|
4 |
import {RouterModule} from '@angular/router'; |
|
5 |
import {ManageModule} from '../openaireLibrary/utils/manage/manage.module'; |
|
6 |
|
|
7 |
import {HomeComponent} from './home.component'; |
|
8 |
|
|
9 |
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; |
|
10 |
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; |
|
11 |
|
|
12 |
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; |
|
13 |
import {ErrorMessagesModule} from '../openaireLibrary/utils/errorMessages.module'; |
|
14 |
|
|
15 |
import {SearchFormModule} from '../openaireLibrary/searchPages/searchUtils/searchForm.module'; |
|
16 |
import {HelperModule} from "../openaireLibrary/utils/helper/helper.module"; |
|
17 |
import {GifSliderModule} from "../openaireLibrary/utils/gif-slider/gif-slider.module"; |
|
18 |
import {OtherPortalsModule} from "../openaireLibrary/sharedComponents/other-portals/other-portals.module"; |
|
19 |
import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; |
|
20 |
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module"; |
|
21 |
import {BrowseCommunityModule} from "../communities/browseCommunity/browse-community.module"; |
|
22 |
import {HomeRoutingModule} from "./home-routing.module"; |
|
23 |
|
|
24 |
@NgModule({ |
|
25 |
imports: [ |
|
26 |
CommonModule, FormsModule, RouterModule, |
|
27 |
ManageModule, ErrorMessagesModule, |
|
28 |
SearchFormModule, GifSliderModule, OtherPortalsModule, |
|
29 |
HelperModule, Schema2jsonldModule, SEOServiceModule, HomeRoutingModule, BrowseCommunityModule |
|
30 |
], |
|
31 |
declarations: [ |
|
32 |
HomeComponent |
|
33 |
], |
|
34 |
providers:[ |
|
35 |
FreeGuard, PreviousRouteRecorder, |
|
36 |
PiwikService |
|
37 |
], |
|
38 |
exports: [ |
|
39 |
HomeComponent |
|
40 |
] |
|
41 |
}) |
|
42 |
export class HomeModule { } |
modules/uoa-monitor-portal/trunk/monitor/src/app/home/home-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { RouterModule } from '@angular/router'; |
|
3 |
|
|
4 |
import{HomeComponent} from './home.component'; |
|
5 |
|
|
6 |
import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; |
|
7 |
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; |
|
8 |
|
|
9 |
@NgModule({ |
|
10 |
imports: [ |
|
11 |
RouterModule.forChild([ |
|
12 |
{ path: '', component: HomeComponent, canActivate: [FreeGuard], canDeactivate: [PreviousRouteRecorder] } |
|
13 |
|
|
14 |
]) |
|
15 |
] |
|
16 |
}) |
|
17 |
export class HomeRoutingModule { } |
modules/uoa-monitor-portal/trunk/monitor/src/app/home/home.component.html | ||
---|---|---|
1 |
<schema2jsonld [URL]="properties.baseLink" |
|
2 |
[logoURL]="properties.baseLink+'/assets/common-assets/logo-small-monitor.png'" type="home" |
|
3 |
name="OpenAIRE Monitor"> |
|
4 |
</schema2jsonld> |
|
5 |
<div |
|
6 |
class="image-front-topbar uk-margin-large-top" |
|
7 |
uk-scrollspy="{"target":"[uk-scrollspy-class]","cls":"uk-animation-fade","delay":false}" |
|
8 |
tm-header-transparent="light" tm-header-transparent-placeholder=""> |
|
9 |
<helper *ngIf="pageContents && pageContents['left'] && pageContents['left'].length > 0" |
|
10 |
[texts]="pageContents['left']"></helper> |
|
11 |
<!--<div style="background-image: url('assets/home/banner.jpg') !important;" |
|
12 |
class="uk-section uk-background-norepeat uk-background-bottom-center uk-background-cover uk-section-overlap uk-position-relative uk-preserve-color"> |
|
13 |
<div class=" uk-section uk-padding-remove-bottom"> |
|
14 |
<div class="uk-position-cover"></div> |
|
15 |
<div class="uk-position-relative uk-panel"> |
|
16 |
<div class="uk-container uk-container-large uk-section"> |
|
17 |
<div class="uk-grid"> |
|
18 |
<div class="uk-width-1-2@m uk-width-1-1@s"> |
|
19 |
<div class="uk-h1">Build an Open Research <b>Gateway</b> for your <b>Community</b></div> |
|
20 |
<h4 class="uk-margin-remove-top">Turn Open Science into practice</h4> |
|
21 |
<div class="uk-h5 uk-margin-top">Share and link your research results.<br> |
|
22 |
Across organizations, across borders.<br>Customized to your needs. |
|
23 |
</div> |
|
24 |
</div> |
|
25 |
<div class="uk-width-1-1 uk-inline uk-margin-medium-top uk-margin-medium-bottom"> |
|
26 |
<a class="uk-button portal-button" routerLink="/about/learn-how" routerLinkActive="router-link-active"> |
|
27 |
LEARN |
|
28 |
HOW</a> |
|
29 |
</div> |
|
30 |
</div> |
|
31 |
</div> |
|
32 |
</div> |
|
33 |
</div> |
|
34 |
</div>--> |
|
35 |
</div> |
|
36 |
<div> |
|
37 |
<helper *ngIf="pageContents && pageContents['top'] && pageContents['top'].length > 0" |
|
38 |
[texts]="pageContents['top']"></helper> |
|
39 |
<!--<div class="uk-container uk-container-large uk-margin-medium-top"> |
|
40 |
<div class="uk-text-center uk-text-bold uk-h4">Open and FAIR science is our mission</div> |
|
41 |
<div class="uk-margin-medium-top"> |
|
42 |
<div class="uk-child-width-1-3@m uk-child-width-1-1@s uk-grid-match uk-grid-medium uk-grid-margin" |
|
43 |
uk-height-match=".target" uk-grid> |
|
44 |
<div> |
|
45 |
<div class="uk-card uk-card-default uk-padding-small connectInfoCard"> |
|
46 |
<div class="uk-card-media-top uk-flex uk-flex-middle uk-flex-center"> |
|
47 |
<div class="target"> |
|
48 |
<img src="assets/connect-assets/home/1.png" width="100" height="89"> |
|
49 |
</div> |
|
50 |
</div> |
|
51 |
<div class="uk-card-body uk-padding-remove-horizontal uk-padding-remove-bottom"> |
|
52 |
<div class="target"> |
|
53 |
<h5 class="uk-text-bold uk-text-center">A Virtual Research Environment</h5> |
|
54 |
<div>An overlay platform making it easy to share, link, disseminate and monitor all your publications, |
|
55 |
data, software, methods. In one place. |
|
56 |
</div> |
|
57 |
</div> |
|
58 |
<hr> |
|
59 |
<div> |
|
60 |
<div class="uk-text-uppercase text-center">Features</div> |
|
61 |
<ul class="uk-list"> |
|
62 |
<li> |
|
63 |
<span |
|
64 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
65 |
uk-icon="check"> |
|
66 |
</span> |
|
67 |
Access to OpenAIRE resources |
|
68 |
</li> |
|
69 |
<li> |
|
70 |
<span |
|
71 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
72 |
uk-icon="check"> |
|
73 |
</span> |
|
74 |
Moderated, front-end linking |
|
75 |
</li> |
|
76 |
<li> |
|
77 |
<span |
|
78 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
79 |
uk-icon="check"> |
|
80 |
</span> |
|
81 |
Cross-platform search |
|
82 |
</li> |
|
83 |
</ul> |
|
84 |
</div> |
|
85 |
</div> |
|
86 |
</div> |
|
87 |
</div> |
|
88 |
<div> |
|
89 |
<div class="uk-card uk-card-default uk-padding-small connectInfoCard"> |
|
90 |
<div class="uk-card-media-top uk-flex uk-flex-middle uk-flex-center"> |
|
91 |
<div class="target"> |
|
92 |
<img src="assets/connect-assets/home/2.png" width="100" height="108"> |
|
93 |
</div> |
|
94 |
</div> |
|
95 |
<div class="uk-card-body uk-padding-remove-horizontal uk-padding-remove-bottom"> |
|
96 |
<div class="target"> |
|
97 |
<h5 class="uk-text-bold uk-text-center">Open Science in action</h5> |
|
98 |
<div>A time-saving bundle of services for researchers to effortlessly practice open science. An integral |
|
99 |
part of the European Open Science Cloud. |
|
100 |
</div> |
|
101 |
|
|
102 |
</div> |
|
103 |
<hr> |
|
104 |
<div> |
|
105 |
<div class="uk-text-uppercase text-center">Features</div> |
|
106 |
<ul class="uk-list"> |
|
107 |
<li> |
|
108 |
<span |
|
109 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
110 |
uk-icon="check"> |
|
111 |
</span> |
|
112 |
Use of OpenAIRE Guidelines |
|
113 |
</li> |
|
114 |
<li> |
|
115 |
<span |
|
116 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
117 |
uk-icon="check"> |
|
118 |
</span> |
|
119 |
DOIs via Zenodo |
|
120 |
</li> |
|
121 |
<li> |
|
122 |
<span |
|
123 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
124 |
uk-icon="check"> |
|
125 |
</span> |
|
126 |
EOSC Single Sign-On |
|
127 |
</li> |
|
128 |
</ul> |
|
129 |
</div> |
|
130 |
</div> |
|
131 |
</div> |
|
132 |
</div> |
|
133 |
<div> |
|
134 |
<div class="uk-card uk-card-default uk-padding-small connectInfoCard"> |
|
135 |
<div class="uk-card-media-top uk-flex uk-flex-middle uk-flex-center"> |
|
136 |
<div class="target"> |
|
137 |
<img src="assets/connect-assets/home/3.png" width="120" height="104"> |
|
138 |
</div> |
|
139 |
</div> |
|
140 |
<div class="uk-card-body uk-padding-remove-horizontal uk-padding-remove-bottom"> |
|
141 |
<div class="target"> |
|
142 |
<h5 class="uk-text-bold uk-text-center">Customized to your needs</h5> |
|
143 |
<div>A Science Gateway with your own brand, rules for aggregation, text & data mining, and |
|
144 |
presentation. Run by you via a simple, yet powerful backend administration tool. |
|
145 |
</div> |
|
146 |
</div> |
|
147 |
<hr> |
|
148 |
<div> |
|
149 |
<div class="uk-text-uppercase text-center">Features</div> |
|
150 |
<ul class="uk-list"> |
|
151 |
<li> |
|
152 |
<span |
|
153 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
154 |
uk-icon="check"> |
|
155 |
</span> |
|
156 |
Access control |
|
157 |
</li> |
|
158 |
<li> |
|
159 |
<span |
|
160 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
161 |
uk-icon="check"> |
|
162 |
</span> |
|
163 |
Analytics: rich set of indicators |
|
164 |
</li> |
|
165 |
<li> |
|
166 |
<span |
|
167 |
class="uk-border-circle uk-icon-button icon-button-small portal-icon-button uk-margin-small-right" |
|
168 |
uk-icon="check"> |
|
169 |
</span> |
|
170 |
Look & feel to match your brand |
|
171 |
</li> |
|
172 |
</ul> |
|
173 |
</div> |
|
174 |
</div> |
|
175 |
</div> |
|
176 |
</div> |
|
177 |
</div> |
|
178 |
</div> |
|
179 |
</div> |
|
180 |
<div style="background-image: url('assets/home/background.png') !important;" |
|
181 |
class="uk-margin-large-top uk-section uk-background-norepeat uk-background-top-center uk-background-cover uk-section-overlap uk-position-relative uk-preserve-color"> |
|
182 |
<div class="uk-container uk-container-large"> |
|
183 |
<gif-slider [gifs]="gifs" [link]="true" [linkTitle]="'learn more'" [route]="'/about/learn-how'"> |
|
184 |
</gif-slider> |
|
185 |
</div> |
|
186 |
</div>--> |
|
187 |
</div> |
|
188 |
<div *ngIf="researchCommunities.length === 0" class="uk-container uk-container-large uk-margin-medium-top"> |
|
189 |
<errorMessages [status]="[status]" [type]="'communities'"></errorMessages> |
|
190 |
</div> |
|
191 |
<div *ngIf="!loading && researchCommunities.length > 0" class="uk-container uk-container-large uk-margin-medium-top"> |
|
192 |
<div class="uk-text-bold uk-h4">Community Gateways in Action</div> |
|
193 |
<div [class]="'uk-margin-medium-top' + (researchCommunities.length <= 5 ? ' uk-margin-medium-bottom' : '')"> |
|
194 |
|
|
195 |
<div |
|
196 |
class="uk-grid-match uk-grid-medium uk-child-width-1-5@m uk-child-width-1-2 uk-text-center" |
|
197 |
uk-grid uk-height-match=".community"> |
|
198 |
<div *ngFor="let community of researchCommunities.slice(0, 5); let i = index"> |
|
199 |
<div class="uk-padding-small uk-card uk-card-default communityCard"> |
|
200 |
<browse-community [community]=community></browse-community> |
|
201 |
</div> |
|
202 |
</div> |
|
203 |
</div> |
|
204 |
|
|
205 |
</div> |
|
206 |
<div class="uk-text-right uk-margin-top"> |
|
207 |
<a *ngIf="researchCommunities.length > 5" class="portal-link uk-text-uppercase uk-text-bold uk-text-small" |
|
208 |
routerLinkActive="router-link-active" routerLink="/search/find/communities"> |
|
209 |
Browse All > |
|
210 |
</a> |
|
211 |
</div> |
|
212 |
</div> |
|
213 |
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" |
|
214 |
[texts]="pageContents['bottom']"></helper> |
|
215 |
<!--<div style="background-color: #CFDEF1;" |
|
216 |
class="uk-background-norepeat uk-background-cover uk-section-overlap uk-position-relative uk-preserve-color uk-margin-large-top"> |
|
217 |
<div class="uk-container uk-container-large uk-section"> |
|
218 |
<div class="uk-flex uk-flex-middle uk-padding" uk-grid> |
|
219 |
<div class="uk-text-center uk-width-1-1@s uk-width-1-3@m"> |
|
220 |
<img width="237" height="250" src="assets/connect-assets/contact/1.png"> |
|
221 |
</div> |
|
222 |
<div class="uk-width-expand"> |
|
223 |
<div class="uk-text-bold uk-h4"> |
|
224 |
<div>Let us help you develop a collaborative Open Science Gateway for your community. It is fast. It is |
|
225 |
reliable. |
|
226 |
</div> |
|
227 |
</div> |
|
228 |
<div class="uk-margin-medium">Get in touch with our team to find out how.</div> |
|
229 |
<div class="uk-inline"> |
|
230 |
<a class="uk-button portal-button" routerLink="/contact-us" routerLinkActive="router-link-active"> CONTACT |
|
231 |
US</a> |
|
232 |
</div> |
|
233 |
</div> |
|
234 |
</div> |
|
235 |
</div> |
|
236 |
</div>--> |
|
237 |
<div class="uk-section-muted" |
|
238 |
uk-scrollspy="{"target":"[uk-scrollspy-class]","cls":"uk-animation-fade","delay":false}"> |
|
239 |
<div class="uk-container uk-container-large"> |
|
240 |
<other-portals [properties]="properties" portal="monitor"> </other-portals> |
|
241 |
</div> |
|
242 |
</div> |
modules/uoa-monitor-portal/trunk/monitor/src/app/home/home.component.ts | ||
---|---|---|
1 |
import {Component} from '@angular/core'; |
|
2 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
3 |
import {Meta, Title} from '@angular/platform-browser'; |
|
4 |
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties'; |
|
5 |
import {CommunitiesService} from '../openaireLibrary/connect/communities/communities.service'; |
|
6 |
import {SubscribeService} from '../openaireLibrary/utils/subscribe/subscribe.service'; |
|
7 |
import {CommunityInfo} from '../openaireLibrary/connect/community/communityInfo'; |
|
8 |
|
|
9 |
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service'; |
|
10 |
import {StringUtils} from '../openaireLibrary/utils/string-utils.class'; |
|
11 |
|
|
12 |
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes'; |
|
13 |
import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.component'; |
|
14 |
import {HelperService} from "../openaireLibrary/utils/helper/helper.service"; |
|
15 |
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; |
|
16 |
|
|
17 |
@Component({ |
|
18 |
selector: 'home', |
|
19 |
templateUrl: 'home.component.html', |
|
20 |
}) |
|
21 |
|
|
22 |
export class HomeComponent { |
|
23 |
public piwiksub: any; |
|
24 |
|
|
25 |
public pageTitle = "OpenAIRE | Monitor"; |
|
26 |
public researchCommunities = []; |
|
27 |
public gifs: { "gif": string, "header": string, "text" }[] = []; |
|
28 |
public pageContents = null; |
|
29 |
public divContents = null; |
|
30 |
// Message variables |
|
31 |
public status: number; |
|
32 |
public loading: boolean = true; |
|
33 |
public subscriberErrorMessage: string = ""; |
|
34 |
public errorCodes: ErrorCodes; |
|
35 |
private errorMessages: ErrorMessagesComponent; |
|
36 |
|
|
37 |
properties: EnvProperties; |
|
38 |
public keyword: string = ""; |
|
39 |
public type: string = "all"; |
|
40 |
|
|
41 |
constructor( |
|
42 |
private route: ActivatedRoute, |
|
43 |
private _router: Router, |
|
44 |
private _meta: Meta, |
|
45 |
private _title: Title, |
|
46 |
private _piwikService: PiwikService, |
|
47 |
private _communitiesService: CommunitiesService, |
|
48 |
private _subscribeService: SubscribeService, |
|
49 |
private helper: HelperService, |
|
50 |
private seoService: SEOService) { |
|
51 |
|
|
52 |
var description = "OpenAIRE - Monitor, monitor dashboard, funder, statistics, "; |
|
53 |
var title = "OpenAIRE - Monitor"; |
|
54 |
|
|
55 |
this._meta.updateTag({content: description}, "name='description'"); |
|
56 |
this._meta.updateTag({content: description}, "property='og:description'"); |
|
57 |
this._meta.updateTag({content: title}, "property='og:title'"); |
|
58 |
this._title.setTitle(title); |
|
59 |
|
|
60 |
this.errorCodes = new ErrorCodes(); |
|
61 |
this.errorMessages = new ErrorMessagesComponent(); |
|
62 |
this.status = this.errorCodes.LOADING; |
|
63 |
} |
|
64 |
|
|
65 |
public ngOnInit() { |
|
66 |
this.route.data |
|
67 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
68 |
this.properties = data.envSpecific; |
|
69 |
var url = data.envSpecific.baseLink + this._router.url; |
|
70 |
this.seoService.createLinkForCanonicalURL(url, false); |
|
71 |
this._meta.updateTag({content: url}, "property='og:url'"); |
|
72 |
if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { |
|
73 |
this.piwiksub = this._piwikService.trackView(this.properties, "OpenAIRE Monitor", this.properties.piwikSiteId).subscribe(); |
|
74 |
} |
|
75 |
this.getCommunities(); |
|
76 |
this.createGifs(); |
|
77 |
//this.getDivContents(); |
|
78 |
this.getPageContents(); |
|
79 |
}); |
|
80 |
} |
|
81 |
|
|
82 |
private getPageContents() { |
|
83 |
this.helper.getPageHelpContents(this._router.url, this.properties, 'monitor').subscribe(contents => { |
|
84 |
this.pageContents = contents; |
|
85 |
}) |
|
86 |
} |
|
87 |
|
|
88 |
private getDivContents() { |
|
89 |
this.helper.getDivHelpContents(this._router.url, this.properties, 'monitor').subscribe(contents => { |
|
90 |
this.divContents = contents; |
|
91 |
}) |
|
92 |
} |
|
93 |
|
|
94 |
public getCommunities() { |
|
95 |
this.loading = true; |
|
96 |
this.status = this.errorCodes.LOADING; |
|
97 |
this.subscriberErrorMessage = ""; |
|
98 |
|
|
99 |
this.researchCommunities = []; |
|
100 |
|
|
101 |
this._communitiesService.getCommunitiesState().subscribe( |
|
102 |
communitiesResults => { |
|
103 |
if(!communitiesResults){ |
|
104 |
return; |
|
105 |
} |
|
106 |
if(communitiesResults.length == 0) { |
|
107 |
this.status = this.errorCodes.DONE; |
|
108 |
return; |
|
109 |
} |
|
110 |
this.sort(communitiesResults); |
|
111 |
communitiesResults.forEach((community, index) => { |
|
112 |
let showCommunity: boolean = true; |
|
113 |
if (community['status'] == "hidden" || community['status'] == "manager") { |
|
114 |
showCommunity = false; |
|
115 |
} |
|
116 |
if (showCommunity) { |
|
117 |
this.researchCommunities.push(community); |
|
118 |
} |
|
119 |
this.status = this.errorCodes.DONE; |
|
120 |
}); |
|
121 |
this.loading = false; |
|
122 |
}, |
|
123 |
error => { |
|
124 |
this.status = this.handleError("Error getting communities", error); |
|
125 |
this.loading = false; |
|
126 |
} |
|
127 |
); |
|
128 |
} |
|
129 |
|
|
130 |
private createGifs() { |
|
131 |
this.gifs.push({ |
|
132 |
gif: "assets/connect-assets/home/gifs/deposit.gif", |
|
133 |
header: "Find a repository to deposit your research outcome", |
|
134 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
135 |
}); |
|
136 |
this.gifs.push({ |
|
137 |
gif: "assets/connect-assets/home/gifs/link.gif", |
|
138 |
header: "Link your research output with your community, funding, and other research products", |
|
139 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
140 |
}); |
|
141 |
this.gifs.push({ |
|
142 |
gif: "assets/connect-assets/home/gifs/overview.gif", |
|
143 |
header: "View community's overview at a glance", |
|
144 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
145 |
}); |
|
146 |
this.gifs.push({ |
|
147 |
gif: "assets/connect-assets/home/gifs/results.gif", |
|
148 |
header: "Search & browse your community's research products. ", |
|
149 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
150 |
}); |
|
151 |
this.gifs.push({ |
|
152 |
gif: "assets/connect-assets/home/gifs/graph-analysis.gif", |
|
153 |
header: "View statistics for your community's research products.", |
|
154 |
text: "This is OpenAIRE’s key service for research communities, both established and emerging ones. Our service helps you reach out and engage all your researchers to practice open science out-of-the-box." |
|
155 |
}); |
|
156 |
} |
|
157 |
|
|
158 |
private sort(results: CommunityInfo[]) { |
|
159 |
results.sort((left, right): number => { |
|
160 |
if (!right.date || left.date > right.date) { |
|
161 |
return -1; |
|
162 |
} else if (!left.date || left.date < right.date) { |
|
163 |
return 1; |
|
164 |
} else { |
|
165 |
if (left.title > right.title) { |
|
166 |
return 1; |
|
167 |
} else if (left.title < right.title) { |
|
168 |
return -1; |
|
169 |
} else { |
|
170 |
return 0; |
|
171 |
} |
|
172 |
} |
|
173 |
}) |
|
174 |
} |
|
175 |
|
|
176 |
public quote(param: string): string { |
|
177 |
return StringUtils.quote(param); |
|
178 |
} |
|
179 |
|
|
180 |
public ngOnDestroy() { |
|
181 |
if (this.piwiksub) { |
|
182 |
this.piwiksub.unsubscribe(); |
|
183 |
} |
|
184 |
} |
|
185 |
|
|
186 |
private handleError(message: string, error): number { |
|
187 |
var code = ""; |
|
188 |
if (!error.status) { |
|
189 |
var error = error.json(); |
|
190 |
code = error.code; |
|
191 |
} else { |
|
192 |
code = error.status; |
|
193 |
} |
|
194 |
|
|
195 |
console.error("Communities (component): " + message, error); |
|
196 |
|
|
197 |
return this.errorMessages.getErrorCode(code); |
|
198 |
} |
|
199 |
} |
modules/uoa-monitor-portal/trunk/monitor/src/app/error/errorPage.component.ts | ||
---|---|---|
1 |
import { Component, Input } from '@angular/core'; |
|
2 |
import { Location } from '@angular/common'; |
|
3 |
|
|
4 |
@Component({ |
|
5 |
selector: 'openaire-error', |
|
6 |
template: ` |
|
7 |
<error></error> |
|
8 |
` |
|
9 |
}) |
|
10 |
|
|
11 |
export class OpenaireErrorPageComponent { |
|
12 |
|
|
13 |
} |
modules/uoa-monitor-portal/trunk/monitor/src/app/app.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {FormsModule} from '@angular/forms'; |
|
3 |
import {CommonModule} from '@angular/common'; |
|
4 |
import {HttpClientModule} from "@angular/common/http"; |
|
5 |
import {BrowserModule} from '@angular/platform-browser'; |
|
6 |
import {NoopAnimationsModule} from '@angular/platform-browser/animations'; |
|
7 |
import {AppComponent} from './app.component'; |
|
8 |
import {OpenaireErrorPageComponent} from './error/errorPage.component'; |
|
9 |
|
|
10 |
import {AppRoutingModule} from './app-routing.module'; |
|
11 |
import {SharedModule} from './shared/shared.module'; |
|
12 |
import {CookieLawModule} from './openaireLibrary/sharedComponents/cookie-law/cookie-law.module'; |
|
13 |
import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module'; |
|
14 |
import {ErrorModule} from './openaireLibrary/error/error.module'; |
|
15 |
import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module'; |
|
16 |
|
|
17 |
import {EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver'; |
|
18 |
|
|
19 |
import {CommunitiesService} from './openaireLibrary/connect/communities/communities.service'; |
|
20 |
import {LayoutService} from "./openaireLibrary/services/layout.service"; |
|
21 |
import {SubscribeModule} from './utils/subscribe/subscribe.module'; |
|
22 |
import {ThemeComponent} from "./test/theme.component"; |
|
23 |
|
|
24 |
@NgModule({ |
|
25 |
|
|
26 |
imports: [ |
|
27 |
SharedModule, |
|
28 |
NoopAnimationsModule, |
|
29 |
CommonModule, |
|
30 |
HttpClientModule, |
|
31 |
ErrorModule, |
|
32 |
FormsModule, |
|
33 |
NavigationBarModule, |
|
34 |
BottomModule, |
|
35 |
CookieLawModule, |
|
36 |
SubscribeModule.forRoot(), |
|
37 |
BrowserModule.withServerTransition({appId: 'my-app'}), |
|
38 |
AppRoutingModule |
|
39 |
], |
|
40 |
declarations: [ AppComponent, OpenaireErrorPageComponent, ThemeComponent], |
|
41 |
exports: [ AppComponent ], |
|
42 |
providers:[EnvironmentSpecificResolver, CommunitiesService, LayoutService], |
|
43 |
bootstrap: [AppComponent] |
|
44 |
}) |
|
45 |
// |
|
46 |
export class AppModule {} |
|
0 | 47 |
modules/uoa-monitor-portal/trunk/monitor/src/app/app.server.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {ServerModule} from '@angular/platform-server'; |
|
3 |
import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader'; |
|
4 |
|
|
5 |
import {AppModule} from './app.module'; |
|
6 |
import {AppComponent} from './app.component'; |
|
7 |
|
|
8 |
@NgModule({ |
|
9 |
imports: [ |
|
10 |
// The AppServerModule should import your AppModule followed |
|
11 |
// by the ServerModule from @angular/platform-server. |
|
12 |
AppModule, |
|
13 |
ServerModule, |
|
14 |
ModuleMapLoaderModule, |
|
15 |
], |
|
16 |
// Since the bootstrapped component is not inherited from your |
|
17 |
// imported AppModule, it needs to be repeated here. |
|
18 |
bootstrap: [AppComponent], |
|
19 |
}) |
|
20 |
export class AppServerModule {} |
modules/uoa-monitor-portal/trunk/monitor/static.paths.ts | ||
---|---|---|
1 |
export const ROUTES = [ |
|
2 |
'/', |
|
3 |
'/lazy', |
|
4 |
'/home', |
|
5 |
'/search/publication','/search/other','/search/project','/search/dataset','/search/dataprovider','/search/organization', |
|
6 |
'/search/find', |
|
7 |
'/search/person','/search/publication','/search/project','/search/dataset','/search/dataprovider','/search/organization', |
|
8 |
'/search/find/people','/search/find/publications','/search/find/other','/search/find/projects','/search/find/datasets','/search/find/dataproviders','/search/find/organizations', |
|
9 |
'/search/advanced/people','/search/advanced/publications','/search/advanced/other','/search/advanced/projects','/search/advanced/datasets','/search/advanced/dataproviders','/search/advanced/organizations', |
|
10 |
'/participate/deposit-publications','/participate/deposit-datasets','/participate/deposit-publications-result','/participate/deposit-datasets-result','/participate/deposit-subject-result', |
|
11 |
'/search/content-providers','/search/content-providers-table','/search/entity-registries','/search/entity-registries-table','/search/journals','/search/journals-table', |
|
12 |
'/project-report','/claims','/myclaims','/participate/claim','/participate/direct-claim','/claims-project-manager', |
|
13 |
'/test','/user-info', |
|
14 |
'/error', '/*path' |
|
15 |
]; |
modules/uoa-monitor-portal/trunk/monitor/prerender.ts | ||
---|---|---|
1 |
// Load zone.js for the server. |
|
2 |
import 'zone.js/dist/zone-node'; |
|
3 |
import 'reflect-metadata'; |
|
4 |
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs'; |
|
5 |
import { join } from 'path'; |
|
6 |
|
|
7 |
import { enableProdMode } from '@angular/core'; |
|
8 |
// Faster server renders w/ Prod mode (dev mode never needed) |
|
9 |
enableProdMode(); |
|
10 |
|
|
11 |
// Express Engine |
|
12 |
import { ngExpressEngine } from '@nguniversal/express-engine'; |
|
13 |
// Import module map for lazy loading |
|
14 |
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader'; |
|
15 |
import { renderModuleFactory } from '@angular/platform-server'; |
|
16 |
import { ROUTES } from './static.paths'; |
|
17 |
|
|
18 |
// * NOTE :: leave this as require() since this file is built Dynamically from webpack |
|
19 |
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main'); |
|
20 |
|
|
21 |
const BROWSER_FOLDER = join(process.cwd(), 'browser'); |
|
22 |
|
|
23 |
// Load the index.html file containing referances to your application bundle. |
|
24 |
const index = readFileSync(join('browser', 'index.html'), 'utf8'); |
|
25 |
|
|
26 |
let previousRender = Promise.resolve(); |
|
27 |
|
|
28 |
// Iterate each route path |
|
29 |
ROUTES.forEach(route => { |
|
30 |
const fullPath = join(BROWSER_FOLDER, route); |
|
31 |
|
|
32 |
// Make sure the directory structure is there |
|
33 |
if(!existsSync(fullPath)){ |
|
34 |
mkdirSync(fullPath); |
|
35 |
} |
|
36 |
|
|
37 |
// Writes rendered HTML to index.html, replacing the file if it already exists. |
|
38 |
previousRender = previousRender.then(_ => renderModuleFactory(AppServerModuleNgFactory, { |
|
39 |
document: index, |
|
40 |
url: route, |
|
41 |
extraProviders: [ |
|
42 |
provideModuleMap(LAZY_MODULE_MAP) |
|
43 |
] |
|
44 |
})).then(html => writeFileSync(join(fullPath, 'index.html'), html)); |
|
45 |
}); |
modules/uoa-monitor-portal/trunk/monitor/server.ts | ||
---|---|---|
1 |
import 'zone.js/dist/zone-node'; |
|
2 |
import 'reflect-metadata'; |
|
3 |
import { renderModuleFactory } from '@angular/platform-server'; |
|
4 |
import { enableProdMode } from '@angular/core'; |
|
5 |
|
|
6 |
import * as express from 'express'; |
|
7 |
import { join } from 'path'; |
|
8 |
import { readFileSync } from 'fs'; |
|
9 |
|
|
10 |
// Faster server renders w/ Prod mode (dev mode never needed) |
|
11 |
enableProdMode(); |
|
12 |
|
|
13 |
// Express server |
|
14 |
const app = express(); |
|
15 |
|
|
16 |
const PORT = process.env.PORT || 4000; |
|
17 |
const DIST_FOLDER = join(process.cwd(), 'dist'); |
|
18 |
|
|
19 |
// Our index.html we'll use as our template |
|
20 |
const template = readFileSync(join(DIST_FOLDER, 'browser', 'index.html')).toString(); |
|
21 |
|
|
22 |
// * NOTE :: leave this as require() since this file is built Dynamically from webpack |
|
23 |
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main'); |
|
24 |
|
|
25 |
// Express Engine |
|
26 |
import {ngExpressEngine, RenderOptions} from '@nguniversal/express-engine'; |
|
27 |
// Import module map for lazy loading |
|
28 |
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader'; |
|
29 |
|
|
30 |
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine) |
|
31 |
// app.engine('html', ngExpressEngine({ |
|
32 |
// bootstrap: AppServerModuleNgFactory, |
|
33 |
// providers: [ |
|
34 |
// { provide: 'request', useFactory: () => options.req, deps: [] }, |
|
35 |
// provideModuleMap(LAZY_MODULE_MAP) |
|
36 |
// ] |
|
37 |
// })); |
|
38 |
|
|
39 |
// be able to get request and get domain from there |
|
40 |
app.engine('html', (_, options: RenderOptions, callback) => { |
|
41 |
let engine = ngExpressEngine({ |
|
42 |
bootstrap: AppServerModuleNgFactory, |
|
43 |
providers: [ |
|
44 |
{ provide: 'request', useFactory: () => options.req, deps: [] }, |
|
45 |
provideModuleMap(LAZY_MODULE_MAP) |
|
46 |
] |
|
47 |
}); |
|
48 |
engine(_, options, callback); |
|
49 |
}); |
|
50 |
|
|
51 |
app.set('view engine', 'html'); |
|
52 |
app.set('views', join(DIST_FOLDER, 'browser')); |
|
53 |
|
|
54 |
/* - Example Express Rest API endpoints - |
|
55 |
app.get('/api/**', (req, res) => { }); |
|
56 |
*/ |
|
57 |
|
|
58 |
// Server static files from /browser |
|
59 |
app.get('*.*', express.static(join(DIST_FOLDER, 'browser'), { |
|
60 |
maxAge: '1y' |
|
61 |
})); |
|
62 |
|
|
63 |
// ALl regular routes use the Universal engine |
|
64 |
app.get('*', (req, res) => { |
|
65 |
res.render('index', { req }); |
|
66 |
}); |
|
67 |
|
|
68 |
// Start up the Node server |
|
69 |
app.listen(PORT, () => { |
|
70 |
console.log(`Node Express server listening on http://localhost:${PORT}`); |
|
71 |
}); |
modules/uoa-monitor-portal/trunk/monitor/README.md | ||
---|---|---|
1 |
# Angular Universal & Anguar-CLI minimal starter |
|
2 |
|
|
3 |
> This demo is built following the [Angular-CLI Wiki guide](https://github.com/angular/angular-cli/wiki/stories-universal-rendering) |
|
4 |
|
|
5 |
We're utilizing packages from the [Angular Universal @nguniversal](https://github.com/angular/universal) repo, such as [ng-module-map-ngfactory-loader](https://github.com/angular/universal/tree/master/modules/module-map-ngfactory-loader) to enable Lazy Loading. |
|
6 |
|
|
7 |
--- |
|
8 |
|
|
9 |
## Static or Dynamic |
|
10 |
This repo demonstrates the use of 2 different forms of Server Side Rendering. |
|
11 |
|
|
12 |
**Static** Also known as "prerendering" |
|
13 |
* Happens at build time |
|
14 |
* Renders your application and replaces the dist index.html with a version rendered at the route `/`. |
|
15 |
|
|
16 |
**Dynamic** |
|
17 |
* Happens at runtime |
|
18 |
* Uses `ngExpressEngine` to render you application on the fly at the requested url. |
|
19 |
|
|
20 |
--- |
|
21 |
|
|
22 |
## Installation |
|
23 |
* `npm install` or `yarn` |
|
24 |
|
|
25 |
--- |
|
26 |
|
|
27 |
## Development (Client-side only rendering) |
|
28 |
* run `npm run start` which will start `ng serve` (project served at the standard: localhost:4200) |
|
29 |
|
|
30 |
--- |
|
31 |
|
|
32 |
## Production |
|
33 |
|
|
34 |
Depending on whether you're publishing dynamic or static prerendering, run the build command, and then serve up your dist folder assets. |
|
35 |
|
|
36 |
> **NOTE**: To deploy your **Static** site to a static hosting platform you will have to deploy the *`dist/browser`* folder, rather than the usual *`dist`* |
|
37 |
|
|
38 |
ie: `npm run build:dynamic` or `npm run build:static`. All of the files that need to be served will be found within the `/dist` folder. |
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
--- |
|
43 |
|
|
44 |
## Testing Universal (dynamic or static) builds -Locally- |
|
45 |
|
|
46 |
**Dynamic** : **`npm run start:dynamic`** |
|
47 |
|
|
48 |
Compiles your application and spins up a Node Express to dynamically serve your Universal application on `http://localhost:4000`. |
|
49 |
|
|
50 |
**Static** : **`npm run start:static`** |
|
51 |
|
|
52 |
- Compiles your application and prerenders your applications files, spinning up a demo http-server so you can view it on `http://127.0.0.1:8080` |
|
53 |
|
|
54 |
|
Also available in: Unified diff
[Monitor|Trunk]
complete previous commit