RED-4006: Use time to restore from API
This commit is contained in:
parent
b2d013fc60
commit
415110c503
@ -5,7 +5,6 @@ import { HttpClientModule } from '@angular/common/http';
|
||||
import { KeycloakAngularModule, KeycloakOptions, KeycloakService } from 'keycloak-angular';
|
||||
import { ConfigService } from '@services/config.service';
|
||||
import { BASE_HREF } from '../../tokens';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
|
||||
function getKeycloakOptions(configService: ConfigService, baseUrl: string) {
|
||||
let url: string = configService.values.OAUTH_URL;
|
||||
@ -37,11 +36,9 @@ function configureAutomaticRedirectToLoginScreen(keyCloakService: KeycloakServic
|
||||
|
||||
export function keycloakInitializer(keycloakService: KeycloakService, configService: ConfigService, baseUrl: string): () => Promise<void> {
|
||||
return () =>
|
||||
firstValueFrom(configService.loadAppConfig()).then(() =>
|
||||
keycloakService
|
||||
.init(getKeycloakOptions(configService, baseUrl))
|
||||
.then(() => configureAutomaticRedirectToLoginScreen(keycloakService)),
|
||||
);
|
||||
keycloakService
|
||||
.init(getKeycloakOptions(configService, baseUrl))
|
||||
.then(() => configureAutomaticRedirectToLoginScreen(keycloakService));
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
|
||||
@ -2,10 +2,11 @@ import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Title } from '@angular/platform-browser';
|
||||
import packageInfo from '../../../../../package.json';
|
||||
import config from '../../assets/config/config.json';
|
||||
import envConfig from '../../assets/config/config.json';
|
||||
import { CacheApiService, wipeCaches } from '@red/cache';
|
||||
import { Observable } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { AppConfig } from '@red/domain';
|
||||
|
||||
const version = packageInfo.version;
|
||||
|
||||
@ -19,19 +20,21 @@ export class ConfigService {
|
||||
private readonly _titleService: Title,
|
||||
) {
|
||||
this._checkFrontendVersion();
|
||||
|
||||
console.log('[REDACTION] Started with config: ', this._values);
|
||||
}
|
||||
|
||||
private _values = { ...config, FRONTEND_APP_VERSION: version } as const;
|
||||
private _values: AppConfig = { ...envConfig, FRONTEND_APP_VERSION: version } as const;
|
||||
|
||||
get values() {
|
||||
return this._values;
|
||||
}
|
||||
|
||||
loadAppConfig(): Observable<any> {
|
||||
return this._httpClient.get<any>('/assets/config/config.json').pipe(
|
||||
tap(envConfig => {
|
||||
console.log('[REDACTION] Started with config: ', envConfig);
|
||||
this._values = envConfig;
|
||||
return this._httpClient.get('/app-config').pipe(
|
||||
tap(appConfig => {
|
||||
console.log('[REDACTION] Loaded app config: ', appConfig);
|
||||
this._values = { ...this._values, ...appConfig };
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ export class TrashService extends EntitiesService<TrashItem> {
|
||||
dossier =>
|
||||
new TrashDossier(
|
||||
dossier,
|
||||
this._configService.values.DELETE_RETENTION_HOURS as number,
|
||||
this._configService.values.softDeleteCleanupTime,
|
||||
this._permissionsService.canRestoreDossier(dossier),
|
||||
this._permissionsService.canHardDeleteDossier(dossier),
|
||||
),
|
||||
@ -82,7 +82,7 @@ export class TrashService extends EntitiesService<TrashItem> {
|
||||
return new TrashFile(
|
||||
file,
|
||||
dossier.dossierTemplateId,
|
||||
this._configService.values.DELETE_RETENTION_HOURS as number,
|
||||
this._configService.values.softDeleteCleanupTime,
|
||||
this._permissionsService.canRestoreFile(file, dossier),
|
||||
this._permissionsService.canHardDeleteFile(file, dossier),
|
||||
);
|
||||
|
||||
@ -39,6 +39,7 @@ export function configurationInitializer(
|
||||
switchMap(user => (!user.hasAnyREDRoles ? throwError('Not user has no red roles') : of({}))),
|
||||
mergeMap(() => generalSettingsService.getGeneralConfigurations()),
|
||||
tap(configuration => configService.updateDisplayName(configuration.displayName)),
|
||||
switchMap(() => configService.loadAppConfig()),
|
||||
switchMap(() => userPreferenceService.reload()),
|
||||
catchError(e => {
|
||||
console.log('[Redaction] Initialization error:', e);
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
"APP_NAME": "RedactManager",
|
||||
"AUTO_READ_TIME": 3,
|
||||
"BACKEND_APP_VERSION": "4.4.40",
|
||||
"DELETE_RETENTION_HOURS": 96,
|
||||
"EULA_URL": "EULA_URL",
|
||||
"FRONTEND_APP_VERSION": "1.1",
|
||||
"LICENSE_CUSTOMER": "Development License",
|
||||
|
||||
@ -6,7 +6,6 @@ API_URL="${API_URL:-/redaction-gateway-v1}"
|
||||
APP_NAME="${APP_NAME:-}"
|
||||
AUTO_READ_TIME="${AUTO_READ_TIME:-1.5}"
|
||||
BACKEND_APP_VERSION="${BACKEND_APP_VERSION:-4.7.0}"
|
||||
DELETE_RETENTION_HOURS="${DELETE_RETENTION_HOURS:-96}"
|
||||
EULA_URL="${EULA_URL:-}"
|
||||
FRONTEND_APP_VERSION="${FRONTEND_APP_VERSION:-}"
|
||||
|
||||
@ -34,7 +33,6 @@ echo '{
|
||||
"APP_NAME":"'"$APP_NAME"'",
|
||||
"AUTO_READ_TIME":'"$AUTO_READ_TIME"',
|
||||
"BACKEND_APP_VERSION":"'"$BACKEND_APP_VERSION"'",
|
||||
"DELETE_RETENTION_HOURS":'"$DELETE_RETENTION_HOURS"',
|
||||
"EULA_URL":"'"$EULA_URL:"'",
|
||||
"FRONTEND_APP_VERSION":"'"$FRONTEND_APP_VERSION:"'",
|
||||
"LICENSE_EMAIL":"'"$LICENSE_EMAIL"'",
|
||||
|
||||
26
libs/red-domain/src/lib/shared/app-config.ts
Normal file
26
libs/red-domain/src/lib/shared/app-config.ts
Normal file
@ -0,0 +1,26 @@
|
||||
export interface AppConfig {
|
||||
ADMIN_CONTACT_NAME: string;
|
||||
ADMIN_CONTACT_URL: string;
|
||||
API_URL: string;
|
||||
APP_NAME: string;
|
||||
AUTO_READ_TIME: number;
|
||||
BACKEND_APP_VERSION: string;
|
||||
EULA_URL: string;
|
||||
FRONTEND_APP_VERSION: string;
|
||||
LICENSE_CUSTOMER: string;
|
||||
LICENSE_EMAIL: string;
|
||||
LICENSE_END: string;
|
||||
LICENSE_PAGE_COUNT: number;
|
||||
LICENSE_START: string;
|
||||
MAX_FILE_SIZE_MB: number;
|
||||
MAX_RETRIES_ON_SERVER_ERROR: number;
|
||||
OAUTH_CLIENT_ID: string;
|
||||
OAUTH_IDP_HINT: null;
|
||||
OAUTH_URL: string;
|
||||
RECENT_PERIOD_IN_HOURS: number;
|
||||
SELECTION_MODE: string;
|
||||
MANUAL_BASE_URL: string;
|
||||
softDeleteCleanupTime?: number;
|
||||
downloadCleanupDownloadFilesHours?: number;
|
||||
downloadCleanupNotDownloadFilesHours?: number;
|
||||
}
|
||||
@ -11,3 +11,4 @@ export * from './pdf.types';
|
||||
export * from './logger-config';
|
||||
export * from './admin-side-nav-types';
|
||||
export * from './charts';
|
||||
export * from './app-config';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user