Compare commits
31 Commits
master
...
new-search
Author | SHA1 | Date |
---|---|---|
Konstantina Galouni | 5453fdaf9b | |
Konstantina Galouni | a3dd286192 | |
argirok | 830cb04b69 | |
Konstantina Galouni | 9d5c8f1154 | |
argirok | 73ef588464 | |
Konstantina Galouni | df99012c45 | |
Konstantina Galouni | a31744347b | |
Konstantina Galouni | 8cb8d15f70 | |
Konstantina Galouni | b0c73d962c | |
Konstantina Galouni | 388655afd1 | |
Konstantina Galouni | 6504475da7 | |
Konstantina Galouni | 19dc6f9413 | |
Konstantina Galouni | 3656a825bd | |
Konstantina Galouni | da1d260431 | |
Konstantina Galouni | fb5efdd37f | |
Konstantina Galouni | 3a4a57a3c6 | |
Alex Martzios | 780ca3b846 | |
Alex Martzios | 48b1c93ee4 | |
Alex Martzios | 451966b4ce | |
Konstantina Galouni | c0eaf1dee9 | |
Konstantina Galouni | 9a14c3dc77 | |
Konstantina Galouni | f67e2b533d | |
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);
|
||||
|
@ -421,8 +420,8 @@ export class AppComponent implements AfterViewInit {
|
|||
this.userMenuItems.push(new MenuItem("", "My links", "", "/myclaims", false, [], ["/myclaims"], {}));
|
||||
let researchOutcomesMenu = new MenuItem("", OpenaireEntities.RESULTS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {});
|
||||
researchOutcomesMenu.items = [
|
||||
new MenuItem("", OpenaireEntities.PUBLICATIONS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("publications") + '"'}),
|
||||
new MenuItem("", OpenaireEntities.DATASETS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("datasets") + '"'}),
|
||||
new MenuItem("", OpenaireEntities.PUBLICATIONS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("publication") + '"'}),
|
||||
new MenuItem("", OpenaireEntities.DATASETS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("dataset") + '"'}),
|
||||
new MenuItem("", OpenaireEntities.SOFTWARE, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("software") + '"'}),
|
||||
new MenuItem("", OpenaireEntities.OTHER, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {type: '"' + encodeURIComponent("other") + '"'})];
|
||||
//TODO add check for research results route
|
||||
|
|
|
@ -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 ebff30414f3e62a2a44ee5fa98ae314b16cec789
|
||||
Subproject commit e6c6ce107151ab5f1862f5160b76a97a193f2456
|
|
@ -1 +1 @@
|
|||
Subproject commit 038684a0dca02700164e467abd390bbd865df3d9
|
||||
Subproject commit cd3b9df75702a25dd82f68c58d965bc147ee74f0
|
|
@ -1 +1 @@
|
|||
Subproject commit b4d09b7cd942893c238d4152eeac1bbc822a0b13
|
||||
Subproject commit c6d21a6c027df56ae3bbf5c489b2ee9893924aef
|
|
@ -1,5 +1,5 @@
|
|||
userInfoUrl = http://dl170.madgik.di.uoa.gr:19080/login-service/userInfo
|
||||
searchServiceAPIUrl = https://beta.services.openaire.eu/search/v2/api/
|
||||
searchServiceAPIUrl = http://rudie.di.uoa.gr:9111/
|
||||
monitorAPIUrl = http://dl170.madgik.di.uoa.gr:19380/uoa-monitor-service/
|
||||
irishMonitorAPIUrl = http://dl170.madgik.di.uoa.gr:19680/irish-monitor-service/
|
||||
fundersServiceAPIUrl = https://dev-openaire.d4science.org/openaire/funders/
|
||||
|
|
|
@ -107,12 +107,12 @@ app.get('/explore/home', async function (req, res) {
|
|||
// Make requests to multiple APIs
|
||||
let requests= [
|
||||
"http://localhost:" + properties.get('port') + "/portals/countResults",
|
||||
searchServiceAPIUrl +'results/?fields=relfunder&sf=relfunder&format=json&size=0',
|
||||
searchServiceAPIUrl + 'datasources/count?format=json',
|
||||
searchServiceAPIUrl + 'resources2/?format=json&size=0&type=organizations&fq=(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)',
|
||||
searchServiceAPIUrl + 'projects/?fields=funder&sf=funder&format=json&size=0',
|
||||
searchServiceAPIUrl + 'resources?query=(%20(oaftype%20exact%20result)%20and%20(resulttypeid%20exact%20dataset)%20and%20(relresulttype%3Dpublication)%20%20)&page=0&size=0&format=json',
|
||||
searchServiceAPIUrl + 'resources?query=(%20(oaftype%20exact%20result)%20and%20(resulttypeid%20exact%20software)%20and%20(relresulttype%3Dpublication)%20%20)&page=0&size=0&format=json'
|
||||
searchServiceAPIUrl + 'browseAll/researchProducts/relfunder',
|
||||
searchServiceAPIUrl + 'datasources/facetSearch?page=0&size=0',
|
||||
searchServiceAPIUrl + 'organizations/facetSearch?page=0&size=0',
|
||||
searchServiceAPIUrl + 'browseAll/projects/funder',
|
||||
searchServiceAPIUrl + 'researchProducts/facetSearch?relResultType=publication&type=dataset&page=0&size=0',
|
||||
searchServiceAPIUrl + 'researchProducts/facetSearch?relResultType=publication&type=software&page=0&size=0'
|
||||
];
|
||||
const dataPromises = requests.map((url) => axios.get( url));
|
||||
const dataResponses = await Promise.all(dataPromises);
|
||||
|
@ -124,13 +124,13 @@ app.get('/explore/home', async function (req, res) {
|
|||
datasets: dataResponses[0].data.datasets,
|
||||
software: dataResponses[0].data.software,
|
||||
other: dataResponses[0].data.other,
|
||||
results: dataResponses[1].data.meta.total,
|
||||
datasources: dataResponses[2].data.total,
|
||||
organizations: dataResponses[3].data.meta.total,
|
||||
projects:dataResponses[4].data.meta.total,
|
||||
funders: parseNoOfFunders(dataResponses[1].data, dataResponses[4].data),
|
||||
datasetsInterlinked:dataResponses[5].data.meta.total,
|
||||
softwareInterlinked:dataResponses[6].data.meta.total,
|
||||
results: dataResponses[1].data.header.total,
|
||||
datasources: dataResponses[2].data.header.total,
|
||||
organizations: dataResponses[3].data.header.total,
|
||||
projects:dataResponses[4].data.header.total,
|
||||
funders: parseNoOfFunders(dataResponses[1].data.body, dataResponses[4].data.body),
|
||||
datasetsInterlinked:dataResponses[5].data.header.total,
|
||||
softwareInterlinked:dataResponses[6].data.header.total,
|
||||
success:allRequestsSuccessful,
|
||||
calculated_at: (new Date()).toUTCString()
|
||||
|
||||
|
@ -148,10 +148,10 @@ app.get('/explore/search', async function (req, res) {
|
|||
try {
|
||||
// Make requests to multiple APIs
|
||||
let requests= [
|
||||
searchServiceAPIUrl +'resources2/?format=json&size=0&type=results',
|
||||
searchServiceAPIUrl + 'datasources/count?format=json',
|
||||
searchServiceAPIUrl + 'resources2/?format=json&size=0&type=organizations&fq=(reldatasourcecompatibilityid exact driver or reldatasourcecompatibilityid exact driver-openaire2.0 or reldatasourcecompatibilityid exact openaire2.0 or reldatasourcecompatibilityid exact openaire3.0 or reldatasourcecompatibilityid exact openaire4.0 or reldatasourcecompatibilityid exact openaire-cris_1.1 or reldatasourcecompatibilityid exact openaire2.0_data or reldatasourcecompatibilityid exact hostedBy or relproject=*)',
|
||||
searchServiceAPIUrl + 'projects/count?format=json&fq=projectcode<>"unidentified"'
|
||||
searchServiceAPIUrl + 'researchProducts/facetSearch?page=0&size=0',
|
||||
searchServiceAPIUrl + 'datasources/facetSearch?page=0&size=0',
|
||||
searchServiceAPIUrl + 'organizations/facetSearch?page=0&size=0',
|
||||
searchServiceAPIUrl + 'projects/facetSearch?page=0&size=0&code=NOT "unidentified"'
|
||||
]
|
||||
const dataPromises = requests.map((url) => axios.get( url));
|
||||
const dataResponses = await Promise.all(dataPromises);
|
||||
|
@ -159,10 +159,10 @@ app.get('/explore/search', async function (req, res) {
|
|||
const allRequestsSuccessful = dataResponses.every((response) => response.status === 200);
|
||||
// Combine the data
|
||||
aggregatedData = {
|
||||
results: dataResponses[0].data.meta.total,
|
||||
datasources: dataResponses[1].data.total,
|
||||
organizations: dataResponses[2].data.meta.total,
|
||||
projects:dataResponses[3].data.total,
|
||||
results: dataResponses[0].data.header.total,
|
||||
datasources: dataResponses[1].data.header.total,
|
||||
organizations: dataResponses[2].data.header.total,
|
||||
projects:dataResponses[3].data.header.total,
|
||||
success:allRequestsSuccessful,
|
||||
calculated_at: (new Date()).toUTCString()
|
||||
|
||||
|
@ -179,22 +179,22 @@ app.get('/explore/search', async function (req, res) {
|
|||
|
||||
app.get('/portals/countResults', async function (req, res) {
|
||||
const field = req.query.field;
|
||||
let allowedFields = ["communityid"];
|
||||
let allowedFields = ["communityid", "country"];
|
||||
if(field && allowedFields.indexOf(field) ==-1){
|
||||
res.status(405).send('Not allowed request');
|
||||
return;
|
||||
}
|
||||
const value = req.query.value;
|
||||
const params = field && value?(encodeURI("&fq=" + field + "=" + value)):"";
|
||||
const params = field && value?(encodeURI("&"+field+"='" + value+"'")):"";
|
||||
let aggregatedData = {};
|
||||
|
||||
try {
|
||||
// Make requests to multiple APIs
|
||||
let requests= [
|
||||
searchServiceAPIUrl +'publications/count?format=json' + params,
|
||||
searchServiceAPIUrl +'datasets/count?format=json' + params,
|
||||
searchServiceAPIUrl +'software/count?format=json' + params,
|
||||
searchServiceAPIUrl +'other/count?format=json' + params
|
||||
searchServiceAPIUrl +'researchProducts/facetSearch?page=0&size=0&type=publication' + params,
|
||||
searchServiceAPIUrl +'researchProducts/facetSearch?page=0&size=0&type=dataset' + params,
|
||||
searchServiceAPIUrl +'researchProducts/facetSearch?page=0&size=0&type=software' + params,
|
||||
searchServiceAPIUrl +'researchProducts/facetSearch?page=0&size=0&type=other' + params
|
||||
]
|
||||
const dataPromises = requests.map((url) => axios.get( url));
|
||||
const dataResponses = await Promise.all(dataPromises);
|
||||
|
@ -202,10 +202,10 @@ app.get('/portals/countResults', async function (req, res) {
|
|||
const allRequestsSuccessful = dataResponses.every((response) => response.status === 200);
|
||||
// Combine the data
|
||||
aggregatedData = {
|
||||
publications: dataResponses[0].data.total,
|
||||
datasets: dataResponses[1].data.total,
|
||||
software: dataResponses[2].data.total,
|
||||
other:dataResponses[3].data.total,
|
||||
publications: dataResponses[0].data.header.total,
|
||||
datasets: dataResponses[1].data.header.total,
|
||||
software: dataResponses[2].data.header.total,
|
||||
other:dataResponses[3].data.header.total,
|
||||
success:allRequestsSuccessful,
|
||||
calculated_at: (new Date()).toUTCString()
|
||||
|
||||
|
@ -224,9 +224,12 @@ app.get('/explore/funders', async function (req, res) {
|
|||
try {
|
||||
// Make requests to multiple APIs
|
||||
let requests= [
|
||||
searchServiceAPIUrl + 'resources2/?format=json&type=results&fq=relfunder=*&refine=true&fields=relfunder&sf=relfunder&page=0&size=0',
|
||||
searchServiceAPIUrl + 'resources2/?format=json&type=results&fq=relfunder=*&refine=true&fields=relfunder&sf=relfunder&page=0&size=0&fq=resultbestaccessright%20exact%20%22Open%20Access%22',
|
||||
searchServiceAPIUrl + 'resources2/?format=json&type=projects&fq=funder=*&fq=projectcode<>"unidentified"&refine=true&fields=funder&sf=funder&page=0&size=0',
|
||||
// searchServiceAPIUrl + 'resources2/?format=json&type=results&fq=relfunder=*&refine=true&fields=relfunder&sf=relfunder&page=0&size=0',
|
||||
// searchServiceAPIUrl + 'resources2/?format=json&type=results&fq=relfunder=*&refine=true&fields=relfunder&sf=relfunder&page=0&size=0&fq=resultbestaccessright%20exact%20%22Open%20Access%22',
|
||||
// searchServiceAPIUrl + 'resources2/?format=json&type=projects&fq=funder=*&fq=projectcode<>"unidentified"&refine=true&fields=funder&sf=funder&page=0&size=0',
|
||||
searchServiceAPIUrl + 'browseAll/researchProducts/relfunder?hasFunderRel=true',
|
||||
searchServiceAPIUrl + 'browseAll/researchProducts/relfunder?hasFunderRel=true&bestOpenAccessRightLabel=%22Open%20Access%22',
|
||||
searchServiceAPIUrl + 'browseAll/projects/funder?hasFunder=true&projectcode=NOT "unidentified"',
|
||||
monitorServiceAPIUrl + 'stakeholder?type=funder',
|
||||
irishMonitorServiceAPIUrl + 'stakeholder?type=funder',
|
||||
fundersServiceAPIUrl
|
||||
|
@ -237,7 +240,7 @@ app.get('/explore/funders', async function (req, res) {
|
|||
const allRequestsSuccessful = dataResponses.every((response) => response.status === 200);
|
||||
let fundersMap = new Map();
|
||||
|
||||
let resultsFunders = dataResponses[0].data.refineResults.relfunder;
|
||||
let resultsFunders = dataResponses[0].data.body.facetResponse.facets.relfunder;
|
||||
resultsFunders.forEach(queriedFunder => {
|
||||
let id = queriedFunder.id;
|
||||
let name = queriedFunder.name.split("||");
|
||||
|
@ -245,7 +248,7 @@ app.get('/explore/funders', async function (req, res) {
|
|||
fundersMap.set(id,{name: name?.length>0 ? name[0] : "", shortName: name?.length>1 ? name[1] : "", id: id, results:queriedFunder.count, openResults: null, projects:null, stakeholder:null});
|
||||
}
|
||||
});
|
||||
let openResultsFunders = dataResponses[1].data.refineResults.relfunder;
|
||||
let openResultsFunders = dataResponses[1].data.body.facetResponse.facets.relfunder;
|
||||
openResultsFunders.forEach(queriedFunder => {
|
||||
let id = queriedFunder.id;
|
||||
let name = queriedFunder.name.split("||");
|
||||
|
@ -255,7 +258,7 @@ app.get('/explore/funders', async function (req, res) {
|
|||
fundersMap.get(id).openResults = queriedFunder.count;
|
||||
}
|
||||
});
|
||||
let projectFunders = dataResponses[2].data.refineResults.funder;
|
||||
let projectFunders = dataResponses[2].data.body.facetResponse.facets.funder;
|
||||
projectFunders.forEach(queriedFunder => {
|
||||
let id = queriedFunder.id;
|
||||
let name = queriedFunder.name.split("||");
|
||||
|
@ -357,8 +360,8 @@ app.get('/explore/funders', async function (req, res) {
|
|||
// console.log(fundersMap)
|
||||
aggregatedData = {
|
||||
count: fundersMap.size,
|
||||
results: dataResponses[0].data.meta.total,
|
||||
projects: dataResponses[2].data.meta.total,
|
||||
results: dataResponses[0].data.header.total,
|
||||
projects: dataResponses[2].data.header.total,
|
||||
funders: Array.from(fundersMap.values()),
|
||||
success:allRequestsSuccessful,
|
||||
calculated_at: (new Date()).toUTCString()
|
||||
|
@ -381,13 +384,13 @@ app.get('/grouped-requests', async function (req, res) {
|
|||
function parseNoOfFunders(resultRES, projectsRES){
|
||||
// combines the refines qeries on funders field, the funders with results and the funders that have at least one project
|
||||
let mergedFundersSet = new Set();
|
||||
let queriedFunders = resultRES.refineResults.relfunder;
|
||||
let queriedFunders = resultRES.facetResponse.facets.relfunder;
|
||||
queriedFunders.forEach(queriedFunder => {
|
||||
if (!mergedFundersSet.has(queriedFunder.id)) {
|
||||
mergedFundersSet.add(queriedFunder.id);
|
||||
}
|
||||
});
|
||||
queriedFunders = projectsRES.refineResults.funder;
|
||||
queriedFunders = projectsRES.facetResponse.facets.funder;
|
||||
queriedFunders.forEach(queriedFunder => {
|
||||
if(+queriedFunder.count > 1) {
|
||||
if (!mergedFundersSet.has(queriedFunder.id)) {
|
||||
|
|
Loading…
Reference in New Issue