8000 fix: display error when fetching OAuth2 provider apps (#11713) · coder/coder@7589df3 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

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: 7 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
<>
@@ -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)
0