File tree Expand file tree Collapse file tree 4 files changed +22
-4
lines changed
Expand file tree Collapse file tree 4 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -76,5 +76,7 @@ async def get_cached():
7676 # As such, we treat them being missing as a signal that there is
7777 # a problem with how the user is logged in to gcloud.
7878 credentials ["login_error" ] = 1
79+ elif not credentials ["project_id" ] or not credentials ["region_id" ]:
80+ credentials ["config_error" ] = 1
7981
8082 return credentials
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ const NotebookSchedulerComponent = ({
7272 const abortControllerRef = useRef < any > ( null ) ;
7373 const [ apiEnableUrl , setApiEnableUrl ] = useState < any > ( null ) ;
7474 const [ loginError , setLoginError ] = useState < boolean > ( false ) ;
75+ const [ configError , setConfigError ] = useState < boolean > ( false ) ;
7576 const [ isLoading , setIsLoading ] = useState < boolean > ( true ) ;
7677 const [ listingScreenFlag , setListingScreenFlag ] = useState < boolean > ( false ) ;
7778 const [ jobNameUniquenessError , setJobNameUniquenessError ] =
@@ -100,7 +101,7 @@ const NotebookSchedulerComponent = ({
100101
101102 useEffect ( ( ) => {
102103 getKernelDetails ( ) ;
103- checkConfig ( setLoginError , setIsLoading ) ;
104+ checkConfig ( setLoginError , setIsLoading , setConfigError ) ;
104105 } , [ ] ) ;
105106
106107 const handleJobNameChange = ( event : React . ChangeEvent < HTMLInputElement > ) => {
@@ -167,11 +168,12 @@ const NotebookSchedulerComponent = ({
167168 />
168169 Loading...
169170 </ div >
170- ) : loginError && ! isLoading ? (
171+ ) : loginError || configError ? (
171172 < div className = "login-error login-error-main" >
172173 < LoginErrorComponent
173174 setLoginError = { setLoginError }
174175 loginError = { loginError }
176+ configError = { configError }
175177 />
176178 </ div >
177179 ) : (
Original file line number Diff line number Diff line change @@ -44,14 +44,18 @@ export const authApi = async (
4444
4545export const checkConfig = async (
4646 setLoginError : React . Dispatch < React . SetStateAction < boolean > > ,
47- setIsLoading : React . Dispatch < React . SetStateAction < boolean > >
47+ setIsLoading : React . Dispatch < React . SetStateAction < boolean > > ,
48+ setConfigError : React . Dispatch < React . SetStateAction < boolean > >
4849) : Promise < void > => {
4950 const credentials : IAuthCredentials | undefined = await authApi ( ) ;
5051 if ( credentials ) {
5152 if ( credentials . login_error === 1 ) {
5253 setLoginError ( true ) ;
5354 setIsLoading ( false ) ;
5455 }
56+ if ( credentials . config_error === 1 ) {
57+ setConfigError ( true ) ;
58+ }
5559 setIsLoading ( false ) ;
5660 }
5761} ;
@@ -291,6 +295,7 @@ export const login = async (
291295 const loginStatus = ( data as { login : string } ) . login ;
292296 if ( loginStatus === STATUS_SUCCESS ) {
293297 setLoginError ( false ) ;
298+ window . location . reload ( ) ;
294299 } else {
295300 setLoginError ( true ) ;
296301 }
Original file line number Diff line number Diff line change @@ -22,8 +22,17 @@ import { IconsigninGoogle } from './Icons';
2222
2323const LoginErrorComponent : React . FC < ILoginErrorProps > = ( {
2424 loginError = false ,
25- setLoginError
25+ setLoginError,
26+ configError = false
2627} ) => {
28+ if ( configError ) {
29+ return (
30+ < div className = "login-error" >
31+ Please configure gcloud with account, project-id and region
32+ </ div >
33+ ) ;
34+ }
35+
2736 if ( loginError ) {
2837 return (
2938 < >
You can’t perform that action at this time.
0 commit comments