File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -174,7 +174,13 @@ export class OpenShiftCluster extends OpenShiftObjectImpl {
174174 }
175175
176176 async getChildren ( ) : Promise < OpenShiftObject [ ] > {
177- const activeProject = ( await this . odo . getProjects ( ) ) . find ( ( prj :OpenShiftProject ) => prj . active )
177+ const prjs = await this . odo . getProjects ( ) ;
178+ let activeProject = prjs . find ( ( prj :OpenShiftProject ) => prj . active ) ;
179+ if ( prjs . length > 0 && ! activeProject ) {
180+ // no active project after login
181+ await OdoImpl . Instance . execute ( Command . setActiveProject ( prjs [ 0 ] . getName ( ) ) ) ;
182+ activeProject = prjs [ 0 ] ;
183+ }
178184 return activeProject ? [ activeProject ] : [ ] ;
179185 }
180186
Original file line number Diff line number Diff line change @@ -117,6 +117,10 @@ export class Command {
117117 ) ;
118118 }
119119
120+ static setActiveProject ( name : string ) : CommandText {
121+ return new CommandText ( 'odo project set' , name ) ;
122+ }
123+
120124 static deleteProject ( name : string ) : CommandText {
121125 return new CommandText (
122126 'odo project delete' ,
You can’t perform that action at this time.
0 commit comments