Add domain property. Disable caching indicators. Fix an error in server.

This commit is contained in:
Konstantinos Triantafyllou 2023-11-16 16:45:01 +02:00
parent 24b9b3840a
commit ba916df4e1
7 changed files with 34 additions and 14 deletions

View File

@ -6,12 +6,6 @@
"irish-monitor": { "irish-monitor": {
"projectType": "application", "projectType": "application",
"schematics": { "schematics": {
"@schematics/angular:component": {
"inlineTemplate": true,
"inlineStyle": true,
"style": "less",
"skipTests": true
},
"@schematics/angular:class": { "@schematics/angular:class": {
"skipTests": true "skipTests": true
}, },
@ -90,7 +84,7 @@
{ {
"type": "initial", "type": "initial",
"maximumWarning": "2mb", "maximumWarning": "2mb",
"maximumError": "5mb" "maximumError": "20mb"
}, },
{ {
"type": "anyComponentStyle", "type": "anyComponentStyle",
@ -123,7 +117,7 @@
{ {
"type": "initial", "type": "initial",
"maximumWarning": "2mb", "maximumWarning": "2mb",
"maximumError": "5mb" "maximumError": "20mb"
}, },
{ {
"type": "anyComponentStyle", "type": "anyComponentStyle",
@ -168,7 +162,7 @@
{ {
"type": "initial", "type": "initial",
"maximumWarning": "2mb", "maximumWarning": "2mb",
"maximumError": "5mb" "maximumError": "20mb"
}, },
{ {
"type": "anyComponentStyle", "type": "anyComponentStyle",

View File

@ -47,6 +47,7 @@
"@angular/cli": "~16.2.0", "@angular/cli": "~16.2.0",
"@angular/compiler-cli": "^16.2.0", "@angular/compiler-cli": "^16.2.0",
"@nguniversal/builders": "^16.2.0", "@nguniversal/builders": "^16.2.0",
"@types/compression": "^1.7.0",
"@types/express": "^4.17.0", "@types/express": "^4.17.0",
"@types/node": "^16.11.7", "@types/node": "^16.11.7",
"typescript": "~5.1.3" "typescript": "~5.1.3"

View File

@ -3,19 +3,23 @@ import 'zone.js/node';
import { APP_BASE_HREF } from '@angular/common'; import { APP_BASE_HREF } from '@angular/common';
import { ngExpressEngine } from '@nguniversal/express-engine'; import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express'; import * as express from 'express';
import * as compression from 'compression';
import { existsSync } from 'node:fs'; import { existsSync } from 'node:fs';
import { join } from 'node:path'; import { join } from 'node:path';
import { AppServerModule } from './src/main.server'; import { AppServerModule } from './src/main.server';
import {REQUEST, RESPONSE} from "./src/app/openaireLibrary/utils/tokens";
// 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(): express.Express { export function app(): express.Express {
const server = express(); const server = express();
server.use(compression());
const distFolder = join(process.cwd(), 'dist/irish-monitor/browser'); const distFolder = join(process.cwd(), 'dist/irish-monitor/browser');
const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index'; const indexHtml = existsSync(join(distFolder, 'index.original.html')) ? 'index.original.html' : 'index';
// Our Universal express-engine (found @ https://github.com/angular/universal/tree/main/modules/express-engine) // Our Universal express-engine (found @ https://github.com/angular/universal/tree/main/modules/express-engine)
server.engine('html', ngExpressEngine({ server.engine('html', ngExpressEngine({
bootstrap: AppServerModule bootstrap: AppServerModule,
inlineCriticalCss: false
})); }));
server.set('view engine', 'html'); server.set('view engine', 'html');
@ -30,9 +34,24 @@ export function app(): express.Express {
// All regular routes use the Universal engine // All regular routes use the Universal engine
server.get('*', (req, res) => { server.get('*', (req, res) => {
res.render(indexHtml, { req, providers: [{ provide: APP_BASE_HREF, useValue: req.baseUrl }] }); res.render(indexHtml, {
req, providers: [
{
provide: APP_BASE_HREF,
useValue: req.baseUrl
},
{
provide: REQUEST, useValue: (req)
},
{
provide: RESPONSE, useValue: (res)
}
]
}
);
}); });
return server; return server;
} }
@ -56,4 +75,4 @@ if (moduleFilename === __filename || moduleFilename.includes('iisnode')) {
run(); run();
} }
export * from './src/main.server'; export * from './src/main.server';

@ -1 +1 @@
Subproject commit 79d49c80e334c7674456b427e5cb59f2a9e4ae50 Subproject commit 3c1b72e7e4c2e551f15315a2ddd4e62ec0880423

View File

@ -20,7 +20,7 @@ export class Irish {
{value: 'organization', label: StakeholderConfiguration.ENTITIES.organization}, {value: 'organization', label: StakeholderConfiguration.ENTITIES.organization},
{value: 'country', label: StakeholderConfiguration.ENTITIES.country}, {value: 'country', label: StakeholderConfiguration.ENTITIES.country},
{value: 'datasource', label: StakeholderConfiguration.ENTITIES.datasource} {value: 'datasource', label: StakeholderConfiguration.ENTITIES.datasource}
] ];
StakeholderConfiguration.FUNDER_TYPES = [ StakeholderConfiguration.FUNDER_TYPES = [
{value: null, label: 'None'}, {value: null, label: 'None'},
@ -32,6 +32,8 @@ export class Irish {
{icon: 'earth', value: "PUBLIC", label: 'Public'}, {icon: 'earth', value: "PUBLIC", label: 'Public'},
]; ];
StakeholderConfiguration.CACHE_INDICATORS = false;
LayoutService.HEADER_HEIGHT = '60px'; LayoutService.HEADER_HEIGHT = '60px';
} }

View File

@ -10,6 +10,8 @@ let props: EnvProperties = {
piwikBaseUrl: 'https://beta.analytics.openaire.eu/piwik.php?idsite=', piwikBaseUrl: 'https://beta.analytics.openaire.eu/piwik.php?idsite=',
adminToolsPortalType: 'irish', adminToolsPortalType: 'irish',
adminToolsCommunity: 'irish', adminToolsCommunity: 'irish',
baseLink: "/",
domain: "https://beta.oamonitor.ireland.openaire.eu",
} }
export let properties: EnvProperties = { export let properties: EnvProperties = {

View File

@ -17,6 +17,8 @@ let props: EnvProperties = {
disableFrameLoad: true, disableFrameLoad: true,
adminToolsPortalType: 'irish', adminToolsPortalType: 'irish',
adminToolsCommunity: 'irish', adminToolsCommunity: 'irish',
baseLink: "/",
domain: "http://mpagasas.di.uoa.gr:4600",
} }
export let properties: EnvProperties = { export let properties: EnvProperties = {