rename dmp-frontend to frontend

This commit is contained in:
amentis 2024-07-09 11:21:04 +03:00
parent 94a690915a
commit 38544f463f
1332 changed files with 14346 additions and 484 deletions

View File

@ -1,4 +1,4 @@
# DmpFrontend2 # Frontend2
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.7.4. This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.7.4.

View File

@ -3,7 +3,7 @@
"version": 1, "version": 1,
"newProjectRoot": "projects", "newProjectRoot": "projects",
"projects": { "projects": {
"dmp-frontend": { "frontend": {
"root": "", "root": "",
"sourceRoot": "src", "sourceRoot": "src",
"projectType": "application", "projectType": "application",
@ -91,18 +91,18 @@
"serve": { "serve": {
"builder": "@angular-devkit/build-angular:dev-server", "builder": "@angular-devkit/build-angular:dev-server",
"options": { "options": {
"buildTarget": "dmp-frontend:build" "buildTarget": "frontend:build"
}, },
"configurations": { "configurations": {
"production": { "production": {
"buildTarget": "dmp-frontend:build:production" "buildTarget": "frontend:build:production"
} }
} }
}, },
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n", "builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"buildTarget": "dmp-frontend:build" "buildTarget": "frontend:build"
} }
}, },
"test": { "test": {
@ -130,7 +130,7 @@
} }
} }
}, },
"dmp-frontend-e2e": { "frontend-e2e": {
"root": "", "root": "",
"sourceRoot": "e2e", "sourceRoot": "e2e",
"projectType": "application", "projectType": "application",
@ -139,7 +139,7 @@
"builder": "@angular-devkit/build-angular:protractor", "builder": "@angular-devkit/build-angular:protractor",
"options": { "options": {
"protractorConfig": "./protractor.conf.js", "protractorConfig": "./protractor.conf.js",
"devServerTarget": "dmp-frontend:serve" "devServerTarget": "frontend:serve"
} }
} }
} }

View File

@ -1,6 +1,6 @@
import { AppPage } from './app.po'; import { AppPage } from './app.po';
describe('dmp-frontend2 App', () => { describe('frontend2 App', () => {
let page: AppPage; let page: AppPage;
beforeEach(() => { beforeEach(() => {

13861
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
{ {
"name": "dmp-frontend2", "name": "frontend2",
"version": "0.0.0", "version": "0.0.0",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
@ -21,10 +21,13 @@
"@angular/material-moment-adapter": "^18.0.2", "@angular/material-moment-adapter": "^18.0.2",
"@angular/platform-browser": "^18.0.2", "@angular/platform-browser": "^18.0.2",
"@kolkov/angular-editor": "^2.1.0", "@kolkov/angular-editor": "^2.1.0",
"@mat-datetimepicker/core": "^13.0.2",
"@mat-datetimepicker/moment": "^13.0.2",
"@ngx-translate/core": "^15.0.0", "@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^8.0.0", "@ngx-translate/http-loader": "^8.0.0",
"@swimlane/ngx-datatable": "^20.1.0", "@swimlane/ngx-datatable": "^20.1.0",
"@tinymce/tinymce-angular": "^7.0.0", "@tinymce/tinymce-angular": "^8.0.0",
"angular-mentions": "^1.5.0",
"bootstrap": "^4.6.0", "bootstrap": "^4.6.0",
"cookieconsent": "^3.1.1", "cookieconsent": "^3.1.1",
"dragula": "^3.7.3", "dragula": "^3.7.3",
@ -33,8 +36,6 @@
"keycloak-js": "^24.0.5", "keycloak-js": "^24.0.5",
"moment": "^2.30.1", "moment": "^2.30.1",
"moment-timezone": "^0.5.45", "moment-timezone": "^0.5.45",
"@mat-datetimepicker/core": "^13.0.2",
"@mat-datetimepicker/moment": "^13.0.2",
"ng-dialog-animation": "^9.0.4", "ng-dialog-animation": "^9.0.4",
"ng2-dragula": "^5.1.0", "ng2-dragula": "^5.1.0",
"ngx-colors": "^3.6.0", "ngx-colors": "^3.6.0",
@ -44,7 +45,7 @@
"ngx-guided-tour": "^2.0.1", "ngx-guided-tour": "^2.0.1",
"ngx-matomo-client": "^6.2.0", "ngx-matomo-client": "^6.2.0",
"rxjs": "^7.4.0", "rxjs": "^7.4.0",
"tinymce": "^6.7.0", "tinymce": "^7.2.0",
"ts-simple-nameof": "^1.3.1", "ts-simple-nameof": "^1.3.1",
"tslib": "^2.6.3", "tslib": "^2.6.3",
"zone.js": "~0.14.4" "zone.js": "~0.14.4"
@ -62,7 +63,7 @@
"@types/file-saver": "^2.0.7", "@types/file-saver": "^2.0.7",
"@types/moment-timezone": "^0.5.13", "@types/moment-timezone": "^0.5.13",
"@types/node": "^20.14.2", "@types/node": "^20.14.2",
"codelyzer": "^6.0.2", "codelyzer": "^0.0.28",
"ts-node": "~10.9.2", "ts-node": "~10.9.2",
"tslint": "~6.1.0", "tslint": "~6.1.0",
"typescript": "5.4.5" "typescript": "5.4.5"

View File

@ -1,281 +1,281 @@
import { of as observableOf, Subscription } from 'rxjs'; import { of as observableOf, Subscription } from 'rxjs';
import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core'; import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, NavigationEnd, NavigationStart, Router } from '@angular/router'; import { ActivatedRoute, NavigationEnd, NavigationStart, Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { filter, map, switchMap } from 'rxjs/operators'; import { filter, map, switchMap } from 'rxjs/operators';
import { AuthService, LoginStatus } from './core/services/auth/auth.service'; import { AuthService, LoginStatus } from './core/services/auth/auth.service';
import { CultureService } from './core/services/culture/culture-service'; import { CultureService } from './core/services/culture/culture-service';
// import { BreadCrumbResolverService } from './ui/misc/breadcrumb/service/breadcrumb.service'; // import { BreadCrumbResolverService } from './ui/misc/breadcrumb/service/breadcrumb.service';
import { DomSanitizer, Title } from '@angular/platform-browser'; import { DomSanitizer, Title } from '@angular/platform-browser';
import { CookieService } from "ngx-cookie-service"; import { CookieService } from "ngx-cookie-service";
import { NgcCookieConsentService, NgcStatusChangeEvent } from "ngx-cookieconsent"; import { NgcCookieConsentService, NgcStatusChangeEvent } from "ngx-cookieconsent";
import { ConfigurationService } from './core/services/configuration/configuration.service'; import { ConfigurationService } from './core/services/configuration/configuration.service';
import { LanguageService } from './core/services/language/language.service'; import { LanguageService } from './core/services/language/language.service';
import { MatSidenav } from '@angular/material/sidenav'; import { MatSidenav } from '@angular/material/sidenav';
import { MatomoService } from './core/services/matomo/matomo-service'; import { MatomoService } from './core/services/matomo/matomo-service';
import { SideNavService } from './core/services/sidenav/side-nav.sevice'; import { SideNavService } from './core/services/sidenav/side-nav.sevice';
import { TimezoneService } from './core/services/timezone/timezone-service'; import { TimezoneService } from './core/services/timezone/timezone-service';
import { BreadcrumbService } from './ui/misc/breadcrumb/breadcrumb.service'; import { BreadcrumbService } from './ui/misc/breadcrumb/breadcrumb.service';
import { TenantHandlingService } from './core/services/tenant/tenant-handling.service'; import { TenantHandlingService } from './core/services/tenant/tenant-handling.service';
import { MatIconRegistry } from '@angular/material/icon'; import { MatIconRegistry } from '@angular/material/icon';
declare const gapi: any; declare const gapi: any;
declare var $: any; declare var $: any;
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'] styleUrls: ['./app.component.scss']
}) })
export class AppComponent implements OnInit, AfterViewInit { export class AppComponent implements OnInit, AfterViewInit {
hasBreadCrumb = observableOf(false); hasBreadCrumb = observableOf(false);
// sideNavOpen = false; // sideNavOpen = false;
private sideNavSubscription: Subscription; private sideNavSubscription: Subscription;
helpContentEnabled: boolean; helpContentEnabled: boolean;
private statusChangeSubscription: Subscription; private statusChangeSubscription: Subscription;
showOnlyRouterOutlet = false; showOnlyRouterOutlet = false;
cssConfigLoaded = false; cssConfigLoaded = false;
@ViewChild('sidenav') sidenav: MatSidenav; @ViewChild('sidenav') sidenav: MatSidenav;
constructor( constructor(
private router: Router, private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
private authentication: AuthService, private authentication: AuthService,
private translate: TranslateService, private translate: TranslateService,
// private breadCrumbResolverService: BreadCrumbResolverService, // private breadCrumbResolverService: BreadCrumbResolverService,
private titleService: Title, private titleService: Title,
private cultureService: CultureService, private cultureService: CultureService,
private timezoneService: TimezoneService, private timezoneService: TimezoneService,
private cookieService: CookieService, private cookieService: CookieService,
private ccService: NgcCookieConsentService, private ccService: NgcCookieConsentService,
private language: LanguageService, private language: LanguageService,
private configurationService: ConfigurationService, private configurationService: ConfigurationService,
private matomoService: MatomoService, private matomoService: MatomoService,
private tenantHandlingService: TenantHandlingService, private tenantHandlingService: TenantHandlingService,
private sidenavService: SideNavService, private sidenavService: SideNavService,
private breadcrumbService: BreadcrumbService, private breadcrumbService: BreadcrumbService,
private sanitizer: DomSanitizer, private sanitizer: DomSanitizer,
public iconRegistry: MatIconRegistry, public iconRegistry: MatIconRegistry,
) { ) {
this.initializeServices(); this.initializeServices();
this.matomoService.init(); this.matomoService.init();
this.helpContentEnabled = configurationService.helpService.enabled; this.helpContentEnabled = configurationService.helpService.enabled;
const paperPlaneIconSrc = this.sanitizer.bypassSecurityTrustResourceUrl('/assets/images/annotations/paper-plane.svg'); const paperPlaneIconSrc = this.sanitizer.bypassSecurityTrustResourceUrl('/assets/images/annotations/paper-plane.svg');
iconRegistry.addSvgIcon('paperPlane', paperPlaneIconSrc); iconRegistry.addSvgIcon('paperPlane', paperPlaneIconSrc);
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {
setTimeout(() => { setTimeout(() => {
this.sideNavSubscription = this.sidenavService.status().subscribe(isopen => { this.sideNavSubscription = this.sidenavService.status().subscribe(isopen => {
const hamburger = document.getElementById('hamburger'); const hamburger = document.getElementById('hamburger');
if (isopen) { if (isopen) {
//update value of hamburfer //update value of hamburfer
if (!hamburger) {//try later if (!hamburger) {//try later
setTimeout(() => { setTimeout(() => {
const hamburger = document.getElementById('hamburger'); const hamburger = document.getElementById('hamburger');
if (hamburger) { if (hamburger) {
hamburger.classList.add('change'); hamburger.classList.add('change');
} }
}, 300); }, 300);
} else { } else {
hamburger.classList.add('change'); hamburger.classList.add('change');
} }
this.sidenav.open() this.sidenav.open()
} else {//closed } else {//closed
if (!hamburger) {//try later if (!hamburger) {//try later
setTimeout(() => { setTimeout(() => {
const hamburger = document.getElementById('hamburger'); const hamburger = document.getElementById('hamburger');
if (hamburger) { if (hamburger) {
hamburger.classList.remove('change'); hamburger.classList.remove('change');
} }
}, 300); }, 300);
} else { } else {
hamburger.classList.remove('change'); hamburger.classList.remove('change');
} }
this.sidenav.close(); this.sidenav.close();
} }
}); });
}); });
} }
onActivate(event: any) { onActivate(event: any) {
// this.breadCrumbResolverService.push(event); // this.breadCrumbResolverService.push(event);
} }
onDeactivate(event: any) { onDeactivate(event: any) {
//this.breadCrumbResolverService.clear() //this.breadCrumbResolverService.clear()
} }
ngOnInit() { ngOnInit() {
if (!this.cookieService.check("cookiesConsent")) { if (!this.cookieService.check("cookiesConsent")) {
// this.cookieService.set("cookiesConsent", "false", 356); // this.cookieService.set("cookiesConsent", "false", 356);
this.cookieService.set("cookiesConsent", "false", 356, null, null, false, 'Lax'); this.cookieService.set("cookiesConsent", "false", 356, null, null, false, 'Lax');
} }
this.hasBreadCrumb = this.router.events.pipe( this.hasBreadCrumb = this.router.events.pipe(
filter(event => event instanceof NavigationEnd), filter(event => event instanceof NavigationEnd),
map(() => this.route), map(() => this.route),
map(route => route.firstChild), map(route => route.firstChild),
switchMap(route => route.data), switchMap(route => route.data),
map(data => data['breadcrumb'])); map(data => data['breadcrumb']));
const appTitle = this.titleService.getTitle(); const appTitle = this.titleService.getTitle();
this.router this.router
.events.pipe( .events.pipe(
filter(event => event instanceof NavigationEnd), filter(event => event instanceof NavigationEnd),
map(() => { map(() => {
let child = this.route.firstChild; let child = this.route.firstChild;
if (child != null) { if (child != null) {
while (child.firstChild) { while (child.firstChild) {
child = child.firstChild; child = child.firstChild;
} }
if (child.snapshot.data && child.snapshot.data.showOnlyRouterOutlet) { if (child.snapshot.data && child.snapshot.data.showOnlyRouterOutlet) {
this.showOnlyRouterOutlet = true; this.showOnlyRouterOutlet = true;
this.ccService.getConfig().enabled = false; this.ccService.getConfig().enabled = false;
this.ccService.destroy(); this.ccService.destroy();
this.ccService.init(this.ccService.getConfig()); this.ccService.init(this.ccService.getConfig());
} else { } else {
this.showOnlyRouterOutlet = false; this.showOnlyRouterOutlet = false;
if (this.cookieService.get("cookiesConsent") == "true") { if (this.cookieService.get("cookiesConsent") == "true") {
this.ccService.getConfig().enabled = false; this.ccService.getConfig().enabled = false;
} else { } else {
this.ccService.getConfig().enabled = true; this.ccService.getConfig().enabled = true;
} }
this.ccService.destroy(); this.ccService.destroy();
this.ccService.init(this.ccService.getConfig()); this.ccService.init(this.ccService.getConfig());
} }
const usePrefix = child.snapshot.data['usePrefix'] ?? true; const usePrefix = child.snapshot.data['usePrefix'] ?? true;
if (child.snapshot.data['getFromTitleService']) { if (child.snapshot.data['getFromTitleService']) {
return { title: this.titleService.getTitle(), usePrefix: usePrefix }; return { title: this.titleService.getTitle(), usePrefix: usePrefix };
} }
else if (child.snapshot.data['title']) { else if (child.snapshot.data['title']) {
return { title: child.snapshot.data['title'], usePrefix: usePrefix }; return { title: child.snapshot.data['title'], usePrefix: usePrefix };
} }
} }
return { title: appTitle, usePrefix: true }; return { title: appTitle, usePrefix: true };
}) })
).subscribe((titleOptions: { title: string, usePrefix: boolean }) => { ).subscribe((titleOptions: { title: string, usePrefix: boolean }) => {
this.translateTitle(titleOptions.title, titleOptions.usePrefix); this.translateTitle(titleOptions.title, titleOptions.usePrefix);
this.translate.onLangChange.subscribe(() => this.translateTitle(titleOptions.title, titleOptions.usePrefix)); this.translate.onLangChange.subscribe(() => this.translateTitle(titleOptions.title, titleOptions.usePrefix));
}); });
this.router this.router
.events.pipe( .events.pipe(
filter(event => event instanceof NavigationEnd) filter(event => event instanceof NavigationEnd)
) )
.subscribe((event: NavigationStart) => { .subscribe((event: NavigationStart) => {
this.breadcrumbService.addExcludedParam('t', true); this.breadcrumbService.addExcludedParam('t', true);
if (this.authentication.getSelectedTenantName() && this.authentication.getSelectedTenantName() !== '') if (this.authentication.getSelectedTenantName() && this.authentication.getSelectedTenantName() !== '')
this.breadcrumbService.addIdResolvedValue(this.authentication.selectedTenant(), this.authentication.getSelectedTenantName()); this.breadcrumbService.addIdResolvedValue(this.authentication.selectedTenant(), this.authentication.getSelectedTenantName());
// const enrichedUrl = this.tenantHandlingService.getUrlEnrichedWithTenantCode(event.url, this.authentication.selectedTenant() ?? 'default'); // const enrichedUrl = this.tenantHandlingService.getUrlEnrichedWithTenantCode(event.url, this.authentication.selectedTenant() ?? 'default');
// if (event.url != enrichedUrl) { // if (event.url != enrichedUrl) {
// this.router.navigateByUrl(enrichedUrl); // this.router.navigateByUrl(enrichedUrl);
// } // }
}); });
this.statusChangeSubscription = this.ccService.statusChange$.subscribe((event: NgcStatusChangeEvent) => { this.statusChangeSubscription = this.ccService.statusChange$.subscribe((event: NgcStatusChangeEvent) => {
if (event.status == "dismiss") { if (event.status == "dismiss") {
// this.cookieService.set("cookiesConsent", "true", 365); // this.cookieService.set("cookiesConsent", "true", 365);
this.cookieService.set("cookiesConsent", "true", 356, null, null, false, 'Lax'); this.cookieService.set("cookiesConsent", "true", 356, null, null, false, 'Lax');
} }
}); });
this.ccService.getConfig().content.href = this.configurationService.app + "cookies-policy"; this.ccService.getConfig().content.href = this.configurationService.app + "cookies-policy";
this.ccService.getConfig().cookie.domain = this.configurationService.app; this.ccService.getConfig().cookie.domain = this.configurationService.app;
this.translate this.translate
.get(['COOKIE.MESSAGE', 'COOKIE.DISMISS', 'COOKIE.DENY', 'COOKIE.LINK', 'COOKIE.POLICY']) .get(['COOKIE.MESSAGE', 'COOKIE.DISMISS', 'COOKIE.DENY', 'COOKIE.LINK', 'COOKIE.POLICY'])
.subscribe(data => { .subscribe(data => {
this.ccService.getConfig().content = this.ccService.getConfig().content || {}; this.ccService.getConfig().content = this.ccService.getConfig().content || {};
// Override default messages with the translated ones // Override default messages with the translated ones
this.ccService.getConfig().content.message = data['COOKIE.MESSAGE']; this.ccService.getConfig().content.message = data['COOKIE.MESSAGE'];
this.ccService.getConfig().content.dismiss = data['COOKIE.DISMISS']; this.ccService.getConfig().content.dismiss = data['COOKIE.DISMISS'];
this.ccService.getConfig().content.deny = data['COOKIE.DENY']; this.ccService.getConfig().content.deny = data['COOKIE.DENY'];
this.ccService.getConfig().content.link = data['COOKIE.LINK']; this.ccService.getConfig().content.link = data['COOKIE.LINK'];
this.ccService.getConfig().content.policy = data['COOKIE.POLICY']; this.ccService.getConfig().content.policy = data['COOKIE.POLICY'];
if (this.cookieService.get("cookiesConsent") == "true") { if (this.cookieService.get("cookiesConsent") == "true") {
this.ccService.getConfig().enabled = false; this.ccService.getConfig().enabled = false;
} }
this.ccService.destroy(); this.ccService.destroy();
this.ccService.init(this.ccService.getConfig()); this.ccService.init(this.ccService.getConfig());
}); });
} }
translateTitle(ttl: string, usePrefix: boolean) { translateTitle(ttl: string, usePrefix: boolean) {
if (ttl.length > 0) { if (ttl.length > 0) {
this.translate.get(ttl).subscribe((translated: string) => { this.translate.get(ttl).subscribe((translated: string) => {
if (usePrefix) { if (usePrefix) {
this.translate.get('GENERAL.TITLES.PREFIX').subscribe((titlePrefix: string) => { this.translate.get('GENERAL.TITLES.PREFIX').subscribe((titlePrefix: string) => {
this.titleService.setTitle(titlePrefix + translated); this.titleService.setTitle(titlePrefix + translated);
}); });
} else { } else {
this.titleService.setTitle(translated); this.titleService.setTitle(translated);
} }
}); });
} else { } else {
this.translate.get('GENERAL.TITLES.GENERAL').subscribe((translated: string) => { this.translate.get('GENERAL.TITLES.GENERAL').subscribe((translated: string) => {
this.titleService.setTitle(translated); this.titleService.setTitle(translated);
}); });
} }
} }
ngOnDestroy() { ngOnDestroy() {
this.statusChangeSubscription.unsubscribe(); this.statusChangeSubscription.unsubscribe();
if (this.sideNavSubscription) { if (this.sideNavSubscription) {
this.sideNavSubscription.unsubscribe(); this.sideNavSubscription.unsubscribe();
} }
} }
login() { login() {
//redirect to login page //redirect to login page
this.router.navigate(['/login'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } }); this.router.navigate(['/login'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
} }
logout() { logout() {
} }
public isAuthenticated(): boolean { public isAuthenticated(): boolean {
return this.authentication.currentAccountIsAuthenticated(); return this.authentication.currentAccountIsAuthenticated();
} }
goToPlans() { //not used goToPlans() { //not used
this.router.navigate(['/plans'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } }); this.router.navigate(['/plans'], { queryParams: { /*refresh : Math.random() ,returnUrl: this.state.url*/ } });
} }
initializeServices() { initializeServices() {
if (!this.authentication.currentAccountIsAuthenticated() && this.configurationService.cssColorsTenantConfiguration) { if (!this.authentication.currentAccountIsAuthenticated() && this.configurationService.cssColorsTenantConfiguration) {
this.tenantHandlingService.applyTenantCssColors(this.configurationService.cssColorsTenantConfiguration); this.tenantHandlingService.applyTenantCssColors(this.configurationService.cssColorsTenantConfiguration);
} }
this.translate.setDefaultLang(this.language.getDefaultLanguagesCode()); this.translate.setDefaultLang(this.language.getDefaultLanguagesCode());
this.authentication.currentAccountIsAuthenticated() && this.authentication.getUserProfileCulture() ? this.cultureService.cultureSelected(this.authentication.getUserProfileCulture()) : this.cultureService.cultureSelected(this.configurationService.defaultCulture); this.authentication.currentAccountIsAuthenticated() && this.authentication.getUserProfileCulture() ? this.cultureService.cultureSelected(this.authentication.getUserProfileCulture()) : this.cultureService.cultureSelected(this.configurationService.defaultCulture);
this.authentication.currentAccountIsAuthenticated() && this.authentication.getUserProfileTimezone() ? this.timezoneService.timezoneSelected(this.authentication.getUserProfileTimezone()) : this.timezoneService.timezoneSelected(this.configurationService.defaultTimezone); this.authentication.currentAccountIsAuthenticated() && this.authentication.getUserProfileTimezone() ? this.timezoneService.timezoneSelected(this.authentication.getUserProfileTimezone()) : this.timezoneService.timezoneSelected(this.configurationService.defaultTimezone);
this.authentication.currentAccountIsAuthenticated() && this.authentication.getUserProfileLanguage() ? this.language.changeLanguage(this.authentication.getUserProfileLanguage()) : (this.language.getDefaultLanguagesCode()); this.authentication.currentAccountIsAuthenticated() && this.authentication.getUserProfileLanguage() ? this.language.changeLanguage(this.authentication.getUserProfileLanguage()) : (this.language.getDefaultLanguagesCode());
this.authentication.getAuthenticationStateObservable().subscribe(authenticationState => { this.authentication.getAuthenticationStateObservable().subscribe(authenticationState => {
if (authenticationState.loginStatus === LoginStatus.LoggedIn) { if (authenticationState.loginStatus === LoginStatus.LoggedIn) {
this.tenantHandlingService.loadAndApplyTenantCssColors(); this.tenantHandlingService.loadAndApplyTenantCssColors();
} }
}); });
} }
toggleNavbar(event) { toggleNavbar(event) {
document.getElementById('hamburger').classList.toggle("change"); document.getElementById('hamburger').classList.toggle("change");
} }
} }

View File

@ -1,189 +1,189 @@
import { OverlayModule } from '@angular/cdk/overlay'; import { OverlayModule } from '@angular/cdk/overlay';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { APP_INITIALIZER, LOCALE_ID, NgModule } from '@angular/core'; import { APP_INITIALIZER, LOCALE_ID, NgModule } from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MAT_MOMENT_DATE_FORMATS, MatMomentDateModule } from '@angular/material-moment-adapter'; import { MAT_MOMENT_DATE_FORMATS, MatMomentDateModule } from '@angular/material-moment-adapter';
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field'; import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
import { BrowserModule, Title } from '@angular/platform-browser'; import { BrowserModule, Title } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppRoutingModule } from '@app/app-routing.module'; import { AppRoutingModule } from '@app/app-routing.module';
import { AppComponent } from '@app/app.component'; import { AppComponent } from '@app/app.component';
import { CoreServiceModule } from '@app/core/core-service.module'; import { CoreServiceModule } from '@app/core/core-service.module';
import { NotificationModule } from '@app/library/notification/notification.module'; import { NotificationModule } from '@app/library/notification/notification.module';
import { LoginModule } from '@app/ui/auth/login/login.module'; import { LoginModule } from '@app/ui/auth/login/login.module';
import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component'; import { ReloadHelperComponent } from '@app/ui/misc/reload-helper/reload-helper.component';
import { NavbarModule } from '@app/ui/navbar/navbar.module'; import { NavbarModule } from '@app/ui/navbar/navbar.module';
import { SidebarModule } from '@app/ui/sidebar/sidebar.module'; import { SidebarModule } from '@app/ui/sidebar/sidebar.module';
import { MomentUtcDateAdapter } from '@common/date/moment-utc-date-adapter'; import { MomentUtcDateAdapter } from '@common/date/moment-utc-date-adapter';
import { MomentUtcDateTimeAdapter } from '@common/date/moment-utc-date-time.adapter'; import { MomentUtcDateTimeAdapter } from '@common/date/moment-utc-date-time.adapter';
import { BaseHttpParams } from '@common/http/base-http-params'; import { BaseHttpParams } from '@common/http/base-http-params';
import { CommonHttpModule } from '@common/http/common-http.module'; import { CommonHttpModule } from '@common/http/common-http.module';
import { InterceptorType } from '@common/http/interceptors/interceptor-type'; import { InterceptorType } from '@common/http/interceptors/interceptor-type';
import { CommonUiModule } from '@common/ui/common-ui.module'; import { CommonUiModule } from '@common/ui/common-ui.module';
import { DatetimeAdapter } from '@mat-datetimepicker/core'; import { DatetimeAdapter } from '@mat-datetimepicker/core';
import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateCompiler, TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { CoreNotificationServiceModule } from '@notification-service/services/core-service.module'; import { CoreNotificationServiceModule } from '@notification-service/services/core-service.module';
import { CoreAnnotationServiceModule } from 'annotation-service/services/core-service.module'; import { CoreAnnotationServiceModule } from 'annotation-service/services/core-service.module';
import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular'; import { KeycloakAngularModule, KeycloakService } from 'keycloak-angular';
import { DragulaModule } from 'ng2-dragula'; import { DragulaModule } from 'ng2-dragula';
import { CookieService } from 'ngx-cookie-service'; import { CookieService } from 'ngx-cookie-service';
import { NgcCookieConsentConfig, NgcCookieConsentModule } from 'ngx-cookieconsent'; import { NgcCookieConsentConfig, NgcCookieConsentModule } from 'ngx-cookieconsent';
import { MatomoInitializationMode, NgxMatomoModule } from 'ngx-matomo-client'; import { MatomoInitializationMode, NgxMatomoModule } from 'ngx-matomo-client';
import { from } from 'rxjs'; import { from } from 'rxjs';
import { AuthService } from './core/services/auth/auth.service'; import { AuthService } from './core/services/auth/auth.service';
import { ConfigurationService } from './core/services/configuration/configuration.service'; import { ConfigurationService } from './core/services/configuration/configuration.service';
import { CultureService } from './core/services/culture/culture-service'; import { CultureService } from './core/services/culture/culture-service';
import { LanguageHttpService } from './core/services/language/language.http.service'; import { LanguageHttpService } from './core/services/language/language.http.service';
import { LanguageService } from './core/services/language/language.service'; import { LanguageService } from './core/services/language/language.service';
import { TranslateServerLoader } from './core/services/language/server.loader'; import { TranslateServerLoader } from './core/services/language/server.loader';
import { AnalyticsService } from './core/services/matomo/analytics-service'; import { AnalyticsService } from './core/services/matomo/analytics-service';
import { MatomoService } from './core/services/matomo/matomo-service'; import { MatomoService } from './core/services/matomo/matomo-service';
import { TenantHandlingService } from './core/services/tenant/tenant-handling.service'; import { TenantHandlingService } from './core/services/tenant/tenant-handling.service';
import { GuidedTourModule } from './library/guided-tour/guided-tour.module'; import { GuidedTourModule } from './library/guided-tour/guided-tour.module';
import { DepositOauth2DialogModule } from './ui/misc/deposit-oauth2-dialog/deposit-oauth2-dialog.module'; import { DepositOauth2DialogModule } from './ui/misc/deposit-oauth2-dialog/deposit-oauth2-dialog.module';
import { OpenCDMPCustomTranslationCompiler } from './utilities/translate/opencdmp-custom-translation-compiler'; import { OpenCDMPCustomTranslationCompiler } from './utilities/translate/opencdmp-custom-translation-compiler';
// AoT requires an exported function for factories // AoT requires an exported function for factories
export function HttpLoaderFactory(languageHttpService: LanguageHttpService) { export function HttpLoaderFactory(languageHttpService: LanguageHttpService) {
return new TranslateServerLoader(languageHttpService); return new TranslateServerLoader(languageHttpService);
} }
const cookieConfig: NgcCookieConsentConfig = { const cookieConfig: NgcCookieConsentConfig = {
enabled: true, enabled: true,
cookie: { cookie: {
domain: ""//environment.App // or 'your.domain.com' // it is mandatory to set a domain, for cookies to work properly (see https://goo.gl/S2Hy2A) domain: ""//environment.App // or 'your.domain.com' // it is mandatory to set a domain, for cookies to work properly (see https://goo.gl/S2Hy2A)
}, },
palette: { palette: {
popup: { popup: {
background: "#000000", background: "#000000",
text: "#ffffff", text: "#ffffff",
link: "#ffffff" link: "#ffffff"
}, },
button: { button: {
background: "#00b29f", background: "#00b29f",
text: "#ffffff", text: "#ffffff",
border: "transparent" border: "transparent"
} }
}, },
content: { content: {
message: "This website uses cookies to enhance the user experience.", message: "This website uses cookies to enhance the user experience.",
dismiss: "Got it!", dismiss: "Got it!",
deny: "Refuse cookies", deny: "Refuse cookies",
link: "Learn more", link: "Learn more",
href: "",//environment.App + "terms-of-service", href: "",//environment.App + "terms-of-service",
policy: "Cookies Policy" policy: "Cookies Policy"
}, },
position: "bottom-right", position: "bottom-right",
theme: 'edgeless', theme: 'edgeless',
type: 'info' type: 'info'
}; };
export function InstallationConfigurationFactory(appConfig: ConfigurationService, keycloak: KeycloakService, authService: AuthService, languageService: LanguageService, tenantHandlingService: TenantHandlingService) { export function InstallationConfigurationFactory(appConfig: ConfigurationService, keycloak: KeycloakService, authService: AuthService, languageService: LanguageService, tenantHandlingService: TenantHandlingService) {
return () => appConfig.loadConfiguration().then(() => { return () => appConfig.loadConfiguration().then(() => {
return languageService.loadAvailableLanguages().toPromise(); return languageService.loadAvailableLanguages().toPromise();
}).then(x => keycloak.init({ }).then(x => keycloak.init({
config: { config: {
url: appConfig.keycloak.address, url: appConfig.keycloak.address,
realm: appConfig.keycloak.realm, realm: appConfig.keycloak.realm,
clientId: appConfig.keycloak.clientId, clientId: appConfig.keycloak.clientId,
}, },
initOptions: { initOptions: {
onLoad: 'check-sso', onLoad: 'check-sso',
flow: appConfig.keycloak.flow, flow: appConfig.keycloak.flow,
checkLoginIframe: false, checkLoginIframe: false,
scope: appConfig.keycloak.scope, scope: appConfig.keycloak.scope,
pkceMethod: 'S256' pkceMethod: 'S256'
}, },
shouldAddToken: () => false shouldAddToken: () => false
}).then(() => { }).then(() => {
const params = new BaseHttpParams(); const params = new BaseHttpParams();
params.interceptorContext = { params.interceptorContext = {
excludedInterceptors: [ excludedInterceptors: [
InterceptorType.Locale, InterceptorType.Locale,
InterceptorType.ProgressIndication, InterceptorType.ProgressIndication,
InterceptorType.RequestTiming, InterceptorType.RequestTiming,
InterceptorType.UnauthorizedResponse, InterceptorType.UnauthorizedResponse,
] ]
}; };
const tenantCode = tenantHandlingService.extractTenantCodeFromUrlPath(window.location.pathname) ?? authService.selectedTenant() ?? 'default'; const tenantCode = tenantHandlingService.extractTenantCodeFromUrlPath(window.location.pathname) ?? authService.selectedTenant() ?? 'default';
const tokenPromise = keycloak.getToken(); const tokenPromise = keycloak.getToken();
return authService.prepareAuthRequest(from(tokenPromise), tenantCode, { params }).toPromise().catch(error => authService.onAuthenticateError(error)); return authService.prepareAuthRequest(from(tokenPromise), tenantCode, { params }).toPromise().catch(error => authService.onAuthenticateError(error));
})); }));
} }
@NgModule({ @NgModule({
declarations: [ declarations: [
AppComponent, AppComponent,
ReloadHelperComponent ReloadHelperComponent
], ],
bootstrap: [AppComponent], imports: [BrowserModule, bootstrap: [AppComponent], imports: [BrowserModule,
BrowserAnimationsModule, BrowserAnimationsModule,
KeycloakAngularModule, KeycloakAngularModule,
CoreServiceModule.forRoot(), CoreServiceModule.forRoot(),
CoreAnnotationServiceModule.forRoot(), CoreAnnotationServiceModule.forRoot(),
CoreNotificationServiceModule.forRoot(), CoreNotificationServiceModule.forRoot(),
AppRoutingModule, AppRoutingModule,
CommonUiModule, CommonUiModule,
TranslateModule.forRoot({ TranslateModule.forRoot({
compiler: { provide: TranslateCompiler, useClass: OpenCDMPCustomTranslationCompiler }, compiler: { provide: TranslateCompiler, useClass: OpenCDMPCustomTranslationCompiler },
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,
useFactory: HttpLoaderFactory, useFactory: HttpLoaderFactory,
deps: [LanguageHttpService] deps: [LanguageHttpService]
} }
}), }),
OverlayModule, OverlayModule,
CommonHttpModule, CommonHttpModule,
MatMomentDateModule, MatMomentDateModule,
LoginModule, LoginModule,
//Ui //Ui
NotificationModule, NotificationModule,
ReactiveFormsModule, ReactiveFormsModule,
FormsModule, FormsModule,
NavbarModule, NavbarModule,
SidebarModule, SidebarModule,
NgcCookieConsentModule.forRoot(cookieConfig), NgcCookieConsentModule.forRoot(cookieConfig),
DepositOauth2DialogModule, DepositOauth2DialogModule,
GuidedTourModule.forRoot(), GuidedTourModule.forRoot(),
DragulaModule.forRoot(), DragulaModule.forRoot(),
NgxMatomoModule.forRoot({ NgxMatomoModule.forRoot({
mode: MatomoInitializationMode.AUTO_DEFERRED, mode: MatomoInitializationMode.AUTO_DEFERRED,
})], })],
providers: [ providers: [
ConfigurationService, ConfigurationService,
{ {
provide: APP_INITIALIZER, provide: APP_INITIALIZER,
useFactory: InstallationConfigurationFactory, useFactory: InstallationConfigurationFactory,
deps: [ConfigurationService, KeycloakService, AuthService, LanguageService, TenantHandlingService], deps: [ConfigurationService, KeycloakService, AuthService, LanguageService, TenantHandlingService],
multi: true multi: true
}, },
{ {
provide: MAT_DATE_LOCALE, provide: MAT_DATE_LOCALE,
deps: [CultureService], deps: [CultureService],
useFactory: (cultureService) => cultureService.getCurrentCulture().name useFactory: (cultureService) => cultureService.getCurrentCulture().name
}, },
{ provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS }, { provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS },
{ provide: DateAdapter, useClass: MomentUtcDateAdapter }, { provide: DateAdapter, useClass: MomentUtcDateAdapter },
{ provide: DatetimeAdapter, useClass: MomentUtcDateTimeAdapter }, { provide: DatetimeAdapter, useClass: MomentUtcDateTimeAdapter },
{ {
provide: LOCALE_ID, provide: LOCALE_ID,
deps: [CultureService, ConfigurationService], deps: [CultureService, ConfigurationService],
useFactory: (cultureService, installationConfigurationService) => cultureService.getCurrentCulture(installationConfigurationService).name useFactory: (cultureService, installationConfigurationService) => cultureService.getCurrentCulture(installationConfigurationService).name
}, },
{ {
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
useValue: { useValue: {
appearance: 'outline' appearance: 'outline'
} }
}, },
Title, Title,
CookieService, CookieService,
MatomoService, MatomoService,
AnalyticsService, AnalyticsService,
provideHttpClient(withInterceptorsFromDi()) provideHttpClient(withInterceptorsFromDi())
] ]
}) })
export class AppModule { } export class AppModule { }

Some files were not shown because too many files have changed in this diff Show More