@@ -11,6 +11,7 @@ import open = require("open");
1111import { TokenStore } from "../util/credentialManager" ;
1212import { KubeConfigUtils } from '../util/kubeUtils' ;
1313import { Filters } from "../util/filters" ;
14+ import { Progress } from "../util/progress" ;
1415
1516class CreateUrlItem implements QuickPickItem {
1617 get label ( ) : string { return `$(plus) Provide new URL...` ; }
@@ -173,11 +174,12 @@ export class Cluster extends OpenShiftItem {
173174
174175 if ( ! passwd ) return null ;
175176
176- return Promise . resolve ( )
177- . then ( ( ) => Cluster . odo . execute ( Command . odoLoginWithUsernamePassword ( clusterURL , username , passwd ) ) )
177+ return Progress . execFunctionWithProgress ( `Login to the cluster: ${ clusterURL } ` ,
178+ ( ) => Cluster . odo . execute ( Command . odoLoginWithUsernamePassword ( clusterURL , username , passwd ) )
178179 . then ( ( result ) => Cluster . save ( username , passwd , password , result ) )
179180 . then ( ( result ) => Cluster . loginMessage ( clusterURL , result ) )
180- . catch ( ( error ) => Promise . reject ( new Error ( `Failed to login to cluster '${ clusterURL } ' with '${ Filters . filterPassword ( error . message ) } '!` ) ) ) ;
181+ . catch ( ( error ) => Promise . reject ( new Error ( `Failed to login to cluster '${ clusterURL } ' with '${ Filters . filterPassword ( error . message ) } '!` ) ) )
182+ ) ;
181183 }
182184
183185 static async readFromClipboard ( ) : Promise < string > {
@@ -207,10 +209,11 @@ export class Cluster extends OpenShiftItem {
207209 password : true
208210 } ) ;
209211 if ( ! ocToken ) return null ;
210- return Promise . resolve ( )
211- . then ( ( ) => Cluster . odo . execute ( Command . odoLoginWithToken ( clusterURL , ocToken ) ) )
212+ return Progress . execFunctionWithProgress ( `Login to the cluster: ${ clusterURL } ` ,
213+ ( ) => Cluster . odo . execute ( Command . odoLoginWithToken ( clusterURL , ocToken ) )
212214 . then ( ( result ) => Cluster . loginMessage ( clusterURL , result ) )
213- . catch ( ( error ) => Promise . reject ( new Error ( `Failed to login to cluster '${ clusterURL } ' with '${ Filters . filterToken ( error . message ) } '!` ) ) ) ;
215+ . catch ( ( error ) => Promise . reject ( new Error ( `Failed to login to cluster '${ clusterURL } ' with '${ Filters . filterToken ( error . message ) } '!` ) ) )
216+ ) ;
214217 }
215218
216219 private static async loginMessage ( clusterURL : string , result : CliExitData ) : Promise < string > {
0 commit comments