diff --git a/.browserslistrc b/.browserslistrc
new file mode 100644
index 0000000..37371cb
--- /dev/null
+++ b/.browserslistrc
@@ -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
\ No newline at end of file
diff --git a/README.md b/README.md
index 96e55e9..d4385db 100644
--- a/README.md
+++ b/README.md
@@ -1,54 +1,39 @@
-# Angular Universal & Anguar-CLI minimal starter
+# Connect
-> 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:4200/`. 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.
+Use the `npm run build-beta` for a beta build.
+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.
+Use the `npm run build:ssr-beta` for a beta build.
+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/).
diff --git a/angular.json b/angular.json
index 7be801f..c5cb604 100644
--- a/angular.json
+++ b/angular.json
@@ -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": {
- "ng-universal-demo": {
+ "connect": {
"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/connect/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"
],
@@ -24,102 +49,123 @@
"src/material.scss"
],
"scripts": [
- "node_modules/jquery/dist/jquery.js",
+ "node_modules/jquery/dist/jquery.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"
- },
- {
- "replace": "src/index.html",
- "with": "src/index.prod.html"
- }
- ]
- },
- "beta": {
- "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"
- },
- {
- "replace": "src/index.html",
- "with": "src/index.beta.html"
- }
- ]
- },
"development": {
"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"
+ }
+ ]
+ },
+ "beta": {
+ "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,
+ "namedChunks": false,
+ "aot": true,
+ "extractLicenses": true,
+ "vendorChunk": false,
+ "buildOptimizer": true,
+ "budgets": [
+ {
+ "type": "initial",
+ "maximumWarning": "2mb",
+ "maximumError": "5mb"
+ },
+ {
+ "type": "anyComponentStyle",
+ "maximumWarning": "6kb"
+ }
+ ]
+ },
+ "production": {
+ "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,
+ "namedChunks": false,
+ "aot": true,
+ "extractLicenses": true,
+ "vendorChunk": false,
+ "buildOptimizer": true,
+ "budgets": [
+ {
+ "type": "initial",
+ "maximumWarning": "2mb",
+ "maximumError": "5mb"
+ },
+ {
+ "type": "anyComponentStyle",
+ "maximumWarning": "6kb"
+ }
+ ]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
- "browserTarget": "ng-universal-demo:build"
+ "browserTarget": "connect:build"
},
"configurations": {
"production": {
- "browserTarget": "ng-universal-demo:build:production"
- },
- "beta": {
- "browserTarget": "ng-universal-demo:build:beta"
- },
- "development": {
- "browserTarget": "ng-universal-demo:build:development"
+ "browserTarget": "connect:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
- "browserTarget": "ng-universal-demo:build"
+ "browserTarget": "connect: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"
- ],
+ "karmaConfig": "src/karma.conf.js",
"styles": [
- "src/styles.css",
- "src/material.scss"
+ "src/styles.css"
],
+ "scripts": [],
"assets": [
"src/assets"
]
@@ -140,58 +186,89 @@
"server": {
"builder": "@angular-devkit/build-angular:server",
"options": {
- "outputPath": "dist/server",
- "main": "src/main.server.ts",
+ "outputPath": "dist/connect/server",
+ "main": "server.ts",
"tsConfig": "src/tsconfig.server.json"
},
"configurations": {
- "production": {
- "fileReplacements": [
- {
- "replace": "src/environments/environment.ts",
- "with": "src/environments/environment.prod.ts"
- },
- {
- "replace": "src/index.html",
- "with": "src/index.prod.html"
- }
- ]
+ "development": {
+ "outputHashing": "media",
+ "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"
}
- ]
+ ],
+ "sourceMap": false,
+ "optimization": true
},
- "development": {}
+ "production": {
+ "outputHashing": "media",
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.prod.ts"
+ }
+ ],
+ "sourceMap": false,
+ "optimization": true
+ }
+ }
+ },
+ "serve-ssr": {
+ "builder": "@nguniversal/builders:ssr-dev-server",
+ "options": {
+ "browserTarget": "connect:build",
+ "serverTarget": "connect:server"
+ },
+ "configurations": {
+ "production": {
+ "browserTarget": "connect:build:production",
+ "serverTarget": "connect:server:production"
+ }
+ }
+ },
+ "prerender": {
+ "builder": "@nguniversal/builders:prerender",
+ "options": {
+ "browserTarget": "connect:build:production",
+ "serverTarget": "connect:server:production",
+ "routes": [
+ "/"
+ ]
+ },
+ "configurations": {
+ "production": {}
}
}
}
},
- "ng-universal-demo-e2e": {
- "root": "e2e",
- "sourceRoot": "e2e",
+ "connect-e2e": {
+ "root": "e2e/",
"projectType": "application",
+ "prefix": "",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
- "protractorConfig": "./protractor.conf.js",
- "devServerTarget": "ng-universal-demo:serve"
+ "protractorConfig": "e2e/protractor.conf.js",
+ "devServerTarget": "connect:serve"
+ },
+ "configurations": {
+ "production": {
+ "devServerTarget": "connect:serve:production"
+ }
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
- "tsConfig": [
- "e2e/tsconfig.e2e.json"
- ],
+ "tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
@@ -200,33 +277,5 @@
}
}
},
- "defaultProject": "ng-universal-demo",
- "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": "connect"
}
diff --git a/clean-library.sh b/clean-library.sh
new file mode 100644
index 0000000..1cadfec
--- /dev/null
+++ b/clean-library.sh
@@ -0,0 +1,6 @@
+cd src/app/openaireLibrary
+# Exclude Dashboard files
+echo "Exclude Dashboard files"
+svn update --set-depth exclude ./dashboard
+cd ../../../
+echo "Done"
diff --git a/deploy/beta-properties.json b/deploy/beta-properties.json
deleted file mode 100644
index b2461aa..0000000
--- a/deploy/beta-properties.json
+++ /dev/null
@@ -1,126 +0,0 @@
-{
- "environment" : "beta",
- "dashboard" : "connect",
- "enablePiwikTrack" : true,
- "useCache" : true,
- "showContent" : true,
- "showAddThis" : false,
- "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,
- "impactFactorsAPIURL" :"https://bip-api.imsi.athenarc.gr/paper/scores/batch/",
- "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/",
- "zenodoCommunities" : "https://zenodo.org/api/communities/",
- "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" : "80",
- "loginUrl" :"https://beta.services.openaire.eu/connect-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=",
-
- "adminToolsAPIURL" :"https://beta.services.openaire.eu/uoa-admin-tools",
-
- "adminToolsCommunity" :"connect",
- "datasourcesAPI": "https://beta.services.openaire.eu/openaire/ds/search/",
- "contextsAPI":"https://beta.services.openaire.eu/openaire/context",
- "communityAPI": "https://beta.services.openaire.eu/openaire/community/",
- "communitiesAPI": "https://beta.services.openaire.eu/openaire/community/communities",
-
- "csvLimit": 2000,
- "pagingLimit": 20,
- "resultsPerPage": 10,
-
- "baseLink" :"",
- "domain":"https://beta.connect.openaire.eu",
-
- "afterLoginRedirectLink": "/myCommunities",
-
- "searchLinkToPublication" : "/search/publication?articleId=",
- "searchLinkToProject" : "/search/project?projectId=",
- "searchLinkToDataProvider" : "/search/dataprovider?datasourceId=",
- "searchLinkToDataset" : "/search/dataset?datasetId=",
- "searchLinkToSoftwareLanding" : "/search/software?softwareId=",
- "searchLinkToOrganization" : "/search/organization?organizationId=",
- "searchLinkToOrp" : "/search/other?orpId=",
-
- "searchLinkToCommunities" : "/search/find/communities",
- "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",
- "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://beta.openaire.eu/aggregation-and-content-provision-workflows",
- "showLastIndexInformationLink" : true,
- "widgetLink" : "https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=",
- "claimsInformationLink": "https://beta.openaire.eu/linking",
-
- "depositLearnHowPage": "/participate/deposit/learn-how",
- "depositSearchPage": "/participate/deposit/search",
- "shareInZenodoPage": "/participate/deposit/zenodo",
-
- "reCaptchaSiteKey": "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
-
- "admins" : ["rcd-helpdesk@openaire.eu"],
- "lastIndexUpdate": "2020-05-06",
- "indexInfoAPI": "https://beta.services.openaire.eu/openaire/info/",
- "altMetricsAPIURL": "https://api.altmetric.com/v1/doi/",
- "b2noteAPIURL": "http://b2note-dev.bsc.es/api/",
- "adminPortalURL": "https://beta.admin.connect.openaire.eu"
-}
diff --git a/deploy/prepareDeploy.sh b/deploy/prepareDeploy.sh
deleted file mode 100755
index 2d24a1f..0000000
--- a/deploy/prepareDeploy.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#ATTENTION
-#DON'T run it in svn folder - it REMOVES files
-#Copy project in another location eg "deploy-folder"
-#go to "deploy-folder/deploy"
-#uncomment the proper commands
-#run the script
-
-# cp theproperties file according to the deploy environment!!!
-## uncommect one of the following -->
-# cp beta-properties.json ../src/assets/env-properties.json;
-# cp production-properties.json ../src/assets/env-properties.json;
-
-## uncommect from here-->
-# printf '\nCheck that you have the correct properties file';
-# echo -n "Press key:";
-# read -n1 ans
-# pico ../src/assets/env-properties.json;
-# printf '\nCheck the properties file version';
-# echo -n "Press key:";
-# read -n1 ans
-# pico ../src/app/openaireLibrary/utils/properties/environment-specific.service.ts;
-# echo 'For Production keep meta for bots';
-# printf '\n\nCheck index.html: For test and beta keep meta for noindex, for production remove noindex and keep meta for Search engines verification';
-# printf '\nUpdate css/ js files version!';
-# echo -n "Press key:";
-# read -n1 ans
-# echo -n "Pressed";
-# pico ../src/index.html;
-# pico ../src/app/utils/customization/customization.component.ts;
-# echo -n 'Check Robots.txt: For test and beta add "Diasallow /", for production remove it!';
-# echo -n "Press key:";
-# read -n1 ans
-# pico ../src/robots.txt;
-# echo -n "Pressed";
-# 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.connect.openaire.eu or connect.openaire.eu
-#copies of previous deployments exist in "/home/argiro.kokogiannaki/connect-portal/connectYYYY-MM-DD"
-#run "npm i"
-#become nodejs user to 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/connect"
-#copy deployment files to the portal folder "cp -r /home/argiro.kokogiannaki/connect-portal/connectYYYY-MM-DD/* /srv/www/portal/connect"
-#restart portal to get the changes "pm2 restart connect"
diff --git a/deploy/production-properties.json b/deploy/production-properties.json
deleted file mode 100644
index 8cddc28..0000000
--- a/deploy/production-properties.json
+++ /dev/null
@@ -1,127 +0,0 @@
-{
- "environment" : "production",
- "dashboard" : "connect",
- "enablePiwikTrack" : false,
- "useCache" : true,
- "showContent" : true,
- "showAddThis" : false,
- "metricsAPIURL" : "https://services.openaire.eu/usagestats/",
- "framesAPIURL" : "https://www.openaire.eu/stats3/",
- "statisticsAPIURL" : "https://services.openaire.eu/stats-api/",
- "statisticsFrameAPIURL":"https://www.openaire.eu/stats/",
- "statisticsFrameNewAPIURL": "https://services.openaire.eu/stats/",
- "useNewStatistisTool":false,
- "impactFactorsAPIURL" :"https://bip-api.imsi.athenarc.gr/paper/scores/batch/",
- "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/",
- "zenodoCommunities" : "https://zenodo.org/api/communities/",
- "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" : "112",
- "loginUrl" :"https://services.openaire.eu/_UPDATE_/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" :"connect",
- "contextsAPI":"https://services.openaire.eu/openaire/context",
-
- "communityAPI": "https://services.openaire.eu/openaire/community/",
- "communitiesAPI": "https://services.openaire.eu/openaire/community/communities",
-
- "csvLimit": 2000,
- "pagingLimit": 20,
- "resultsPerPage": 10,
-
- "baseLink" :"",
- "domain": "https://connect.openaire.eu",
-
- "afterLoginRedirectLink": "/myCommunities",
-
- "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=",
-
- "searchLinkToCommunities" : "/search/find/communities",
- "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",
- "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",
-
- "depositLearnHowPage": "/participate/deposit/learn-how",
- "depositSearchPage": "/participate/deposit/search",
- "shareInZenodoPage": "/participate/deposit/zenodo",
- "reCaptchaSiteKey": "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
-
- "admins" : ["rcd-helpdesk@openaire.eu"],
- "lastIndexUpdate": "2019-07-24",
- "indexInfoAPI": "https://services.openaire.eu/openaire/info/",
- "altMetricsAPIURL": "https://api.altmetric.com/v1/doi/",
- "b2noteAPIURL": "http://b2note-dev.bsc.es/api/",
- "adminPortalURL": "https://admin.connect.openaire.eu"
-}
diff --git a/package.json b/package.json
index ab6bc8a..c3dfbd8 100644
--- a/package.json
+++ b/package.json
@@ -1,78 +1,72 @@
{
- "name": "openaire-connect",
+ "name": "connect",
"version": "1.0.0",
- "license": "Openaire",
- "contributors": [
- "Argiro Kokogiannaki ",
- "Konstantina Galouni "
- ],
"scripts": {
"ng": "ng",
- "start": " ng serve --disable-host-check --host 0.0.0.0",
- "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-dev": "npm run build:ssr-dev && npm run serve:ssr",
- "start:prerender-dev": "npm run build:prerender-dev && npm run serve:prerender",
+ "start": "ng serve --disable-host-check --host 0.0.0.0 --port 4200",
"build": "ng build",
- "build:client-and-server-bundles": "ng build --prod --stats-json=true && ng run ng-universal-demo:server:production",
- "build:client-and-server-bundles-beta": "ng build --configuration=beta --stats-json=true && ng run ng-universal-demo:server:beta",
- "build:client-and-server-bundles-dev": "ng build --configuration=development --stats-json=true && ng run ng-universal-demo: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-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-beta": "ng build --configuration=beta",
+ "build-prod": "ng build --prod",
+ "webpack-bundle-analyzer": "ng build --stats-json && webpack-bundle-analyzer dist/connect/browser/stats.json --host 0.0.0.0",
+ "test": "ng test",
+ "e2e": "ng e2e",
+ "dev:ssr": "ng run connect:serve-ssr",
+ "serve:ssr": "node dist/connect/server/main.js",
+ "build:ssr-dev": "npm run build-dev && ng run connect:server:development",
+ "build:ssr-beta": "npm run build-beta && ng run connect:server:beta",
+ "build:ssr-prod": "npm run build-prod && ng run connect:server:production",
+ "prerender": "ng run connect:prerender",
+ "postinstall": "chmod +x clean-library.sh && ./clean-library.sh",
+ "after-build-clean": "rm -rf dist/connect/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",
- "ngx-json-ld": "0.1.6",
- "prom-client": "^11.3.0",
+ "ng-recaptcha": "^7.0.1",
+ "ng2-ckeditor": "1.3.1",
+ "rxjs": "^6.5.1",
"ts-md5": "^1.2.0",
- "tslib": "^1.9.0",
- "zone.js": "^0.8.26",
- "ng-recaptcha": "^3.0.5",
- "ng2-ckeditor": "1.1.9"
+ "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.14",
+ "@angular/cli": "~11.2.14",
+ "@angular/compiler-cli": "~11.2.14",
+ "@angular/language-service": "~11.2.14",
+ "@nguniversal/builders": "^11.2.1",
+ "@types/node": "^12.11.1",
+ "@types/jasmine": "~3.6.0",
+ "@types/jasminewd2": "~2.0.3",
+ "@types/express": "^4.17.0",
+ "@types/compression": "^1.7.0",
+ "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"
}
}
diff --git a/prerender.ts b/prerender.ts
deleted file mode 100644
index c664006..0000000
--- a/prerender.ts
+++ /dev/null
@@ -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));
-});
diff --git a/server.ts b/server.ts
index 1fa5859..a745ceb 100644
--- a/server.ts
+++ b/server.ts
@@ -1,86 +1,48 @@
import 'zone.js/dist/zone-node';
-import 'reflect-metadata';
-import { renderModuleFactory } from '@angular/platform-server';
-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 PORT = process.env.PORT || 4000;
-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 {REQUEST, RESPONSE} from "@nguniversal/express-engine/tokens";
+import {AppServerModule} from './src/main.server';
+import {APP_BASE_HREF} from '@angular/common';
+import {existsSync} from 'fs';
+import {REQUEST, RESPONSE} from "./src/app/openaireLibrary/utils/tokens";
import {isArray} from "util";
-// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
-// app.engine('html', ngExpressEngine({
-// bootstrap: AppServerModuleNgFactory,
-// providers: [
-// { provide: 'request', useFactory: () => options.req, deps: [] },
-// provideModuleMap(LAZY_MODULE_MAP)
-// ]
-// }));
-
-// be able to get request and get domain from there
-
-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'));
-// Allow frames from specific domains
-app.use(function (req, res, next) {
- var XFRAME_WHITELIST = [ 'http://spitoo.di.uoa.gr:5000/','http://scoobydoo.di.uoa.gr:5000/', 'https://beta.admin.connect.openaire.eu/','https://admin.connect.openaire.eu/' ];
- let referer: string;
- if(req.headers.referer){
- referer = isArray(req.headers.referer)?req.headers.referer[0]:(req.headers.referer);
- referer = referer.split("?")[0];
- }
- if ( referer && (XFRAME_WHITELIST.indexOf(referer) != -1 || referer.indexOf("/customize-layout") !=-1 || referer.indexOf(".d4science.org") != -1)) {
- // res.header('X-FRAME-OPTIONS', 'allow from ' +req.headers.referer);
- }else {
- res.header('X-FRAME-OPTIONS', 'SAMEORIGIN');
- }
- next();
-});
- // - Serve sitemap based on the host -
- app.get('/sitemap.xml', (req, res) => {
+// 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/connect/browser');
+ const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index';
+
+ // 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);
+
+ server.use(function (req, res, next) {
+ var XFRAME_WHITELIST = [ 'http://spitoo.di.uoa.gr:5000/','http://scoobydoo.di.uoa.gr:5000/', 'https://beta.admin.connect.openaire.eu/','https://admin.connect.openaire.eu/' ];
+ let referer: string;
+ if(req.headers.referer){
+ referer = isArray(req.headers.referer)?req.headers.referer[0]:(req.headers.referer);
+ referer = referer.split("?")[0];
+ }
+ if ( referer && (XFRAME_WHITELIST.indexOf(referer) != -1 || referer.indexOf("/customize-layout") !=-1 || referer.indexOf(".d4science.org") != -1)) {
+ // res.header('X-FRAME-OPTIONS', 'allow from ' +req.headers.referer);
+ }else {
+ res.header('X-FRAME-OPTIONS', 'SAMEORIGIN');
+ }
+ next();
+ });
+
+ // - Serve sitemap based on the host -
+ server.get('/sitemap.xml', (req, res) => {
let host = req.get("host").split(":")[0];
let connectLinks= ["/","/about/learn-how","/about/learn-in-depth", "/about/faq","/search/find/communities"];
let communityLinks= ["/","/search/find/research-outcomes?size=20","/search/advanced/research-outcomes?size=20","/participate/deposit/learn-how","/organizations", "/content"];
@@ -92,52 +54,85 @@ app.use(function (req, res, next) {
" ";
for(let link of (host.indexOf("connect.openaire.eu") == -1 ?communityLinks:connectLinks)){
sitemap += urlPre + "https://" + host + link + urlSuf;
- }
+ }
sitemap += "\n";
res.setHeader('content-type', 'application/xml');
res.send( sitemap);
});
-app.get('/robots.txt', (req, res) => {
- let host = req.get("host").split(":")[0];
- let robots = "";
- if(host.indexOf(".openaire.eu") != -1 && host.indexOf("beta.") == -1 ){
- //link to disallow
- let connectLinks= ["/about/*","/search/find/communities"];
- let communityLinks= ["/search/advanced/*","/participate/*",
- "/search/project",'/search/result', '/search/publication', '/search/dataset','/search/software','/search/other','/search/dataprovider','/search/organization','/project-report',
- '/search/find/publications','/search/find/datasets','/search/find/software','/search/find/other','/search/find/projects','/search/find/dataproviders','/search/find/research-outcomes'
-
- ];
-
- robots = "User-Agent: *\n"+
- "Crawl-delay: 30\n" +
- "Sitemap: /sitemap.xml\n";
- for(let link of (host.indexOf("connect.openaire.eu") == -1 ?connectLinks:communityLinks)){
- robots += "Disallow: " + link + "\n";
+
+ // - Serve robots based on the host -
+ server.get('/robots.txt', (req, res) => {
+ let host = req.get("host").split(":")[0];
+ let robots = "";
+ if (host.indexOf(".openaire.eu") != -1 && host.indexOf("beta.") == -1) {
+ //link to disallow
+ let connectLinks = ["/about/*", "/search/find/communities"];
+ let communityLinks = ["/search/advanced/*", "/participate/*",
+ "/search/project", '/search/result', '/search/publication', '/search/dataset', '/search/software', '/search/other', '/search/dataprovider', '/search/organization', '/project-report',
+ '/search/find/publications', '/search/find/datasets', '/search/find/software', '/search/find/other', '/search/find/projects', '/search/find/dataproviders', '/search/find/research-outcomes'
+
+ ];
+ robots = "User-Agent: *\n" +
+ "Crawl-delay: 30\n" +
+ "Sitemap: /sitemap.xml\n";
+ for (let link of (host.indexOf("connect.openaire.eu") == -1 ? connectLinks : communityLinks)) {
+ robots += "Disallow: " + link + "\n";
+ }
+ } else {
+ robots = "User-Agent: *\n" +
+ "Disallow: /\n"
}
- }else{
- robots = "User-Agent: *\n" +
- "Disallow: /\n"
- }
- res.setHeader('content-type', 'text/plain');
- res.send( robots);
-});
+ res.setHeader('content-type', 'text/plain');
+ res.send(robots);
+ });
+
+ // Example Express Rest API endpoints
+ // server.get('/api/**', (req, res) => { });
+ // Serve static files from /browser
+ server.get('*.*', express.static(distFolder, {
+ maxAge: '1y'
+ }));
+
+ // All regular routes use the Universal engine
+ server.get('*', (req, res) => {
+ res.render(indexHtml, {
+ req, providers: [
+ {
+ provide: APP_BASE_HREF,
+ useValue: req.baseUrl
+ },
+ {
+ provide: REQUEST, useValue: (req)
+ },
+ {
+ provide: RESPONSE, useValue: (res)
+ }
+ ]
+ }
+ );
+ });
+
+ return server;
+}
-/* - Example Express Rest API endpoints -
- app.get('/api/**', (req, res) => { });
-*/
+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}`);
+ });
+}
-// Server static files from /browser
-app.get('*.*', express.static(join(DIST_FOLDER, 'browser'), {
- maxAge: '1y'
-}));
+// 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();
+}
-// ALl regular routes use the Universal engine
-app.get('*', (req, res) => {
- res.render('index', { req });
-});
-
-// Start up the Node server
-app.listen(PORT, () => {
- console.log(`Node Express server listening on http://localhost:${PORT}`);
-});
+export * from './src/main.server';
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index 4cbbad4..4897548 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -6,94 +6,94 @@ import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.
const routes: Routes = [
// ORCID Pages
- {path: 'orcid', loadChildren: './orcid/orcid.module#LibOrcidModule'},
- {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)},
/** Other Pages */
- {path: '', loadChildren: './communitywrapper/communityWrapper.module#CommunityWrapperModule'},
+ {path: '', loadChildren: () => import('./communitywrapper/communityWrapper.module').then(m => m.CommunityWrapperModule)},
{path: 'about', redirectTo: 'about/learn-how', pathMatch: 'full'},
- {path: 'about/learn-how', loadChildren: './learn-how/learn-how.module#LearnHowModule'},
- {path: 'about/learn-in-depth', loadChildren: './learn-how/learnInDepth/learn-in-depth.module#LearnInDepthModule'},
- {path: 'about/faq', loadChildren: './learn-how/faqs/faqs.module#FaqsModule'},
- {path: 'contact-us', loadChildren: './contact/contact.module#ContactModule'},
- {path: 'invite', loadChildren: './utils/subscribe/invite/invite.module#InviteModule'},
- {path: 'content', loadChildren: './content/contentPage.module#ContentPageModule', canActivate: [IsCommunity]},
+ {path: 'about/learn-how', loadChildren: () => import('./learn-how/learn-how.module').then(m => m.LearnHowModule)},
+ {path: 'about/learn-in-depth', loadChildren: () => import('./learn-how/learnInDepth/learn-in-depth.module').then(m => m.LearnInDepthModule)},
+ {path: 'about/faq', loadChildren: () => import('./learn-how/faqs/faqs.module').then(m => m.FaqsModule)},
+ {path: 'contact-us', loadChildren: () => import('./contact/contact.module').then(m => m.ContactModule)},
+ {path: 'invite', loadChildren: () => import('./utils/subscribe/invite/invite.module').then(m => m.InviteModule)},
+ {path: 'content', loadChildren: () => import('./content/contentPage.module').then(m => m.ContentPageModule), canActivate: [IsCommunity]},
{
path: 'organizations',
- loadChildren: './htmlPages/organizations/organizationsPage.module#OrganizationsPageModule',
+ loadChildren: () => import('./htmlPages/organizations/organizationsPage.module').then(m => m.OrganizationsPageModule),
canActivate: [IsCommunity]
},
{
path: 'publications',
- loadChildren: './htmlPages/publications/publications-page.module#PublicationsPageModule',
+ loadChildren: () => import('./htmlPages/publications/publications-page.module').then(m => m.PublicationsPageModule),
canActivate: [IsCommunity]
},
{
path: 'projects',
- loadChildren: './htmlPages/projects/projectsPage.module#ProjectsPageModule',
+ loadChildren: () => import('./htmlPages/projects/projectsPage.module').then(m => m.ProjectsPageModule),
canActivate: [IsCommunity]
},
{
path: 'national-bulletins',
- loadChildren: './htmlPages/nationalBulletins/nationalBulletinsPage.module#NaionalBulletinPageModule',
+ loadChildren: () => import('./htmlPages/nationalBulletins/nationalBulletinsPage.module').then(m => m.NaionalBulletinPageModule),
canActivate: [IsCommunity]
},
- {path: 'curators', loadChildren: './curators/curators.module#CuratorsModule', canActivate: [IsCommunity]},
- {path: 'subjects', loadChildren: './subjects/subjects.module#SubjectsModule', canActivate: [IsCommunity]},
- {path: 'myCommunities', loadChildren: './my-communities/my-communities.module#MyCommunitiesModule'},
+ {path: 'curators', loadChildren: () => import('./curators/curators.module').then(m => m.CuratorsModule), canActivate: [IsCommunity]},
+ {path: 'subjects', loadChildren: () => import('./subjects/subjects.module').then(m => m.SubjectsModule), canActivate: [IsCommunity]},
+ {path: 'myCommunities', loadChildren: () => import('./my-communities/my-communities.module').then(m => m.MyCommunitiesModule)},
/** Testing Page for help contents */
- {path: 'helper-test', loadChildren: './helper-test/helper-test.module#HelperTestModule'},
+ {path: 'helper-test', loadChildren: () => import('./helper-test/helper-test.module').then(m => m.HelperTestModule)},
/** Landing Pages */
{
path: 'search/result',
- loadChildren: './landingPages/result/libResult.module#LibResultModule',
+ loadChildren: () => import('./landingPages/result/libResult.module').then(m => m.LibResultModule),
canActivate: [IsCommunity]
},
{
path: 'search/publication',
- loadChildren: './landingPages/publication/libPublication.module#LibPublicationModule',
+ loadChildren: () => import('./landingPages/publication/libPublication.module').then(m => m.LibPublicationModule),
canActivate: [IsCommunity]
},
{
path: 'search/dataset',
- loadChildren: './landingPages/dataset/libDataset.module#LibDatasetModule',
+ loadChildren: () => import('./landingPages/dataset/libDataset.module').then(m => m.LibDatasetModule),
canActivate: [IsCommunity]
},
{
path: 'search/software',
- loadChildren: './landingPages/software/libSoftware.module#LibSoftwareModule',
+ loadChildren: () => import('./landingPages/software/libSoftware.module').then(m => m.LibSoftwareModule),
canActivate: [IsCommunity]
},
- {path: 'search/other', loadChildren: './landingPages/orp/libOrp.module#LibOrpModule', canActivate: [IsCommunity]},
+ {path: 'search/other', loadChildren: () => import('./landingPages/orp/libOrp.module').then(m => m.LibOrpModule), canActivate: [IsCommunity]},
{
path: 'search/project',
- loadChildren: './landingPages/project/libProject.module#LibProjectModule',
+ loadChildren: () => import('./landingPages/project/libProject.module').then(m => m.LibProjectModule),
canActivate: [IsCommunity]
},
{
path: 'search/dataprovider',
- loadChildren: '././landingPages/dataProvider/libDataProvider.module#LibDataProviderModule',
+ loadChildren: () => import('././landingPages/dataProvider/libDataProvider.module').then(m => m.LibDataProviderModule),
canActivate: [IsCommunity]
},
{
path: 'search/organization',
- loadChildren: './landingPages/organization/libOrganization.module#LibOrganizationModule',
+ loadChildren: () => import('./landingPages/organization/libOrganization.module').then(m => m.LibOrganizationModule),
canActivate: [IsCommunity]
},
{
path: 'project-report',
- loadChildren: './landingPages/htmlProjectReport/libHtmlProjectReport.module#LibHtmlProjectReportModule'
+ loadChildren: () => import('./landingPages/htmlProjectReport/libHtmlProjectReport.module').then(m => m.LibHtmlProjectReportModule)
},
/** Search Pages */
{path: 'search/find', redirectTo: 'search/find/research-outcomes', pathMatch: 'full'},
{
path: 'search/find/communities',
- loadChildren: './searchPages/communities/searchCommunities.module#SearchCommunitiesModule'
+ loadChildren: () => import('./searchPages/communities/searchCommunities.module').then(m => m.SearchCommunitiesModule)
},
{
path: 'search/find/research-outcomes',
- loadChildren: './searchPages/simple/searchResearchResults.module#OpenaireSearchResearchResultsModule',
+ loadChildren: () => import('./searchPages/simple/searchResearchResults.module').then(m => m.OpenaireSearchResearchResultsModule),
canActivate: [IsCommunity]
},
{path: 'search/find/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]},
@@ -102,18 +102,18 @@ const routes: Routes = [
{path: 'search/find/other', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{
path: 'search/find/projects',
- loadChildren: './searchPages/simple/searchProjects.module#LibSearchProjectsModule',
+ loadChildren: () => import('./searchPages/simple/searchProjects.module').then(m => m.LibSearchProjectsModule),
canActivate: [IsCommunity]
},
{
path: 'search/find/dataproviders',
- loadChildren: './searchPages/simple/searchDataProviders.module#LibSearchDataProvidersModule',
+ loadChildren: () => import('./searchPages/simple/searchDataProviders.module').then(m => m.LibSearchDataProvidersModule),
canActivate: [IsCommunity]
},
/** Advanced Search Pages */
{
path: 'search/advanced/research-outcomes',
- loadChildren: './searchPages/advanced/searchResearchResults.module#OpenaireAdvancedSearchResearchResultsModule',
+ loadChildren: () => import('./searchPages/advanced/searchResearchResults.module').then(m => m.OpenaireAdvancedSearchResearchResultsModule),
canActivate: [IsCommunity]
},
{path: 'search/advanced/publications', component: PageURLResolverComponent, canActivate: [IsCommunity]},
@@ -122,100 +122,81 @@ const routes: Routes = [
{path: 'search/advanced/other', component: PageURLResolverComponent, canActivate: [IsCommunity]},
{
path: 'search/advanced/organizations',
- loadChildren: './searchPages/advanced/advancedSearchOrganizations.module#LibAdvancedSearchOrganizationsModule',
+ loadChildren: () => import('./searchPages/advanced/advancedSearchOrganizations.module').then(m => m.LibAdvancedSearchOrganizationsModule),
canActivate: [IsCommunity]
},
{
path: 'search/advanced/dataproviders',
- loadChildren: './searchPages/advanced/advancedSearchDataProviders.module#LibAdvancedSearchDataProvidersModule',
+ loadChildren: () => import('./searchPages/advanced/advancedSearchDataProviders.module').then(m => m.LibAdvancedSearchDataProvidersModule),
canActivate: [IsCommunity]
},
{
path: 'search/advanced/projects',
- loadChildren: './searchPages/advanced/advancedSearchProjects.module#LibAdvancedSearchProjectsModule',
+ loadChildren: () => import('./searchPages/advanced/advancedSearchProjects.module').then(m => m.LibAdvancedSearchProjectsModule),
canActivate: [IsCommunity]
},
/** Deposit Pages */
- {
- path: 'participate/deposit-datasets',
+ { path: 'participate/deposit-datasets',
redirectTo: 'participate/deposit/learn-how',
- pathMatch: 'full',
- canActivate: [IsCommunity]
- },
- {
- path: 'participate/deposit-datasets-result',
+ pathMatch: 'full' },
+ { path: 'participate/deposit-datasets-result',
redirectTo: 'participate/deposit/learn-how',
- pathMatch: 'full',
- canActivate: [IsCommunity]
- },
- {
- path: 'participate/deposit-subject-result',
+ pathMatch: 'full' },
+ { path: 'participate/deposit-subject-result',
redirectTo: 'participate/deposit/learn-how',
- pathMatch: 'full',
- canActivate: [IsCommunity]
- },
- {
- path: 'participate/deposit-publications',
+ pathMatch: 'full' },
+ { path: 'participate/deposit-publications',
redirectTo: 'participate/deposit/learn-how',
- pathMatch: 'full',
- canActivate: [IsCommunity]
- },
- {
- path: 'participate/deposit-publications-result',
+ pathMatch: 'full' },
+ { path: 'participate/deposit-publications-result',
redirectTo: 'participate/deposit/learn-how',
- pathMatch: 'full',
- canActivate: [IsCommunity]
- },
- {
- path: 'participate/share-zenodo',
+ pathMatch: 'full' },
+ { path: 'participate/share-zenodo',
redirectTo: '/participate/deposit/zenodo',
- pathMatch: 'full',
- canActivate: [IsCommunity]
- },
+ pathMatch: 'full' },
{
path: 'participate/deposit/learn-how',
- loadChildren: './deposit/deposit.module#LibDepositModule',
+ loadChildren: () => import('./deposit/deposit.module').then(m => m.LibDepositModule),
canActivate: [IsCommunity]
},
{
path: 'participate/deposit/search',
- loadChildren: './deposit/searchDataprovidersToDeposit.module#LibSearchDataprovidersToDepositModule',
+ loadChildren: () => import('./deposit/searchDataprovidersToDeposit.module').then(m => m.LibSearchDataprovidersToDepositModule),
canActivate: [IsCommunity]
},
{
path: 'participate/deposit/zenodo',
- loadChildren: './deposit/zenodo/shareInZenodo.module#ShareInZenodoModule',
+ loadChildren: () => import('./deposit/zenodo/shareInZenodo.module').then(m => m.ShareInZenodoModule),
canActivate: [IsCommunity]
},
/** Linking Pages */
- {path: 'myclaims', loadChildren: './claims/myClaims/myClaims.module#LibMyClaimsModule', canActivate: [IsCommunity]},
+ {path: 'myclaims', loadChildren: () => import('./claims/myClaims/myClaims.module').then(m => m.LibMyClaimsModule), canActivate: [IsCommunity]},
{
path: 'participate/claim',
- loadChildren: './claims/linking/linkingGeneric.module#LibLinkingGenericModule',
+ loadChildren: () => import('./claims/linking/linkingGeneric.module').then(m => m.LibLinkingGenericModule),
canActivate: [IsCommunity]
},
{
path: 'participate/direct-claim',
- loadChildren: './claims/directLinking/directLinking.module#LibDirectLinkingModule',
+ loadChildren: () => import('./claims/directLinking/directLinking.module').then(m => m.LibDirectLinkingModule),
canActivate: [IsCommunity]
},
{
path: 'preview',
- loadChildren: './demo/demo.module#DemoModule',
+ loadChildren: () => import('./demo/demo.module').then(m => m.DemoModule),
canActivate: [IsCommunity]
},
/** 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: 'theme', loadChildren: './openaireLibrary/utils/theme/theme.module#ThemeModule'},
+ {path: 'theme', loadChildren: () => import('./openaireLibrary/utils/theme/theme.module').then(m => m.ThemeModule)},
{path: '**', pathMatch: 'full', component: OpenaireErrorPageComponent}
];
@NgModule({
imports: [RouterModule.forRoot(routes, {
- onSameUrlNavigation: "reload",
- relativeLinkResolution: 'corrected'
+ onSameUrlNavigation: "reload"
})],
exports: [RouterModule]
})
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index cdd4307..bf6f794 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -183,8 +183,6 @@ export class AppComponent {
this.layout = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor, CustomizationOptions.getIdentity(communityId).secondaryColor);
}
);
- }else{
- this.layout = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor, CustomizationOptions.getIdentity(communityId).secondaryColor);
}
}
public buildMenu(communityId: string) {
@@ -328,7 +326,7 @@ export class AppComponent {
});
this.menuItems.push({
- rootItem: new MenuItem("communities", "Communities", restrictedData ? url + "/about/faq" : "", restrictedData ? "" : "/search/find/communities", false, [], ['/search/find/communities'], {}),
+ rootItem: new MenuItem("communities", "Communities", restrictedData ? url + "/search/find/communities" : "", restrictedData ? "" : "/search/find/communities", false, [], ['/search/find/communities'], {}),
items: []
});
this.menuItems.push({
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 4074f82..08e030e 100755
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -41,7 +41,7 @@ import {RoleVerificationModule} from "./openaireLibrary/role-verification/role-v
CookieLawModule,
CustomizationModule,
SubscribeModule.forRoot(), InviteBasicModule,
- BrowserModule.withServerTransition({appId: 'my-app'}),
+ BrowserModule.withServerTransition({ appId: 'serverApp' }),
AppRoutingModule,
BrowserTransferStateModule,
BrowserAnimationsModule,
diff --git a/src/app/app.server.module.ts b/src/app/app.server.module.ts
index 3ca5c33..cc86a55 100644
--- a/src/app/app.server.module.ts
+++ b/src/app/app.server.module.ts
@@ -1,21 +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 { 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 {}
diff --git a/src/app/communities/browseCommunity/browse-community.component.ts b/src/app/communities/browseCommunity/browse-community.component.ts
index 770b031..15947ea 100644
--- a/src/app/communities/browseCommunity/browse-community.component.ts
+++ b/src/app/communities/browseCommunity/browse-community.component.ts
@@ -18,7 +18,7 @@ export class BrowseCommunityComponent {
@Input() public community: CommunityInfo = null;
@Input() public showDescription: boolean = true;
@Input() public smallTitle: boolean = false;
- @ViewChild('AlertModal') modal;
+ @ViewChild('AlertModal', { static: true }) modal;
public hiddenMessage: string = "Community is hidden to registered users. It is visible only to users that have privileges to manage community; delay: 100";
// cut title too
diff --git a/src/app/community/community.component.ts b/src/app/community/community.component.ts
index 3ef1560..3d46a8b 100644
--- a/src/app/community/community.component.ts
+++ b/src/app/community/community.component.ts
@@ -93,9 +93,6 @@ export class CommunityComponent {
shareInZenodoPage: string = null;
public routerHelper: RouterHelper = new RouterHelper();
private user: User;
-
- @ViewChild(SubscribeComponent) subscribeComponent: SubscribeComponent = null;
-//Search Form
selectedEntity;
selectedEntitySimpleUrl;
selectedEntityAdvancedUrl;
diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts
index ca95580..d6f48f8 100644
--- a/src/app/community/community.module.ts
+++ b/src/app/community/community.module.ts
@@ -22,7 +22,7 @@ import {SearchResultsModule} from "../openaireLibrary/searchPages/searchUtils/se
import {CuratorsModule} from "../curators/curators.module";
import {AffiliationsModule} from "../affiliations/affiliations.module";
import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module";
-import {MatSelectModule} from "@angular/material";
+import { MatSelectModule } from "@angular/material/select";
import {EntitiesSelectionModule} from "../openaireLibrary/searchPages/searchUtils/entitiesSelection.module";
import {TabsModule} from "../openaireLibrary/utils/tabs/tabs.module";
import {SearchTabModule} from "../openaireLibrary/utils/tabs/contents/search-tab.module";
diff --git a/src/app/contact/contact.component.ts b/src/app/contact/contact.component.ts
index 497c934..eecc0e2 100644
--- a/src/app/contact/contact.component.ts
+++ b/src/app/contact/contact.component.ts
@@ -32,7 +32,6 @@ export class ContactComponent implements OnInit {
public contactForm: FormGroup;
@ViewChild('AlertModal') modal;
- @ViewChild('recaptcha') recaptcha;
private subscriptions = [];
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
diff --git a/src/app/contact/contact.module.ts b/src/app/contact/contact.module.ts
index d1d4d1d..90e5818 100644
--- a/src/app/contact/contact.module.ts
+++ b/src/app/contact/contact.module.ts
@@ -5,7 +5,6 @@ import {RouterModule} from '@angular/router';
import {ContactComponent} from './contact.component';
import {ContactRoutingModule} from "./contact-routing.module";
import {EmailService} from "../openaireLibrary/utils/email/email.service";
-import {RecaptchaModule} from "ng-recaptcha";
import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module";
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
import {HelperModule} from "../openaireLibrary/utils/helper/helper.module";
@@ -19,7 +18,7 @@ import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumb
@NgModule({
imports: [
ContactRoutingModule, CommonModule, RouterModule,
- AlertModalModule, RecaptchaModule.forRoot(), HelperModule,
+ AlertModalModule, HelperModule,
Schema2jsonldModule, SEOServiceModule, ContactUsModule, BreadcrumbsModule
],
declarations: [
diff --git a/src/app/deposit/utils/fetchZenodoInformation.class.ts b/src/app/deposit/utils/fetchZenodoInformation.class.ts
index 1b9e34f..0531ca3 100644
--- a/src/app/deposit/utils/fetchZenodoInformation.class.ts
+++ b/src/app/deposit/utils/fetchZenodoInformation.class.ts
@@ -4,7 +4,11 @@ import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zeno
import {ZenodoInformationClass} from '../../openaireLibrary/deposit/utils/zenodoInformation.class';
import {Subscriber} from "rxjs";
+import {Injectable} from "@angular/core";
+@Injectable({
+ providedIn: 'root'
+})
export class FetchZenodoInformation {
private subscriptions = [];
constructor ( private _zenodoCommunitieService: ZenodoCommunitiesService,
diff --git a/src/app/htmlPages/htmlPage.component.ts b/src/app/htmlPages/htmlPage.component.ts
index 9906528..8461032 100644
--- a/src/app/htmlPages/htmlPage.component.ts
+++ b/src/app/htmlPages/htmlPage.component.ts
@@ -1,6 +1,5 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
-import 'rxjs/Rx';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {Meta, Title} from "@angular/platform-browser";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
diff --git a/src/app/login/user.component.ts b/src/app/login/user.component.ts
index 7aab492..b7e9261 100644
--- a/src/app/login/user.component.ts
+++ b/src/app/login/user.component.ts
@@ -43,8 +43,8 @@ import {Subscriber} from "rxjs";
})
export class OpenaireUserComponent {
- @ViewChild(UserComponent) usercomponent: UserComponent;
- @ViewChild(SubscribeComponent) subscribe: SubscribeComponent;
+ @ViewChild(UserComponent, { static: true }) usercomponent: UserComponent;
+ @ViewChild(SubscribeComponent, { static: true }) subscribe: SubscribeComponent;
properties: EnvProperties;
communityId = null;
subscribeLoading: boolean = false;
diff --git a/src/app/searchPages/communities/searchCommunities.component.ts b/src/app/searchPages/communities/searchCommunities.component.ts
index 7a20805..068d35a 100644
--- a/src/app/searchPages/communities/searchCommunities.component.ts
+++ b/src/app/searchPages/communities/searchCommunities.component.ts
@@ -65,7 +65,7 @@ export class SearchCommunitiesComponent {
public showType = false;
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'communities'}];
properties: EnvProperties;
- @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
+ @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
private user: User;
private userFilterLoaded: boolean = false;
diff --git a/src/app/searchPages/simple/searchDataproviders.component.ts b/src/app/searchPages/simple/searchDataproviders.component.ts
index c038393..80e960b 100644
--- a/src/app/searchPages/simple/searchDataproviders.component.ts
+++ b/src/app/searchPages/simple/searchDataproviders.component.ts
@@ -68,7 +68,7 @@ export class OpenaireSearchDataprovidersComponent {
customFilter: SearchCustomFilter = null;
initialLoad = true;
public allResults =[];
- @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
+ @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
public fieldIds: string[] = this.searchFields.DATASOURCE_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.DATASOURCE_FIELDS;
public selectedFields:AdvancedField[] = [];
diff --git a/src/app/searchPages/simple/searchProjects.component.ts b/src/app/searchPages/simple/searchProjects.component.ts
index fcf5908..ea6f2f9 100644
--- a/src/app/searchPages/simple/searchProjects.component.ts
+++ b/src/app/searchPages/simple/searchProjects.component.ts
@@ -68,7 +68,7 @@ export class OpenaireSearchProjectsComponent {
customFilter: SearchCustomFilter = null;
initialLoad = true;
public allResults =[];
- @ViewChild(NewSearchPageComponent) searchPage: NewSearchPageComponent;
+ @ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
public fieldIds: string[] = this.searchFields.PROJECT_ADVANCED_FIELDS;
public fieldIdsMap= this.searchFields.PROJECT_FIELDS;
public selectedFields:AdvancedField[] = [];
diff --git a/src/app/shared/shared.module.ts b/src/app/shared/shared.module.ts
index f0ce0d2..a5d38d7 100644
--- a/src/app/shared/shared.module.ts
+++ b/src/app/shared/shared.module.ts
@@ -37,7 +37,7 @@ const COMPONENTS = [
]
})
export class SharedModule {
- static forRoot(): ModuleWithProviders {
+ static forRoot(): ModuleWithProviders {
return {
ngModule: SharedModule,
};
diff --git a/src/app/statistics/statistics.component.ts b/src/app/statistics/statistics.component.ts
index 10af401..edcc6fe 100644
--- a/src/app/statistics/statistics.component.ts
+++ b/src/app/statistics/statistics.component.ts
@@ -1,22 +1,20 @@
import {Component, Input} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Location, TitleCasePipe} from '@angular/common';
-import {Title, Meta} from '@angular/platform-browser';
-import {DomSanitizer} from '@angular/platform-browser';
-import "rxjs/add/observable/zip";
+import {DomSanitizer, Meta, Title} from '@angular/platform-browser';
import {EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
import {ErrorCodes} from '../openaireLibrary/utils/properties/errorCodes';
import {StatisticsService} from '../utils/services/statistics.service';
import {ConfigurationService} from '../openaireLibrary/utils/configuration/configuration.service';
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
-import {ConnectHelper} from '../openaireLibrary/connect/connectHelper';
import {
- availableCharts, availableEntitiesMap, StatisticsDisplay,
+ availableCharts,
+ availableEntitiesMap,
+ StatisticsDisplay,
StatisticsSummary
} from "../openaireLibrary/connect/statistics/statisticsEntities";
import {PiwikHelper} from '../utils/piwikHelper';
import {CommunityCharts} from "../openaireLibrary/connect/statistics/communityCharts";
-import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {Subscriber, Subscription} from "rxjs";
import {properties} from "../../environments/environment";
diff --git a/src/app/utils/customization/customization.module.ts b/src/app/utils/customization/customization.module.ts
index a2785d6..c25b686 100644
--- a/src/app/utils/customization/customization.module.ts
+++ b/src/app/utils/customization/customization.module.ts
@@ -17,7 +17,7 @@ import {LayoutService} from "../../openaireLibrary/services/layout.service";
]
})
export class CustomizationModule {
- static forRoot(): ModuleWithProviders {
+ static forRoot(): ModuleWithProviders {
return {
ngModule: CustomizationModule,
providers: [
diff --git a/src/app/utils/services/statistics.service.ts b/src/app/utils/services/statistics.service.ts
index e29ed5d..2341b6a 100644
--- a/src/app/utils/services/statistics.service.ts
+++ b/src/app/utils/services/statistics.service.ts
@@ -1,9 +1,8 @@
import { Injectable } from '@angular/core';
import {HttpClient, HttpErrorResponse} from "@angular/common/http";
-import { Observable } from 'rxjs/Rx';
import {StatisticsDisplay, StatisticsSummary} from "../../openaireLibrary/connect/statistics/statisticsEntities";
import {catchError, map} from "rxjs/operators";
-import {throwError} from "rxjs";
+import {Observable, throwError} from "rxjs";
import {EnvProperties} from "../../openaireLibrary/utils/properties/env-properties";
diff --git a/src/app/utils/subscribe/subscribe.component.ts b/src/app/utils/subscribe/subscribe.component.ts
index 4dfbb47..18b806f 100644
--- a/src/app/utils/subscribe/subscribe.component.ts
+++ b/src/app/utils/subscribe/subscribe.component.ts
@@ -75,7 +75,7 @@ export class SubscribeComponent {
members: number = 0;
@Output() countSubscribersEvent = new EventEmitter();
showLoginAlert: Boolean = false;
- @ViewChild(AlertModal) alert;
+ @ViewChild(AlertModal, { static: true }) alert;
private user: User;
subs: Subscription[] = [];
diff --git a/src/app/utils/subscribe/subscribe.module.ts b/src/app/utils/subscribe/subscribe.module.ts
index 9478f31..9a25509 100644
--- a/src/app/utils/subscribe/subscribe.module.ts
+++ b/src/app/utils/subscribe/subscribe.module.ts
@@ -19,7 +19,7 @@ import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module"
]
})
export class SubscribeModule {
- static forRoot(): ModuleWithProviders {
+ static forRoot(): ModuleWithProviders {
return {
ngModule: SubscribeModule,
providers: [
diff --git a/src/index.beta.html b/src/beta/index.html
similarity index 100%
rename from src/index.beta.html
rename to src/beta/index.html
diff --git a/src/karma.conf.js b/src/karma.conf.js
new file mode 100644
index 0000000..fce7f6e
--- /dev/null
+++ b/src/karma.conf.js
@@ -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/connect'),
+ 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
+ });
+};
diff --git a/src/main.server.ts b/src/main.server.ts
index 748c4ff..6b9b32c 100644
--- a/src/main.server.ts
+++ b/src/main.server.ts
@@ -1,8 +1,15 @@
-import {properties} from "./environments/environment";
-import {enableProdMode} from "@angular/core";
+/***************************************************************************************************
+ * Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
+*/
+import '@angular/localize/init';
+
+import { enableProdMode } from '@angular/core';
+
+import {properties} from './environments/environment';
if (properties.environment !== "development") {
enableProdMode();
}
export { AppServerModule } from './app/app.server.module';
+export { renderModule, renderModuleFactory } from '@angular/platform-server';
diff --git a/src/main.ts b/src/main.ts
index d8a282e..82a0683 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -9,5 +9,6 @@ if (properties.environment !== "development") {
}
document.addEventListener('DOMContentLoaded', () => {
- platformBrowserDynamic().bootstrapModule(AppModule);
+ platformBrowserDynamic().bootstrapModule(AppModule)
+ .catch(err => console.error(err));
});
diff --git a/src/polyfills.ts b/src/polyfills.ts
index 4e77c07..7c9e495 100644
--- a/src/polyfills.ts
+++ b/src/polyfills.ts
@@ -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,61 +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';
-
-
/**
- * 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';
diff --git a/src/index.prod.html b/src/prod/index.html
similarity index 100%
rename from src/index.prod.html
rename to src/prod/index.html
diff --git a/src/styles.css b/src/styles.css
index 74c71ce..bc3fde1 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -1,6 +1,4 @@
/* 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";
diff --git a/src/test.ts b/src/test.ts
new file mode 100644
index 0000000..1631789
--- /dev/null
+++ b/src/test.ts
@@ -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);
diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json
index 16b7847..f3a1b80 100644
--- a/src/tsconfig.app.json
+++ b/src/tsconfig.app.json
@@ -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"
]
}
diff --git a/src/tsconfig.server.json b/src/tsconfig.server.json
index 7e55994..39f85aa 100644
--- a/src/tsconfig.server.json
+++ b/src/tsconfig.server.json
@@ -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"
}
}
diff --git a/src/tsconfig.spec.json b/src/tsconfig.spec.json
new file mode 100644
index 0000000..de77336
--- /dev/null
+++ b/src/tsconfig.spec.json
@@ -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"
+ ]
+}
diff --git a/static.paths.ts b/static.paths.ts
deleted file mode 100644
index be309ca..0000000
--- a/static.paths.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-export const ROUTES = [
- '/',
- '/lazy',
- '/home',
- '/search/publication','/search/other','/search/project','/search/dataset','/search/dataprovider','/search/organization',
- '/search/find',
- '/search/person','/search/publication','/search/project','/search/dataset','/search/dataprovider','/search/organization',
- '/search/find/people','/search/find/publications','/search/find/other','/search/find/projects','/search/find/datasets','/search/find/dataproviders','/search/find/organizations',
- '/search/advanced/people','/search/advanced/publications','/search/advanced/other','/search/advanced/projects','/search/advanced/datasets','/search/advanced/dataproviders','/search/advanced/organizations',
- '/participate/deposit-publications','/participate/deposit-datasets','/participate/deposit-publications-result','/participate/deposit-datasets-result','/participate/deposit-subject-result',
- '/search/content-providers','/search/content-providers-table','/search/entity-registries','/search/entity-registries-table','/search/journals','/search/journals-table',
- '/project-report','/claims','/myclaims','/participate/claim','/participate/direct-claim','/claims-project-manager',
- '/test','/user-info',
- '/error', '/*path'
-];
diff --git a/tsconfig.json b/tsconfig.json
index 8cd9a30..8c693a2 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -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": "./"
+ ]
}
-}
\ No newline at end of file
+}
diff --git a/webpack.server.config.js b/webpack.server.config.js
deleted file mode 100644
index 4d2b44f..0000000
--- a/webpack.server.config.js
+++ /dev/null
@@ -1,51 +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'),
- {}
- )
- ]
-}