RED-3800: allow paths to skip server error interceptor
This commit is contained in:
parent
90b9f229b7
commit
079d1288a6
@ -36,6 +36,7 @@ import {
|
||||
IqserHelpModeModule,
|
||||
MANUAL_BASE_URL,
|
||||
MAX_RETRIES_ON_SERVER_ERROR,
|
||||
SERVER_ERROR_SKIP_PATHS,
|
||||
ServerErrorInterceptor,
|
||||
ToastComponent,
|
||||
} from '@iqser/common-ui';
|
||||
@ -203,6 +204,10 @@ const components = [AppComponent, AuthErrorComponent, NotificationsComponent, Sp
|
||||
useFactory: (configService: ConfigService) => configService.values.MAX_RETRIES_ON_SERVER_ERROR,
|
||||
deps: [ConfigService],
|
||||
},
|
||||
{
|
||||
provide: SERVER_ERROR_SKIP_PATHS,
|
||||
useValue: ['redaction-gateway-v1/license'],
|
||||
},
|
||||
{
|
||||
provide: ACTIVE_DOSSIERS_SERVICE,
|
||||
useExisting: ActiveDossiersService,
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { Injectable, Injector } from '@angular/core';
|
||||
import { GenericService, QueryParam, RequiredParam, Validate } from '@iqser/common-ui';
|
||||
import { ILicense, ILicenseReport, ILicenseReportRequest, ILicenses } from '@red/domain';
|
||||
import { BehaviorSubject, firstValueFrom, Observable } from 'rxjs';
|
||||
import { BehaviorSubject, firstValueFrom, Observable, of } from 'rxjs';
|
||||
import { ConfigService } from './config.service';
|
||||
import { filter, tap } from 'rxjs/operators';
|
||||
import { catchError, filter, tap } from 'rxjs/operators';
|
||||
import { LICENSE_STORAGE_KEY } from '../modules/admin/screens/license/utils/constants';
|
||||
|
||||
export function getStoredReports() {
|
||||
@ -11,6 +11,35 @@ export function getStoredReports() {
|
||||
return JSON.parse(rawStoredReports ?? '{}') as Record<string, ILicenseReport>;
|
||||
}
|
||||
|
||||
const defaultOnError: ILicenses = {
|
||||
activeLicense: 'err',
|
||||
licenses: [
|
||||
{
|
||||
id: 'err',
|
||||
name: 'Error',
|
||||
product: 'Error',
|
||||
licensedTo: 'Error',
|
||||
licensedToEmail: 'Error',
|
||||
validFrom: '01-01-2022',
|
||||
validUntil: '01-01-2023',
|
||||
features: [
|
||||
{
|
||||
name: 'processingPages',
|
||||
type: 'NUMBER',
|
||||
value: '2000000',
|
||||
},
|
||||
{
|
||||
name: 'pdftron',
|
||||
type: 'STRING',
|
||||
value:
|
||||
'S25lY29uIEFHKGVuLmtuZWNvbi5zd2lzcyk6T0VNOkREQS1SOjpCKzpBTVMoMj' +
|
||||
'AyMjEwMjkpOkZGQ0M0RDMzMDdEQUI0RjM4QjMxM0JDOUIyNDMzODJDNEU2RjZGQ0I4M0NEOEFDNTc0MzU4QTk1OTczMEI2MjJGQUJFRjVDNw==',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
@ -77,6 +106,7 @@ export class LicenseService extends GenericService<ILicenseReport> {
|
||||
|
||||
loadLicense() {
|
||||
return this._http.get<ILicenses>('/license').pipe(
|
||||
catchError(() => of(defaultOnError)),
|
||||
tap(licenses => this.#licenseData$.next(licenses)),
|
||||
tap(() => this.setDefaultSelectedLicense()),
|
||||
);
|
||||
|
||||
@ -32,31 +32,29 @@ export function configurationInitializer(
|
||||
userPreferenceService: UserPreferenceService,
|
||||
licenseService: LicenseService,
|
||||
) {
|
||||
return () =>
|
||||
firstValueFrom(
|
||||
keycloakService.keycloakEvents$.pipe(
|
||||
filter(event => event.type === KeycloakEventType.OnReady),
|
||||
map(() => featuresService.loadConfig()),
|
||||
switchMap(() => from(keycloakService.isLoggedIn())),
|
||||
switchMap(loggedIn => (!loggedIn ? throwError('Not Logged In') : of({}))),
|
||||
switchMap(() => from(userService.loadCurrentUser())),
|
||||
switchMap(user => (!user.hasAnyREDRoles ? throwError('Not user has no red roles') : of({}))),
|
||||
mergeMap(() => generalSettingsService.getGeneralConfigurations()),
|
||||
tap(configuration => configService.updateDisplayName(configuration.displayName)),
|
||||
switchMap(() => systemPreferencesService.loadPreferences()),
|
||||
switchMap(() => userPreferenceService.reload()),
|
||||
catchError(e => {
|
||||
console.log('[Redaction] Initialization error:', e);
|
||||
title.setTitle('RedactManager');
|
||||
return of({});
|
||||
}),
|
||||
tap(() => {
|
||||
lastDossierTemplateRedirect(baseHref.replace('/', ''), userPreferenceService);
|
||||
}),
|
||||
switchMap(() => languageService.chooseAndSetInitialLanguage()),
|
||||
tap(() => userService.initialize()),
|
||||
tap(() => firstValueFrom(licenseService.loadLicense())),
|
||||
take(1),
|
||||
),
|
||||
);
|
||||
const setup = keycloakService.keycloakEvents$.pipe(
|
||||
filter(event => event.type === KeycloakEventType.OnReady),
|
||||
map(() => featuresService.loadConfig()),
|
||||
switchMap(() => from(keycloakService.isLoggedIn())),
|
||||
switchMap(loggedIn => (!loggedIn ? throwError('Not Logged In') : of({}))),
|
||||
switchMap(() => from(userService.loadCurrentUser())),
|
||||
switchMap(user => (!user.hasAnyREDRoles ? throwError('Not user has no red roles') : of({}))),
|
||||
mergeMap(() => generalSettingsService.getGeneralConfigurations()),
|
||||
tap(configuration => configService.updateDisplayName(configuration.displayName)),
|
||||
switchMap(() => systemPreferencesService.loadPreferences()),
|
||||
switchMap(() => userPreferenceService.reload()),
|
||||
catchError(e => {
|
||||
console.log('[Redaction] Initialization error:', e);
|
||||
title.setTitle('RedactManager');
|
||||
return of({});
|
||||
}),
|
||||
tap(() => {
|
||||
lastDossierTemplateRedirect(baseHref.replace('/', ''), userPreferenceService);
|
||||
}),
|
||||
switchMap(() => languageService.chooseAndSetInitialLanguage()),
|
||||
tap(() => userService.initialize()),
|
||||
tap(() => firstValueFrom(licenseService.loadLicense())),
|
||||
take(1),
|
||||
);
|
||||
return () => firstValueFrom(setup);
|
||||
}
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 4aad2e33adc673deb8d4017445bb3064e124dbd1
|
||||
Subproject commit a814fc8aa7a16c9acdaa9b7dd749e4493a54e1c2
|
||||
Loading…
x
Reference in New Issue
Block a user