From ed8513310a0a3b37a9084e57f3d7f96571ecc825 Mon Sep 17 00:00:00 2001 From: Katia Aresti Date: Wed, 15 Nov 2023 14:01:17 +0100 Subject: [PATCH] Refactor Welcome Page Button --- src/app/Welcome/Welcome.tsx | 65 +++++++++++++++---------------------- 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/src/app/Welcome/Welcome.tsx b/src/app/Welcome/Welcome.tsx index 5be635c2..992ab36d 100644 --- a/src/app/Welcome/Welcome.tsx +++ b/src/app/Welcome/Welcome.tsx @@ -21,7 +21,7 @@ import { } from '@patternfly/react-core'; import icon from '!!url-loader!@app/assets/images/infinispan_logo_rgb_darkbluewhite_darkblue.svg'; import { CatalogIcon, DownloadIcon, GithubIcon, UnknownIcon } from '@patternfly/react-icons'; -import { chart_color_blue_500 } from '@patternfly/react-tokens'; +import { chart_color_blue_500, chart_global_Fill_Color_white } from '@patternfly/react-tokens'; import { ConsoleBackground } from '@app/Common/ConsoleBackground/ConsoleBackground'; import { Support } from '@app/Support/Support'; import { KeycloakService } from '@services/keycloakService'; @@ -68,47 +68,36 @@ const Welcome = (props) => { return ; } + let onClickGoToConsole; if (authState == 'HTTP_LOGIN') { - return ( - - ); - } - - if (authState == 'NOT_READY') { - return ( - - ); - } - - if (authState == 'READY') { - return ( - - ); + onClickGoToConsole = () => { + ConsoleServices.authentication() + .loginLink() + .then((r) => { + if (r.success) { + logUser(); + navigate('/' + location.search); + // history.push('/' + history.location.search); + } else { + // Do nothing + } + }); + }; + } else if (authState == 'NOT_READY') { + onClickGoToConsole = () => setSupportOpen(true); + } else if (authState == 'READY') { + onClickGoToConsole = () => notSecuredModeOn(); + } else { + onClickGoToConsole = () => login(); } return ( - );