Skip to content

Commit

Permalink
Add retry button in login dialog to refetch auth preferences (#46664)
Browse files Browse the repository at this point in the history
* Add a retry button for fetching auth preferences

* Fix types
  • Loading branch information
gzdunek authored Sep 18, 2024
1 parent c7cec8d commit d918006
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function makeProps(): ClusterLoginPresentationProps {
status: '',
statusText: '',
} as Attempt<void>,
init: () => null,
initAttempt: {
status: 'success',
statusText: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import React from 'react';
import * as Alerts from 'design/Alert';
import { ButtonIcon, Text, Indicator, Box, H2 } from 'design';
import { ButtonIcon, Text, Indicator, Box, H2, ButtonPrimary } from 'design';
import * as Icons from 'design/Icon';
import { DialogHeader, DialogContent } from 'design/Dialog';
import { PrimaryAuthType } from 'shared/services';
Expand All @@ -43,6 +43,7 @@ export type ClusterLoginPresentationProps = State & {
export function ClusterLoginPresentation({
title,
initAttempt,
init,
loginAttempt,
clearLoginAttempt,
onLoginWithLocal,
Expand All @@ -69,10 +70,12 @@ export function ClusterLoginPresentation({
{reason && <Reason reason={reason} />}

{initAttempt.status === 'error' && (
<Alerts.Danger m={4}>
Unable to retrieve cluster auth preferences,{' '}
{initAttempt.statusText}
</Alerts.Danger>
<Box m={4}>
<Alerts.Danger details={initAttempt.statusText}>
Unable to retrieve cluster auth preferences
</Alerts.Danger>
<ButtonPrimary onClick={init}>Retry</ButtonPrimary>
</Box>
)}
{initAttempt.status === 'processing' && (
<Box textAlign="center" m={4}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export default function useClusterLogin(props: Props) {
onAbort,
loginAttempt,
initAttempt,
init,
clearLoginAttempt,
};
}
Expand Down

0 comments on commit d918006

Please sign in to comment.