@@ -6,40 +6,42 @@ import './App.css';
66
77class App extends Component {
88 constructor ( props ) {
9- super ( props ) ;
10-
11- console . log ( this . props . frameworkImages ) ;
12-
9+ super ( props ) ;
1310 this . state = { frameworks : this . props . frameworkImages ,
14- disableButton : false } ;
15-
11+ disableAllButton : false } ;
12+ this . loadingGif = "https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/0.16.1/images/loader-large.gif" ;
1613 this . click = this . click . bind ( this ) ;
1714 }
18-
1915
2016 click ( f ) {
21- this . setState ( { framework :this . state . framework , disableButton :true } )
22- fetch ( 'http://vault.acm.illinois.edu:5656/create_container' , {
23- method : 'POST' ,
24- headers : {
25- 'Accept' : 'application/json' ,
26- 'Content-Type' : 'application/json' ,
27- } ,
28- body : JSON . stringify ( f )
29- } ) . then ( ( resp ) => resp . json ( ) ) . then ( function ( res ) {
30- window . location . replace ( res [ 'jupyter_url' ] ) ;
31- } ) ;
32- console . log ( f )
17+ var updatedFramework = this . state . frameworks
18+ var type = typeof updatedFramework ;
19+ console . log ( type ) ;
20+ var index = updatedFramework . indexOf ( f ) ;
21+ updatedFramework [ index ] . loading = true ;
22+ this . setState ( { framework :updatedFramework , disableAllButton :true } )
23+
24+ fetch ( 'http://vault.acm.illinois.edu:5656/create_container' , {
25+ method : 'POST' ,
26+ headers : {
27+ 'Accept' : 'application/json' ,
28+ 'Content-Type' : 'application/json' ,
29+ } ,
30+ body : JSON . stringify ( f )
31+ } ) . then ( ( resp ) => resp . json ( ) ) . then ( function ( res ) {
32+ window . location . replace ( res [ 'jupyter_url' ] ) ;
33+ } ) ;
34+ console . log ( f )
3335 }
3436
3537 render ( ) {
36- console . log ( this . state . disableButton ) ;
37- return (
38+ console . log ( this . state . disableAllButton ) ;
39+ return (
3840 < div className = "GPU-CLUSTER-FRONTEND" >
3941 < Nav />
40- < Frameworks disabled = { this . state . disableButton } frameworks = { this . state . frameworks } handler = { this . click } />
41- < Footer />
42- </ div >
42+ < Frameworks disabled = { this . state . disableButton } frameworks = { this . state . frameworks } handler = { this . click } loadingGif = { this . loadingGif } />
43+ < Footer />
44+ </ div >
4345 ) ;
4446 }
4547}
0 commit comments