From 900232f8f5c910c3cf8597bb22a93b222aee27de Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Mon, 16 Nov 2020 12:33:23 +0200 Subject: [PATCH] auto read time --- apps/red-ui/src/app/app-config/app-config.service.ts | 3 ++- .../file/page-indicator/page-indicator.component.ts | 6 ++++-- docker/red-ui/docker-entrypoint.sh | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/red-ui/src/app/app-config/app-config.service.ts b/apps/red-ui/src/app/app-config/app-config.service.ts index 23f546e90..a8327b3a3 100644 --- a/apps/red-ui/src/app/app-config/app-config.service.ts +++ b/apps/red-ui/src/app/app-config/app-config.service.ts @@ -8,7 +8,8 @@ export enum AppConfigKey { OAUTH_CLIENT_ID = 'OAUTH_CLIENT_ID', API_URL = 'API_URL', ADMIN_CONTACT_NAME = 'ADMIN_CONTACT_NAME', - ADMIN_CONTACT_URL = 'ADMIN_CONTACT_URL' + ADMIN_CONTACT_URL = 'ADMIN_CONTACT_URL', + AUTO_READ_TIME = 'AUTO_READ_TIME' } @Injectable({ diff --git a/apps/red-ui/src/app/screens/file/page-indicator/page-indicator.component.ts b/apps/red-ui/src/app/screens/file/page-indicator/page-indicator.component.ts index c34b856fe..0d4516289 100644 --- a/apps/red-ui/src/app/screens/file/page-indicator/page-indicator.component.ts +++ b/apps/red-ui/src/app/screens/file/page-indicator/page-indicator.component.ts @@ -1,7 +1,8 @@ -import { Component, EventEmitter, HostListener, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { ViewedPages, ViewedPagesControllerService } from '@redaction/red-ui-http'; import { AppStateService } from '../../../state/app-state.service'; import { PermissionsService } from '../../../common/service/permissions.service'; +import { AppConfigKey, AppConfigService } from '../../../app-config/app-config.service'; @Component({ selector: 'redaction-page-indicator', @@ -21,6 +22,7 @@ export class PageIndicatorComponent implements OnChanges, OnInit { constructor( private readonly _viewedPagesControllerService: ViewedPagesControllerService, private readonly _appStateService: AppStateService, + private readonly _appConfigService: AppConfigService, private readonly _permissionService: PermissionsService ) {} @@ -48,7 +50,7 @@ export class PageIndicatorComponent implements OnChanges, OnInit { if (this.active && !this.read) { this._markPageRead(); } - }, 3 * 1000); // 3 seconds + }, this._appConfigService.getConfig(AppConfigKey.AUTO_READ_TIME, 1.5) * 1000); } } } diff --git a/docker/red-ui/docker-entrypoint.sh b/docker/red-ui/docker-entrypoint.sh index 2239fa4aa..00d3db9f0 100755 --- a/docker/red-ui/docker-entrypoint.sh +++ b/docker/red-ui/docker-entrypoint.sh @@ -3,10 +3,17 @@ OAUTH_CLIENT_ID="${OAUTH_CLIENT_ID:-gin-client}" OAUTH_URL="${OAUTH_URL:-https://keycloak-dev.iqser.cloud/auth/realms/dev}" API_URL="${API_URL:-}" +ADMIN_CONTACT_NAME="${ADMIN_CONTACT_NAME:-}" +ADMIN_CONTACT_URL="${ADMIN_CONTACT_URL:-}" +AUTO_READ_TIME="${AUTO_READ_TIME:-1.5}" + echo '{ "OAUTH_CLIENT_ID":"'"$OAUTH_CLIENT_ID"'", "OAUTH_URL":"'"$OAUTH_URL"'", + "ADMIN_CONTACT_NAME":"'"$ADMIN_CONTACT_NAME"'", + "ADMIN_CONTACT_URL":"'"$ADMIN_CONTACT_URL"'", + "AUTO_READ_TIME":'"$AUTO_READ_TIME"', "API_URL":"'"$API_URL"'" }' > /usr/share/nginx/html/assets/config/config.json