@@ -18,6 +18,7 @@ import { ComponentTypesView } from '../../registriesView';
1818import sendTelemetry from '../../telemetry' ;
1919import { ExtensionID } from '../../util/constants' ;
2020import { DevfileConverter } from '../../util/devfileConverter' ;
21+ import { DevfileV1 } from '../../util/devfileV1Type' ;
2122import { getInitialWorkspaceFolder , selectWorkspaceFolder } from '../../util/workspace' ;
2223import {
2324 getDevfileCapabilities ,
@@ -29,7 +30,6 @@ import {
2930} from '../common-ext/createComponentHelpers' ;
3031import { loadWebviewHtml , validateGitURL } from '../common-ext/utils' ;
3132import { Devfile , DevfileRegistry , TemplateProjectIdentifier } from '../common/devfile' ;
32- import { DevfileV1 } from '../../util/devfileV1Type' ;
3333
3434interface CloneProcess {
3535 status : boolean ;
@@ -86,7 +86,7 @@ export default class CreateComponentLoader {
8686 } ) ;
8787
8888 const tagsSubscription = ComponentTypesView . instance . subject . subscribe ( ( ) => {
89- sendUpdatedTags ( ) ;
89+ void sendUpdatedTags ( ) ;
9090 } ) ;
9191
9292 panel . onDidDispose ( ( ) => {
@@ -158,7 +158,7 @@ export default class CreateComponentLoader {
158158 case 'getDevfileTags' : {
159159 void CreateComponentLoader . panel . webview . postMessage ( {
160160 action : 'devfileTags' ,
161- data : getDevfileTags ( ) ,
161+ data : await getDevfileTags ( ) ,
162162 } ) ;
163163 break ;
164164 }
@@ -360,7 +360,7 @@ export default class CreateComponentLoader {
360360 await fs . mkdir ( componentFolder , { recursive : true } ) ;
361361 await fse . copy ( tmpFolder . fsPath , componentFolder ) ;
362362 }
363- const devfileType = getDevfileType ( message . data . devfileDisplayName ) ;
363+ const devfileType = await getDevfileType ( message . data . devfileDisplayName ) ;
364364 const componentFolderUri = Uri . file ( componentFolder ) ;
365365 if ( ! await isDevfileExists ( componentFolderUri ) ) {
366366 await Odo . Instance . createComponentFromLocation (
@@ -521,7 +521,7 @@ export default class CreateComponentLoader {
521521 action : 'getRecommendedDevfileStart'
522522 } ) ;
523523 analyzeRes = await Odo . Instance . analyze ( uri . fsPath ) ;
524- compDescriptions = getCompDescription ( analyzeRes ) ;
524+ compDescriptions = await getCompDescription ( analyzeRes ) ;
525525 } catch ( error ) {
526526 if ( error . message . toLowerCase ( ) . indexOf ( 'failed to parse the devfile' ) !== - 1 ) {
527527 const actions : Array < string > = [ 'Yes' , 'Cancel' ] ;
@@ -536,7 +536,7 @@ export default class CreateComponentLoader {
536536 const devfileV1 = JSYAML . load ( file . toString ( ) ) as DevfileV1 ;
537537 await fs . unlink ( devFileV1Path ) ;
538538 analyzeRes = await Odo . Instance . analyze ( uri . fsPath ) ;
539- compDescriptions = getCompDescription ( analyzeRes ) ;
539+ compDescriptions = await getCompDescription ( analyzeRes ) ;
540540 const endPoints = getEndPoints ( compDescriptions [ 0 ] ) ;
541541 const devfileV2 = DevfileConverter . getInstance ( ) . devfileV1toDevfileV2 (
542542 devfileV1 ,
@@ -562,7 +562,7 @@ export default class CreateComponentLoader {
562562 void CreateComponentLoader . panel . webview . postMessage ( {
563563 action : 'getRecommendedDevfile'
564564 } ) ;
565- const devfileRegistry : DevfileRegistry [ ] = getDevfileRegistries ( ) ;
565+ const devfileRegistry : DevfileRegistry [ ] = await getDevfileRegistries ( ) ;
566566 const allDevfiles : Devfile [ ] = devfileRegistry . flatMap ( ( registry ) => registry . devfiles ) ;
567567 const devfile : Devfile | undefined =
568568 compDescriptions . length !== 0
@@ -583,8 +583,8 @@ export default class CreateComponentLoader {
583583 }
584584}
585585
586- function getCompDescription ( devfiles : AnalyzeResponse [ ] ) : ComponentTypeDescription [ ] {
587- const compDescriptions = ComponentTypesView . instance . getCompDescriptions ( ) ;
586+ async function getCompDescription ( devfiles : AnalyzeResponse [ ] ) : Promise < ComponentTypeDescription [ ] > {
587+ const compDescriptions = await ComponentTypesView . instance . getCompDescriptions ( ) ;
588588 if ( devfiles . length === 0 ) {
589589 return Array . from ( compDescriptions ) ;
590590 }
@@ -598,9 +598,9 @@ function getCompDescription(devfiles: AnalyzeResponse[]): ComponentTypeDescripti
598598 ) ;
599599}
600600
601- function getDevfileType ( devfileDisplayName : string ) : string {
601+ async function getDevfileType ( devfileDisplayName : string ) : Promise < string > {
602602 const compDescriptions : Set < ComponentTypeDescription > =
603- ComponentTypesView . instance . getCompDescriptions ( ) ;
603+ await ComponentTypesView . instance . getCompDescriptions ( ) ;
604604 const devfileDescription : ComponentTypeDescription = Array . from ( compDescriptions ) . find (
605605 ( description ) => description . displayName === devfileDisplayName ,
606606 ) ;
@@ -679,11 +679,11 @@ function sendUpdatedCapabilities() {
679679 }
680680}
681681
682- function sendUpdatedTags ( ) {
682+ async function sendUpdatedTags ( ) {
683683 if ( CreateComponentLoader . panel ) {
684684 void CreateComponentLoader . panel . webview . postMessage ( {
685685 action : 'devfileTags' ,
686- data : getDevfileTags ( ) ,
686+ data : await getDevfileTags ( ) ,
687687 } ) ;
688688 }
689689}
0 commit comments