@@ -536,10 +536,9 @@ export class Component extends OpenShiftItem {
536536 }
537537
538538 @vsCommand ( 'openshift.componentType.newComponent' )
539- public static async createComponentFromCatalogEntry ( context : DevfileComponentType | StarterProject , appName ?: string , registryName ?: string ) : Promise < string > {
539+ public static async createComponentFromCatalogEntry ( context : DevfileComponentType | StarterProject , registryName ?: string ) : Promise < string > {
540540 const application = await Component . getOpenShiftCmdData ( undefined ,
541- 'Select an Application where you want to create a Component' , undefined , undefined ,
542- appName
541+ 'Select an Application where you want to create a Component' , undefined , undefined
543542 ) ;
544543
545544 if ( ! application ) return null ;
@@ -605,7 +604,7 @@ export class Component extends OpenShiftItem {
605604
606605 @vsCommand ( 'openshift.component.createFromRootWorkspaceFolder' )
607606 static async createFromRootWorkspaceFolder ( folder : Uri , selection : Uri [ ] , context : OpenShiftApplication , componentTypeName ?: string , starterProjectName ?: string , registryName ?: string , notification = true ) : Promise < string | null > {
608- const application = await Component . getOpenShiftCmdData ( context ,
607+ let application = await Component . getOpenShiftCmdData ( context ,
609608 'Select an Application where you want to create a Component'
610609 ) ;
611610
@@ -622,19 +621,8 @@ export class Component extends OpenShiftItem {
622621 if ( devfileYaml && devfileYaml . metadata && devfileYaml . metadata . name ) {
623622 initialNameValue = devfileYaml . metadata . name ;
624623 }
625- } else {
626- initialNameValue = starterProjectName || path . basename ( folder . fsPath ) ;
627624 }
628625
629- const componentName = await Component . getName (
630- 'Name' ,
631- application . getParent ( ) . getParent ( ) ? Component . odo . getComponents ( application ) : Promise . resolve ( [ ] ) ,
632- application . getName ( ) ,
633- initialNameValue
634- ) ;
635-
636- if ( ! componentName ) return createCancelledResult ( 'componentName' ) ;
637-
638626 const progressIndicator = window . createQuickPick ( ) ;
639627
640628 let createStarter : string ;
@@ -699,9 +687,19 @@ export class Component extends OpenShiftItem {
699687 }
700688 }
701689 }
690+ application = application . getName ( ) === 'app' ?
691+ new OpenShiftApplication ( application . getParent ( ) , `app-${ createStarter } ` ) : application ;
702692 }
703693 }
704694
695+ const componentName = await Component . getName (
696+ 'Name' ,
697+ application . getParent ( ) . getParent ( ) ? Component . odo . getComponents ( application ) : Promise . resolve ( [ ] ) ,
698+ application . getName ( ) ,
699+ initialNameValue ?. trim ( ) . length > 0 ? initialNameValue : createStarter
700+ ) ;
701+
702+ if ( ! componentName ) return createCancelledResult ( 'componentName' ) ;
705703 const refreshComponentsView = workspace . getWorkspaceFolder ( folder ) ;
706704 const creatComponentProperties : NewComponentCommandProps = {
707705 'component_kind' : 'devfile' ,
0 commit comments