Skip to content

Commit 953d19f

Browse files
authored
fix: configurable access error (#2859)
1 parent e76e2af commit 953d19f

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/containers/App/Content.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,11 @@ function GetUser({children}: {children: React.ReactNode}) {
196196
const {isLoading, error} = authenticationApi.useWhoamiQuery({database});
197197
const {appTitle} = useAppTitle();
198198

199+
const errorProps = error ? {...uiFactory.clusterOrDatabaseAccessError} : undefined;
200+
199201
return (
200202
<LoaderWrapper loading={isLoading} size="l">
201-
<PageError
202-
error={error}
203-
{...uiFactory.clusterOrDatabaseAccessError}
204-
errorPageTitle={appTitle}
205-
>
203+
<PageError error={error} {...errorProps} errorPageTitle={appTitle}>
206204
{children}
207205
</PageError>
208206
</LoaderWrapper>

src/containers/Clusters/Clusters.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,13 @@ export function Clusters() {
140140

141141
const showBlockingError = isAccessError(query.error);
142142

143+
const errorProps = showBlockingError ? uiFactory.clusterOrDatabaseAccessError : undefined;
144+
143145
return (
144146
<PageError
145147
error={showBlockingError ? query.error : undefined}
146-
{...uiFactory.clusterOrDatabaseAccessError}
148+
{...errorProps}
149+
errorPageTitle={uiFactory.clustersPageTitle ?? i18n('page_title')}
147150
>
148151
<div className={b()}>
149152
<Helmet>

src/containers/Tenant/Tenant.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export function Tenant(props: TenantProps) {
106106

107107
const showBlockingError = isAccessError(error);
108108

109+
const errorProps = showBlockingError ? uiFactory.clusterOrDatabaseAccessError : undefined;
110+
109111
const onCollapseSummaryHandler = () => {
110112
dispatchSummaryVisibilityAction(PaneVisibilityActionTypes.triggerCollapse);
111113
};
@@ -131,10 +133,7 @@ export function Tenant(props: TenantProps) {
131133
titleTemplate={`%s — ${title}${appTitle}`}
132134
/>
133135
<LoaderWrapper loading={initialLoading}>
134-
<PageError
135-
error={showBlockingError ? error : undefined}
136-
{...uiFactory.clusterOrDatabaseAccessError}
137-
>
136+
<PageError error={showBlockingError ? error : undefined} {...errorProps}>
138137
<TenantContextProvider
139138
database={database}
140139
path={path}

0 commit comments

Comments
 (0)