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

Commitd8c0c53

Browse files
committed
add stories
1 parentab19fd1 commitd8c0c53

File tree

3 files changed

+70
-34
lines changed

3 files changed

+70
-34
lines changed
Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,52 @@
1-
// import { ExternalAuthSettingsPageView } from "./ExternalAuthSettingsPageView";
2-
// import type { Meta, StoryObj } from "@storybook/react";
1+
import{
2+
MockGithubAuthLink,
3+
MockGithubExternalProvider,
4+
}from"testHelpers/entities";
5+
import{UserExternalAuthSettingsPageView}from"./UserExternalAuthSettingsPageView";
6+
importtype{Meta,StoryObj}from"@storybook/react";
37

4-
// const meta: Meta<typeof ExternalAuthSettingsPageView> = {
5-
// title: "pages/DeploySettingsPage/ExternalAuthSettingsPageView",
6-
// component: ExternalAuthSettingsPageView,
7-
// args: {
8-
// config: {
9-
// external_auth: [
10-
// {
11-
// id: "0000-1111",
12-
// type: "GitHub",
13-
// client_id: "client_id",
14-
// regex: "regex",
15-
// auth_url: "",
16-
// token_url: "",
17-
// validate_url: "",
18-
// app_install_url: "https://github.com/apps/coder/installations/new",
19-
// app_installations_url: "",
20-
// no_refresh: false,
21-
// scopes: [],
22-
// extra_token_keys: [],
23-
// device_flow: true,
24-
// device_code_url: "",
25-
// display_icon: "",
26-
// display_name: "GitHub",
27-
// },
28-
// ],
29-
// },
30-
// },
31-
// };
8+
constmeta:Meta<typeofUserExternalAuthSettingsPageView>={
9+
title:"pages/UserExternalAuthSettingsPage/UserExternalAuthSettingsPageView",
10+
component:UserExternalAuthSettingsPageView,
11+
args:{
12+
isLoading:false,
13+
getAuthsError:undefined,
14+
unlinked:0,
15+
auths:{
16+
providers:[],
17+
links:[],
18+
},
19+
onUnlinkExternalAuth:()=>{},
20+
onValidateExternalAuth:()=>{},
21+
},
22+
};
3223

33-
//export default meta;
34-
//type Story = StoryObj<typeofExternalAuthSettingsPageView>;
24+
exportdefaultmeta;
25+
typeStory=StoryObj<typeofUserExternalAuthSettingsPageView>;
3526

36-
// export const Page: Story = {};
27+
exportconstNoProviders:Story={};
28+
29+
exportconstAuthenticated:Story={
30+
args:{
31+
...meta.args,
32+
auths:{
33+
providers:[MockGithubExternalProvider],
34+
links:[MockGithubAuthLink],
35+
},
36+
},
37+
};
38+
39+
exportconstUnAuthenticated:Story={
40+
args:{
41+
...meta.args,
42+
auths:{
43+
providers:[MockGithubExternalProvider],
44+
links:[
45+
{
46+
...MockGithubAuthLink,
47+
authenticated:false,
48+
},
49+
],
50+
},
51+
},
52+
};

‎site/src/pages/UserExternalAuthSettingsPage/UserExternalAuthSettingsPageView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const useExternalAuth = (providerID: string, unlinked: number) => {
209209
if(unlinked>0){
210210
voidrefetch();
211211
}
212-
},[unlinked]);
212+
},[refetch,unlinked]);
213213

214214
useEffect(()=>{
215215
if(signedIn){

‎site/src/testHelpers/entities.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,3 +2929,23 @@ export const DeploymentHealthUnhealthy: TypesGen.HealthcheckReport = {
29292929
},
29302930
},
29312931
};
2932+
2933+
exportconstMockGithubExternalProvider:TypesGen.ExternalAuthLinkProvider={
2934+
id:"github",
2935+
type:"github",
2936+
device:false,
2937+
display_icon:"/icon/github.svg",
2938+
display_name:"GitHub",
2939+
allow_refresh:true,
2940+
allow_validate:true,
2941+
};
2942+
2943+
exportconstMockGithubAuthLink:TypesGen.ExternalAuthLink={
2944+
provider_id:"github",
2945+
created_at:"",
2946+
updated_at:"",
2947+
has_refresh_token:true,
2948+
expires:"",
2949+
authenticated:true,
2950+
validate_error:"",
2951+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp