File tree Expand file tree Collapse file tree 7 files changed +354
-39
lines changed Expand file tree Collapse file tree 7 files changed +354
-39
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const Account = React.lazy(() => import(/* webpackPrefetch: true */ './settings/
14
14
const Notifications = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ './settings/Notifications' ) ) ;
15
15
const Plans = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ './settings/Plans' ) ) ;
16
16
const EnvironmentVariables = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ './settings/EnvironmentVariables' ) ) ;
17
- const GitIntegrations = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ './settings/GitIntegrations ' ) ) ;
17
+ const Integrations = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ './settings/Integrations ' ) ) ;
18
18
const Preferences = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ './settings/Preferences' ) ) ;
19
19
20
20
function Loading ( ) {
@@ -70,10 +70,10 @@ function App() {
70
70
< Route path = { [ "/" , "/workspaces" ] } exact render = {
71
71
( ) => < Workspaces /> } />
72
72
< Route path = "/account" exact component = { Account } />
73
+ < Route path = { [ "/integrations" , "/access-control" ] } exact component = { Integrations } />
73
74
< Route path = "/notifications" exact component = { Notifications } />
74
75
< Route path = "/plans" exact component = { Plans } />
75
76
< Route path = "/variables" exact component = { EnvironmentVariables } />
76
- < Route path = "/integrations" exact component = { GitIntegrations } />
77
77
< Route path = "/preferences" exact component = { Preferences } />
78
78
</ React . Fragment >
79
79
) }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { AuthProviderInfo } from "@gitpod/gitpod-protocol";
2
2
import { useContext , useEffect , useState } from "react" ;
3
3
import { UserContext } from "./user-context" ;
4
4
import { getGitpodService , gitpodHostUrl , reconnectGitpodService } from "./service/service" ;
5
+ import { iconForAuthProvider , simplifyProviderName } from "./provider-utils" ;
5
6
6
7
export function Login ( ) {
7
8
const { setUser } = useContext ( UserContext ) ;
@@ -92,32 +93,6 @@ export function Login() {
92
93
</ div > ) ;
93
94
}
94
95
95
- function iconForAuthProvider ( type : string ) {
96
- switch ( type ) {
97
- case "GitHub" :
98
- return "/images/github.svg"
99
- case "GitLab" :
100
- return "/images/gitlab.svg"
101
- case "BitBucket" :
102
- return "/images/bitbucket.svg"
103
- default :
104
- break ;
105
- }
106
- }
107
-
108
- function simplifyProviderName ( host : string ) {
109
- switch ( host ) {
110
- case "github.com" :
111
- return "GitHub"
112
- case "gitlab.com" :
113
- return "GitLab"
114
- case "bitbucket.org" :
115
- return "BitBucket"
116
- default :
117
- return host ;
118
- }
119
- }
120
-
121
96
function getLoginUrl ( host : string ) {
122
97
const returnTo = gitpodHostUrl . with ( { pathname : 'login-success' } ) . toString ( ) ;
123
98
return gitpodHostUrl . withApi ( {
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ function ContextMenu(props: ContextMenuProps) {
43
43
} )
44
44
45
45
const font = "text-gray-600 hover:text-gray-800"
46
+
47
+ const menuId = String ( Math . random ( ) ) ;
48
+
46
49
return (
47
50
< div className = "relative cursor-pointer" >
48
51
< div onClick = { ( e ) => {
@@ -53,15 +56,15 @@ function ContextMenu(props: ContextMenuProps) {
53
56
</ div >
54
57
{ expanded ?
55
58
< div className = { `mt-2 z-50 ${ props . width || 'w-48' } bg-white absolute right-0 flex flex-col border border-gray-200 rounded-lg truncated` } >
56
- { enhancedEntries . map ( e => {
59
+ { enhancedEntries . map ( ( e , index ) => {
57
60
const clickable = e . href || e . onClick ;
58
61
const entry = < div key = { e . title } className = { `px-4 flex py-3 ${ clickable ?'hover:bg-gray-200' :'' } text-sm leading-1 ${ e . customFontStyle || font } ${ e . separator ? ' border-b border-gray-200' :'' } ` } >
59
62
< div > { e . title } </ div > < div className = "flex-1" > </ div > { e . active ? < div className = "pl-1 font-semibold" > ✓</ div > : null }
60
63
</ div >
61
64
if ( ! clickable ) {
62
65
return entry ;
63
66
}
64
- return < a key = { e . title } href = { e . href } onClick = { e . onClick } >
67
+ return < a key = { `entry- ${ menuId } - ${ index } - ${ e . title } ` } href = { e . href } onClick = { e . onClick } >
65
68
{ entry }
66
69
</ a >
67
70
} ) }
Original file line number Diff line number Diff line change
1
+
2
+ function iconForAuthProvider ( type : string ) {
3
+ switch ( type ) {
4
+ case "GitHub" :
5
+ return "/images/github.svg"
6
+ case "GitLab" :
7
+ return "/images/gitlab.svg"
8
+ case "BitBucket" :
9
+ return "/images/bitbucket.svg"
10
+ default :
11
+ break ;
12
+ }
13
+ }
14
+
15
+ function simplifyProviderName ( host : string ) {
16
+ switch ( host ) {
17
+ case "github.com" :
18
+ return "GitHub"
19
+ case "gitlab.com" :
20
+ return "GitLab"
21
+ case "bitbucket.org" :
22
+ return "BitBucket"
23
+ default :
24
+ return host ;
25
+ }
26
+ }
27
+
28
+ export { iconForAuthProvider , simplifyProviderName }
Original file line number Diff line number Diff line change @@ -41,6 +41,24 @@ const gitpodServiceMock = createServiceMock({
41
41
"isReadonly" : false
42
42
} ]
43
43
} ,
44
+ getOwnAuthProviders : async ( ) => {
45
+ return [ {
46
+ "id" : "foobar123" ,
47
+ "ownerId" : "1234" ,
48
+ "status" : "verified" ,
49
+ "host" : "testing.doptig.com/gitlab" ,
50
+ "type" : "GitLab" ,
51
+ "oauth" : {
52
+ "authorizationUrl" : "https://testing.doptig.com/gitlab/oauth/authorize" ,
53
+ "tokenUrl" : "https://testing.doptig.com/gitlab/oauth/token" ,
54
+ "settingsUrl" : "https://testing.doptig.com/gitlab/profile/applications" ,
55
+ "callBackUrl" : "https://gitpod-staging.com/auth/testing.doptig.com/gitlab/callback" ,
56
+ "clientId" : "clientid-123" ,
57
+ "clientSecret" : "redacted"
58
+ } ,
59
+ "deleted" : false
60
+ } ]
61
+ } ,
44
62
onDidOpenConnection : Event . None ,
45
63
onDidCloseConnection : Event . None ,
46
64
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments