From a2b6dd34d73bf432846dc59c6f57dd59a03aff9b Mon Sep 17 00:00:00 2001
From: Michael Dürre <michael.duerre@highstreet-technologies.com>
Date: Thu, 8 Sep 2022 09:45:06 +0200
Subject: update odlux sources
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

update basic odlux functionality for kohn

Issue-ID: CCSDK-3765
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Change-Id: I3723c9c2f35b9012ba537920b294a54bb556cbc6
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
---
 sdnr/wt/odlux/framework/src/views/login.tsx | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

(limited to 'sdnr/wt/odlux/framework/src/views/login.tsx')

diff --git a/sdnr/wt/odlux/framework/src/views/login.tsx b/sdnr/wt/odlux/framework/src/views/login.tsx
index 8eb7a6c0f..e037edf82 100644
--- a/sdnr/wt/odlux/framework/src/views/login.tsx
+++ b/sdnr/wt/odlux/framework/src/views/login.tsx
@@ -119,6 +119,7 @@ interface ILoginState {
   password: string;
   scope: string;
   message: string;
+  isServerReady: boolean;
   providers: {
     id: string;
     title: string;
@@ -141,6 +142,7 @@ class LoginComponent extends React.Component<LoginProps, ILoginState> {
       scope: 'sdn',
       message: '',
       providers: null,
+      isServerReady: false
     };
   }
 
@@ -148,6 +150,13 @@ class LoginComponent extends React.Component<LoginProps, ILoginState> {
      if (this.props.authentication === "oauth" && (this.props.externalLoginProviders == null || this.props.externalLoginProviders.length === 0)){
        this.props.updateExternalProviders();
      }
+
+    authenticationService.getServerReadyState().then(result =>{
+      this.setState({isServerReady: result});
+    })
+
+
+
   }
 
   private setExternalProviderAnchor = (el: HTMLElement | null) => {
@@ -262,10 +271,21 @@ class LoginComponent extends React.Component<LoginProps, ILoginState> {
       this.props.history.replace(returnTo && returnTo[1] || "/");
     }
     else {
-      this.setState({
-        message: "Could not log in. Please check your credentials or ask your administrator for assistence.",
-        password: ""
-      })
+
+      if(!this.state.isServerReady){
+        const ready = await authenticationService.getServerReadyState();
+        if(ready){
+          this.setState({isServerReady: true});
+        }else{
+          this.setState({message: "Login is currently not possible. Please re-try in a few minutes. If the problem persits, ask your administrator for assistence."});
+        }
+  
+      }else{
+        this.setState({
+          message: "Could not log in. Please check your credentials or ask your administrator for assistence.",
+          password: ""
+        })
+      }
     }
   }
 }
-- 
cgit 1.2.3-korg

