Fix Bug 2048:The VCA Status for an NS with both a KNF and a VNF does not provide...
[osm/NG-UI.git] / src / app / AppComponent.ts
index 04ad8d8..0571014 100644 (file)
@@ -24,8 +24,7 @@ import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
 import { DEFAULT_INTERRUPTSOURCES, Idle } from '@ng-idle/core';
 import { AuthenticationService } from 'AuthenticationService';
 import { DeviceCheckService } from 'DeviceCheckService';
 import { DEFAULT_INTERRUPTSOURCES, Idle } from '@ng-idle/core';
 import { AuthenticationService } from 'AuthenticationService';
 import { DeviceCheckService } from 'DeviceCheckService';
-import { SharedService } from 'SharedService';
-import { isNullOrUndefined } from 'util';
+import { SharedService, isNullOrUndefined } from 'SharedService';
 
 /**
  * Creating component
 
 /**
  * Creating component
@@ -38,6 +37,8 @@ import { isNullOrUndefined } from 'util';
 })
 /** Exporting a class @exports AppComponent */
 export class AppComponent {
 })
 /** Exporting a class @exports AppComponent */
 export class AppComponent {
+    /** Handle idle time out @public */
+    public idleTime: number;
     /** To inject services @public */
     public injector: Injector;
     /** Instance for modal service @public */
     /** To inject services @public */
     public injector: Injector;
     /** Instance for modal service @public */
@@ -70,10 +71,14 @@ export class AppComponent {
 
     /** To handle handleIdle @public */
     public handleIdle(): void {
 
     /** To handle handleIdle @public */
     public handleIdle(): void {
-        const idleTime: number = 1200;
+        if (!isNullOrUndefined((sessionStorage.getItem('timeout')))) {
+            this.idleTime = Number(sessionStorage.getItem('timeout'));
+        } else {
+            this.idleTime = 1200;
+        }
         const idleTimeOutWarning: number = 5;
         //  sets an idle timeout in seconds.
         const idleTimeOutWarning: number = 5;
         //  sets an idle timeout in seconds.
-        this.idle.setIdle(idleTime);
+        this.idle.setIdle(this.idleTime);
         //sets a timeout period in seconds. after idleTime seconds of inactivity, the user will be considered timed out.
         this.idle.setTimeout(idleTimeOutWarning);
         // sets the default interrupts, in this case, things like clicks, scrolls, touches to the document
         //sets a timeout period in seconds. after idleTime seconds of inactivity, the user will be considered timed out.
         this.idle.setTimeout(idleTimeOutWarning);
         // sets the default interrupts, in this case, things like clicks, scrolls, touches to the document
@@ -86,7 +91,7 @@ export class AppComponent {
     public idleTimeOut(): void {
         this.idle.onTimeout.subscribe(() => {
             this.idle.stop();
     public idleTimeOut(): void {
         this.idle.onTimeout.subscribe(() => {
             this.idle.stop();
-            if (localStorage.getItem('id_token') !== null) {
+            if (sessionStorage.getItem('id_token') !== null) {
                 this.authService.logout();
             }
         });
                 this.authService.logout();
             }
         });