Skip to content

Commit 4587ef0

Browse files
committed
Display error when fetching OAuth2 provider apps
1 parent f5a9f5c commit 4587ef0

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

site/src/pages/DeploySettingsPage/OAuth2AppsSettingsPage/OAuth2AppsSettingsPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const OAuth2AppsSettingsPage: FC = () => {
1818
<OAuth2AppsSettingsPageView
1919
apps={appsQuery.data}
2020
isLoading={appsQuery.isLoading}
21+
error={appsQuery.error}
2122
isEntitled={
2223
entitlements.features.oauth2_provider.entitlement !== "not_entitled"
2324
}

site/src/pages/DeploySettingsPage/OAuth2AppsSettingsPage/OAuth2AppsSettingsPageView.stories.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ export const Loading: Story = {
1616
},
1717
};
1818

19+
export const Error: Story = {
20+
args: {
21+
isLoading: false,
22+
error: "some error",
23+
},
24+
};
25+
1926
export const Unentitled: Story = {
2027
args: {
2128
isLoading: false,

site/src/pages/DeploySettingsPage/OAuth2AppsSettingsPage/OAuth2AppsSettingsPageView.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
EnterpriseBadge,
2020
EntitledBadge,
2121
} from "components/Badges/Badges";
22+
import { ErrorAlert } from "components/Alert/ErrorAlert";
2223
import { TableLoader } from "components/TableLoader/TableLoader";
2324
import { Stack } from "components/Stack/Stack";
2425
import { useClickableTableRow } from "hooks/useClickableTableRow";
@@ -28,12 +29,14 @@ type OAuth2AppsSettingsProps = {
2829
apps?: TypesGen.OAuth2ProviderApp[];
2930
isEntitled: boolean;
3031
isLoading: boolean;
32+
error?: unknown;
3133
};
3234

3335
const OAuth2AppsSettingsPageView: FC<OAuth2AppsSettingsProps> = ({
3436
apps,
3537
isEntitled,
3638
isLoading,
39+
error,
3740
}) => {
3841
return (
3942
<>
@@ -77,9 +80,13 @@ const OAuth2AppsSettingsPageView: FC<OAuth2AppsSettingsProps> = ({
7780
{!isLoading && (!apps || apps?.length === 0) && (
7881
<TableRow>
7982
<TableCell colSpan={999}>
80-
<div css={{ textAlign: "center" }}>
81-
No OAuth2 applications have been configured.
82-
</div>
83+
{error ? (
84+
<ErrorAlert error={error} />
85+
) : (
86+
<div css={{ textAlign: "center" }}>
87+
No OAuth2 applications have been configured.
88+
</div>
89+
)}
8390
</TableCell>
8491
</TableRow>
8592
)}

0 commit comments

Comments
 (0)