Compare commits
16 Commits
master
...
angular-18
Author | SHA1 | Date |
---|---|---|
Alex Martzios | 780ca3b846 | |
Alex Martzios | 48b1c93ee4 | |
Alex Martzios | 451966b4ce | |
Konstantina Galouni | c0eaf1dee9 | |
Konstantina Galouni | 9a14c3dc77 | |
Konstantina Galouni | f67e2b533d | |
Alex Martzios | aed67b0833 | |
Konstantina Galouni | 254fd67771 | |
Konstantina Galouni | ed6c677d74 | |
Alex Martzios | 5102e4e444 | |
Alex Martzios | 86c2a5042c | |
Alex Martzios | c7e1fe316b | |
Alex Martzios | 6c442d4dd7 | |
Alex Martzios | 160c87ceca | |
Alex Martzios | 1c265e4fa5 | |
Alex Martzios | 16a10758cb |
|
@ -239,18 +239,18 @@
|
|||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "explore:build"
|
||||
"buildTarget": "explore:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "explore:build:production"
|
||||
"buildTarget": "explore:build:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "explore:build"
|
||||
"buildTarget": "explore:build"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
|
@ -327,7 +327,7 @@
|
|||
"defaultConfiguration": ""
|
||||
},
|
||||
"serve-ssr": {
|
||||
"builder": "@nguniversal/builders:ssr-dev-server",
|
||||
"builder": "@angular-devkit/build-angular:ssr-dev-server",
|
||||
"options": {
|
||||
"browserTarget": "explore:build",
|
||||
"serverTarget": "explore:server"
|
||||
|
@ -340,7 +340,7 @@
|
|||
}
|
||||
},
|
||||
"prerender": {
|
||||
"builder": "@nguniversal/builders:prerender",
|
||||
"builder": "@angular-devkit/build-angular:prerender",
|
||||
"options": {
|
||||
"browserTarget": "explore:build:production",
|
||||
"serverTarget": "explore:server:production",
|
||||
|
|
|
@ -23,43 +23,43 @@
|
|||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular/animations": "^16.1.7",
|
||||
"@angular/cdk": "^16.1.6",
|
||||
"@angular/common": "^16.1.7",
|
||||
"@angular/compiler": "^16.1.7",
|
||||
"@angular/core": "^16.1.7",
|
||||
"@angular/forms": "^16.1.7",
|
||||
"@angular/localize": "^16.1.7",
|
||||
"@angular/material": "^16.1.6",
|
||||
"@angular/platform-browser": "^16.1.7",
|
||||
"@angular/platform-browser-dynamic": "^16.1.7",
|
||||
"@angular/platform-server": "^16.1.7",
|
||||
"@angular/router": "^16.1.7",
|
||||
"@nguniversal/express-engine": "^16.1.1",
|
||||
"@angular/animations": "^18.1.0",
|
||||
"@angular/cdk": "^18.1.0",
|
||||
"@angular/common": "^18.1.0",
|
||||
"@angular/compiler": "^18.1.0",
|
||||
"@angular/core": "^18.1.0",
|
||||
"@angular/forms": "^18.1.0",
|
||||
"@angular/localize": "^18.1.0",
|
||||
"@angular/material": "^18.1.0",
|
||||
"@angular/platform-browser": "^18.1.0",
|
||||
"@angular/platform-browser-dynamic": "^18.1.0",
|
||||
"@angular/platform-server": "^18.1.0",
|
||||
"@angular/router": "^18.1.0",
|
||||
"@angular/ssr": "^18.1.0",
|
||||
"clipboard": "^1.5.16",
|
||||
"core-js": "^2.5.4",
|
||||
"express": "^4.15.2",
|
||||
"flag-icons": "^7.2.1",
|
||||
"jquery": "^3.4.1",
|
||||
"ng-recaptcha": "^12.0.2",
|
||||
"ng-recaptcha-2": "^14.0.0",
|
||||
"prom-client": "^11.3.0",
|
||||
"rxjs": "^6.5.1",
|
||||
"ts-md5": "^1.2.0",
|
||||
"tslib": "^2.0.0",
|
||||
"uikit": "3.16.24",
|
||||
"zone.js": "~0.13.1"
|
||||
"zone.js": "~0.14.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "^16.1.6",
|
||||
"@angular/cli": "^16.1.6",
|
||||
"@angular/compiler-cli": "^16.1.7",
|
||||
"@angular/language-service": "^16.1.7",
|
||||
"@nguniversal/builders": "^16.1.1",
|
||||
"@angular-devkit/build-angular": "^18.1.0",
|
||||
"@angular/cli": "^18.1.0",
|
||||
"@angular/compiler-cli": "^18.1.0",
|
||||
"@angular/language-service": "^18.1.0",
|
||||
"@types/compression": "^1.7.0",
|
||||
"@types/express": "^4.17.0",
|
||||
"@types/jasmine": "~3.6.0",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
"@types/node": "^16.18.50",
|
||||
"@types/node": "^18.19.1",
|
||||
"browser-sync": "^3.0.0",
|
||||
"codelyzer": "^6.0.0",
|
||||
"jasmine-core": "~3.8.0",
|
||||
"jasmine-spec-reporter": "~5.0.0",
|
||||
|
@ -69,7 +69,8 @@
|
|||
"karma-jasmine": "~4.0.0",
|
||||
"karma-jasmine-html-reporter": "^1.6.0",
|
||||
"protractor": "~7.0.0",
|
||||
"replace-in-file": "^8.2.0",
|
||||
"ts-node": "~7.0.0",
|
||||
"typescript": "~4.9.5"
|
||||
"typescript": "~5.4.0"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +1,40 @@
|
|||
|
||||
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 { 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 { join } from 'node:path';
|
||||
import {AppServerModule} from "./src/main.server";
|
||||
import {routes} from "./routes";
|
||||
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.
|
||||
export function app() {
|
||||
export function app(): express.Express {
|
||||
const server = express();
|
||||
server.use(compression());
|
||||
const distFolder = join(process.cwd(), 'dist/explore/browser');
|
||||
const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index';
|
||||
|
||||
const 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 responses = new prom.Counter({
|
||||
name: 'portal_http_responses_total',
|
||||
help: 'A counter for portal response codes for every existed or not existed pages.',
|
||||
labelNames: ['route', 'code'],
|
||||
registers: [register]
|
||||
});
|
||||
|
||||
|
||||
const histogram = new prom.Histogram({
|
||||
name: 'portal_http_request_duration_seconds',
|
||||
help: 'A Histogram for a portal. Providing information about page visits and load latency in seconds.',
|
||||
|
@ -35,15 +42,6 @@ export function app() {
|
|||
registers: [register],
|
||||
buckets: [0.1, 0.2, 0.5, 1, 2]
|
||||
});
|
||||
|
||||
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/master/modules/express-engine)
|
||||
server.engine('html', ngExpressEngine({
|
||||
bootstrap: AppServerModule,
|
||||
inlineCriticalCss: false
|
||||
}));
|
||||
|
||||
server.set('view engine', 'html');
|
||||
server.set('views', distFolder);
|
||||
|
||||
// Example Express Rest API endpoints
|
||||
// server.get('/api/**', (req, res) => { });
|
||||
|
@ -51,7 +49,7 @@ export function app() {
|
|||
server.get('*.*', express.static(distFolder, {
|
||||
maxAge: '1y'
|
||||
}));
|
||||
|
||||
|
||||
server.get('/metrics', (req, res) => {
|
||||
res.set('Content-Type', register.contentType);
|
||||
res.end(register.metrics());
|
||||
|
@ -80,56 +78,59 @@ export function app() {
|
|||
}
|
||||
});
|
||||
|
||||
// All regular routes use the Universal engine
|
||||
server.get('*', (req, res) => {
|
||||
// All regular routes use the Angular engine
|
||||
server.get('*', (req, res, next) => {
|
||||
const { protocol, originalUrl, baseUrl, headers } = req;
|
||||
if (routes.indexOf(req.path) !== -1) {
|
||||
const end = histogram.startTimer({route: req.path});
|
||||
res.render(indexHtml, {
|
||||
req, providers: [
|
||||
{
|
||||
provide: APP_BASE_HREF,
|
||||
useValue: req.baseUrl
|
||||
},
|
||||
{
|
||||
provide: REQUEST, useValue: (req)
|
||||
},
|
||||
{
|
||||
provide: RESPONSE, useValue: (res)
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
res.on('finish', function () {
|
||||
responses.inc({route: req.path, code: res.statusCode});
|
||||
end();
|
||||
});
|
||||
commonEngine.render({
|
||||
bootstrap: AppServerModule,
|
||||
documentFilePath: indexHtml,
|
||||
url: `${protocol}://${headers.host}${originalUrl}`,
|
||||
publicPath: distFolder,
|
||||
inlineCriticalCss: false,
|
||||
providers: [
|
||||
{provide: APP_BASE_HREF, useValue: baseUrl},
|
||||
{provide: REQUEST, useValue: (req)},
|
||||
{provide: RESPONSE, useValue: (res)}
|
||||
],
|
||||
})
|
||||
.then((html) => {
|
||||
res.on('finish', function () {
|
||||
responses.inc({route: req.path, code: res.statusCode});
|
||||
end();
|
||||
});
|
||||
res.status(200).send(html)
|
||||
})
|
||||
.catch((err) => res.status(500).send('Error during SSR'))
|
||||
} else {
|
||||
res.render(indexHtml, {
|
||||
req, providers: [
|
||||
{
|
||||
provide: APP_BASE_HREF,
|
||||
useValue: req.baseUrl
|
||||
},
|
||||
{
|
||||
provide: REQUEST, useValue: (req)
|
||||
},
|
||||
{
|
||||
provide: RESPONSE, useValue: (res)
|
||||
}
|
||||
]
|
||||
}
|
||||
);
|
||||
res.on('finish', function () {
|
||||
responses.inc({route: '**', code: res.statusCode});
|
||||
});
|
||||
commonEngine.render({
|
||||
bootstrap: AppServerModule,
|
||||
documentFilePath: indexHtml,
|
||||
url: `${protocol}://${headers.host}${originalUrl}`,
|
||||
publicPath: distFolder,
|
||||
inlineCriticalCss: false,
|
||||
providers: [
|
||||
{provide: APP_BASE_HREF, useValue: baseUrl},
|
||||
{provide: REQUEST, useValue: (req)},
|
||||
{provide: RESPONSE, useValue: (res)}
|
||||
],
|
||||
})
|
||||
.then((html) => {
|
||||
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;
|
||||
}
|
||||
|
||||
function run() {
|
||||
const port = process.env.PORT || 4000;
|
||||
function run(): void {
|
||||
const port = process.env['PORT'] || 4000;
|
||||
|
||||
// Start up the Node server
|
||||
const server = app();
|
||||
|
@ -146,6 +147,4 @@ const mainModule = __non_webpack_require__.main;
|
|||
const moduleFilename = mainModule && mainModule.filename || '';
|
||||
if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
|
||||
run();
|
||||
}
|
||||
|
||||
export * from './src/main.server';
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule, Routes} from '@angular/router';
|
||||
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
|
||||
import {SdgModule} from "./openaireLibrary/sdg/sdg.module";
|
||||
import {ErrorPageComponent} from "./openaireLibrary/error/errorPage.component";
|
||||
|
||||
const routes: Routes = [
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
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 {MenuItem} from './openaireLibrary/sharedComponents/menu';
|
||||
import {EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
||||
import {Session, User} from './openaireLibrary/login/utils/helper.class';
|
||||
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
|
||||
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
|
||||
|
@ -87,8 +86,8 @@ export class AppComponent implements AfterViewInit {
|
|||
|
||||
subscriptions = [];
|
||||
|
||||
constructor(private route: ActivatedRoute, private propertiesService: EnvironmentSpecificService,
|
||||
private router: Router, private userManagementService: UserManagementService, private smoothScroll: SmoothScroll,
|
||||
constructor(private route: ActivatedRoute,
|
||||
private userManagementService: UserManagementService, private smoothScroll: SmoothScroll,
|
||||
private configurationService: ConfigurationService, private _meta: Meta, private seoService: SEOService,
|
||||
private emailService: EmailService, private fb: FormBuilder, private quickContactService: QuickContactService,
|
||||
private layoutService: LayoutService, private cdr: ChangeDetectorRef,
|
||||
|
@ -339,13 +338,13 @@ export class AppComponent implements AfterViewInit {
|
|||
this.subscriptions.push(this.layoutService.hasQuickContact.subscribe(hasQuickContact => {
|
||||
if(this.showQuickContact !== hasQuickContact) {
|
||||
this.showQuickContact = hasQuickContact;
|
||||
this.cdr.detectChanges();
|
||||
this.cdr.markForCheck();
|
||||
}
|
||||
}));
|
||||
this.subscriptions.push(this.quickContactService.isDisplayed.subscribe(display => {
|
||||
if(this.displayQuickContact !== display) {
|
||||
this.displayQuickContact = display;
|
||||
this.cdr.detectChanges();
|
||||
this.cdr.markForCheck();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
@ -368,7 +367,7 @@ export class AppComponent implements AfterViewInit {
|
|||
this.createObservers();
|
||||
this.subscriptions.push(this.layoutService.rootClass.subscribe(rootClass => {
|
||||
this.loading = true;
|
||||
this.cdr.detectChanges();
|
||||
this.cdr.markForCheck();
|
||||
if (rootClass && this.isClient) {
|
||||
let link = <HTMLLinkElement>document.getElementById('theme');
|
||||
let append = false;
|
||||
|
@ -385,10 +384,10 @@ export class AppComponent implements AfterViewInit {
|
|||
}
|
||||
}
|
||||
this.rootClass = rootClass;
|
||||
this.cdr.detectChanges();
|
||||
this.cdr.markForCheck();
|
||||
setTimeout(() => {
|
||||
this.loading = false;
|
||||
this.cdr.detectChanges();
|
||||
this.cdr.markForCheck();
|
||||
}, 500)
|
||||
}));
|
||||
}
|
||||
|
@ -404,7 +403,7 @@ export class AppComponent implements AfterViewInit {
|
|||
entries.forEach(entry => {
|
||||
if(this.bottomNotIntersecting !== (!entry.isIntersecting)) {
|
||||
this.bottomNotIntersecting = !entry.isIntersecting;
|
||||
this.cdr.detectChanges();
|
||||
this.cdr.markForCheck();
|
||||
}
|
||||
});
|
||||
}, options);
|
||||
|
|
|
@ -3,7 +3,7 @@ import {SharedModule} from './openaireLibrary/shared/shared.module';
|
|||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
|
||||
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 {NavigationBarModule} from './openaireLibrary/sharedComponents/navigationBar.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 {PageURLResolverModule} from "./openaireLibrary/utils/pageURLResolver.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 {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.service";
|
||||
import {QuickContactModule} from './openaireLibrary/sharedComponents/quick-contact/quick-contact.module';
|
||||
import {AlertModalModule} from './openaireLibrary/utils/modal/alertModal.module';
|
||||
import {LoadingModule} from "./openaireLibrary/utils/loading/loading.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SharedModule,
|
||||
CommonModule,
|
||||
HttpClientModule,
|
||||
ErrorModule,
|
||||
NavigationBarModule, BottomModule,
|
||||
CookieLawModule,
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
BrowserAnimationsModule, PageURLResolverModule,
|
||||
Schema2jsonldModule,
|
||||
QuickContactModule,
|
||||
AlertModalModule, LoadingModule
|
||||
],
|
||||
declarations: [AppComponent],
|
||||
exports: [AppComponent],
|
||||
providers: [
|
||||
{provide: APP_ID, useValue: 'explore'},
|
||||
// {
|
||||
// provide: HTTP_INTERCEPTORS,
|
||||
// useClass: CacheInterceptorService,
|
||||
// multi: true
|
||||
// },
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: HttpInterceptorService,
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: ErrorInterceptorService,
|
||||
multi: true
|
||||
},
|
||||
[{provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true}],
|
||||
[{provide: DEFAULT_TIMEOUT, useValue: 3000}]
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
//
|
||||
@NgModule({ declarations: [AppComponent],
|
||||
exports: [AppComponent],
|
||||
bootstrap: [AppComponent], imports: [SharedModule,
|
||||
CommonModule,
|
||||
ErrorModule,
|
||||
NavigationBarModule, BottomModule,
|
||||
CookieLawModule,
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
BrowserAnimationsModule, PageURLResolverModule,
|
||||
Schema2jsonldModule,
|
||||
QuickContactModule,
|
||||
AlertModalModule, LoadingModule], providers: [
|
||||
{ provide: APP_ID, useValue: 'explore' },
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: HttpInterceptorService,
|
||||
multi: true
|
||||
},
|
||||
{
|
||||
provide: HTTP_INTERCEPTORS,
|
||||
useClass: ErrorInterceptorService,
|
||||
multi: true
|
||||
},
|
||||
[{ provide: HTTP_INTERCEPTORS, useClass: TimeoutInterceptor, multi: true }],
|
||||
[{ provide: DEFAULT_TIMEOUT, useValue: 3000 }],
|
||||
provideHttpClient(withInterceptorsFromDi())
|
||||
] })
|
||||
|
||||
export class AppModule {
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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 {Email} from "../openaireLibrary/utils/email/email";
|
||||
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 {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";
|
||||
|
@ -28,8 +27,6 @@ export class ContactComponent implements OnInit {
|
|||
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;
|
||||
|
@ -44,15 +41,13 @@ export class ContactComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
constructor(private _router: Router,
|
||||
private _emailService: EmailService,
|
||||
private _meta: Meta,
|
||||
private _title: Title,
|
||||
private seoService: SEOService,
|
||||
private _piwikService: PiwikService,
|
||||
private fb: FormBuilder,
|
||||
private helper: HelperService) {
|
||||
private fb: FormBuilder) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -66,16 +61,9 @@ export class ContactComponent implements OnInit {
|
|||
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) {
|
||||
|
|
|
@ -8,8 +8,6 @@ import {PiwikService} from "../openaireLibrary/utils/piwik/piwik.service";
|
|||
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
|
||||
import {Breadcrumb} from "../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
||||
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 {StringUtils} from '../openaireLibrary/utils/string-utils.class';
|
||||
import {HelperFunctions} from '../openaireLibrary/utils/HelperFunctions.class';
|
||||
|
@ -91,8 +89,6 @@ export class FundersComponent implements OnInit {
|
|||
private title: Title,
|
||||
private seoService: SEOService,
|
||||
private piwikService: PiwikService,
|
||||
private refineFieldResultsService: RefineFieldResultsService,
|
||||
private stakeholderService: StakeholderService,
|
||||
private layoutService: LayoutService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private fb: FormBuilder,
|
||||
|
@ -225,102 +221,6 @@ export class FundersComponent implements OnInit {
|
|||
this.displayedFunders = this.funders;
|
||||
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) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import {
|
||||
AfterViewInit,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
ElementRef,
|
||||
OnDestroy,
|
||||
|
@ -76,12 +75,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
@ViewChild('contact') contact: ElementRef;
|
||||
subscriptions: any[] = [];
|
||||
@ViewChildren('scrolling_element') elements: QueryList<ElementRef>;
|
||||
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = null;//{
|
||||
// filter: null,
|
||||
// selected: true,
|
||||
// filterId: "resultbestaccessright",
|
||||
// value: "Open Access"
|
||||
// };
|
||||
resultsQuickFilter: { filter: Filter, selected: boolean, filterId: string, value: string } = null;
|
||||
selectedEntity = "all";
|
||||
selectedEntitySimpleUrl;
|
||||
selectedEntityAdvancedUrl;
|
||||
|
@ -108,14 +102,13 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
{value: "lcsh:Technology", label: "Technology"},
|
||||
];
|
||||
stringUtils = new StringUtils();
|
||||
// disableSelect: boolean = true;
|
||||
|
||||
constructor(
|
||||
private _router: Router,
|
||||
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 cdr: ChangeDetectorRef,
|
||||
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.";
|
||||
|
@ -291,29 +284,11 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
goTo() {
|
||||
let parameterNames = [];
|
||||
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) {
|
||||
parameterNames.push(this.resultsQuickFilter.filterId);
|
||||
parameterValues.push('"' + encodeURIComponent(this.resultsQuickFilter.value) + '"');
|
||||
}
|
||||
// }
|
||||
if (this.keyword.length > 0) {
|
||||
parameterNames.push("fv0");
|
||||
parameterValues.push(this.keyword);
|
||||
|
@ -326,9 +301,4 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
getSubjectParameter(param) {
|
||||
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
|
Loading…
Reference in New Issue