Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

feat: add user/settings page for managing external auth#10945

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 9 commits intomainfromexternal_auth_fe_updates
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
add stories
  • Loading branch information
@Emyrk
Emyrk committedDec 5, 2023
commitea2f65ba53c3de0b97d46a4b2bd6586f1fe2b88c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,52 @@
// import { ExternalAuthSettingsPageView } from "./ExternalAuthSettingsPageView";
// import type { Meta, StoryObj } from "@storybook/react";
import {
MockGithubAuthLink,
MockGithubExternalProvider,
} from "testHelpers/entities";
import { UserExternalAuthSettingsPageView } from "./UserExternalAuthSettingsPageView";
import type { Meta, StoryObj } from "@storybook/react";

// const meta: Meta<typeof ExternalAuthSettingsPageView> = {
// title: "pages/DeploySettingsPage/ExternalAuthSettingsPageView",
// component: ExternalAuthSettingsPageView,
// args: {
// config: {
// external_auth: [
// {
// id: "0000-1111",
// type: "GitHub",
// client_id: "client_id",
// regex: "regex",
// auth_url: "",
// token_url: "",
// validate_url: "",
// app_install_url: "https://github.com/apps/coder/installations/new",
// app_installations_url: "",
// no_refresh: false,
// scopes: [],
// extra_token_keys: [],
// device_flow: true,
// device_code_url: "",
// display_icon: "",
// display_name: "GitHub",
// },
// ],
// },
// },
// };
const meta: Meta<typeof UserExternalAuthSettingsPageView> = {
title: "pages/UserExternalAuthSettingsPage/UserExternalAuthSettingsPageView",
component: UserExternalAuthSettingsPageView,
args: {
isLoading: false,
getAuthsError: undefined,
unlinked: 0,
auths: {
providers: [],
links: [],
},
onUnlinkExternalAuth: () => {},
onValidateExternalAuth: () => {},
},
};

//export default meta;
//type Story = StoryObj<typeofExternalAuthSettingsPageView>;
export default meta;
type Story = StoryObj<typeofUserExternalAuthSettingsPageView>;

// export const Page: Story = {};
export const NoProviders: Story = {};

export const Authenticated: Story = {
args: {
...meta.args,
auths: {
providers: [MockGithubExternalProvider],
links: [MockGithubAuthLink],
},
},
};

export const UnAuthenticated: Story = {
args: {
...meta.args,
auths: {
providers: [MockGithubExternalProvider],
links: [
{
...MockGithubAuthLink,
authenticated: false,
},
],
},
},
};
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -209,7 +209,7 @@ const useExternalAuth = (providerID: string, unlinked: number) => {
if (unlinked > 0) {
void refetch();
}
}, [unlinked]);
}, [refetch,unlinked]);

useEffect(() => {
if (signedIn) {
Expand Down
20 changes: 20 additions & 0 deletionssite/src/testHelpers/entities.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2931,3 +2931,23 @@ export const DeploymentHealthUnhealthy: TypesGen.HealthcheckReport = {
},
},
};

export const MockGithubExternalProvider: TypesGen.ExternalAuthLinkProvider = {
id: "github",
type: "github",
device: false,
display_icon: "/icon/github.svg",
display_name: "GitHub",
allow_refresh: true,
allow_validate: true,
};

export const MockGithubAuthLink: TypesGen.ExternalAuthLink = {
provider_id: "github",
created_at: "",
updated_at: "",
has_refresh_token: true,
expires: "",
authenticated: true,
validate_error: "",
};

[8]ページ先頭

©2009-2025 Movatter.jp