[Explore-Service]: Update to angular 11. Delete branches

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-portal/trunk@61402 d315682c-612b-4755-9ff5-7f18f6832af3
deprecated
k.triantafyllou 3 years ago
parent 6dbdecafb4
commit 20badf397f

@ -0,0 +1,11 @@
# This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
#
# For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11

@ -1,54 +1,41 @@
# Angular Universal & Anguar-CLI minimal starter
# Explore
> This demo is built following the [Angular-CLI Wiki guide](https://github.com/angular/angular-cli/wiki/stories-universal-rendering)
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.3.10 and has been updated to 11.2.14.
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.
## Install packages
---
Run npm install (maybe needs sudo), a script that will delete unused files from library will be run.
## Static or Dynamic
This repo demonstrates the use of 2 different forms of Server Side Rendering.
## Development server
**Static** Also known as "prerendering"
* Happens at build time
* Renders your application and replaces the dist index.html with a version rendered at the route `/`.
Run `npm start` for a dev server. Navigate to `http://localhost:4300/`. The app will automatically reload if you change any of the source files.
**Dynamic**
* Happens at runtime
* Uses `ngExpressEngine` to render you application on the fly at the requested url.
## Build - CSR
---
Use the `npm run build-dev` for a development build.<br>
Use the `npm run build-test` for a test build.<br>
Use the `npm run build-beta` for a beta build.<br>
Use the `npm run build-prod` for a production build.
## Installation
* `npm install` or `yarn`
## Build - SSR
---
Use the `npm run build:ssr-dev` for a development build.<br>
Use the `npm run build:ssr-test` for a test build.<br>
Use the `npm run build:ssr-beta` for a beta build.<br>
Use the `npm run build:ssr-prod` for a production build.
## Development (Client-side only rendering)
* run `npm run start` which will start `ng serve` (project served at the standard: localhost:4200)
## Run SSR
---
`npm run serve:ssr` will run the last server build.
## Production
## Webpack Analyzer
Depending on whether you're publishing dynamic or static prerendering, run the build command, and then serve up your dist folder assets.
In order to analyze bundle size you can run `npm run webpack-bundle-analyzer`
> **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`*
## Running unit tests
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.
---
## Testing Universal (dynamic or static) builds -Locally-
**Dynamic** : **`npm run start:dynamic`**
Compiles your application and spins up a Node Express to dynamically serve your Universal application on `http://localhost:4000`.
**Static** : **`npm run start:static`**
- 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`
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).

@ -1,21 +1,46 @@
{
"$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"openaire-search": {
"explore": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"@schematics/angular:class": {
"skipTests": true
},
"@schematics/angular:component": {
"skipTests": true
},
"@schematics/angular:directive": {
"skipTests": true
},
"@schematics/angular:guard": {
"skipTests": true
},
"@schematics/angular:module": {
"skipTests": true
},
"@schematics/angular:pipe": {
"skipTests": true
},
"@schematics/angular:service": {
"skipTests": true
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/browser",
"aot": true,
"outputPath": "dist/explore/browser",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/assets",
"src/robots.txt",
@ -38,138 +63,176 @@
]
},
"configurations": {
"production": {
"development": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
"budgets": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
},
{
"replace": "src/index.html",
"with": "src/index.prod.html"
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"replace": "src/robots.txt",
"with": "src/robots.prod.txt"
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
},
"beta": {
"test": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}
],
"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.beta.ts"
},
"budgets": [
{
"replace": "src/index.html",
"with": "src/index.beta.html"
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"replace": "src/robots.txt",
"with": "src/robots.beta.txt"
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
},
"test": {
"beta": {
"assets": [
"src/assets",
{
"input": "src/beta/",
"output": "/",
"glob": "*.txt"
},
"src/OpenSearchDescriptor.xml",
{
"glob": "**/*",
"input": "src/sitemaps",
"output": "/"
}
],
"index": {
"input": "src/beta/index.html",
"output": "index.html"
},
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.beta.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
"budgets": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
},
"development": {
"production": {
"assets": [
"src/assets",
{
"input": "src/prod/",
"output": "/",
"glob": "*.txt"
},
"src/OpenSearchDescriptor.xml",
{
"glob": "**/*",
"input": "src/sitemaps",
"output": "/"
}
],
"index": {
"input": "src/prod/index.html",
"output": "index.html"
},
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "openaire-search:build"
"browserTarget": "explore:build"
},
"configurations": {
"production": {
"browserTarget": "openaire-search:build:production"
},
"beta": {
"browserTarget": "openaire-search:build:beta"
},
"test": {
"browserTarget": "openaire-search:build:test"
},
"development": {
"browserTarget": "openaire-search:build:development"
"browserTarget": "explore:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "openaire-search:build"
"browserTarget": "explore: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": [
"src/assets/common-assets/common/jquery.js",
"src/assets/common-assets/common/uikit.min.js",
"src/assets/common-assets/common/uikit-icons.min.js",
"node_modules/jquery/dist/jquery.js"
],
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css",
"src/material.scss"
"src/styles.css"
],
"scripts": [],
"assets": [
"src/assets",
"src/robots.txt",
"src/OpenSearchDescriptor.xml",
{
"glob": "**/*",
"input": "src/sitemaps",
"output": "/"
}
"src/assets"
]
}
},
@ -188,82 +251,100 @@
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"outputPath": "dist/explore/server",
"main": "server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
"production": {
"development": {
"outputHashing": "media",
"sourceMap": false,
"optimization": true
},
"test": {
"outputHashing": "media",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
},
{
"replace": "src/index.html",
"with": "src/index.prod.html"
},
{
"replace": "src/robots.txt",
"with": "src/robots.prod.txt"
"with": "src/environments/environment.test.ts"
}
]
],
"sourceMap": false,
"optimization": true
},
"beta": {
"outputHashing": "media",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.beta.ts"
},
{
"replace": "src/index.html",
"with": "src/index.beta.html"
},
{
"replace": "src/robots.txt",
"with": "src/robots.beta.txt"
}
]
],
"sourceMap": false,
"optimization": true
},
"test": {
"production": {
"outputHashing": "media",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
},
{
"replace": "src/index.html",
"with": "src/index.beta.html"
},
{
"replace": "src/robots.txt",
"with": "src/robots.beta.txt"
"with": "src/environments/environment.prod.ts"
}
]
},
"development": {}
],
"sourceMap": false,
"optimization": true
}
}
},
"serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server",
"options": {
"browserTarget": "explore:build",
"serverTarget": "explore:server"
},
"configurations": {
"production": {
"browserTarget": "explore:build:production",
"serverTarget": "explore:server:production"
}
}
},
"prerender": {
"builder": "@nguniversal/builders:prerender",
"options": {
"browserTarget": "explore:build:production",
"serverTarget": "explore:server:production",
"routes": [
"/"
]
},
"configurations": {
"production": {}
}
}
}
},
"openaire-search-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"explore-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "openaire-search:serve"
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "explore:serve"
},
"configurations": {
"production": {
"devServerTarget": "explore:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
@ -272,33 +353,5 @@
}
}
},
"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
}
}
"defaultProject": "explore"
}

@ -0,0 +1,9 @@
cd src/app/openaireLibrary
# Exclude Dashboard files
echo "Exclude Dashboard files"
svn update --set-depth exclude ./dashboard
# Exclude ck-editor usages
echo "Exclude ck-editor usages"
svn update --set-depth exclude ./sharedComponents/subscriber-invite
cd ../../../
echo "Done"

@ -1,116 +0,0 @@
{
"environment" : "beta",
"dashboard" : "explore",
"enablePiwikTrack" : true,
"useCache" : true,
"showAddThis" : true,
"metricsAPIURL" : "https://beta.services.openaire.eu/usagestats/",
"framesAPIURL" : "https://beta.openaire.eu/stats3/",
"statisticsAPIURL" : "https://beta.services.openaire.eu/stats-api/",
"statisticsFrameAPIURL":"https://beta.openaire.eu/stats/",
"statisticsFrameNewAPIURL": "https://stats.madgik.di.uoa.gr/stats-api/",
"useNewStatistisTool":true,
"claimsAPIURL" : "https://beta.services.openaire.eu/claims/rest/claimsService/",
"searchAPIURLLAst" : "https://beta.services.openaire.eu/search/v2/api/",
"searchResourcesAPIURL" : "https://beta.services.openaire.eu/search/v2/api/resources",
"openCitationsAPIURL" : "https://services.openaire.eu/opencitations/getCitations?id=",
"csvAPIURL" : "https://beta.services.openaire.eu/search/v2/api/reports",
"searchCrossrefAPIURL" : "https://api.crossref.org/works",
"searchDataciteAPIURL" : "https://api.datacite.org/works",
"searchOrcidURL" : "https://pub.orcid.org/v2.1/",
"orcidURL" : "https://orcid.org/",
"doiURL" : "https://dx.doi.org/",
"pmcURL": "http://europepmc.org/articles/",
"pmidURL": "https://www.ncbi.nlm.nih.gov/pubmed/",
"handleURL": "http://hdl.handle.net/",
"cordisURL" : "http://cordis.europa.eu/projects/",
"openDoarURL": "http://v2.sherpa.ac.uk/id/repository/",
"r3DataURL": "http://service.re3data.org/repository/",
"sherpaURL": "http://sherpa.ac.uk/romeo/issn/",
"sherpaURLSuffix": "/",
"zenodo" : "https://zenodo.org/",
"openAccess" : "https://www.openaire.eu/support/faq#article-id-234",
"openAccessRepo" : "https://www.openaire.eu/support/faq#article-id-310",
"fp7Guidlines" : "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme",
"h2020Guidlines" : "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020",
"ercGuidlines" : "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf",
"helpdesk" : "https://www.openaire.eu/support/helpdesk",
"helpdeskEmail": "helpdesk@openaire.eu",
"utilsService" : "https://demo.openaire.eu/utils-service",
"vocabulariesAPI" :"https://beta.services.openaire.eu/provision/mvc/vocabularies/",
"piwikBaseUrl" :"https://analytics.openaire.eu/piwik.php?idsite=",
"piwikSiteId" : "6",
"loginUrl" :"https://beta.services.openaire.eu/uoa-user-management/openid_connect_login",
"userInfoUrl" : "https://beta.services.openaire.eu/uoa-user-management/api/users/getUserInfo?accessToken=",
"logoutUrl" :"https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
"cookieDomain" :".openaire.eu",
"feedbackmail" :"feedback@openaire.eu",
"cacheUrl" :"https://demo.openaire.eu/cache/get?url=",
"datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/",
"adminToolsAPIURL" :"https://beta.services.openaire.eu/uoa-admin-tools/",
"adminToolsCommunity" :"openaire",
"contextsAPI":"https://beta.services.openaire.eu/openaire/context",
"communityAPI": "https://beta.services.openaire.eu/openaire/community/",
"csvLimit": 2000,
"pagingLimit": 20,
"resultsPerPage": 10,
"baseLink" : "",
"domain": "https://beta.explore.openaire.eu",
"searchLinkToPublication" : "/search/publication?articleId=",
"searchLinkToProject" : "/search/project?projectId=",
"searchLinkToDataProvider" : "/search/dataprovider?datasourceId=",
"searchLinkToDataset" : "/search/dataset?datasetId=",
"searchLinkToSoftwareLanding" : "/search/software?softwareId=",
"searchLinkToOrp" : "/search/other?orpId=",
"searchLinkToOrganization" : "/search/organization?organizationId=",
"searchLinkToPublications" : "/search/find/publications",
"searchLinkToDataProviders" : "/search/find/dataproviders",
"searchLinkToProjects" : "/search/find/projects",
"searchLinkToDatasets" : "/search/find/datasets",
"searchLinkToSoftware" : "/search/find/software",
"searchLinkToOrps" : "/search/find/other",
"searchLinkToOrganizations" : "/search/find/organizations",
"searchLinkToCompatibleDataProviders" : "/search/content-providers",
"searchLinkToCompatibleDataProvidersTable" : "/search/content-providers-table",
"searchLinkToEntityRegistriesDataProviders" : "/search/entity-registries",
"searchLinkToEntityRegistriesDataProvidersTable" : "/search/entity-registries-table",
"searchLinkToJournals" : "/search/journals",
"searchLinkToJournalsTable" : "/search/journals-table",
"searchLinkToResults" : "/search/find/research-outcomes",
"searchLinkToAdvancedPublications" : "/search/advanced/publications",
"searchLinkToAdvancedProjects" : "/search/advanced/projects",
"searchLinkToAdvancedDatasets" : "/search/advanced/datasets",
"searchLinkToAdvancedSoftware" : "/search/advanced/software",
"searchLinkToAdvancedOrps" : "/search/advanced/other",
"searchLinkToAdvancedDataProviders" : "/search/advanced/dataproviders",
"searchLinkToAdvancedOrganizations" : "/search/advanced/organizations",
"searchLinkToAdvancedResults" : "/search/advanced/research-outcomes",
"lastIndexInformationLink" : "https://www.openaire.eu/aggregation-and-content-provision-workflows",
"showLastIndexInformationLink" : false,
"widgetLink" : "https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=",
"claimsInformationLink": "https://beta.openaire.eu/linking",
"lastIndexUpdate": "2020-03-26",
"indexInfoAPI": "https://beta.services.openaire.eu/openaire/info/",
"depositLearnHowPage": "/participate/deposit/learn-how",
"depositSearchPage": "/participate/deposit/search",
"altMetricsAPIURL": "https://api.altmetric.com/v1/doi/",
"reCaptchaSiteKey": "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
"b2noteAPIURL": "http://b2note-dev.bsc.es/api/"
}

@ -1,7 +0,0 @@
cp /home/argiro.kokogiannaki/sitemap/dataset/* dist/browser/;
cp /home/argiro.kokogiannaki/sitemap/publication/* dist/browser/;
cp /home/argiro.kokogiannaki/sitemap/software/* dist/browser/;
cp /home/argiro.kokogiannaki/sitemap/other/* dist/browser/;
cp /home/argiro.kokogiannaki/sitemap/project/* dist/browser/;
cp /home/argiro.kokogiannaki/sitemap/organization/* dist/browser/;
cp /home/argiro.kokogiannaki/sitemap/dataprovider/* dist/browser/;

@ -1,55 +0,0 @@
#ATTENTION
#DON'T run this script in svn folder - it REMOVES files
#Copy project in another location "deploy-folder"
# go to "deploy-folder/deploy"
#1. uncomment the proper property file
#2. uncomment the rest commands
#3.run the script
#4.Check the Deploy instructions
#Property files:
# uncommect ONE of the following according to the deploy environment!!!
# cp production-properties.json ../src/assets/env-properties.json;
# cp test-properties.json ../src/assets/env-properties.json;
# cp beta-properties.json ../src/assets/env-properties.json;
## uncommect from here-->
# printf '\nCheck that you have the correct properties file\n';
# printf "\nPress key:";
# read -n1 ans
# pico ../src/assets/env-properties.json;
# printf '\nCheck the properties file version\n';
# echo -n "Press key:";
# read -n1 ans
# pico ../src/app/openaireLibrary/utils/properties/environment-specific.service.ts;
# printf '\nFor Production keep meta for bots';
# printf '\n\nCheck index.html:\n For test keep meta for noindex, for production remove noindex and keep meta for Search engines verification';
# printf '\nUpdate css/ js files version!';
# printf "\nPress key:";
# read -n1 ans
# printf "\nPressed";
# pico ../src/index.html;
# printf '\n\nCheck Robots.txt: \n For test and beta add "Disallow /" and comment all sitemaps, for production remove it!';
# printf "\nPress key:";
# read -n1 ans
# echo -n "Pressed";
# pico ../src/robots.txt;
# rm -rf ../src/assets/common-assets/.svn/;
# rm -rf ../src/app/openaireLibrary/.svn/;
# 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!'
##<-- to here
#Deploy instructions!
#copy "deploy-folder" in beta.explore.openaire.eu, test.openaire.eu or explore.openaire.eu depending which in environment want to deploy and properties selected
#copies of previous deployments exist in "/home/argiro.kokogiannaki/uoa-portal/environment.exlore-YYYY-MM-DD"
#run "npm i"
#become nodejs user be able to copy the files: "sudo su nodejs -s /bin/bash"
#check what is running "pm2 list"
#portal files exist in "/srv/www/portal"
#copy deployment files to the portal folder cp -r /home/argiro.kokogiannaki/uoa-portal/environment.exlore-YYYY-MM-DD/* /srv/www/portal"
#restart portal to get the changes "pm2 restart openaire"
#for test "pm2 restart test-explore"

@ -1,117 +0,0 @@
{
"environment" : "production",
"dashboard" : "explore",
"enablePiwikTrack" : true,
"useCache" : true,
"showAddThis" : false,
"metricsAPIURL" : "https://services.openaire.eu/usagestats/",
"framesAPIURL" : "https://www.openaire.eu/stats3/",
"statisticsAPIURL" : "https://beta.services.openaire.eu/stats-api/",
"statisticsFrameAPIURL":"https://www.openaire.eu/stats/",
"statisticsFrameNewAPIURL": "https://services.openaire.eu/stats/",
"useNewStatistisTool":false,
"claimsAPIURL" : "https://services.openaire.eu/claims/rest/claimsService/",
"searchAPIURLLAst" : "https://services.openaire.eu/search/v2/api/",
"searchResourcesAPIURL" : "https://services.openaire.eu/search/v2/api/resources",
"openCitationsAPIURL" : "https://services.openaire.eu/opencitations/getCitations?id=",
"csvAPIURL" : "https://services.openaire.eu/search/v2/api/reports",
"searchCrossrefAPIURL" : "https://api.crossref.org/works",
"searchDataciteAPIURL" : "https://api.datacite.org/works",
"searchOrcidURL" : "https://pub.orcid.org/v2.1/",
"orcidURL" : "https://orcid.org/",
"doiURL" : "https://dx.doi.org/",
"pmcURL": "http://europepmc.org/articles/",
"pmidURL": "https://www.ncbi.nlm.nih.gov/pubmed/",
"handleURL": "http://hdl.handle.net/",
"cordisURL" : "http://cordis.europa.eu/projects/",
"openDoarURL": "http://v2.sherpa.ac.uk/id/repository/",
"r3DataURL": "http://service.re3data.org/repository/",
"sherpaURL": "http://sherpa.ac.uk/romeo/issn/",
"sherpaURLSuffix": "/",
"zenodo" : "https://zenodo.org/",
"openAccess" : "https://www.openaire.eu/support/faq#article-id-234",
"openAccessRepo" : "https://www.openaire.eu/support/faq#article-id-310",
"fp7Guidlines" : "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme",
"h2020Guidlines" : "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020",
"ercGuidlines" : "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf",
"helpdesk" : "https://www.openaire.eu/support/helpdesk",
"helpdeskEmail": "helpdesk@openaire.eu",
"utilsService" : "https://explore.openaire.eu/utils-service",
"vocabulariesAPI" :"https://services.openaire.eu/provision/mvc/vocabularies/",
"piwikBaseUrl" :"https://analytics.openaire.eu/piwik.php?idsite=",
"piwikSiteId" : "109",
"loginUrl" :"https://services.openaire.eu/uoa-user-management/openid_connect_login",
"userInfoUrl" : " https://services.openaire.eu/uoa-user-management/api/users/getUserInfo?accessToken=",
"logoutUrl" :"https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
"cookieDomain" :".openaire.eu",
"feedbackmail" :"feedback@openaire.eu",
"cacheUrl" :"https://explore.openaire.eu/cache/get?url=",
"datasourcesAPI": "https://services.openaire.eu/openaire/ds/search/",
"adminToolsAPIURL" :"https://services.openaire.eu/uoa-admin-tools/",
"adminToolsCommunity" :"openaire",
"contextsAPI":"https://services.openaire.eu/openaire/context",
"communityAPI": "https://services.openaire.eu/openaire/community/",
"csvLimit": 2000,
"pagingLimit": 20,
"resultsPerPage": 10,
"baseLink" : "",
"domain":"https://explore.openaire.eu",
"searchLinkToPublication" : "/search/publication?articleId=",
"searchLinkToProject" : "/search/project?projectId=",
"searchLinkToDataProvider" : "/search/dataprovider?datasourceId=",
"searchLinkToDataset" : "/search/dataset?datasetId=",
"searchLinkToSoftwareLanding" : "/search/software?softwareId=",
"searchLinkToOrp" : "/search/other?orpId=",
"searchLinkToOrganization" : "/search/organization?organizationId=",
"searchLinkToPublications" : "/search/find/publications",
"searchLinkToDataProviders" : "/search/find/dataproviders",
"searchLinkToProjects" : "/search/find/projects",
"searchLinkToDatasets" : "/search/find/datasets",
"searchLinkToSoftware" : "/search/find/software",
"searchLinkToOrps" : "/search/find/other",
"searchLinkToOrganizations" : "/search/find/organizations",
"searchLinkToCompatibleDataProviders" : "/search/content-providers",
"searchLinkToCompatibleDataProvidersTable" : "/search/content-providers-table",
"searchLinkToEntityRegistriesDataProviders" : "/search/entity-registries",
"searchLinkToEntityRegistriesDataProvidersTable" : "/search/entity-registries-table",
"searchLinkToJournals" : "/search/journals",
"searchLinkToJournalsTable" : "/search/journals-table",
"searchLinkToResults" : "/search/find/research-outcomes",
"searchLinkToAdvancedPublications" : "/search/advanced/publications",
"searchLinkToAdvancedProjects" : "/search/advanced/projects",
"searchLinkToAdvancedDatasets" : "/search/advanced/datasets",
"searchLinkToAdvancedSoftware" : "/search/advanced/software",
"searchLinkToAdvancedOrps" : "/search/advanced/other",
"searchLinkToAdvancedDataProviders" : "/search/advanced/dataproviders",
"searchLinkToAdvancedOrganizations" : "/search/advanced/organizations",
"searchLinkToAdvancedResults" : "/search/advanced/research-outcomes",
"lastIndexInformationLink" : "https://www.openaire.eu/aggregation-and-content-provision-workflows",
"showLastIndexInformationLink" : true,
"widgetLink" : "https://www.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=",
"claimsInformationLink": "https://www.openaire.eu/linking",
"lastIndexUpdate": "2020-04-22",
"indexInfoAPI": "https://services.openaire.eu/openaire/info/",
"depositLearnHowPage": "/participate/deposit/learn-how",
"depositSearchPage": "/participate/deposit/search",
"altMetricsAPIURL": "https://api.altmetric.com/v1/doi/",
"reCaptchaSiteKey": "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
"b2noteAPIURL": "http://b2note-dev.bsc.es/api/"
}

@ -1,116 +0,0 @@
{
"environment" : "test",
"dashboard" : "explore",
"enablePiwikTrack" : false,
"enableHelper" : true,
"useCache" : true,
"showAddThis" : false,
"metricsAPIURL" : "https://services.openaire.eu/usagestats/",
"framesAPIURL" : "https://test.openaire.eu/stats3/",
"statisticsAPIURL" : "https://beta.services.openaire.eu/stats-api/",
"statisticsFrameAPIURL":"https://test.openaire.eu/stats/",
"statisticsFrameNewAPIURL": "https://services.openaire.eu/stats/",
"useNewStatistisTool":false,
"claimsAPIURL" : "https://services.openaire.eu/claims/rest/claimsService/",
"searchAPIURLLAst" : "http://services.openaire.eu:8480/shadowSearch/rest/v2/api/",
"searchResourcesAPIURL" : "http://services.openaire.eu:8480/shadowSearch/rest/v2/api/resources",
"openCitationsAPIURL" : "https://services.openaire.eu/opencitations/getCitations?id=",
"csvAPIURL" : "http://services.openaire.eu:8480/shadowSearch/rest/v2/api/reports",
"searchCrossrefAPIURL" : "https://api.crossref.org/works",
"searchDataciteAPIURL" : "https://api.datacite.org/works",
"searchOrcidURL" : "https://pub.orcid.org/v2.1/",
"orcidURL" : "https://orcid.org/",
"doiURL" : "https://dx.doi.org/",
"pmcURL": "http://europepmc.org/articles/",
"pmidURL": "https://www.ncbi.nlm.nih.gov/pubmed/",
"handleURL": "http://hdl.handle.net/",
"cordisURL" : "http://cordis.europa.eu/projects/",
"openDoarURL": "http://v2.sherpa.ac.uk/id/repository/",
"r3DataURL": "http://service.re3data.org/repository/",
"sherpaURL": "http://sherpa.ac.uk/romeo/issn/",
"sherpaURLSuffix": "/",
"zenodo" : "https://zenodo.org/",
"openAccess" : "https://www.openaire.eu/support/faq#article-id-234",
"openAccessRepo" : "https://www.openaire.eu/support/faq#article-id-310",
"fp7Guidlines" : "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme",
"h2020Guidlines" : "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020",
"ercGuidlines" : "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf",
"helpdesk" : "https://www.openaire.eu/support/helpdesk",
"helpdeskEmail": "helpdesk@openaire.eu",
"uploadService" : "https://explore.openaire.eu/utils-service",
"vocabulariesAPI" :"https://services.openaire.eu/provision/mvc/vocabularies/",
"piwikBaseUrl" :"https://analytics.openaire.eu/piwik.php?idsite=",
"piwikSiteId" : "109",
"loginUrl" :"https://services.openaire.eu/uoa-user-management/openid_connect_login",
"userInfoUrl" : " https://services.openaire.eu/uoa-user-management/api/users/getUserInfo?accessToken=",
"logoutUrl" :"https://aai.openaire.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=",
"cookieDomain" :".openaire.eu",
"feedbackmail" :"feedback@openaire.eu",
"cacheUrl" :"https://explore.openaire.eu/cache/get?url=",
"datasourcesAPI": "https://services.openaire.eu/openaire/ds/search/",
"adminToolsAPIURL" :"https://services.openaire.eu/uoa-admin-tools/",
"adminToolsCommunity" :"openaire",
"contextsAPI":"https://services.openaire.eu/openaire/context",
"communityAPI": "https://services.openaire.eu/openaire/community/",
"csvLimit": 2000,
"pagingLimit": 20,
"resultsPerPage": 10,
"baseLink" : "",
"domain":"https://test.explore.openaire.eu",
"searchLinkToPublication" : "/search/publication?articleId=",
"searchLinkToProject" : "/search/project?projectId=",
"searchLinkToDataProvider" : "/search/dataprovider?datasourceId=",
"searchLinkToDataset" : "/search/dataset?datasetId=",
"searchLinkToSoftwareLanding" : "/search/software?softwareId=",
"searchLinkToOrp" : "/search/other?orpId=",
"searchLinkToOrganization" : "/search/organization?organizationId=",
"searchLinkToPublications" : "/search/find/publications",
"searchLinkToDataProviders" : "/search/find/dataproviders",
"searchLinkToProjects" : "/search/find/projects",
"searchLinkToDatasets" : "/search/find/datasets",
"searchLinkToSoftware" : "/search/find/software",
"searchLinkToOrps" : "/search/find/other",
"searchLinkToOrganizations" : "/search/find/organizations",
"searchLinkToCompatibleDataProviders" : "/search/content-providers",
"searchLinkToCompatibleDataProvidersTable" : "/search/content-providers-table",
"searchLinkToEntityRegistriesDataProviders" : "/search/entity-registries",
"searchLinkToEntityRegistriesDataProvidersTable" : "/search/entity-registries-table",
"searchLinkToJournals" : "/search/journals",
"searchLinkToJournalsTable" : "/search/journals-table",
"searchLinkToResults" : "/search/find/research-outcomes",
"searchLinkToAdvancedPublications" : "/search/advanced/publications",
"searchLinkToAdvancedProjects" : "/search/advanced/projects",
"searchLinkToAdvancedDatasets" : "/search/advanced/datasets",
"searchLinkToAdvancedSoftware" : "/search/advanced/software",
"searchLinkToAdvancedOrps" : "/search/advanced/other",
"searchLinkToAdvancedDataProviders" : "/search/advanced/dataproviders",
"searchLinkToAdvancedOrganizations" : "/search/advanced/organizations",
"searchLinkToAdvancedResults" : "/search/advanced/research-outcomes",
"lastIndexInformationLink" : "https://www.openaire.eu/aggregation-and-content-provision-workflows",
"showLastIndexInformationLink" : false,
"widgetLink" : "https://test.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=",
"claimsInformationLink": "https://www.openaire.eu/linking",
"lastIndexUpdate": "2019-09-07",
"indexInfoAPI": "https://services.openaire.eu/openaire/info/",
"depositLearnHowPage": "/participate/deposit/learn-how",
"depositSearchPage": "/participate/deposit/search",
"altMetricsAPIURL": "https://api.altmetric.com/v1/doi/",
"reCaptchaSiteKey": "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
"b2noteAPIURL": "http://b2note-dev.bsc.es/api/"
}

@ -0,0 +1,28 @@
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

@ -0,0 +1,23 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('Welcome to explore!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

@ -0,0 +1,11 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get(browser.baseUrl) as Promise<any>;
}
getTitleText() {
return element(by.css('app-root h1')).getText() as Promise<string>;
}
}

@ -0,0 +1,13 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

@ -1,3 +0,0 @@
rm -rf node_modules/ng-openaire-library/;
npm install /home/argirok/projects/openaire/uoa-services-library/trunk/ng-openaire-library/dist/ng-openaire-library-1.0.0.tgz;
npm start;

@ -1,81 +1,74 @@
{
"name": "openaire-search",
"name": "explore",
"version": "1.0.0",
"license": "Openaire",
"contributors": [
"Argiro Kokogiannaki <argirok@di.uoa.gr>",
"Konstantina Galouni <kgalouni@di.uoa.gr>"
],
"scripts": {
"ng": "ng",
"start": "ng serve --disable-host-check --host 0.0.0.0 --port 4300",
"start:ssr": "npm run build:ssr && npm run serve:ssr",
"start:prerender": "npm run build:prerender && npm run serve:prerender",
"start:ssr-beta": "npm run build:ssr-beta && npm run serve:ssr",
"start:prerender-beta": "npm run build:prerender-beta && npm run serve:prerender",
"start:ssr-test": "npm run build:ssr-test && npm run serve:ssr",
"start:prerender-test": "npm run build:prerender-test && npm run serve:prerender",
"start:ssr-dev": "npm run build:ssr-dev && npm run serve:ssr",
"start:prerender-dev": "npm run build:prerender-dev && npm run serve:prerender",
"build": "ng build",
"build:client-and-server-bundles": "ng build --prod --stats-json=true && ng run openaire-search:server:production",
"build:client-and-server-bundles-beta": "ng build --configuration=beta --stats-json=true && ng run openaire-search:server:beta",
"build:client-and-server-bundles-test": "ng build --configuration=test --stats-json=true && ng run openaire-search:server:test",
"build:client-and-server-bundles-dev": "ng build --configuration=development --stats-json=true && ng run openaire-search:server:development",
"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",
"build:prerender-beta": "npm run build:client-and-server-bundles-beta && npm run webpack:server && npm run generate:prerender",
"build:ssr-beta": "npm run build:client-and-server-bundles-beta && npm run webpack:server",
"build:prerender-test": "npm run build:client-and-server-bundles-test && npm run webpack:server && npm run generate:prerender",
"build:ssr-test": "npm run build:client-and-server-bundles-test && npm run webpack:server",
"build:prerender-dev": "npm run build:client-and-server-bundles-dev && npm run webpack:server && npm run generate:prerender",
"build:ssr-dev": "npm run build:client-and-server-bundles-dev && npm run webpack:server",
"generate:prerender": "cd dist && node prerender",
"webpack:server": "webpack --config webpack.server.config.js --progress --colors",
"serve:prerender": "cd dist/browser && http-server",
"serve:ssr": "node dist/server",
"after-build-clean": "rm -rf src node_modules .idea/ installOpenaireLib.sh deploy dist/browser/assets/common-assets/.svn/ dist/browser/stats.json ; "
"build-dev": "ng build --configuration=development",
"build-test": "ng build --configuration=test",
"build-beta": "ng build --configuration=beta",
"build-prod": "ng build --prod",
"webpack-bundle-analyzer": "ng build --stats-json && webpack-bundle-analyzer dist/explore/browser/stats.json --host 0.0.0.0",
"test": "ng test",
"e2e": "ng e2e",
"dev:ssr": "ng run explore:serve-ssr",
"serve:ssr": "node dist/explore/server/main.js",
"build:ssr-dev": "npm run build-dev && ng run explore:server:development",
"build:ssr-test": "npm run build-test && ng run explore:server:test",
"build:ssr-beta": "npm run build-beta && ng run explore:server:beta",
"build:ssr-prod": "npm run build-prod && ng run explore:server:production",
"prerender": "ng run explore:prerender",
"postinstall": "chmod +x clean-library.sh && ./clean-library.sh",
"after-build-clean": "rm -rf dist/explore/browser/assets/common-assets/.svn/ src/app/openaireLibrary/.svn node_modules src/assets/common-assets/.svn/"
},
"private": true,
"dependencies": {
"@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/animations": "~11.2.14",
"@angular/cdk": "^11.2.13",
"@angular/common": "~11.2.14",
"@angular/compiler": "~11.2.14",
"@angular/core": "~11.2.14",
"@angular/forms": "~11.2.14",
"@angular/localize": "^11.2.14",
"@angular/material": "^11.2.13",
"@angular/platform-browser": "~11.2.14",
"@angular/platform-browser-dynamic": "~11.2.14",
"@angular/platform-server": "~11.2.14",
"@angular/router": "~11.2.14",
"@nguniversal/express-engine": "^11.2.1",
"clipboard": "^1.5.16",
"core-js": "^2.4.1",
"core-js": "^2.5.4",
"express": "^4.15.2",
"jquery": "^3.4.1",
"ng-recaptcha": "^7.0.1",
"prom-client": "^11.3.0",
"rxjs": "^6.5.1",
"ts-md5": "^1.2.0",
"tslib": "^1.9.0",
"ng-recaptcha": "^3.0.5",
"zone.js": "^0.8.26"
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@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/jquery": "^3.3.29",
"@types/node": "^8.0.30",
"cpy-cli": "^1.0.1",
"http-server": "^0.10.0",
"reflect-metadata": "^0.1.10",
"rxjs": "6.5.1",
"rxjs-compat": "^6.5.1",
"ts-loader": "^4.2.0",
"typescript": "3.2.4",
"webpack-cli": "^3.3.2"
"@angular-devkit/build-angular": "~0.1102.13",
"@angular/cli": "~11.2.13",
"@angular/compiler-cli": "~11.2.14",
"@angular/language-service": "~11.2.14",
"@nguniversal/builders": "^11.2.1",
"@types/express": "^4.17.0",
"@types/compression": "^1.7.0",
"@types/node": "^12.11.1",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.3",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.6.0",
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"typescript": "~4.0.7"
}
}

@ -1,45 +0,0 @@
// Load zone.js for the server.
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
import { join } from 'path';
import { enableProdMode } from '@angular/core';
// Faster server renders w/ Prod mode (dev mode never needed)
enableProdMode();
// Express Engine
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
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');
const BROWSER_FOLDER = join(process.cwd(), 'browser');
// Load the index.html file containing referances to your application bundle.
const index = readFileSync(join('browser', 'index.html'), 'utf8');
let previousRender = Promise.resolve();
// Iterate each route path
ROUTES.forEach(route => {
const fullPath = join(BROWSER_FOLDER, route);
// Make sure the directory structure is there
if(!existsSync(fullPath)){
mkdirSync(fullPath);
}
// Writes rendered HTML to index.html, replacing the file if it already exists.
previousRender = previousRender.then(_ => renderModuleFactory(AppServerModuleNgFactory, {
document: index,
url: route,
extraProviders: [
provideModuleMap(LAZY_MODULE_MAP)
]
})).then(html => writeFileSync(join(fullPath, 'index.html'), html));
});

@ -1,121 +1,127 @@
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import {enableProdMode} from '@angular/core';
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import {join} from 'path';
import {readFileSync} from 'fs';
import * as compression from 'compression';
import { join } from 'path';
// Faster server renders w/ Prod mode (dev mode never needed)
enableProdMode();
// Express server
const app = express();
const compression = require('compression');
app.use(compression());
const PORT = process.env.PORT || 3000;
const DIST_FOLDER = join(process.cwd(), 'dist');
// Our index.html we'll use as our template
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');
// Express Engine
import {ngExpressEngine, RenderOptions} from '@nguniversal/express-engine';
// Import module map for lazy loading
import {provideModuleMap} from '@nguniversal/module-map-ngfactory-loader';
import {routes} from "./routes";
import { AppServerModule } from './src/main.server';
import { APP_BASE_HREF } from '@angular/common';
import { existsSync } from 'fs';
import * as prom from "prom-client";
import {REQUEST, RESPONSE} from "@nguniversal/express-engine/tokens";
import {renderModuleFactory} from "@angular/platform-server";
/*
// 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)
]
}));
*/
// be able to get request and get domain from there
const register = new prom.Registry();
const responses = new prom.Counter({
name: 'portal_http_responses_total',
help: 'A counter for portal response codes for every existed or not existed pages.',
labelNames: ['route', 'code'],
registers: [register]
});
const histogram = new prom.Histogram({
name: 'portal_http_request_duration_seconds',
help: 'A Histogram for a portal. Providing information about page visits and load latency in seconds.',
labelNames: ['route'],
registers: [register],
buckets: [0.1, 0.2, 0.5, 1, 2]
});
app.engine('html', (_, options: any, callback) => {
const opts = {
document: template,
url: options.req.url,
extraProviders: [
provideModuleMap(LAZY_MODULE_MAP),
{
provide: REQUEST,
useValue: options.req
},
{
provide: RESPONSE,
useValue: options.req.res,
},
]
};
renderModuleFactory(AppServerModuleNgFactory, opts)
.then(html => callback(null, html)
);
});
app.set('view engine', 'html');
app.set('views', join(DIST_FOLDER, 'browser'));
/* - Example Express Rest API endpoints -
app.get('/api/**', (req, res) => { });
*/
// Server static files from /browser
app.get('*.*', express.static(join(DIST_FOLDER, 'browser'), {
maxAge: '1y'
}));
app.get('/metrics', (req, res) => {
res.set('Content-Type', register.contentType);
res.end(register.metrics());
});
// All regular routes use the Universal engine
app.get('*', (req, res) => {
if (routes.indexOf(req.path) !== -1) {
const end = histogram.startTimer({route: req.path});
res.render('index', {req});
res.on('finish', function () {
responses.inc({route: req.path, code: res.statusCode});
end();
});
} else {
res.render('index', {req});
res.on('finish', function () {
responses.inc({route: '**', code: res.statusCode});
});
}
});
// Start up the Node server
app.listen(PORT, () => {
console.log(`Node Express server listening on http://localhost:${PORT}`);
});
import {routes} from "./routes";
import {REQUEST, RESPONSE} from "./src/app/openaireLibrary/utils/tokens";
// The Express app is exported so that it can be used by serverless Functions.
export function app() {
const server = express();
server.use(compression());
const distFolder = join(process.cwd(), 'dist/explore/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index';
const register = new prom.Registry();
const responses = new prom.Counter({
name: 'portal_http_responses_total',
help: 'A counter for portal response codes for every existed or not existed pages.',
labelNames: ['route', 'code'],
registers: [register]
});
const histogram = new prom.Histogram({
name: 'portal_http_request_duration_seconds',
help: 'A Histogram for a portal. Providing information about page visits and load latency in seconds.',
labelNames: ['route'],
registers: [register],
buckets: [0.1, 0.2, 0.5, 1, 2]
});
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
server.engine('html', ngExpressEngine({
bootstrap: AppServerModule,
}));
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('*.*', express.static(distFolder, {
maxAge: '1y'
}));
server.get('/metrics', (req, res) => {
res.set('Content-Type', register.contentType);
res.end(register.metrics());
});
// All regular routes use the Universal engine
server.get('*', (req, res) => {
if (routes.indexOf(req.path) !== -1) {
const end = histogram.startTimer({route: req.path});
res.render(indexHtml, {
req, providers: [
{
provide: APP_BASE_HREF,
useValue: req.baseUrl
},
{
provide: REQUEST, useValue: (req)
},
{
provide: RESPONSE, useValue: (res)
}
]
}
);
res.on('finish', function () {
responses.inc({route: req.path, code: res.statusCode});
end();
});
} else {
res.render(indexHtml, {
req, providers: [
{
provide: APP_BASE_HREF,
useValue: req.baseUrl
},
{
provide: REQUEST, useValue: (req)
},
{
provide: RESPONSE, useValue: (res)
}
]
}
);
res.on('finish', function () {
responses.inc({route: '**', code: res.statusCode});
});
}
});
return server;
}
function run() {
const port = process.env.PORT || 4000;
// Start up the Node server
const server = app();
server.listen(port, () => {
console.log(`Node Express server listening on http://localhost:${port}`);
});
}
// Webpack will replace 'require' with '__webpack_require__'
// '__non_webpack_require__' is a proxy to Node 'require'
// The below code is to ensure that the server is run only when not requiring the bundle.
declare const __non_webpack_require__: NodeRequire;
const mainModule = __non_webpack_require__.main;
const moduleFilename = mainModule && mainModule.filename || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run();
}
export * from './src/main.server';

@ -5,59 +5,55 @@ import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.
const routes: Routes = [
// Other Pages
{path: '', loadChildren: './home/home.module#HomeModule'},
{path: '', loadChildren: () => import('./home/home.module').then(m => m.HomeModule)},
//{ path: 'home', loadChildren: './home/home.module#HomeModule'},
{path: 'home', redirectTo: '', pathMatch: 'full'},
{path: 'mail-preferences', loadChildren: './userEmailPreferences/mailPrefs.module#LibMailPrefsModule'},
{path: 'mail-preferences', loadChildren: () => import('./userEmailPreferences/mailPrefs.module').then(m => m.LibMailPrefsModule)},
// ORCID Pages
{path: 'orcid', loadChildren: './orcid/orcid.module#LibOrcidModule'},
// {
// path: 'recommended-orcid-links',
// loadChildren: './orcid/recommend-orcid-links/searchRecommendedResultsForOrcid.module#LibSearchRecommendedResultsForOrcidModule'
// },
{path: 'my-orcid-links', loadChildren: './orcid/my-orcid-links/myOrcidLinks.module#LibMyOrcidLinksModule'},
{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)},
// Landing Pages
{path: 'search/result', loadChildren: './landingPages/result/libResult.module#LibResultModule'},
{path: 'search/publication', loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule'},
{path: 'search/dataset', loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule'},
{path: 'search/software', loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule'},
{path: 'search/other', loadChildren: './landingPages/orp/libOrp.module#LibOrpModule'},
{path: 'search/project', loadChildren: './landingPages/project/libProject.module#LibProjectModule'},
{path: 'search/result', loadChildren: () => import('./landingPages/result/libResult.module').then(m => m.LibResultModule)},
{path: 'search/publication', loadChildren: () => import('./landingPages/publication/libPublication.module').then(m => m.LibPublicationModule)},
{path: 'search/dataset', loadChildren: () => import('./landingPages/dataset/libDataset.module').then(m => m.LibDatasetModule)},
{path: 'search/software', loadChildren: () => import('./landingPages/software/libSoftware.module').then(m => m.LibSoftwareModule)},
{path: 'search/other', loadChildren: () => import('./landingPages/orp/libOrp.module').then(m => m.LibOrpModule)},
{path: 'search/project', loadChildren: () => import('./landingPages/project/libProject.module').then(m => m.LibProjectModule)},
{
path: 'search/dataprovider',
loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule'
loadChildren: () => import('././landingPages/dataProvider/libDataProvider.module').then(m => m.LibDataProviderModule)
},
{
path: 'search/organization',
loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule'
loadChildren: () => import('./landingPages/organization/libOrganization.module').then(m => m.LibOrganizationModule)
},
{
path: 'project-report',
loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule'
loadChildren: () => import('./landingPages/htmlProjectReport/libHtmlProjectReport.module').then(m => m.LibHtmlProjectReportModule)
},
// Search Pages
{path: 'search/find', loadChildren: './searchPages/find/libSearch.module#LibMainSearchModule'},
{path: 'search/find', loadChildren: () => import('./searchPages/find/libSearch.module').then(m => m.LibMainSearchModule)},
{
path: 'search/find/research-outcomes',
loadChildren: './searchPages/simple/searchResearchResults.module#OpenaireSearchResearchResultsModule'
loadChildren: () => import('./searchPages/simple/searchResearchResults.module').then(m => m.OpenaireSearchResearchResultsModule)
},
{path: 'search/find/publications', component: PageURLResolverComponent},
{path: 'search/find/datasets', component: PageURLResolverComponent},
{path: 'search/find/software', component: PageURLResolverComponent},
{path: 'search/find/other', component: PageURLResolverComponent},
{path: 'search/find/projects', loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule'},
{path: 'search/find/projects', loadChildren: () => import('./searchPages/simple/searchProjects.module').then(m => m.LibSearchProjectsModule)},
{
path: 'search/find/dataproviders',
loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule'
loadChildren: () => import('./searchPages/simple/searchDataProviders.module').then(m => m.LibSearchDataProvidersModule)
},
{
path: 'search/find/organizations',
loadChildren: './searchPages/simple/searchOrganizations.module#LibSearchOrganizationsModule'
loadChildren: () => import('./searchPages/simple/searchOrganizations.module').then(m => m.LibSearchOrganizationsModule)
},
// Advanced Search Pages
{
path: 'search/advanced/research-outcomes',
loadChildren: './searchPages/advanced/searchResearchResults.module#OpenaireAdvancedSearchResearchResultsModule'
loadChildren: () => import('./searchPages/advanced/searchResearchResults.module').then(m => m.OpenaireAdvancedSearchResearchResultsModule)
},
{path: 'search/advanced/publications', component: PageURLResolverComponent},
{path: 'search/advanced/datasets', component: PageURLResolverComponent},
@ -65,28 +61,28 @@ const routes: Routes = [
{path: 'search/advanced/other', component: PageURLResolverComponent},
{
path: 'search/advanced/organizations',
loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule'
loadChildren: () => import('./searchPages/advanced/advancedSearchOrganizations.module').then(m => m.LibAdvancedSearchOrganizationsModule)
},
{
path: 'search/advanced/dataproviders',
loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule'
loadChildren: () => import('./searchPages/advanced/advancedSearchDataProviders.module').then(m => m.LibAdvancedSearchDataProvidersModule)
},
{
path: 'search/advanced/projects',
loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule'
loadChildren: () => import('./searchPages/advanced/advancedSearchProjects.module').then(m => m.LibAdvancedSearchProjectsModule)
},
// Search Content Providers Pages
{
path: 'search/content-providers',
loadChildren: './searchPages/dataProviders/compatibleDataProviders.module#LibCompatibleDataProvidersModule'
loadChildren: () => import('./searchPages/dataProviders/compatibleDataProviders.module').then(m => m.LibCompatibleDataProvidersModule)
},
{path: 'search/content-providers-table', redirectTo: 'search/content-providers'},
{
path: 'search/entity-registries',
loadChildren: './searchPages/dataProviders/entityRegistries.module#LibEntityRegistriesModule'
loadChildren: () => import('./searchPages/dataProviders/entityRegistries.module').then(m => m.LibEntityRegistriesModule)
},
{path: 'search/entity-registries-table', redirectTo: 'search/entity-registries'},
{path: 'search/journals', loadChildren: './searchPages/dataProviders/journals.module#LibJournalsModule'},
{path: 'search/journals', loadChildren: () => import('./searchPages/dataProviders/journals.module').then(m => m.LibJournalsModule)},
{path: 'search/journals-table', redirectTo: 'search/journals'},
// Deposit Pages
{path: 'participate/deposit-datasets', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
@ -94,31 +90,30 @@ const routes: Routes = [
{path: 'participate/deposit-subject-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
{path: 'participate/deposit-publications', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
{path: 'participate/deposit-publications-result', redirectTo: 'participate/deposit/learn-how', pathMatch: 'full'},
{path: 'participate/deposit/learn-how', loadChildren: './deposit/deposit.module#LibDepositModule'},
{path: 'participate/deposit/learn-how', loadChildren: () => import('./deposit/deposit.module').then(m => m.LibDepositModule)},
{
path: 'participate/deposit/search',
loadChildren: './deposit/searchDataprovidersToDeposit.module#LibSearchDataprovidersToDepositModule'
loadChildren: () => import('./deposit/searchDataprovidersToDeposit.module').then(m => m.LibSearchDataprovidersToDepositModule)
},
// Linking Pages
{path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule'},
{path: 'claims', loadChildren: './claims/claimsAdmin/claimsAdmin.module#LibClaimsAdminModule'},
{path: 'participate/claim', loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule'},
{path: 'myclaims', loadChildren: () => import('./claims/myClaims/myClaims.module').then(m => m.LibMyClaimsModule)},
{path: 'claims', loadChildren: () => import('./claims/claimsAdmin/claimsAdmin.module').then(m => m.LibClaimsAdminModule)},
{path: 'participate/claim', loadChildren: () => import('./claims/linking/linkingGeneric.module').then(m => m.LibLinkingGenericModule)},
{
path: 'participate/direct-claim',
loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule'
loadChildren: () => import('./claims/directLinking/directLinking.module').then(m => m.LibDirectLinkingModule)
},
// { path: 'claims-project-manager', loadChildren: './claims/claimsByToken/claimsByToken.module#LibClaimsByTokenModule'},
// help pages - do not exist in Admin portal/api/db
{path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule'},
{path: 'user-info', loadChildren: './login/libUser.module#LibUserModule'},
{path: 'reload', loadChildren: () => import('./reload/libReload.module').then(m => m.LibReloadModule)},
{path: 'user-info', loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule)},
{path: 'error', component: OpenaireErrorPageComponent},
{path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent}
];
@NgModule({
imports: [RouterModule.forRoot(routes, {
onSameUrlNavigation: "reload",
relativeLinkResolution: 'corrected'
onSameUrlNavigation: "reload"
})],
exports: [RouterModule]
})

@ -26,7 +26,7 @@ import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.servi
ErrorModule,
NavigationBarModule, BottomModule,
CookieLawModule,
BrowserModule.withServerTransition({appId: 'my-app'}),
BrowserModule.withServerTransition({ appId: 'explore' }),
AppRoutingModule,
BrowserTransferStateModule,
BrowserAnimationsModule, PageURLResolverModule, Schema2jsonldModule

@ -1,24 +1,15 @@
import {NgModule} from '@angular/core';
import { NgModule } from '@angular/core';
import {ServerModule, ServerTransferStateModule} from '@angular/platform-server';
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";
import { AppModule } from './app.module';
import { AppComponent } from './app.component';
@NgModule({
imports: [
// The AppServerModule should import your AppModule followed
// by the ServerModule from @angular/platform-server.
AppModule,
ServerModule,
ModuleMapLoaderModule,
ServerTransferStateModule
],
// Since the bootstrapped component is not inherited from your
// imported AppModule, it needs to be repeated here.
bootstrap: [AppComponent],
})
export class AppServerModule {
/*constructor(@Inject(REQUEST) private request: Request) {}*/
}
export class AppServerModule {}

@ -2,7 +2,6 @@ import {Component, ViewChild} from '@angular/core';
import {Subscription} from 'rxjs';
import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
import "rxjs/add/observable/zip";
import {Meta, Title} from '@angular/platform-browser';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {SearchDataprovidersService} from '../openaireLibrary/services/searchDataproviders.service';
@ -146,7 +145,7 @@ export class HomeComponent {
filterOperator: "or"
};
public pageContents = null;
@ViewChild("numbersComponent") numbersComponent: NumbersComponent;
@ViewChild("numbersComponent", { static: true }) numbersComponent: NumbersComponent;
constructor(
private route: ActivatedRoute,

@ -37,7 +37,7 @@ const COMPONENTS = [
]
})
export class SharedModule {
static forRoot(): ModuleWithProviders {
static forRoot(): ModuleWithProviders<SharedModule> {
return {
ngModule: SharedModule,
};

@ -61,7 +61,7 @@ export let properties: EnvProperties = {
cacheUrl: "https://demo.openaire.eu/cache/get?url=",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/search/",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/",
adminToolsAPIURL: "https://beta.services.openaire.eu/uoa-admin-tools/",

@ -61,7 +61,7 @@ export let properties: EnvProperties = {
cacheUrl: "https://explore.openaire.eu/cache/get?url=",
datasourcesAPI: "https://services.openaire.eu/openaire/ds/search/",
datasourcesAPI: "https://services.openaire.eu/openaire/ds/api/",
adminToolsAPIURL: "https://services.openaire.eu/uoa-admin-tools/",

@ -61,7 +61,7 @@ export let properties: EnvProperties = {
cacheUrl: "https://explore.openaire.eu/cache/get?url=",
datasourcesAPI: "https://services.openaire.eu/openaire/ds/search/",
datasourcesAPI: "https://services.openaire.eu/openaire/ds/api/",
adminToolsAPIURL: "https://services.openaire.eu/uoa-admin-tools/",

@ -68,7 +68,7 @@ export let properties: EnvProperties = {
adminToolsAPIURL: "http://duffy.di.uoa.gr:8080/uoa-admin-tools/",
adminToolsCommunity: "openaire",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/search/",
datasourcesAPI: "https://beta.services.openaire.eu/openaire/ds/api/",
contextsAPI: "https://dev-openaire.d4science.org/openaire/context",
communityAPI: "https://dev-openaire.d4science.org/openaire/community/",

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage/explore'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

@ -1,7 +1,15 @@
import {enableProdMode} from "@angular/core";
import {properties} from "./environments/environment";
/***************************************************************************************************
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
if (properties.environment !== "development") {
import {enableProdMode} from '@angular/core';
import {properties} from './environments/environment';
if (properties.environment !== 'development') {
enableProdMode();
}
export { AppServerModule } from './app/app.server.module';
export {AppServerModule} from './app/app.server.module';
export {renderModule, renderModuleFactory} from '@angular/platform-server';

@ -9,5 +9,6 @@ if (properties.environment !== "development") {
}
document.addEventListener('DOMContentLoaded', () => {
platformBrowserDynamic().bootstrapModule(AppModule);
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
});

@ -1,3 +1,7 @@
/***************************************************************************************************
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
@ -11,62 +15,53 @@
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
/**
* Required to support Web Animations `@angular/animation`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
* Web Animations `@angular/platform-browser/animations`
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
*/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags.ts';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by Angular itself.
* Zone JS is required by default for Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/**
* Need to import at least one locale-data with intl.
*/
// import 'intl/locale-data/jsonp/en';

@ -1,7 +1,5 @@
/* You can add global styles to this file, and also import other style files */
@import '~@angular/material/prebuilt-themes/indigo-pink.css';
@import "assets/common-assets/common/theme.css";
@import "assets/common-assets/common/custom.css";
@import "assets/common-assets/library.css";
@import "assets/explore-custom.css";
@import "assets/explore-custom.css";

@ -0,0 +1,20 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

@ -2,14 +2,13 @@
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": [
"node"
]
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}

@ -1,21 +1,17 @@
{
"extends": "../tsconfig.json",
"extends": "./tsconfig.app.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
// Set the module format to "commonjs":
"module": "commonjs",
"outDir": "../out-tsc/app-server",
"target": "es2016",
"types": [
"node"
]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
"files": [
"main.server.ts",
"../server.ts"
],
// Add "angularCompilerOptions" with the AppServerModule you wrote
// set as the "entryModule".
"angularCompilerOptions": {
"entryModule": "app/app.server.module#AppServerModule"
"entryModule": "./app/app.server.module#AppServerModule"
}
}

@ -0,0 +1,18 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

@ -1,22 +1,23 @@
{
"compileOnSave": false,
"compilerOptions": {
"importHelpers": true,
"baseUrl": "./",
"downlevelIteration": true,
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2020",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"importHelpers": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"es2018",
"dom"
],
"module": "es2015",
"baseUrl": "./"
]
}
}
}

@ -1,52 +0,0 @@
// Work around for https://github.com/angular/angular-cli/issues/7200
const path = require('path');
const webpack = require('webpack');
module.exports = {
//mode: 'none',
entry: {
// This is our Express server for Dynamic universal
server: './server.ts',
// This is an example of Static prerendering (generative)
prerender: './prerender.ts'
},
target: 'node',
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'),
filename: '[name].js'
},
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: [
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, 'src'), // location of your src
{} // a map of your routes
),
new webpack.ContextReplacementPlugin(
// fixes WARNING Critical dependency: the request of a dependency is an expression
/(.+)?express(\\|\/)(.+)?/,
path.join(__dirname, 'src'),
{}
)
]
}

@ -8,11 +8,11 @@ const prom = require('prom-client');
const URL = require('url');
const expireShort = 2 * 60 * 1000; //2mins
const expireLong = 24 * 60 * 60 * 1000; //24 hours
const cacheMaxSize =500;
const cacheMaxSize = 500;
const longCachingRequests = ["/communityFull", "/full", "/pagehelpcontent",
"/provision/mvc/vocabularies/","/pages?page_route=",
"/allmetrics", "/countryusagestats/", "/openaire/info",
"/api/communities/", "/openaire/contexts/"];
"/provision/mvc/vocabularies/", "/pages?page_route=",
"/allmetrics", "/countryusagestats/", "/openaire/info",
"/api/communities/", "/openaire/contexts/"];
let cors = require('cors');
app.use(cors());
@ -42,9 +42,9 @@ const histogram = new prom.Histogram({
let cache = () => {
return (req, res, next) => {
if(req.query.url) {
if(mcache.memsize() > cacheMaxSize){
console.log("Max cache size reached!"+cacheMaxSize);
if (req.query.url) {
if (mcache.memsize() > cacheMaxSize) {
console.log("Max cache size reached!" + cacheMaxSize);
clearCache();
}
let key = '__express__' + req.query.url;
@ -64,13 +64,13 @@ let cache = () => {
res.send = (body) => {
let alreadyCached = !!mcache.get(key);
entries.set(mcache.memsize());
if(!alreadyCached) {
if (!alreadyCached) {
responses.inc({scheme: scheme, target: target, code: res.statusCode});
end();
}
if (res.statusCode === 200) {
// console.log("Expire in " +(longCache?expireLong:expireShort) + " " +req.query.url);
mcache.put(key, body,longCache?expireLong:expireShort, () => {
mcache.put(key, body, longCache ? expireLong : expireShort, () => {
entries.set(mcache.memsize());
});
}
@ -87,21 +87,21 @@ let cache = () => {
app.get('/clear', (req, res) => {
let c = mcache.size();
const url = req.query.url;
let message ="";
if(url){
let message = "";
if (url) {
let key = '__express__' + req.query.url;
mcache.del(key);
message = "Delete entry with key "+ url;
message = "Delete entry with key " + url;
entries.set(mcache.size());
}else{
} else {
clearCache();
message ="Delete "+c + " entries. Now there are: "+mcache.size()
}
message = "Delete " + c + " entries. Now there are: " + mcache.size()
}
res.header("Access-Control-Allow-Headers", "Origin, Content-Type, Content-Length");
res.header("Access-Control-Allow-Methods", "GET, OPTIONS");
res.header("Access-Control-Allow-Methods", "GET, OPTIONS");
res.header("Content-Type", "application/json");
res.status(200).send(getResponse(200,message));
res.status(200).send(getResponse(200, message));
});
app.get('/metrics', (req, res) => {
@ -147,34 +147,35 @@ function getResponse(code, message) {
response["code"] = code;
response["message"] = message;
return response;
}
function clearCache(){
function clearCache() {
console.log("cache is cleared!");
mcache.clear();
entries.set(mcache.size());
}
function checkForLongCachedRequests(url){
let long =false;
function checkForLongCachedRequests(url) {
let long = false;
longCachingRequests.forEach(partUrl => {
if(url.indexOf(partUrl) !==-1){
if (url.indexOf(partUrl) !== -1) {
long = true;
}
});
return long;
}
function resetAtMidnight() {
console.log("Run Reset timer");
var now = new Date();
var night = new Date(
now.getFullYear(),
now.getMonth(),
now.getDate() + 1 , // the next day, ...
0, 0, 0 // ...at 00:00:00 hours
now.getDate() + 1, // the next day, ...
0, 0, 0 // ...at 00:00:00 hours
);
var msToMidnight = night.getTime() - now.getTime();
setTimeout(function() {
setTimeout(function () {
clearCache(); // <-- This is the function being called at midnight.
resetAtMidnight(); // Then, reset again next midnight.
}, msToMidnight);

@ -8,13 +8,13 @@
},
"dependencies": {
"cors": "^2.8.5",
"express": "^4.17.1",
"express": "^4.15.2",
"memory-cache": "^0.2.0",
"superagent": "^5.0.5",
"prom-client": "^11.3.0"
},
"engines": {
"node": "8.1.x"
"node": "16.3.0"
},
"author": "Argiro Kokogiannaki <argirok@di.uoa.gr>",
"license": "NKUA"

@ -1,10 +1,10 @@
{
"name": "trunk",
"name": "utils-service",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node uploadService.js"
},
"keywords": [],
"author": "",
@ -13,9 +13,12 @@
"body-parser": "^1.15.2",
"cookie-parser": "^1.4.4",
"cors": "^2.8.4",
"express": "^4.17.1",
"express": "^4.15.2",
"multer": "^1.1.0",
"properties-reader": "0.0.16",
"tinyurl": "^1.1.4"
},
"engines": {
"node": "16.3.0"
}
}

Loading…
Cancel
Save