diff --git a/explore/src/app/app-routing.module.ts b/explore/src/app/app-routing.module.ts
index 32bfa51f..291b194f 100644
--- a/explore/src/app/app-routing.module.ts
+++ b/explore/src/app/app-routing.module.ts
@@ -11,6 +11,7 @@ const routes: Routes = [
{path: 'mail-preferences', loadChildren: () => import('./userEmailPreferences/mailPrefs.module').then(m => m.LibMailPrefsModule)},
{path: 'sdgs', loadChildren: () => import('./sdg/sdg.module').then(m => m.SdgModule)},
{path: 'fields-of-science', loadChildren: () => import('./fos/fos.module').then(m => m.FosModule)},
+ {path: 'contact-us', loadChildren: () => import('./contact/contact.module').then(m => m.ContactModule)},
// ORCID Pages
{path: 'orcid', loadChildren: () => import('./orcid/orcid.module').then(m => m.LibOrcidModule)},
{path: 'my-orcid-links', loadChildren: () => import('./orcid/my-orcid-links/myOrcidLinks.module').then(m => m.LibMyOrcidLinksModule)},
diff --git a/explore/src/app/app.component.ts b/explore/src/app/app.component.ts
index 7ba8f7c6..a3e2cad1 100644
--- a/explore/src/app/app.component.ts
+++ b/explore/src/app/app.component.ts
@@ -137,7 +137,8 @@ export class AppComponent {
new MenuItem("", "Journals", "", "/search/journals", false, ["datasource"], ["/search/journals"], {}),
new MenuItem("", "Registries", "", "/search/entity-registries", false, ["datasource"], ["/search/entity-registries"], {}),
new MenuItem("", "Browse all", "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {})]
- )
+ ),
+ new MenuItem("contact", "Contact us", "", "/contact-us", false, [], ["/contact-us"], {}),
];
if (Session.isPortalAdministrator(this.user)) {
this.userMenuItems.push(new MenuItem("", "Manage all links", "", "/claims", false, [], ["/claims"], {}));
diff --git a/explore/src/app/contact/contact-routing.module.ts b/explore/src/app/contact/contact-routing.module.ts
new file mode 100644
index 00000000..e9cd5a07
--- /dev/null
+++ b/explore/src/app/contact/contact-routing.module.ts
@@ -0,0 +1,14 @@
+import { NgModule } from '@angular/core';
+import {RouterModule} from '@angular/router';
+import {ContactComponent} from './contact.component';
+import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
+import {PreviousRouteRecorder} from "../openaireLibrary/utils/piwik/previousRouteRecorder.guard";
+
+@NgModule({
+ imports: [
+ RouterModule.forChild([
+ { path: '', component: ContactComponent, canActivate: [IsRouteEnabled], canDeactivate: [PreviousRouteRecorder]}
+ ])
+ ]
+})
+export class ContactRoutingModule { }
diff --git a/explore/src/app/contact/contact.component.html b/explore/src/app/contact/contact.component.html
new file mode 100644
index 00000000..4daf7db9
--- /dev/null
+++ b/explore/src/app/contact/contact.component.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ Contact us to
learn more.
+
+
+
+
+
+
+ Our team will respond to your submission soon.
+ Press OK to redirect to OpenAIRE Explore home page.
+
diff --git a/explore/src/app/contact/contact.component.ts b/explore/src/app/contact/contact.component.ts
new file mode 100644
index 00000000..024e9f01
--- /dev/null
+++ b/explore/src/app/contact/contact.component.ts
@@ -0,0 +1,156 @@
+import {Component, OnInit, ViewChild} from '@angular/core';
+import {ActivatedRoute, Router} from '@angular/router';
+import {EmailService} from "../openaireLibrary/utils/email/email.service";
+import {Email} from "../openaireLibrary/utils/email/email";
+import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
+import {Composer} from "../openaireLibrary/utils/email/composer";
+import {Meta, Title} from "@angular/platform-browser";
+import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
+import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
+import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
+import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
+import {FormBuilder, FormGroup, Validators} from "@angular/forms";
+import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
+import {Subscriber} from "rxjs";
+import {properties} from "../../environments/environment";
+import {NotificationHandler} from "../openaireLibrary/utils/notification-handler";
+
+@Component({
+ selector: 'contact',
+ templateUrl: './contact.component.html',
+})
+
+export class ContactComponent implements OnInit {
+ public url: string = null;
+ public pageTitle: string = "OpenAIRE - Explore | Contact Us";
+ public description: string = "Contact us to learn more about OpenAIRE Explore";
+ public sending = true;
+ public email: Email;
+ public properties: EnvProperties = properties;
+ public pageContents = null;
+ public divContents = null;
+ public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Contact us'}];
+ public contactForm: FormGroup;
+ @ViewChild('modal') modal;
+ private subscriptions = [];
+
+ ngOnDestroy() {
+ this.subscriptions.forEach(subscription => {
+ if (subscription instanceof Subscriber) {
+ subscription.unsubscribe();
+ }
+ });
+ }
+
+ constructor(private route: ActivatedRoute,
+ private _router: Router,
+ private _emailService: EmailService,
+ private _meta: Meta,
+ private _title: Title,
+ private seoService: SEOService,
+ private _piwikService: PiwikService,
+ private fb: FormBuilder,
+ private helper: HelperService) {
+ }
+
+ ngOnInit() {
+ this._title.setTitle('OpenAIRE - Explore | Contact Us');
+
+ this.properties = properties;
+ this.email = {body: '', subject: '', recipients: []};
+
+ if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) {
+ this.subscriptions.push( this._piwikService.trackView(this.properties, this.pageTitle, this.properties.piwikSiteId).subscribe());
+ }
+ this.url = this.properties.domain + this._router.url;
+ this.seoService.createLinkForCanonicalURL(this.url);
+ this.updateUrl(this.url);
+ this.updateTitle(this.pageTitle);
+ this.updateDescription(this.description);
+ this.reset();
+ this.getPageContents();
+ this.sending = false;
+ }
+
+ private getPageContents() {
+ this.subscriptions.push(this.helper.getPageHelpContents(this.properties, 'explore', this._router.url).subscribe(contents => {
+ this.pageContents = contents;
+ }));
+ }
+
+ public send(event) {
+ HelperFunctions.scroll();
+ if(event.valid === true) {
+ this.sendMail(this.properties.admins);
+ }
+ }
+
+ public reset() {
+ this.contactForm = this.fb.group( {
+ name: this.fb.control('', Validators.required),
+ surname: this.fb.control('', Validators.required),
+ email: this.fb.control('', [Validators.required, Validators.email]),
+ affiliation: this.fb.control(''),
+ message: this.fb.control('', Validators.required),
+ recaptcha: this.fb.control('', Validators.required),
+ });
+ }
+
+ private sendMail(admins: any) {
+ this.sending = true;
+ this.subscriptions.push(this._emailService.contact(this.properties,
+ Composer.composeEmailForExplore(this.contactForm.value, admins),
+ this.contactForm.value.recaptcha).subscribe(
+ res => {
+ if (res) {
+ this.sending = false;
+ this.reset();
+ this.modalOpen();
+ } else {
+ this.handleError('Email sent failed! Please try again.');
+ }
+ },
+ error => {
+ this.handleError('Email sent failed! Please try again.', error);
+ }
+ ));
+ }
+
+ public modalOpen() {
+ this.modal.okButton = true;
+ this.modal.alertTitle = 'Your request has been successfully submitted';
+ this.modal.alertMessage = false;
+ this.modal.cancelButton = false;
+ this.modal.okButtonLeft = false;
+ this.modal.okButtonText = 'OK';
+ this.modal.open();
+ }
+
+ handleError(message: string, error = null) {
+ if(error) {
+ console.error(error);
+ }
+ NotificationHandler.rise(message, 'danger');
+ this.sending = false;
+ this.contactForm.get('recaptcha').setValue('');
+ }
+
+ public goToHome() {
+ this._router.navigate(['/']);
+ }
+
+ private updateDescription(description: string) {
+ this._meta.updateTag({content: description}, "name='description'");
+ this._meta.updateTag({content: description}, "property='og:description'");
+ }
+
+ private updateTitle(title: string) {
+ var _title = ((title.length > 50) ? title.substring(0, 50) : title);
+ this._title.setTitle(_title);
+ this._meta.updateTag({content: _title}, "property='og:title'");
+ }
+
+ private updateUrl(url: string) {
+ this._meta.updateTag({content: url}, "property='og:url'");
+ }
+}
diff --git a/explore/src/app/contact/contact.module.ts b/explore/src/app/contact/contact.module.ts
new file mode 100644
index 00000000..3e5b0f26
--- /dev/null
+++ b/explore/src/app/contact/contact.module.ts
@@ -0,0 +1,36 @@
+import {NgModule} from '@angular/core';
+import {CommonModule} from '@angular/common';
+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 {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module";
+import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
+import {HelperModule} from "../openaireLibrary/utils/helper/helper.module";
+import {IsRouteEnabled} from "../openaireLibrary/error/isRouteEnabled.guard";
+import {Schema2jsonldModule} from "../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
+import {SEOServiceModule} from "../openaireLibrary/sharedComponents/SEO/SEOService.module";
+import {ContactUsModule} from "../openaireLibrary/contact-us/contact-us.module";
+import {BreadcrumbsModule} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.module";
+import {LoadingModule} from "../openaireLibrary/utils/loading/loading.module";
+
+
+@NgModule({
+ imports: [
+ ContactRoutingModule, CommonModule, RouterModule,
+ AlertModalModule, HelperModule,
+ Schema2jsonldModule, SEOServiceModule, ContactUsModule, BreadcrumbsModule, LoadingModule
+ ],
+ declarations: [
+ ContactComponent
+ ],
+ providers: [
+ EmailService, PiwikService, IsRouteEnabled
+ ],
+ exports: [
+ ContactComponent
+ ]
+})
+
+export class ContactModule { }
diff --git a/explore/src/app/home/home.component.html b/explore/src/app/home/home.component.html
index 2e5f4cdd..f8c6ccc0 100644
--- a/explore/src/app/home/home.component.html
+++ b/explore/src/app/home/home.component.html
@@ -188,19 +188,19 @@
+ style="width: 100%;">
+ style="width: 100%;">
+ style="width: 100%;">
+ style="width: 100%;">
+ style="width: 100%;">
@@ -329,7 +329,7 @@
Get in touch and let us help you.
Contact us
+ routerLink="/contact-us">Contact us
diff --git a/explore/src/environments/environment.beta.ts b/explore/src/environments/environment.beta.ts
index bee23746..1754c11e 100644
--- a/explore/src/environments/environment.beta.ts
+++ b/explore/src/environments/environment.beta.ts
@@ -115,6 +115,7 @@ export let properties: EnvProperties = {
depositSearchPage: "/participate/deposit/search",
altMetricsAPIURL: "https://api.altmetric.com/v1/doi/",
reCaptchaSiteKey: "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
+ admins: ['feedback@openaire.eu'],
b2noteAPIURL: 'https://b2note.eudat.eu/',
adminPortalURL: "https://beta.admin.connect.openaire.eu",
diff --git a/explore/src/environments/environment.prod.ts b/explore/src/environments/environment.prod.ts
index 79f3809b..ae4ab27e 100644
--- a/explore/src/environments/environment.prod.ts
+++ b/explore/src/environments/environment.prod.ts
@@ -120,6 +120,7 @@ export let properties: EnvProperties = {
depositSearchPage: "/participate/deposit/search",
altMetricsAPIURL: "https://api.altmetric.com/v1/doi/",
reCaptchaSiteKey: "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
+ admins: ['feedback@openaire.eu'],
b2noteAPIURL: 'https://b2note.eudat.eu/',
adminPortalURL: "https://admin.explore.openaire.eu",
diff --git a/explore/src/environments/environment.test.ts b/explore/src/environments/environment.test.ts
index fa056e21..0af87fef 100644
--- a/explore/src/environments/environment.test.ts
+++ b/explore/src/environments/environment.test.ts
@@ -119,6 +119,7 @@ export let properties: EnvProperties = {
depositSearchPage: "/participate/deposit/search",
altMetricsAPIURL: "https://api.altmetric.com/v1/doi/",
reCaptchaSiteKey: "6LezhVIUAAAAAOb4nHDd87sckLhMXFDcHuKyS76P",
+ admins: ['feedback@openaire.eu'],
b2noteAPIURL: 'https://b2note.eudat.eu/',
adminPortalURL: "https://beta.admin.connect.openaire.eu",
diff --git a/explore/src/environments/environment.ts b/explore/src/environments/environment.ts
index 25b0b622..e4260d95 100644
--- a/explore/src/environments/environment.ts
+++ b/explore/src/environments/environment.ts
@@ -120,6 +120,7 @@ export let properties: EnvProperties = {
depositSearchPage: "/participate/deposit/search",
altMetricsAPIURL: "https://api.altmetric.com/v1/doi/",
reCaptchaSiteKey: "6LcVtFIUAAAAAB2ac6xYivHxYXKoUvYRPi-6_rLu",
+ admins: ['kostis30fylloy@gmail.com', 'alexandros.martzios@athenarc.gr', 'kgalouni@di.uoa.gr'],
b2noteAPIURL: 'https://b2note.eudat.eu/',
impactFactorsAPIURL: "https://bip-api.imsi.athenarc.gr/paper/scores/batch/",
adminPortalURL: "https://beta.admin.connect.openaire.eu",
diff --git a/services/cache/mecache/README.md b/services/cache/mecache/README.md
new file mode 100644
index 00000000..3922272d
--- /dev/null
+++ b/services/cache/mecache/README.md
@@ -0,0 +1,25 @@
+# README #
+
+
+### What is this repository for? ###
+
+Cache service
+
+* Version 1.0.0
+
+### How to run locally? ###
+
+* "npm start" to start the service
+* Check properties to set the port
+
+### How to run in a server? ###
+* run "npm run prepare-{CONFIGURATION_NAME}"
+* cp dist folder in the server
+* create a folder for the service files
+* "npm i" to install dependencies.
+* if you just update the project run "pm2 restart cache"
+* if you start a new service run: pm2 start --name cache ./cache.js --log-date-format="YYYY-MM-DD HH:mm Z"
+
+
+
+
diff --git a/services/cache/mecache/beta-properties.file b/services/cache/mecache/beta-properties.file
new file mode 100644
index 00000000..471fad82
--- /dev/null
+++ b/services/cache/mecache/beta-properties.file
@@ -0,0 +1 @@
+port = 4000
diff --git a/services/cache/mecache/cache.js b/services/cache/mecache/cache.js
index 425c2a61..8dba6912 100644
--- a/services/cache/mecache/cache.js
+++ b/services/cache/mecache/cache.js
@@ -6,6 +6,8 @@ let mcache = require('memory-cache');
const request = require('superagent');
const prom = require('prom-client');
const URL = require('url');
+var PropertiesReader = require('properties-reader');
+var properties = PropertiesReader('./properties.file');
const expireShort = 2 * 60 * 1000; //2mins
const expireLong = 24 * 60 * 60 * 1000; //24 hours
const cacheMaxSize = 500;
@@ -136,8 +138,8 @@ app.use((req, res) => {
res.status(404).send(getResponse(404, "Not Found")); //not found
});
-app.listen((process.env.PORT) ? process.env.PORT : 3000, function () {
- console.log(`Example app listening on port ${(process.env.PORT) ? process.env.PORT : 3000}!`)
+const server = app.listen(properties.get('port'), function () {
+ console.log(`Example app listening on port`, server.address().port)
//run the timer
resetAtMidnight();
});
diff --git a/services/cache/mecache/package.json b/services/cache/mecache/package.json
index 580d7869..e98c7edb 100644
--- a/services/cache/mecache/package.json
+++ b/services/cache/mecache/package.json
@@ -4,17 +4,21 @@
"description": "Caching in memory",
"main": "cache.js",
"scripts": {
- "start": "PORT=3200 node cache.js"
+ "start": "node cache.js",
+ "prepare-dist": "rm -rf dist; mkdir dist; cp package.json ./dist; cp cache.js ./dist; cp properties.file ./dist;",
+ "prepare-beta": " npm run prepare-dist; cp beta-properties.file ./dist/properties.file",
+ "prepare-prod": " npm run prepare-dist; cp production-properties.file ./dist/properties.file"
},
"dependencies": {
"cors": "^2.8.5",
"express": "^4.15.2",
"memory-cache": "^0.2.0",
- "superagent": "^5.0.5",
- "prom-client": "^11.3.0"
+ "prom-client": "^11.3.0",
+ "properties-reader": "^2.2.0",
+ "superagent": "^5.0.5"
},
"engines": {
- "node": "16.3.0"
+ "node": ">=16.3.0"
},
"author": "Argiro Kokogiannaki ",
"license": "NKUA"
diff --git a/services/cache/mecache/production-properties.file b/services/cache/mecache/production-properties.file
new file mode 100644
index 00000000..471fad82
--- /dev/null
+++ b/services/cache/mecache/production-properties.file
@@ -0,0 +1 @@
+port = 4000
diff --git a/services/cache/mecache/properties.file b/services/cache/mecache/properties.file
new file mode 100644
index 00000000..74f6260b
--- /dev/null
+++ b/services/cache/mecache/properties.file
@@ -0,0 +1 @@
+port = 3200
diff --git a/services/utils-service/README.md b/services/utils-service/README.md
new file mode 100644
index 00000000..d553c9f5
--- /dev/null
+++ b/services/utils-service/README.md
@@ -0,0 +1,24 @@
+# README #
+
+
+### What is this repository for? ###
+
+Utils service
+
+* Version 1.0.0
+
+### How to run locally? ###
+
+* "npm start" to start the service
+
+### How to run in a server? ###
+* run "npm run prepare-{CONFIGURATION_NAME}"
+* cp dist folder in the server
+* create a folder for the service files
+* "npm i" to install dependencies.
+* if you just update the project run "pm2 restart upload"
+* if you start a new service run: pm2 start --name upload ./uploadService.js --log-date-format="YYYY-MM-DD HH:mm Z"
+
+
+
+
diff --git a/services/utils-service/beta-properties.file b/services/utils-service/beta-properties.file
index 534e81dd..7e37b386 100644
--- a/services/utils-service/beta-properties.file
+++ b/services/utils-service/beta-properties.file
@@ -5,3 +5,4 @@ localPath = false
max.size = 200
# file size in KB
big-max.size = 1000
+port = 8000
diff --git a/services/utils-service/package.json b/services/utils-service/package.json
index 736a2805..6965d570 100644
--- a/services/utils-service/package.json
+++ b/services/utils-service/package.json
@@ -4,7 +4,10 @@
"description": "",
"main": "index.js",
"scripts": {
- "start": "node uploadService.js"
+ "start": "node uploadService.js",
+ "prepare-dist": "rm -rf dist; mkdir dist; cp package.json ./dist; cp uploadService.js ./dist; cp properties.file ./dist;",
+ "prepare-beta": " npm run prepare-dist; cp beta-properties.file ./dist/properties.file",
+ "prepare-prod": " npm run prepare-dist; cp production-properties.file ./dist/properties.file"
},
"keywords": [],
"author": "",
@@ -14,10 +17,10 @@
"cookie-parser": "^1.4.4",
"cors": "^2.8.4",
"express": "^4.15.2",
- "multer": "^1.1.0",
- "properties-reader": "0.0.16"
+ "multer": "1.4.5-lts.1",
+ "properties-reader": "^2.2.0"
},
"engines": {
- "node": "16.3.0"
+ "node": ">=16.3.0"
}
}
diff --git a/services/utils-service/prepareDeploy.sh b/services/utils-service/prepareDeploy.sh
deleted file mode 100755
index 69f959e5..00000000
--- a/services/utils-service/prepareDeploy.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#uncomment properties file based on deployment environment
-#mv beta-properties.file properties.file
-#mv production-properties.file properties.file
-
-#rm -rf node_modules/ run.sh uploads/ .idea/ beta-properties.file production-properties.file
-#rm prepareDeploy.sh
-
-#Copy files to beta.explore.openaire.eu or explore.openaire.eu /home/argiro.kokogiannaki/portals/utils-service.YYYY-MM-DD
-# run npm i
-#change to user nodejs " sudo su nodejs -s /bin/bash"
-#copy files to deploy folder " cp -r /home/argiro.kokogiannaki/portals/utils-service.YYY-MM-DD/* /srv/www/upload/"
-# restart uplication "pm2 restart upload"
-
-
diff --git a/services/utils-service/production-properties.file b/services/utils-service/production-properties.file
index 896864da..93f676c1 100644
--- a/services/utils-service/production-properties.file
+++ b/services/utils-service/production-properties.file
@@ -5,3 +5,4 @@ localPath = false
max.size = 200
# file size in KB
big-max.size = 1000
+port = 8000
diff --git a/services/utils-service/properties.file b/services/utils-service/properties.file
index 9420587d..ed2c1d79 100644
--- a/services/utils-service/properties.file
+++ b/services/utils-service/properties.file
@@ -5,3 +5,4 @@ localPath = true
max.size = 200
# file size in KB
big-max.size = 1000
+port = 8000
diff --git a/services/utils-service/uploadService.js b/services/utils-service/uploadService.js
index 3122f1ec..c929c2e2 100644
--- a/services/utils-service/uploadService.js
+++ b/services/utils-service/uploadService.js
@@ -97,7 +97,7 @@ app.delete(['/delete/:filename', '/delete/stakeholder/:filename', '/delete/:type
});
});
-const server = app.listen(8000, function () {
+const server = app.listen(properties.get('port'), function () {
console.log("Listening on port %s...", server.address().port);
});