[Explore|Trunk]

Merge into trunk branch angular7 rev 55729



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@55965 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2019-06-03 13:21:49 +00:00
parent e4c3b01e00
commit 247ef9dccd
20 changed files with 677 additions and 268 deletions

View File

@ -1,128 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "ng-universal-demo"
},
"apps": [
{
"root": "src",
"outDir": "dist/browser",
"assets": [
"assets",
"robots.txt",
{"glob": "sitemap.xml", "input": "./sitemaps", "output": "./"},
{"glob": "sitemap.xml", "input": "./sitemaps", "output": "./assets"},
{ "glob": "**/*", "input": "./sitemaps/publication", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/dataset", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/software", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/other", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/project", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/organization", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/dataprovider", "output": "./" }
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css",
"../node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/datatables.net/js/jquery.dataTables.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
},
{
"platform": "server",
"root": "src",
"outDir": "dist/server",
"assets": [
"assets",
"robots.txt",
{"glob": "sitemap.xml", "input": "./sitemaps", "output": "./"},
{"glob": "sitemap.xml", "input": "./sitemaps", "output": "./assets"},
{ "glob": "**/*", "input": "./sitemaps/publication", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/dataset", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/software", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/other", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/project", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/organization", "output": "./" },
{ "glob": "**/*", "input": "./sitemaps/dataprovider", "output": "./" }
],
"index": "index.html",
"main": "main.server.ts",
"test": "test.ts",
"tsconfig": "tsconfig.server.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {
"spec": false,
"inlineStyle": true,
"inlineTemplate": true
},
"directive": {
"spec": false
},
"class": {
"spec": false
},
"guard": {
"spec": false
},
"module": {
"spec": false
},
"pipe": {
"spec": false
},
"service": {
"spec": false
}
}
}

267
explore/angular.json Normal file
View File

@ -0,0 +1,267 @@
{
"$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"openaire-search": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/robots.txt",
{
"glob": "sitemap.xml",
"input": "src/sitemaps",
"output": "/"
},
{
"glob": "sitemap.xml",
"input": "src/sitemaps",
"output": "/assets"
},
{
"glob": "**/*",
"input": "src/sitemaps/publication",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/dataset",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/software",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/other",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/project",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/organization",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/dataprovider",
"output": "/"
}
],
"styles": [
"src/styles.css",
"node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js"
]
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "openaire-search:build"
},
"configurations": {
"production": {
"browserTarget": "openaire-search:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "openaire-search:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js"
],
"styles": [
"src/styles.css",
"node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"assets": [
"src/assets",
"src/robots.txt",
{
"glob": "sitemap.xml",
"input": "src/sitemaps",
"output": "/"
},
{
"glob": "sitemap.xml",
"input": "src/sitemaps",
"output": "/assets"
},
{
"glob": "**/*",
"input": "src/sitemaps/publication",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/dataset",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/software",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/other",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/project",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/organization",
"output": "/"
},
{
"glob": "**/*",
"input": "src/sitemaps/dataprovider",
"output": "/"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
}
}
},
"openaire-search-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "openaire-search:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "openaire-search",
"schematics": {
"@schematics/angular:class": {
"spec": false
},
"@schematics/angular:component": {
"spec": false,
"inlineStyle": true,
"inlineTemplate": true,
"prefix": "app",
"styleext": "css"
},
"@schematics/angular:directive": {
"spec": false,
"prefix": "app"
},
"@schematics/angular:guard": {
"spec": false
},
"@schematics/angular:module": {
"spec": false
},
"@schematics/angular:pipe": {
"spec": false
},
"@schematics/angular:service": {
"spec": false
}
}
}

View File

@ -28,7 +28,7 @@
# pico ../src/robots.txt;
# rm -rf ../src/assets/common-assets/.svn/;
# rm -rf ../src/app/openaireLibrary/.svn/;
# cd ..; npm run build:dynamic; cd deploy;
# cd ..; npm run build:ssr; cd deploy;
# rm -rf ../src ../node_modules ../.idea/ ../installOpenaireLib.sh;
# cd ..; rm -rf deploy;
# echo 'Now copy to the server!'

View File

@ -9,55 +9,63 @@
"scripts": {
"ng": "ng",
"start": "ng serve --disable-host-check --host 0.0.0.0 --port 4300",
"start:dynamic": "npm run build:dynamic && npm run serve:dynamic",
"start:static": "npm run build:static && npm run serve:static",
"start:ssr": "npm run build:ssr && npm run serve:ssr",
"start:prerender": "npm run build:prerender && npm run serve:prerender",
"build": "ng build",
"build:client-and-server-bundles": "ng build --prod -sm --stats-json && ng build --prod --app 1 --output-hashing=false",
"build:static": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:static",
"build:dynamic": "npm run build:client-and-server-bundles && npm run webpack:server",
"generate:static": "cd dist && node prerender",
"build:client-and-server-bundles": "ng build --prod --sourceMap --stats-json=true && ng run openaire-search:server:production",
"build:prerender": "npm run build:client-and-server-bundles && npm run webpack:server && npm run generate:prerender",
"build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server",
"generate:prerender": "cd dist && node prerender",
"webpack:server": "webpack --config webpack.server.config.js --progress --colors",
"serve:static": "cd dist/browser && http-server",
"serve:dynamic": "node dist/server"
"serve:prerender": "cd dist/browser && http-server",
"serve:ssr": "node dist/server"
},
"private": true,
"dependencies": {
"@angular/animations": "^4.2.4",
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
"@angular/platform-browser-dynamic": "^4.2.4",
"@angular/platform-server": "^4.2.4",
"@angular/router": "^4.2.4",
"@nguniversal/express-engine": "^1.0.0-beta.3",
"@nguniversal/module-map-ngfactory-loader": "^1.0.0-beta.3",
"angular-datatables": "^4.4.0",
"@angular/animations": "^7.2.14",
"@angular/cdk": "^7.3.7",
"@angular/common": "7.2.14",
"@angular/compiler": "7.2.14",
"@angular/core": "7.2.14",
"@angular/forms": "7.2.14",
"@angular/http": "7.2.14",
"@angular/material": "^7.3.7",
"@angular/platform-browser": "7.2.14",
"@angular/platform-browser-dynamic": "7.2.14",
"@angular/platform-server": "7.2.14",
"@angular/router": "7.2.14",
"@nguniversal/express-engine": "^6.0.0",
"@nguniversal/module-map-ngfactory-loader": "^6.0.0",
"@types/express": "^4.16.1",
"angular-datatables": "^4.4.1",
"citation-js": "^0.3.4",
"clipboard": "^1.5.16",
"core-js": "^2.4.1",
"datatables.net": "^1.10.16",
"datatables.net-dt": "^1.10.16",
"jquery": "^3.2.1",
"datatables.net": "^1.10.19",
"datatables.net-dt": "^1.10.19",
"jquery": "^3.4.1",
"ngx-json-ld": "0.1.6",
"rxjs": "^5.4.2",
"prom-client": "^11.3.0",
"ts-md5": "^1.2.0",
"tslib": "^1.9.0",
"wikidata-sdk": "^5.2.9",
"zone.js": "^0.8.14"
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/cli": "^1.3.0",
"@angular/compiler-cli": "^4.2.4",
"@angular/language-service": "^4.2.4",
"@types/datatables.net": "^1.10.8",
"@types/jquery": "^3.2.17",
"@angular-devkit/build-angular": "~0.13.0",
"@angular/cli": "^7.3.9",
"@angular/compiler-cli": "7.2.14",
"@angular/language-service": "7.2.14",
"@types/datatables.net": "^1.10.17",
"@types/jquery": "^3.3.29",
"@types/node": "^8.0.30",
"cpy-cli": "^1.0.1",
"http-server": "^0.10.0",
"reflect-metadata": "^0.1.10",
"ts-loader": "^2.3.7",
"typescript": "~2.3.3"
"rxjs": "6.5.1",
"rxjs-compat": "^6.5.1",
"ts-loader": "^4.2.0",
"typescript": "3.2.4",
"webpack-cli": "^3.3.2"
}
}

View File

@ -16,7 +16,7 @@ import { renderModuleFactory } from '@angular/platform-server';
import { ROUTES } from './static.paths';
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle');
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main');
const BROWSER_FOLDER = join(process.cwd(), 'browser');
@ -27,7 +27,7 @@ let previousRender = Promise.resolve();
// Iterate each route path
ROUTES.forEach(route => {
var fullPath = join(BROWSER_FOLDER, route);
const fullPath = join(BROWSER_FOLDER, route);
// Make sure the directory structure is there
if(!existsSync(fullPath)){

200
explore/prometheus.ts Normal file
View File

@ -0,0 +1,200 @@
import * as prom from 'prom-client';
export class Prometheus {
register = new prom.Registry();
counters: Map<string, prom.Counter> = new Map<string, prom.Counter>([
["/", new prom.Counter({
name: 'home',
help: 'Home Page Counter',
registers: [this.register]
})],
["/search/publication", new prom.Counter({
name: 'search_publication',
help: 'Publication Landing Page Counter',
registers: [this.register]
})],
["/search/dataset", new prom.Counter({
name: 'search_dataset',
help: 'Dataset Landing Page Counter',
registers: [this.register]
})],
["/search/software", new prom.Counter({
name: 'search_software',
help: 'Software Landing Page Counter',
registers: [this.register]
})],
["/search/other", new prom.Counter({
name: 'search_other',
help: 'Other Landing Page Counter',
registers: [this.register]
})],
["/search/project", new prom.Counter({
name: 'search_project',
help: 'Project Landing Page Counter',
registers: [this.register]
})],
["/search/dataprovider", new prom.Counter({
name: 'search_dataprovider',
help: 'DataProvider Landing Page Counter',
registers: [this.register]
})],
["/search/organization", new prom.Counter({
name: 'search_organization',
help: 'organization Landing Page Counter',
registers: [this.register]
})],
["/participate/deposit-datasets", new prom.Counter({
name: 'participate_deposit_datasets',
help: 'Participate Deposit Datasets Page Counter',
registers: [this.register]
})],
["/participate/deposit-datasets-result", new prom.Counter({
name: 'participate_deposit_datasets_result',
help: 'Participate Deposit Datasets Result Page Counter',
registers: [this.register]
})],
["/participate/deposit-subject-result", new prom.Counter({
name: 'participate_deposit_subject_result',
help: 'Participate Deposit Subject Result Page Counter',
registers: [this.register]
})],
["/participate/deposit-publications", new prom.Counter({
name: 'participate_deposit_publications',
help: 'Participate Deposit Publications Page Counter',
registers: [this.register]
})],
["/participate/deposit-publications-result", new prom.Counter({
name: 'participate_deposit_publications_result',
help: 'Participate Deposit Publications Result Page Counter',
registers: [this.register]
})],
["/search/find", new prom.Counter({
name: 'search_find',
help: 'Main Search Page Counter',
registers: [this.register]
})],
["/search/find/publications", new prom.Counter({
name: 'search_find_publications',
help: 'Publications Search Page Counter',
registers: [this.register]
})],
["/search/find/datasets", new prom.Counter({
name: 'search_find_datasets',
help: 'Datasets Search Page Counter',
registers: [this.register]
})],
["/search/find/software", new prom.Counter({
name: 'search_find_software',
help: 'Software Search Page Counter',
registers: [this.register]
})],
["/search/find/other", new prom.Counter({
name: 'search_find_other',
help: 'Other Search Page Counter',
registers: [this.register]
})],
["/search/find/projects", new prom.Counter({
name: 'search_find_projects',
help: 'Projects Search Page Counter',
registers: [this.register]
})],
["/search/find/dataproviders", new prom.Counter({
name: 'search_find_dataproviders',
help: 'DataProviders Search Page Counter',
registers: [this.register]
})],
["/search/find/organizations", new prom.Counter({
name: 'search_find_organizations',
help: 'Organizations Search Page Counter',
registers: [this.register]
})],
["/search/content-providers", new prom.Counter({
name: 'search_content_providers',
help: 'Repositories Search Page Counter',
registers: [this.register]
})],
["/search/content-providers-table", new prom.Counter({
name: 'search_content_providers_table',
help: 'Repositories Search Page Table Counter',
registers: [this.register]
})],
["/search/entity-registries", new prom.Counter({
name: 'search_entity_registries',
help: 'Registries Search Page Counter',
registers: [this.register]
})],
["/search/entity-registries-table", new prom.Counter({
name: 'search_entity_registries_table',
help: 'Registries Search Page Table Counter',
registers: [this.register]
})],
["/search/journals", new prom.Counter({
name: 'search_journals',
help: 'Journals Search Page Counter',
registers: [this.register]
})],
["/search/journals-table", new prom.Counter({
name: 'search_journals_table',
help: 'Journals Search Page Table Counter',
registers: [this.register]
})],
["/search/advanced/publications", new prom.Counter({
name: 'search_advanced_publications',
help: 'Publications Advanced Search Page Counter',
registers: [this.register]
})],
["/search/advanced/datasets", new prom.Counter({
name: 'search_advanced_datasets',
help: 'Datasets Advanced Search Page Counter',
registers: [this.register]
})],
["/search/advanced/software", new prom.Counter({
name: 'search_advanced_software',
help: 'Software Advanced Search Page Counter',
registers: [this.register]
})],
["/search/advanced/other", new prom.Counter({
name: 'search_advanced_other',
help: 'Other Advanced Search Page Counter',
registers: [this.register]
})],
["/search/advanced/projects", new prom.Counter({
name: 'search_advanced_projects',
help: 'Projects Advanced Search Page Counter',
registers: [this.register]
})],
["/search/advanced/dataproviders", new prom.Counter({
name: 'search_advanced_dataproviders',
help: 'DataProviders Advanced Search Page Counter',
registers: [this.register]
})],
["/search/advanced/organizations", new prom.Counter({
name: 'search_advanced_organizations',
help: 'Organizations Advanced Search Page Counter',
registers: [this.register]
})],
["/myclaims", new prom.Counter({
name: 'my_claims',
help: 'My Claims Page Counter',
registers: [this.register]
})],
["/claims", new prom.Counter({
name: 'claims',
help: 'Admin Claims Page Counter',
registers: [this.register]
})],
["/participate/claim", new prom.Counter({
name: 'participate_claim',
help: 'Linking Page Counter',
registers: [this.register]
})],
["/participate/direct-claim", new prom.Counter({
name: 'participate_direct_claim',
help: 'Direct Linking Page Counter',
registers: [this.register]
})]
]);
}

View File

@ -20,22 +20,29 @@ const DIST_FOLDER = join(process.cwd(), 'dist');
const template = readFileSync(join(DIST_FOLDER, 'browser', 'index.html')).toString();
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main.bundle');
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main');
// Express Engine
import { ngExpressEngine } from '@nguniversal/express-engine';
import {ngExpressEngine, RenderOptions} from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
import {Prometheus} from "./prometheus";
import {Counter} from "prom-client";
/*
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
// app.engine('html', ngExpressEngine({
// bootstrap: AppServerModuleNgFactory,
// providers: [
// provideModuleMap(LAZY_MODULE_MAP)
// ]
// }));
app.engine('html', ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
provideModuleMap(LAZY_MODULE_MAP)
]
}));
*/
// be able to get request and get domain from there
app.engine('html', (_, options, callback) => {
const prometheus: Prometheus = new Prometheus();
app.engine('html', (_, options:RenderOptions, callback) => {
let engine = ngExpressEngine({
bootstrap: AppServerModuleNgFactory,
providers: [
@ -58,9 +65,25 @@ app.get('*.*', express.static(join(DIST_FOLDER, 'browser'), {
maxAge: '1y'
}));
// ALl regular routes use the Universal engine
app.get('/metrics', (req, res) => {
res.set('Content-Type', prometheus.register.contentType);
res.end(prometheus.register.metrics());
});
// All regular routes use the Universal engine
app.get('*', (req, res) => {
let start = new Date();
let counter: Counter = prometheus.counters.get(req.path);
if(counter !== undefined) {
counter.inc(1, new Date());
res.render('index', { req });
// event triggers when express is done sending response
res.on('finish', function() {
// console.log(new Date().getTime() - start.getTime());
});
} else {
res.render('index', { req });
}
});
// Start up the Node server

View File

@ -1,12 +1,13 @@
import { Component, Directive, ElementRef, Renderer, ChangeDetectionStrategy, ViewEncapsulation } from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {ActivatedRoute} from '@angular/router';
import {Component, Directive, ElementRef, Renderer2, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
import {Observable} from 'rxjs';
import {ActivatedRoute, NavigationStart, Router} from '@angular/router';
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
import {MenuItem, RootMenuItem} from './openaireLibrary/sharedComponents/menu';
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import {Session} from './openaireLibrary/login/utils/helper.class';
import {HelperFunctions} from "./openaireLibrary/utils/HelperFunctions.class";
@Component({
//changeDetection: ChangeDetectionStrategy.Default,
@ -16,8 +17,10 @@ import {Session} from './openaireLibrary/login/utils/helper.class';
`],
template: `
<navbar *ngIf= "properties" portal="explore" [environment]=properties.environment [onlyTop]=false [(communityId)]="properties.adminToolsCommunity" [userMenuItems]=userMenuItems [menuItems]=menuItems
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl" [(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain"></navbar>
<navbar *ngIf="properties" portal="explore" [environment]=properties.environment [onlyTop]=false
[(communityId)]="properties.adminToolsCommunity" [userMenuItems]=userMenuItems [menuItems]=menuItems
[(APIUrl)]="properties.adminToolsAPIURL" [(logInUrl)]="properties.loginUrl"
[(logOutUrl)]="properties.logoutUrl" [(cookieDomain)]="properties.cookieDomain"></navbar>
<div class="custom-main-content">
<main>
<router-outlet></router-outlet>
@ -26,9 +29,12 @@ import {Session} from './openaireLibrary/login/utils/helper.class';
<feedback *ngIf="isClient && properties" portalName="Explore" [feedbackmail]=feedbackmail></feedback>
<cookie-law *ngIf="isClient" position="bottom">
OpenAIRE uses cookies in order to function properly.<br>
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing experience possible.
By using the OpenAIRE portal you accept our use of cookies. <a href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right" ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
Cookies are small pieces of data that websites store in your browser to allow us to give you the best browsing
experience possible.
By using the OpenAIRE portal you accept our use of cookies. <a
href="//ec.europa.eu/ipg/basics/legal/cookies/index_en.htm" target="_blank"> Read more <span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="chevron-right"
ratio="1"><polyline fill="none" stroke="#000" stroke-width="1.03" points="7 4 13 10 7 16"></polyline></svg>
</span></a>
</cookie-law>
<bottom *ngIf="isClient && properties" [environment]=properties.environment></bottom>
@ -45,7 +51,8 @@ export class AppComponent {
menuItems: RootMenuItem [] = [
{rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find"],{}),
{
rootItem: new MenuItem("search", "Search", "", "/search/find", false, [], ["/search/find"], {}),
items: [new MenuItem("", "Publications", "", "/search/find/publications", false, ["publication"], ["/search/find/publications"], {}),
new MenuItem("", "Research Data", "", "/search/find/datasets", false, ["dataset"], ["/search/find/datasets"], {}),
new MenuItem("", "Software", "", "/search/find/software", false, ["software"], ["/search/find/software"], {}),
@ -53,7 +60,8 @@ export class AppComponent {
new MenuItem("", "Projects", "", "/search/find/projects/", false, ["project"], ["/search/find/projects"], {}),
new MenuItem("", "Content Providers", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {}),
new MenuItem("", "Organizations", "", "/search/find/organizations/", false, ["organization"], ["/search/find/organizations"], {})
]},
]
},
{
rootItem: new MenuItem("share", "Share", "", "", false, [], ["/participate/deposit-publications", "/participate/deposit-datasets"], {}),
items: [new MenuItem("", "Publications", "", "/participate/deposit-publications", false, ["publication"], ["/participate/deposit-publications"], {}),
@ -74,10 +82,16 @@ export class AppComponent {
];
feedbackmail: string
properties: EnvProperties;
constructor( private route: ActivatedRoute, private propertiesService:EnvironmentSpecificService) {
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
private router: Router) {
router.events.forEach((event) => {
if (event instanceof NavigationStart) {
HelperFunctions.scroll();
}
});
}
ngOnInit() {

View File

@ -4,7 +4,7 @@ import { SharedModule } from './shared/shared.module';
import { BrowserModule } from '@angular/platform-browser';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { APP_BASE_HREF, CommonModule } from '@angular/common';
import { HttpModule } from '@angular/http';
import { HttpClientModule } from '@angular/common/http';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
@ -15,6 +15,7 @@ import { CookieLawModule } from './openaireLibrary/sharedComponents/cookie-law/c
import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module';
import {FeedbackModule} from './openaireLibrary/sharedComponents/feedback/feedback.module';
import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
//import { EnvironmentSpecificService, REQUEST_TOKEN} from './openaireLibrary/utils/properties/environment-specific.service';
import { ErrorModule} from './openaireLibrary/error/error.module';
@ -27,7 +28,7 @@ import { AppRoutingModule } from './app-routing.module';
SharedModule,
NoopAnimationsModule,
CommonModule,
HttpModule,
HttpClientModule,
ErrorModule,
NavigationBarModule, FeedbackModule, BottomModule,
CookieLawModule,
@ -36,7 +37,14 @@ NavigationBarModule, FeedbackModule, BottomModule,
],
declarations: [ AppComponent, OpenaireErrorPageComponent],
exports: [ AppComponent ],
providers:[EnvironmentSpecificResolver ],
providers:[
/*{
provide: REQUEST_TOKEN,
useClass: EnvironmentSpecificService
},*/
EnvironmentSpecificResolver
],
bootstrap: [AppComponent]
})
//

View File

@ -4,6 +4,7 @@ import {ModuleMapLoaderModule} from '@nguniversal/module-map-ngfactory-loader';
import {AppModule} from './app.module';
import {AppComponent} from './app.component';
//import {REQUEST} from "@nguniversal/express-engine/tokens";
@NgModule({
imports: [
@ -17,4 +18,6 @@ import {AppComponent} from './app.component';
// imported AppModule, it needs to be repeated here.
bootstrap: [AppComponent],
})
export class AppServerModule {}
export class AppServerModule {
/*constructor(@Inject(REQUEST) private request: Request) {}*/
}

View File

@ -1,6 +1,6 @@
import {Component, ViewChild, Input} from '@angular/core';
import {Location} from '@angular/common';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ActivatedRoute, Router} from '@angular/router';
@Component({

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
@Component({

View File

@ -1,5 +1,5 @@
import {Component, Input, Output, EventEmitter, ViewChild, ChangeDetectionStrategy, ViewEncapsulation} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
import "rxjs/add/observable/zip";
@ -92,9 +92,9 @@ public subPub;public subData;public subProjects;public subOrg; public subDataPr;
this.config.getCommunityInformation(this.properties.adminToolsAPIURL, this.properties.adminToolsCommunity ).subscribe(data => {
var showEntity = {};
for(var i=0; i< data.entities.length; i++){
for(var i=0; i< data['entities'].length; i++){
showEntity[""+data.entities[i]["pid"]+""] = data.entities[i]["isEnabled"];
showEntity[""+data['entities'][i]["pid"]+""] = data['entities'][i]["isEnabled"];
}
this.showPublications = showEntity["publication"];
this.showDatasets = showEntity["dataset"];

View File

@ -1,5 +1,5 @@
import {Component, ElementRef} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
@Component({
selector: 'openaire-user',

View File

@ -1,5 +1,5 @@
import {Component, Input} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs';
@Component({

View File

@ -1 +1,2 @@
/* You can add global styles to this file, and also import other style files */
@import '~@angular/material/prebuilt-themes/indigo-pink.css';

View File

@ -1,6 +1,7 @@
{
"compileOnSave": false,
"compilerOptions": {
"importHelpers": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
@ -14,6 +15,8 @@
"lib": [
"es2017",
"dom"
]
],
"module": "es2015",
"baseUrl": "./"
}
}

View File

@ -4,6 +4,7 @@ const path = require('path');
const webpack = require('webpack');
module.exports = {
//mode: 'none',
entry: {
// This is our Express server for Dynamic universal
server: './server.ts',
@ -14,6 +15,9 @@ module.exports = {
resolve: { extensions: ['.ts', '.js'] },
// Make sure we include all node_modules etc
externals: [/(node_modules|main\..*\.js)/,],
optimization: {
minimize: false
},
output: {
// Puts the output at the root of the dist folder
path: path.join(__dirname, 'dist'),
@ -22,6 +26,12 @@ module.exports = {
module: {
rules: [
{ test: /\.ts$/, loader: 'ts-loader' }
,{
// Mark files inside `@angular/core` as using SystemJS style dynamic imports.
// Removing this will cause deprecation warnings to appear.
test: /(\\|\/)@angular(\\|\/)core(\\|\/).+\.js$/,
parser: { system: true },
},
]
},
plugins: [