4
4
* See License.AGPL.txt in the project root for license information.
5
5
*/
6
6
7
- import { AuthProviderInfo } from "@gitpod/gitpod-protocol" ;
8
7
import * as GitpodCookie from "@gitpod/gitpod-protocol/lib/util/gitpod-cookie" ;
9
8
import { useContext , useEffect , useState , useMemo , useCallback , FC } from "react" ;
10
9
import { UserContext } from "./user-context" ;
@@ -18,9 +17,10 @@ import { getURLHash } from "./utils";
18
17
import ErrorMessage from "./components/ErrorMessage" ;
19
18
import { Heading1 , Heading2 , Subheading } from "./components/typography/headings" ;
20
19
import { SSOLoginForm } from "./login/SSOLoginForm" ;
21
- import { useAuthProviders } from "./data/auth-providers/auth-provider-query" ;
20
+ import { useAuthProviderDescriptions } from "./data/auth-providers/auth-provider-query" ;
22
21
import { SetupPending } from "./login/SetupPending" ;
23
22
import { useNeedsSetup } from "./dedicated-setup/use-needs-setup" ;
23
+ import { AuthProviderDescription } from "@gitpod/public-api/lib/gitpod/v1/authprovider_pb" ;
24
24
25
25
export function markLoggedIn ( ) {
26
26
document . cookie = GitpodCookie . generateCookie ( window . location . hostname ) ;
@@ -38,7 +38,7 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
38
38
39
39
const urlHash = useMemo ( ( ) => getURLHash ( ) , [ ] ) ;
40
40
41
- const authProviders = useAuthProviders ( ) ;
41
+ const authProviderDescriptions = useAuthProviderDescriptions ( ) ;
42
42
const [ errorMessage , setErrorMessage ] = useState < string | undefined > ( undefined ) ;
43
43
const [ hostFromContext , setHostFromContext ] = useState < string | undefined > ( ) ;
44
44
const [ repoPathname , setRepoPathname ] = useState < string | undefined > ( ) ;
@@ -58,9 +58,9 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
58
58
}
59
59
} , [ urlHash ] ) ;
60
60
61
- let providerFromContext : AuthProviderInfo | undefined ;
62
- if ( hostFromContext && authProviders . data ) {
63
- providerFromContext = authProviders . data . find ( ( provider ) => provider . host === hostFromContext ) ;
61
+ let providerFromContext : AuthProviderDescription | undefined ;
62
+ if ( hostFromContext && authProviderDescriptions . data ) {
63
+ providerFromContext = authProviderDescriptions . data . find ( ( provider ) => provider . host === hostFromContext ) ;
64
64
}
65
65
66
66
const updateUser = useCallback ( async ( ) => {
@@ -158,19 +158,19 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
158
158
className = "btn-login flex-none w-56 h-10 p-0 inline-flex rounded-xl"
159
159
onClick = { ( ) => openLogin ( providerFromContext ! . host ) }
160
160
>
161
- { iconForAuthProvider ( providerFromContext . authProviderType ) }
161
+ { iconForAuthProvider ( providerFromContext . type ) }
162
162
< span className = "pt-2 pb-2 mr-3 text-sm my-auto font-medium truncate overflow-ellipsis" >
163
163
Continue with { simplifyProviderName ( providerFromContext . host ) }
164
164
</ span >
165
165
</ button >
166
166
) : (
167
- authProviders . data ?. map ( ( ap ) => (
167
+ authProviderDescriptions . data ?. map ( ( ap ) => (
168
168
< button
169
169
key = { "button" + ap . host }
170
170
className = "btn-login flex-none w-56 h-10 p-0 inline-flex rounded-xl"
171
171
onClick = { ( ) => openLogin ( ap . host ) }
172
172
>
173
- { iconForAuthProvider ( ap . authProviderType ) }
173
+ { iconForAuthProvider ( ap . type ) }
174
174
< span className = "pt-2 pb-2 mr-3 text-sm my-auto font-medium truncate overflow-ellipsis" >
175
175
Continue with { simplifyProviderName ( ap . host ) }
176
176
</ span >
@@ -179,7 +179,10 @@ export const Login: FC<LoginProps> = ({ onLoggedIn }) => {
179
179
) }
180
180
< SSOLoginForm
181
181
onSuccess = { authorizeSuccessful }
182
- singleOrgMode = { ! ! authProviders . data && authProviders . data . length === 0 }
182
+ singleOrgMode = {
183
+ ! ! authProviderDescriptions . data &&
184
+ authProviderDescriptions . data . length === 0
185
+ }
183
186
/>
184
187
</ div >
185
188
{ errorMessage && < ErrorMessage imgSrc = { exclamation } message = { errorMessage } /> }
0 commit comments