Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Welcome Page Button #433

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 27 additions & 38 deletions src/app/Welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -68,47 +68,36 @@ const Welcome = (props) => {
return <Alert variant="danger" title="Server error. Check navigator logs" />;
}

let onClickGoToConsole;
if (authState == 'HTTP_LOGIN') {
return (
<Button
onClick={() => {
ConsoleServices.authentication()
.loginLink()
.then((r) => {
if (r.success) {
logUser();
navigate('/' + location.search);
// history.push('/' + history.location.search);
} else {
// Do nothing
}
});
}}
variant={'control'}
>
<Text>{goToTheConsole}</Text>
</Button>
);
}

if (authState == 'NOT_READY') {
return (
<Button size="lg" onClick={() => setSupportOpen(true)} variant={'control'}>
{goToTheConsole}
</Button>
);
}

if (authState == 'READY') {
return (
<Button size="lg" onClick={() => notSecuredModeOn()} variant={'control'}>
{goToTheConsole}
</Button>
);
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 (
<Button size="lg" onClick={() => login()} variant={'control'}>
<Button size="lg"
onClick={onClickGoToConsole}
style={{ backgroundColor: chart_color_blue_500.value,
color: chart_global_Fill_Color_white.value }}

>
{goToTheConsole}
</Button>
);
Expand Down
Loading