Skip to content

Commit 7589df3

Browse files
authored
fix: display error when fetching OAuth2 provider apps (#11713)
1 parent 69e963b commit 7589df3

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

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

+1
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

+7
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

+7-3
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
<>
@@ -62,6 +65,8 @@ const OAuth2AppsSettingsPageView: FC<OAuth2AppsSettingsProps> = ({
6265
</Button>
6366
</Stack>
6467

68+
{error && <ErrorAlert error={error} />}
69+
6570
<TableContainer css={{ marginTop: 32 }}>
6671
<Table>
6772
<TableHead>
@@ -72,9 +77,8 @@ const OAuth2AppsSettingsPageView: FC<OAuth2AppsSettingsProps> = ({
7277
</TableHead>
7378
<TableBody>
7479
{isLoading && <TableLoader />}
75-
{!isLoading &&
76-
apps?.map((app) => <OAuth2AppRow key={app.id} app={app} />)}
77-
{!isLoading && (!apps || apps?.length === 0) && (
80+
{apps?.map((app) => <OAuth2AppRow key={app.id} app={app} />)}
81+
{apps?.length === 0 && (
7882
<TableRow>
7983
<TableCell colSpan={999}>
8084
<div css={{ textAlign: "center" }}>

0 commit comments

Comments
 (0)