Compare commits

...

16 Commits

Author SHA1 Message Date
Alex Martzios 780ca3b846 [angular-18] app.module: replace provider withFetch with withInterceptorsFromDi 2024-09-26 15:02:46 +03:00
Alex Martzios 48b1c93ee4 [angular-18 | DONE | CHANGED] app,contact,funders,home components: remove unused imports and delete old code 2024-09-26 13:03:18 +03:00
Alex Martzios 451966b4ce [angular-18 | DONE | CHANGED] update to recaptcha-2 2024-09-24 14:17:00 +03:00
Konstantina Galouni c0eaf1dee9 Merge remote-tracking branch 'origin/develop' into angular-18 2024-09-24 13:43:28 +03:00
Konstantina Galouni 9a14c3dc77 Updating common-assets 2024-09-24 13:43:17 +03:00
Konstantina Galouni f67e2b533d Updating openaireLibrary & openaire-theme 2024-09-24 13:37:55 +03:00
Alex Martzios aed67b0833 [develop] update submodules 2024-09-24 10:53:05 +03:00
Konstantina Galouni 254fd67771 Updating openaireLibrary 2024-09-23 21:14:19 +03:00
Konstantina Galouni ed6c677d74 [angular-18 | DONE | FIXED]: Updated libraries | app.component.ts: Replaced detectChanges with markForCheck | app.module.ts: Replaced provideHttpClient(withInterceptorsFromDi()) with provideHttpClient(withFetch()) | package.json: Changed version of "@types/node" from "^16.18.50" to "18.19.1" | server.ts: Added response codes in server.ts & missing functions for metrics and health-check & fixed configurations. 2024-09-23 20:58:41 +03:00
Alex Martzios 5102e4e444 [angular-18 | WIP] upgrade angular material to v18 2024-07-15 11:38:40 +03:00
Alex Martzios 86c2a5042c [angular-18 | WIP] upgrade angular core and cli to v18, change submodules to angular 18 as well 2024-07-15 11:34:10 +03:00
Alex Martzios c7e1fe316b [angular-18 | WIP] upgrade typescript to 5.4.0 2024-07-15 11:22:23 +03:00
Alex Martzios 6c442d4dd7 [angular-17 | DONE] upgrade ng-recaptcha to 13.2.1 2024-07-11 12:26:28 +03:00
Alex Martzios 160c87ceca [angular-17 | WIP] upgrade angular material to v17 2024-07-11 12:24:04 +03:00
Alex Martzios 1c265e4fa5 [angular-17 | WIP] upgrade angular core and cli to v17 2024-07-11 12:19:29 +03:00
Alex Martzios 16a10758cb [angular-17 | WIP] upgrade typescript to 5.2.0 and zone.js to 0.14.0 2024-07-11 12:03:31 +03:00
11 changed files with 143 additions and 299 deletions

View File

@ -239,18 +239,18 @@
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"options": { "options": {
"browserTarget": "explore:build" "buildTarget": "explore:build"
}, },
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "explore:build:production" "buildTarget": "explore:build:production"
} }
} }
}, },
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n", "builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"browserTarget": "explore:build" "buildTarget": "explore:build"
} }
}, },
"test": { "test": {
@ -327,7 +327,7 @@
"defaultConfiguration": "" "defaultConfiguration": ""
}, },
"serve-ssr": { "serve-ssr": {
"builder": "@nguniversal/builders:ssr-dev-server", "builder": "@angular-devkit/build-angular:ssr-dev-server",
"options": { "options": {
"browserTarget": "explore:build", "browserTarget": "explore:build",
"serverTarget": "explore:server" "serverTarget": "explore:server"
@ -340,7 +340,7 @@
} }
}, },
"prerender": { "prerender": {
"builder": "@nguniversal/builders:prerender", "builder": "@angular-devkit/build-angular:prerender",
"options": { "options": {
"browserTarget": "explore:build:production", "browserTarget": "explore:build:production",
"serverTarget": "explore:server:production", "serverTarget": "explore:server:production",

View File

@ -23,43 +23,43 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^16.1.7", "@angular/animations": "^18.1.0",
"@angular/cdk": "^16.1.6", "@angular/cdk": "^18.1.0",
"@angular/common": "^16.1.7", "@angular/common": "^18.1.0",
"@angular/compiler": "^16.1.7", "@angular/compiler": "^18.1.0",
"@angular/core": "^16.1.7", "@angular/core": "^18.1.0",
"@angular/forms": "^16.1.7", "@angular/forms": "^18.1.0",
"@angular/localize": "^16.1.7", "@angular/localize": "^18.1.0",
"@angular/material": "^16.1.6", "@angular/material": "^18.1.0",
"@angular/platform-browser": "^16.1.7", "@angular/platform-browser": "^18.1.0",
"@angular/platform-browser-dynamic": "^16.1.7", "@angular/platform-browser-dynamic": "^18.1.0",
"@angular/platform-server": "^16.1.7", "@angular/platform-server": "^18.1.0",
"@angular/router": "^16.1.7", "@angular/router": "^18.1.0",
"@nguniversal/express-engine": "^16.1.1", "@angular/ssr": "^18.1.0",
"clipboard": "^1.5.16", "clipboard": "^1.5.16",
"core-js": "^2.5.4", "core-js": "^2.5.4",
"express": "^4.15.2", "express": "^4.15.2",
"flag-icons": "^7.2.1", "flag-icons": "^7.2.1",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"ng-recaptcha": "^12.0.2", "ng-recaptcha-2": "^14.0.0",
"prom-client": "^11.3.0", "prom-client": "^11.3.0",
"rxjs": "^6.5.1", "rxjs": "^6.5.1",
"ts-md5": "^1.2.0", "ts-md5": "^1.2.0",
"tslib": "^2.0.0", "tslib": "^2.0.0",
"uikit": "3.16.24", "uikit": "3.16.24",
"zone.js": "~0.13.1" "zone.js": "~0.14.0"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^16.1.6", "@angular-devkit/build-angular": "^18.1.0",
"@angular/cli": "^16.1.6", "@angular/cli": "^18.1.0",
"@angular/compiler-cli": "^16.1.7", "@angular/compiler-cli": "^18.1.0",
"@angular/language-service": "^16.1.7", "@angular/language-service": "^18.1.0",
"@nguniversal/builders": "^16.1.1",
"@types/compression": "^1.7.0", "@types/compression": "^1.7.0",
"@types/express": "^4.17.0", "@types/express": "^4.17.0",
"@types/jasmine": "~3.6.0", "@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
"@types/node": "^16.18.50", "@types/node": "^18.19.1",
"browser-sync": "^3.0.0",
"codelyzer": "^6.0.0", "codelyzer": "^6.0.0",
"jasmine-core": "~3.8.0", "jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0", "jasmine-spec-reporter": "~5.0.0",
@ -69,7 +69,8 @@
"karma-jasmine": "~4.0.0", "karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.6.0", "karma-jasmine-html-reporter": "^1.6.0",
"protractor": "~7.0.0", "protractor": "~7.0.0",
"replace-in-file": "^8.2.0",
"ts-node": "~7.0.0", "ts-node": "~7.0.0",
"typescript": "~4.9.5" "typescript": "~5.4.0"
} }
} }

View File

@ -1,23 +1,30 @@
import 'zone.js/node'; import 'zone.js/node';
import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import * as compression from 'compression';
import { join } from 'path';
import { AppServerModule } from './src/main.server';
import { APP_BASE_HREF } from '@angular/common'; import { APP_BASE_HREF } from '@angular/common';
import { existsSync } from 'fs'; import { CommonEngine } from '@angular/ssr';
import * as express from 'express';
import { existsSync } from 'node:fs';
import * as prom from "prom-client"; import * as prom from "prom-client";
import { join } from 'node:path';
import {AppServerModule} from "./src/main.server";
import {routes} from "./routes"; import {routes} from "./routes";
import {REQUEST, RESPONSE} from "./src/app/openaireLibrary/utils/tokens"; import {REQUEST, RESPONSE} from "./src/app/openaireLibrary/utils/tokens";
import * as compression from "compression";
// The Express app is exported so that it can be used by serverless Functions. // The Express app is exported so that it can be used by serverless Functions.
export function app() { export function app(): express.Express {
const server = express(); const server = express();
server.use(compression()); server.use(compression());
const distFolder = join(process.cwd(), 'dist/explore/browser'); const distFolder = join(process.cwd(), 'dist/explore/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index'; const indexHtml = existsSync(join(distFolder, 'index.original.html'))
? join(distFolder, 'index.original.html')
: join(distFolder, 'index.html');
const commonEngine = new CommonEngine();
server.set('view engine', 'html');
server.set('views', distFolder);
const register = new prom.Registry(); const register = new prom.Registry();
@ -36,15 +43,6 @@ export function app() {
buckets: [0.1, 0.2, 0.5, 1, 2] buckets: [0.1, 0.2, 0.5, 1, 2]
}); });
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
server.engine('html', ngExpressEngine({
bootstrap: AppServerModule,
inlineCriticalCss: false
}));
server.set('view engine', 'html');
server.set('views', distFolder);
// Example Express Rest API endpoints // Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { }); // server.get('/api/**', (req, res) => { });
// Serve static files from /browser // Serve static files from /browser
@ -80,56 +78,59 @@ export function app() {
} }
}); });
// All regular routes use the Universal engine // All regular routes use the Angular engine
server.get('*', (req, res) => { server.get('*', (req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
if (routes.indexOf(req.path) !== -1) { if (routes.indexOf(req.path) !== -1) {
const end = histogram.startTimer({route: req.path}); const end = histogram.startTimer({route: req.path});
res.render(indexHtml, { commonEngine.render({
req, providers: [ bootstrap: AppServerModule,
{ documentFilePath: indexHtml,
provide: APP_BASE_HREF, url: `${protocol}://${headers.host}${originalUrl}`,
useValue: req.baseUrl publicPath: distFolder,
}, inlineCriticalCss: false,
{ providers: [
provide: REQUEST, useValue: (req) {provide: APP_BASE_HREF, useValue: baseUrl},
}, {provide: REQUEST, useValue: (req)},
{ {provide: RESPONSE, useValue: (res)}
provide: RESPONSE, useValue: (res) ],
} })
] .then((html) => {
} res.on('finish', function () {
); responses.inc({route: req.path, code: res.statusCode});
res.on('finish', function () { end();
responses.inc({route: req.path, code: res.statusCode}); });
end(); res.status(200).send(html)
}); })
.catch((err) => res.status(500).send('Error during SSR'))
} else { } else {
res.render(indexHtml, { commonEngine.render({
req, providers: [ bootstrap: AppServerModule,
{ documentFilePath: indexHtml,
provide: APP_BASE_HREF, url: `${protocol}://${headers.host}${originalUrl}`,
useValue: req.baseUrl publicPath: distFolder,
}, inlineCriticalCss: false,
{ providers: [
provide: REQUEST, useValue: (req) {provide: APP_BASE_HREF, useValue: baseUrl},
}, {provide: REQUEST, useValue: (req)},
{ {provide: RESPONSE, useValue: (res)}
provide: RESPONSE, useValue: (res) ],
} })
] .then((html) => {
} res.on('finish', function () {
); responses.inc({route: '**', code: res.statusCode});
res.on('finish', function () { });
responses.inc({route: '**', code: res.statusCode}); res.status(200).send(html)
}); })
.catch((err) => res.status(500).send('Error during SSR'))
} }
}); });
return server; return server;
} }
function run() { function run(): void {
const port = process.env.PORT || 4000; const port = process.env['PORT'] || 4000;
// Start up the Node server // Start up the Node server
const server = app(); const server = app();
@ -147,5 +148,3 @@ const moduleFilename = mainModule && mainModule.filename || '';
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) { if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run(); run();
} }
export * from './src/main.server';

View File

@ -1,7 +1,6 @@
import {NgModule} from '@angular/core'; import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router'; import {RouterModule, Routes} from '@angular/router';
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component"; import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
import {SdgModule} from "./openaireLibrary/sdg/sdg.module";
import {ErrorPageComponent} from "./openaireLibrary/error/errorPage.component"; import {ErrorPageComponent} from "./openaireLibrary/error/errorPage.component";
const routes: Routes = [ const routes: Routes = [

View File

@ -1,8 +1,7 @@
import {AfterViewInit, ChangeDetectorRef, Component, ElementRef, ViewChild} from '@angular/core'; import {AfterViewInit, ChangeDetectorRef, Component, ElementRef, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {EnvProperties} from './openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from './openaireLibrary/utils/properties/env-properties';
import {MenuItem} from './openaireLibrary/sharedComponents/menu'; import {MenuItem} from './openaireLibrary/sharedComponents/menu';
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
import {Session, User} from './openaireLibrary/login/utils/helper.class'; import {Session, User} from './openaireLibrary/login/utils/helper.class';
import {UserManagementService} from "./openaireLibrary/services/user-management.service"; import {UserManagementService} from "./openaireLibrary/services/user-management.service";
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service"; import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
@ -87,8 +86,8 @@ export class AppComponent implements AfterViewInit {
subscriptions = []; subscriptions = [];
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService, constructor(private route: ActivatedRoute,
private router: Router, private userManagementService: UserManagementService, private smoothScroll: SmoothScroll, private userManagementService: UserManagementService, private smoothScroll: SmoothScroll,
private configurationService: ConfigurationService, private _meta: Meta, private seoService: SEOService, private configurationService: ConfigurationService, private _meta: Meta, private seoService: SEOService,
private emailService: EmailService, private fb: FormBuilder, private quickContactService: QuickContactService, private emailService: EmailService, private fb: FormBuilder, private quickContactService: QuickContactService,
private layoutService: LayoutService, private cdr: ChangeDetectorRef, private layoutService: LayoutService, private cdr: ChangeDetectorRef,
@ -339,13 +338,13 @@ export class AppComponent implements AfterViewInit {
this.subscriptions.push(this.layoutService.hasQuickContact.subscribe(hasQuickContact => { this.subscriptions.push(this.layoutService.hasQuickContact.subscribe(hasQuickContact => {
if(this.showQuickContact !== hasQuickContact) { if(this.showQuickContact !== hasQuickContact) {
this.showQuickContact = hasQuickContact; this.showQuickContact = hasQuickContact;
this.cdr.detectChanges(); this.cdr.markForCheck();
} }
})); }));
this.subscriptions.push(this.quickContactService.isDisplayed.subscribe(display => { this.subscriptions.push(this.quickContactService.isDisplayed.subscribe(display => {
if(this.displayQuickContact !== display) { if(this.displayQuickContact !== display) {
this.displayQuickContact = display; this.displayQuickContact = display;
this.cdr.detectChanges(); this.cdr.markForCheck();
} }
})); }));
} }
@ -368,7 +367,7 @@ export class AppComponent implements AfterViewInit {
this.createObservers(); this.createObservers();
this.subscriptions.push(this.layoutService.rootClass.subscribe(rootClass => { this.subscriptions.push(this.layoutService.rootClass.subscribe(rootClass => {
this.loading = true; this.loading = true;
this.cdr.detectChanges(); this.cdr.markForCheck();
if (rootClass && this.isClient) { if (rootClass && this.isClient) {
let link = <HTMLLinkElement>document.getElementById('theme'); let link = <HTMLLinkElement>document.getElementById('theme');
let append = false; let append = false;
@ -385,10 +384,10 @@ export class AppComponent implements AfterViewInit {
} }
} }
this.rootClass = rootClass; this.rootClass = rootClass;
this.cdr.detectChanges(); this.cdr.markForCheck();
setTimeout(() => { setTimeout(() => {
this.loading = false; this.loading = false;
this.cdr.detectChanges(); this.cdr.markForCheck();
}, 500) }, 500)
})); }));
} }
@ -404,7 +403,7 @@ export class AppComponent implements AfterViewInit {
entries.forEach(entry => { entries.forEach(entry => {
if(this.bottomNotIntersecting !== (!entry.isIntersecting)) { if(this.bottomNotIntersecting !== (!entry.isIntersecting)) {
this.bottomNotIntersecting = !entry.isIntersecting; this.bottomNotIntersecting = !entry.isIntersecting;
this.cdr.detectChanges(); this.cdr.markForCheck();
} }
}); });
}, options); }, options);

View File

@ -3,7 +3,7 @@ import {SharedModule} from './openaireLibrary/shared/shared.module';
import {BrowserModule} from '@angular/platform-browser'; import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {HTTP_INTERCEPTORS, HttpClientModule} from '@angular/common/http'; import {HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi} from '@angular/common/http';
import {AppComponent} from './app.component'; import {AppComponent} from './app.component';
import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module'; import {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.module';
import {CookieLawModule} from './openaireLibrary/sharedComponents/cookie-law/cookie-law.module'; import {CookieLawModule} from './openaireLibrary/sharedComponents/cookie-law/cookie-law.module';
@ -13,52 +13,40 @@ import {AppRoutingModule} from './app-routing.module';
import {HttpInterceptorService} from "./openaireLibrary/http-interceptor.service"; import {HttpInterceptorService} from "./openaireLibrary/http-interceptor.service";
import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.module"; import {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.module";
import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; import {Schema2jsonldModule} from "./openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module";
import {CacheInterceptorService} from "./openaireLibrary/cache-interceptor.service";
import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service"; import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service";
import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.service"; import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.service";
import {QuickContactModule} from './openaireLibrary/sharedComponents/quick-contact/quick-contact.module'; import {QuickContactModule} from './openaireLibrary/sharedComponents/quick-contact/quick-contact.module';
import {AlertModalModule} from './openaireLibrary/utils/modal/alertModal.module'; import {AlertModalModule} from './openaireLibrary/utils/modal/alertModal.module';
import {LoadingModule} from "./openaireLibrary/utils/loading/loading.module"; import {LoadingModule} from "./openaireLibrary/utils/loading/loading.module";
@NgModule({ @NgModule({ declarations: [AppComponent],
imports: [ exports: [AppComponent],
SharedModule, bootstrap: [AppComponent], imports: [SharedModule,
CommonModule, CommonModule,
HttpClientModule, ErrorModule,
ErrorModule, NavigationBarModule, BottomModule,
NavigationBarModule, BottomModule, CookieLawModule,
CookieLawModule, BrowserModule,
BrowserModule, AppRoutingModule,
AppRoutingModule, BrowserAnimationsModule, PageURLResolverModule,
BrowserAnimationsModule, PageURLResolverModule, Schema2jsonldModule,
Schema2jsonldModule, QuickContactModule,
QuickContactModule, AlertModalModule, LoadingModule], providers: [
AlertModalModule, LoadingModule { provide: APP_ID, useValue: 'explore' },
], {
declarations: [AppComponent], provide: HTTP_INTERCEPTORS,
exports: [AppComponent], useClass: HttpInterceptorService,
providers: [ multi: true
{provide: APP_ID, useValue: 'explore'}, },
// { {
// provide: HTTP_INTERCEPTORS, provide: HTTP_INTERCEPTORS,
// useClass: CacheInterceptorService, useClass: ErrorInterceptorService,
// multi: true multi: true
// }, },
{ [{ provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true }],
provide: HTTP_INTERCEPTORS, [{ provide: DEFAULT_TIMEOUT, useValue: 3000 }],
useClass: HttpInterceptorService, provideHttpClient(withInterceptorsFromDi())
multi: true ] })
},
{
provide: HTTP_INTERCEPTORS,
useClass: ErrorInterceptorService,
multi: true
},
[{provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true}],
[{provide: DEFAULT_TIMEOUT, useValue: 3000}]
],
bootstrap: [AppComponent]
})
//
export class AppModule { export class AppModule {
} }

View File

@ -1,5 +1,5 @@
import {Component, OnInit, ViewChild} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {Router} from '@angular/router';
import {EmailService} from "../openaireLibrary/utils/email/email.service"; import {EmailService} from "../openaireLibrary/utils/email/email.service";
import {Email} from "../openaireLibrary/utils/email/email"; import {Email} from "../openaireLibrary/utils/email/email";
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties"; import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
@ -7,7 +7,6 @@ import {Composer} from "../openaireLibrary/utils/email/composer";
import {Meta, Title} from "@angular/platform-browser"; import {Meta, Title} from "@angular/platform-browser";
import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service"; import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class"; import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {FormBuilder, FormGroup, Validators} from "@angular/forms"; import {FormBuilder, FormGroup, Validators} from "@angular/forms";
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
@ -28,8 +27,6 @@ export class ContactComponent implements OnInit {
public sending = true; public sending = true;
public email: Email; public email: Email;
public properties: EnvProperties = properties; public properties: EnvProperties = properties;
public pageContents = null;
public divContents = null;
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Contact us'}]; public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Contact us'}];
public contactForm: FormGroup; public contactForm: FormGroup;
@ViewChild('modal') modal; @ViewChild('modal') modal;
@ -44,15 +41,13 @@ export class ContactComponent implements OnInit {
}); });
} }
constructor(private route: ActivatedRoute, constructor(private _router: Router,
private _router: Router,
private _emailService: EmailService, private _emailService: EmailService,
private _meta: Meta, private _meta: Meta,
private _title: Title, private _title: Title,
private seoService: SEOService, private seoService: SEOService,
private _piwikService: PiwikService, private _piwikService: PiwikService,
private fb: FormBuilder, private fb: FormBuilder) {
private helper: HelperService) {
} }
ngOnInit() { ngOnInit() {
@ -66,16 +61,9 @@ export class ContactComponent implements OnInit {
this.updateTitle(this.pageTitle); this.updateTitle(this.pageTitle);
this.updateDescription(this.description); this.updateDescription(this.description);
this.reset(); this.reset();
// this.getPageContents();
this.sending = false; 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) { public send(event) {
HelperFunctions.scroll(); HelperFunctions.scroll();
if(event.valid === true) { if(event.valid === true) {

View File

@ -8,8 +8,6 @@ import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service"; import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component"; import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
import {properties} from "../../environments/environment"; import {properties} from "../../environments/environment";
import {RefineFieldResultsService} from '../openaireLibrary/services/refineFieldResults.service';
import {StakeholderService} from '../openaireLibrary/monitor/services/stakeholder.service';
import {Option} from '../openaireLibrary/sharedComponents/input/input.component'; import {Option} from '../openaireLibrary/sharedComponents/input/input.component';
import {StringUtils} from '../openaireLibrary/utils/string-utils.class'; import {StringUtils} from '../openaireLibrary/utils/string-utils.class';
import {HelperFunctions} from '../openaireLibrary/utils/HelperFunctions.class'; import {HelperFunctions} from '../openaireLibrary/utils/HelperFunctions.class';
@ -91,8 +89,6 @@ export class FundersComponent implements OnInit {
private title: Title, private title: Title,
private seoService: SEOService, private seoService: SEOService,
private piwikService: PiwikService, private piwikService: PiwikService,
private refineFieldResultsService: RefineFieldResultsService,
private stakeholderService: StakeholderService,
private layoutService: LayoutService, private layoutService: LayoutService,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
private fb: FormBuilder, private fb: FormBuilder,
@ -225,102 +221,6 @@ export class FundersComponent implements OnInit {
this.displayedFunders = this.funders; this.displayedFunders = this.funders;
this.showLoading = false; this.showLoading = false;
})) }))
// let refineParams = '&fq=resultbestaccessright%20exact%20%22Open%20Access%22';
// this.subscriptions.push(
// zip(
// this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties),
// this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams),
// this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties),
// this.stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL, 'funder')
// ).subscribe((data: any[]) => {
// // storing all needed data to a map
// // 1st call
// let queriedFunders1 = data[0][1][0].values;
// queriedFunders1.forEach(queriedFunder => {
// this.fundersMap.set(queriedFunder.id, {
// "id": queriedFunder.id,
// "name": queriedFunder.name,
// "alias": '',
// "researchProducts": +queriedFunder.number,
// "openAccessResearchProducts": 0,
// "openAccessPercentage": 0,
// "projects": 0,
// "monitorDashboard": '',
// "monitorDashboardStatus": '',
// "logoUrl": ''
// });
// });
//
// // 2nd call
// let queriedFunders2 = data[1][1][0].values;
// queriedFunders2.forEach(queriedFunder => {
// if(this.fundersMap.has(queriedFunder.id)) {
// this.fundersMap.get(queriedFunder.id).openAccessResearchProducts = +queriedFunder.number;
// }
// });
//
// // 3rd call
// let queriedFunders3 = data[2][1][0].values;
// queriedFunders3.forEach(queriedFunder => {
// if(+queriedFunder.number > 1) {
// if (this.fundersMap.has(queriedFunder.id)) {
// this.fundersMap.get(queriedFunder.id).projects = +queriedFunder.number;
// } else {
// this.fundersMap.set(queriedFunder.id, {
// "id": queriedFunder.id,
// "name": queriedFunder.name,
// "alias": '',
// "researchProducts": 0,
// "openAccessResearchProducts": 0,
// "openAccessPercentage": 0,
// "projects": +queriedFunder.number,
// "monitorDashboard": '',
// "monitorDashboardStatus": '',
// "logoUrl": ''
// });
// }
// }
// });
//
// // 4th call
// let queriedFunders4 = data[3];
// queriedFunders4.forEach(queriedFunder => {
// let id = queriedFunder.index_id + '||' + queriedFunder.index_name + '||' + queriedFunder.index_shortName;
// if(this.fundersMap.has(id) && (
// !this.fundersMap.get(id).monitorDashboardStatus
// ||
// (this.fundersMap.get(id).monitorDashboardStatus == "RESTRICTED" && queriedFunder.visibility == "PUBLIC")
// ||
// (this.fundersMap.get(id).monitorDashboardStatus == "PRIVATE" && (queriedFunder.visibility == "RESTRICTED" || queriedFunder.visibility == "PUBLIC")))) {
// this.fundersMap.get(id).alias = queriedFunder.alias;
// this.fundersMap.get(id).monitorDashboard = queriedFunder.alias;
// this.fundersMap.get(id).monitorDashboardStatus = queriedFunder.visibility;
// this.fundersMap.get(id).logoUrl = (queriedFunder.isUpload ? properties.utilsService + "/download/" : "")+ (queriedFunder.logoUrl);
// }
// });
// this.fundersMap.forEach((value) => {
// if(value.openAccessResearchProducts > 0) {
// value.openAccessPercentage = Math.round((value.openAccessResearchProducts / value.researchProducts) * 100);
// }
// if(!value.logoUrl && this.staticLogos.has(value.id)) {
// let split = value.id.split("||");
// let shortname = (split && split.length==3) ? value.id.split("||")[2] : value.id;
// value.logoUrl = "assets/explore-assets/funders/logos/"+shortname+".png";
// }
// });
// // convert funders map into an array
// this.funders = Array.from(this.fundersMap.values());
// // calculate total numbers for intro content
// this.calculateNumbers();
// // sort funders
// this.funders.sort((a, b) => a['name'].localeCompare(b['name']));
// // initialize displayedFunders
// this.displayedFunders = this.funders;
// console.log(this.funders);
// this.showLoading = false;
// })
// );
} }
private calculateSum(array, property) { private calculateSum(array, property) {

View File

@ -1,6 +1,5 @@
import { import {
AfterViewInit, AfterViewInit,
ChangeDetectorRef,
Component, Component,
ElementRef, ElementRef,
OnDestroy, OnDestroy,
@ -76,12 +75,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
@ViewChild('contact') contact: ElementRef; @ViewChild('contact') contact: ElementRef;
subscriptions: any[] = []; subscriptions: any[] = [];
@ViewChildren('scrolling_element') elements: QueryList<ElementRef>; @ViewChildren('scrolling_element') elements: QueryList<ElementRef>;
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = null;//{ resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = null;
// filter: null,
// selected: true,
// filterId: "resultbestaccessright",
// value: "Open Access"
// };
selectedEntity = "all"; selectedEntity = "all";
selectedEntitySimpleUrl; selectedEntitySimpleUrl;
selectedEntityAdvancedUrl; selectedEntityAdvancedUrl;
@ -108,14 +102,13 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
{value: "lcsh:Technology", label: "Technology"}, {value: "lcsh:Technology", label: "Technology"},
]; ];
stringUtils = new StringUtils(); stringUtils = new StringUtils();
// disableSelect: boolean = true;
constructor( constructor(
private _router: Router, private _router: Router,
private _piwikService: PiwikService, private _piwikService: PiwikService,
private config: ConfigurationService, private _meta: Meta, private _title: Title, private seoService: SEOService, private config: ConfigurationService, private _meta: Meta,
private _title: Title, private seoService: SEOService,
private helper: HelperService, private helper: HelperService,
private cdr: ChangeDetectorRef,
private quickContactService: QuickContactService private quickContactService: QuickContactService
) { ) {
let description = "OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide."; let description = "OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide.";
@ -291,29 +284,11 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
goTo() { goTo() {
let parameterNames = []; let parameterNames = [];
let parameterValues = []; let parameterValues = [];
// if (this.selectedEntity == "result") {
// if (this.resultTypes) {
// let values = [];
// for (let value of this.resultTypes.values) {
// if (value.selected) {
// values.push(value.id);
// }
// }
// if (values.length > 0 && values.length != 4) {
// parameterNames.push("type");
// parameterValues.push(values.join(","));
// }
// if (this.resultsQuickFilter && this.resultsQuickFilter.selected) {
// parameterNames.push(this.resultsQuickFilter.filterId);
// parameterValues.push('"' + encodeURIComponent(this.resultsQuickFilter.value) + '"');
// }
// }
// } else if (this.selectedEntity == "all") {
if (this.resultsQuickFilter && this.resultsQuickFilter.selected) { if (this.resultsQuickFilter && this.resultsQuickFilter.selected) {
parameterNames.push(this.resultsQuickFilter.filterId); parameterNames.push(this.resultsQuickFilter.filterId);
parameterValues.push('"' + encodeURIComponent(this.resultsQuickFilter.value) + '"'); parameterValues.push('"' + encodeURIComponent(this.resultsQuickFilter.value) + '"');
} }
// }
if (this.keyword.length > 0) { if (this.keyword.length > 0) {
parameterNames.push("fv0"); parameterNames.push("fv0");
parameterValues.push(this.keyword); parameterValues.push(this.keyword);
@ -326,9 +301,4 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
getSubjectParameter(param) { getSubjectParameter(param) {
return {'f0': 'resultsubject', 'fv0': '"' + (param) + '"', size: 50}; return {'f0': 'resultsubject', 'fv0': '"' + (param) + '"', size: 50};
} }
// disableSelectChange(event: boolean) {
// this.disableSelect = event;
// this.cdr.detectChanges();
// }
} }

@ -1 +1 @@
Subproject commit 2279420241dcecb156055fb10251930111e29197 Subproject commit 9c93a1e306ce7abd43e3c552a2fff0240ae2f04c

@ -1 +1 @@
Subproject commit 038684a0dca02700164e467abd390bbd865df3d9 Subproject commit 3c9fbe2a9c606ebaec0749cf46f819020d76f6cf