Merge remote-tracking branch 'upstream/main' into created-metadata-service-for-metadata-operations_contribute-main

This commit is contained in:
Alexandre Vryghem
2024-03-22 14:57:48 +01:00
3219 changed files with 124687 additions and 48982 deletions

View File

@@ -5,33 +5,52 @@
*
* http://www.dspace.org/license/
*/
import { InitService } from '../../app/init.service';
import { Store } from '@ngrx/store';
import { AppState } from '../../app/app.reducer';
import {
Inject,
Injectable,
} from '@angular/core';
import { TransferState } from '@angular/platform-browser';
import { APP_CONFIG, APP_CONFIG_STATE, AppConfig } from '../../config/app-config.interface';
import { DefaultAppConfig } from '../../config/default-app-config';
import { extendEnvironmentWithAppConfig } from '../../config/config.util';
import { environment } from '../../environments/environment';
import { CorrelationIdService } from '../../app/correlation-id/correlation-id.service';
import { Inject, Injectable } from '@angular/core';
import { Store } from '@ngrx/store';
import { TranslateService } from '@ngx-translate/core';
import {
firstValueFrom,
Subscription,
} from 'rxjs';
import {
filter,
find,
map,
} from 'rxjs/operators';
import { logStartupMessage } from '../../../startup-message';
import { AppState } from '../../app/app.reducer';
import { BreadcrumbsService } from '../../app/breadcrumbs/breadcrumbs.service';
import { AuthService } from '../../app/core/auth/auth.service';
import { coreSelector } from '../../app/core/core.selectors';
import { RootDataService } from '../../app/core/data/root-data.service';
import { LocaleService } from '../../app/core/locale/locale.service';
import { HeadTagService } from '../../app/core/metadata/head-tag.service';
import { ServerCheckGuard } from '../../app/core/server-check/server-check.guard';
import { CorrelationIdService } from '../../app/correlation-id/correlation-id.service';
import { InitService } from '../../app/init.service';
import { KlaroService } from '../../app/shared/cookies/klaro.service';
import { isNotEmpty } from '../../app/shared/empty.util';
import { MenuService } from '../../app/shared/menu/menu.service';
import { ThemeService } from '../../app/shared/theme-support/theme.service';
import { Angulartics2DSpace } from '../../app/statistics/angulartics/dspace-provider';
import { GoogleAnalyticsService } from '../../app/statistics/google-analytics.service';
import { HeadTagService } from '../../app/core/metadata/head-tag.service';
import { BreadcrumbsService } from '../../app/breadcrumbs/breadcrumbs.service';
import { KlaroService } from '../../app/shared/cookies/klaro.service';
import { AuthService } from '../../app/core/auth/auth.service';
import { ThemeService } from '../../app/shared/theme-support/theme.service';
import { StoreAction, StoreActionTypes } from '../../app/store.actions';
import { coreSelector } from '../../app/core/core.selectors';
import { filter, find, map } from 'rxjs/operators';
import { isNotEmpty } from '../../app/shared/empty.util';
import { logStartupMessage } from '../../../startup-message';
import { MenuService } from '../../app/shared/menu/menu.service';
import { RootDataService } from '../../app/core/data/root-data.service';
import { firstValueFrom, Subscription } from 'rxjs';
import {
StoreAction,
StoreActionTypes,
} from '../../app/store.actions';
import {
APP_CONFIG,
APP_CONFIG_STATE,
AppConfig,
} from '../../config/app-config.interface';
import { extendEnvironmentWithAppConfig } from '../../config/config.util';
import { DefaultAppConfig } from '../../config/default-app-config';
import { environment } from '../../environments/environment';
/**
* Performs client-side initialization.
@@ -56,7 +75,8 @@ export class BrowserInitService extends InitService {
protected authService: AuthService,
protected themeService: ThemeService,
protected menuService: MenuService,
private rootDataService: RootDataService
private rootDataService: RootDataService,
protected serverCheckGuard: ServerCheckGuard,
) {
super(
store,
@@ -120,7 +140,7 @@ export class BrowserInitService extends InitService {
this.store.dispatch(new StoreAction(StoreActionTypes.REHYDRATE, state));
return this.store.select(coreSelector).pipe(
find((core: any) => isNotEmpty(core)),
map(() => true)
map(() => true),
).toPromise();
}
@@ -150,12 +170,12 @@ export class BrowserInitService extends InitService {
private externalAuthCheck() {
this.sub = this.authService.isExternalAuthentication().pipe(
filter((externalAuth: boolean) => externalAuth)
).subscribe(() => {
// Clear the transferState data.
this.rootDataService.invalidateRootCache();
this.authService.setExternalAuthStatus(false);
}
filter((externalAuth: boolean) => externalAuth),
).subscribe(() => {
// Clear the transferState data.
this.rootDataService.invalidateRootCache();
this.authService.setExternalAuthStatus(false);
},
);
this.closeAuthCheckSubscription();
@@ -168,8 +188,17 @@ export class BrowserInitService extends InitService {
*/
private closeAuthCheckSubscription() {
firstValueFrom(this.authenticationReady$()).then(() => {
this.sub.unsubscribe();
});
this.sub.unsubscribe();
});
}
/**
* Start route-listening subscriptions
* @protected
*/
protected initRouteListeners(): void {
super.initRouteListeners();
this.serverCheckGuard.listenForRouteChanges();
}
}