|
1 | | -import {Fragment} from 'react'; |
| 1 | +import {Fragment, type ComponentProps} from 'react'; |
2 | 2 |
|
3 | 3 | import * as Storybook from 'sentry/stories'; |
4 | 4 | import type { |
5 | 5 | IntegrationRepository, |
6 | 6 | OrganizationIntegration, |
7 | 7 | } from 'sentry/types/integrations'; |
8 | | -import {SeerOverview} from 'sentry/views/settings/seer/overview/components'; |
9 | | -import {SCMOverviewSectionView} from 'sentry/views/settings/seer/overview/scmOverviewSection'; |
| 8 | +import {SCMOverviewSection} from 'sentry/views/settings/seer/overview/scmOverviewSection'; |
10 | 9 |
|
11 | 10 | const GITHUB_INTEGRATION: OrganizationIntegration = { |
12 | 11 | id: '1', |
@@ -38,7 +37,7 @@ const REPOS: IntegrationRepository[] = [ |
38 | 37 | {identifier: 'my-org/infra', name: 'my-org/infra', isInstalled: true}, |
39 | 38 | ]; |
40 | 39 |
|
41 | | -const BASE_PROPS = { |
| 40 | +const BASE_PROPS: ComponentProps<typeof SCMOverviewSection> = { |
42 | 41 | canWrite: true, |
43 | 42 | organizationSlug: 'my-org', |
44 | 43 | isError: false, |
@@ -70,94 +69,99 @@ export default Storybook.story('SCMOverviewSection', story => { |
70 | 69 | )); |
71 | 70 |
|
72 | 71 | story('Loading', () => ( |
73 | | - <SeerOverview> |
74 | | - <SCMOverviewSectionView |
75 | | - {...BASE_PROPS} |
76 | | - isPending |
77 | | - supportedScmIntegrations={[]} |
78 | | - seerRepos={[]} |
79 | | - connectedRepos={[]} |
80 | | - unconnectedRepos={[]} |
81 | | - /> |
82 | | - </SeerOverview> |
| 72 | + <SCMOverviewSection |
| 73 | + {...BASE_PROPS} |
| 74 | + isPending |
| 75 | + supportedScmIntegrations={[]} |
| 76 | + seerRepos={[]} |
| 77 | + connectedRepos={[]} |
| 78 | + unconnectedRepos={[]} |
| 79 | + /> |
83 | 80 | )); |
84 | 81 |
|
85 | 82 | story('Error', () => ( |
86 | | - <SeerOverview> |
87 | | - <SCMOverviewSectionView |
88 | | - {...BASE_PROPS} |
89 | | - isError |
90 | | - supportedScmIntegrations={[]} |
91 | | - seerRepos={[]} |
92 | | - connectedRepos={[]} |
93 | | - unconnectedRepos={[]} |
94 | | - /> |
95 | | - </SeerOverview> |
| 83 | + <SCMOverviewSection |
| 84 | + {...BASE_PROPS} |
| 85 | + isError |
| 86 | + supportedScmIntegrations={[]} |
| 87 | + seerRepos={[]} |
| 88 | + connectedRepos={[]} |
| 89 | + unconnectedRepos={[]} |
| 90 | + /> |
96 | 91 | )); |
97 | 92 |
|
98 | 93 | story('No supported integrations installed', () => ( |
99 | | - <SeerOverview> |
100 | | - <SCMOverviewSectionView |
101 | | - {...BASE_PROPS} |
102 | | - supportedScmIntegrations={[]} |
103 | | - seerRepos={[]} |
104 | | - connectedRepos={[]} |
105 | | - unconnectedRepos={[]} |
106 | | - /> |
107 | | - </SeerOverview> |
| 94 | + <SCMOverviewSection |
| 95 | + {...BASE_PROPS} |
| 96 | + supportedScmIntegrations={[]} |
| 97 | + seerRepos={[]} |
| 98 | + connectedRepos={[]} |
| 99 | + unconnectedRepos={[]} |
| 100 | + /> |
108 | 101 | )); |
109 | 102 |
|
110 | 103 | story('Integration installed, provider has no accessible repos', () => ( |
111 | | - <SeerOverview> |
112 | | - <SCMOverviewSectionView |
113 | | - {...BASE_PROPS} |
114 | | - seerRepos={[]} |
115 | | - connectedRepos={[]} |
116 | | - unconnectedRepos={[]} |
117 | | - /> |
118 | | - </SeerOverview> |
| 104 | + <SCMOverviewSection |
| 105 | + {...BASE_PROPS} |
| 106 | + seerRepos={[]} |
| 107 | + connectedRepos={[]} |
| 108 | + unconnectedRepos={[]} |
| 109 | + /> |
119 | 110 | )); |
120 | 111 |
|
121 | | - story('Integration installed, repos visible but none added to Sentry', () => ( |
122 | | - <SeerOverview> |
123 | | - <SCMOverviewSectionView {...BASE_PROPS} /> |
124 | | - </SeerOverview> |
| 112 | + story('Integration installed, 1 repo visible but none added to Sentry', () => ( |
| 113 | + <SCMOverviewSection {...BASE_PROPS} seerRepos={REPOS.slice(0, 1)} /> |
125 | 114 | )); |
126 | 115 |
|
127 | | - story('Some repos connected', () => ( |
128 | | - <SeerOverview> |
129 | | - <SCMOverviewSectionView |
130 | | - {...BASE_PROPS} |
131 | | - connectedRepos={REPOS.slice(0, 1)} |
132 | | - unconnectedRepos={REPOS.slice(1).map(repo => ({ |
133 | | - repo, |
134 | | - integration: GITHUB_INTEGRATION, |
135 | | - }))} |
136 | | - /> |
137 | | - </SeerOverview> |
| 116 | + story('Integration installed, >1 repos visible but none added to Sentry', () => ( |
| 117 | + <SCMOverviewSection {...BASE_PROPS} /> |
138 | 118 | )); |
139 | 119 |
|
140 | | - story('All repos connected', () => ( |
141 | | - <SeerOverview> |
142 | | - <SCMOverviewSectionView |
143 | | - {...BASE_PROPS} |
144 | | - connectedRepos={REPOS} |
145 | | - unconnectedRepos={[]} |
146 | | - /> |
147 | | - </SeerOverview> |
| 120 | + story('Loading more repos', () => ( |
| 121 | + <SCMOverviewSection |
| 122 | + {...BASE_PROPS} |
| 123 | + isReposPending |
| 124 | + connectedRepos={REPOS.slice(0, 1)} |
| 125 | + unconnectedRepos={REPOS.slice(1).map(repo => ({ |
| 126 | + repo, |
| 127 | + isReposPending: true, |
| 128 | + integration: GITHUB_INTEGRATION, |
| 129 | + }))} |
| 130 | + /> |
| 131 | + )); |
| 132 | + |
| 133 | + story('1 of 1 repo added', () => ( |
| 134 | + <SCMOverviewSection |
| 135 | + {...BASE_PROPS} |
| 136 | + connectedRepos={REPOS.slice(0, 1)} |
| 137 | + unconnectedRepos={[]} |
| 138 | + /> |
| 139 | + )); |
| 140 | + |
| 141 | + story('Some repos added', () => ( |
| 142 | + <SCMOverviewSection |
| 143 | + {...BASE_PROPS} |
| 144 | + connectedRepos={REPOS.slice(0, 1)} |
| 145 | + unconnectedRepos={REPOS.slice(1).map(repo => ({ |
| 146 | + repo, |
| 147 | + integration: GITHUB_INTEGRATION, |
| 148 | + }))} |
| 149 | + /> |
| 150 | + )); |
| 151 | + |
| 152 | + story('All repos added', () => ( |
| 153 | + <SCMOverviewSection {...BASE_PROPS} connectedRepos={REPOS} unconnectedRepos={[]} /> |
148 | 154 | )); |
149 | 155 |
|
150 | 156 | story('Read-only (canWrite: false)', () => ( |
151 | | - <SeerOverview> |
152 | | - <SCMOverviewSectionView |
153 | | - {...BASE_PROPS} |
154 | | - canWrite={false} |
155 | | - connectedRepos={REPOS.slice(0, 1)} |
156 | | - unconnectedRepos={REPOS.slice(1).map(repo => ({ |
157 | | - repo, |
158 | | - integration: GITHUB_INTEGRATION, |
159 | | - }))} |
160 | | - /> |
161 | | - </SeerOverview> |
| 157 | + <SCMOverviewSection |
| 158 | + {...BASE_PROPS} |
| 159 | + canWrite={false} |
| 160 | + connectedRepos={REPOS.slice(0, 1)} |
| 161 | + unconnectedRepos={REPOS.slice(1).map(repo => ({ |
| 162 | + repo, |
| 163 | + integration: GITHUB_INTEGRATION, |
| 164 | + }))} |
| 165 | + /> |
162 | 166 | )); |
163 | 167 | }); |
0 commit comments