@@ -20,7 +20,7 @@ export interface WorkspaceEntry {
2020}
2121
2222class Labeled {
23- constructor ( public label : string ) { }
23+ constructor ( public label : string ) { }
2424}
2525
2626class Project extends Labeled {
@@ -31,20 +31,16 @@ class Application extends Labeled {
3131
3232type Entry = Project | Application | WorkspaceEntry | WorkspaceFolderComponent ;
3333
34- export interface WorkspaceFolderComponent extends vsc . TreeItem {
34+ export interface WorkspaceFolderComponent extends vsc . TreeItem {
3535 project : string ;
3636 application : string ;
3737 contextUri : vsc . Uri ;
3838}
3939
40- function isWorkspaceFolderComponent ( entry ) : entry is WorkspaceFolderComponent {
41- return entry . contextUri ;
42- }
43-
4440async function getComponentsInWorkspace ( ) : Promise < WorkspaceFolderComponent [ ] > {
4541 const execs : Promise < CliExitData > [ ] = [ ] ;
4642 if ( vsc . workspace . workspaceFolders ) {
47- vsc . workspace . workspaceFolders . forEach ( ( folder ) => {
43+ vsc . workspace . workspaceFolders . forEach ( ( folder ) => {
4844 try {
4945 execs . push ( getInstance ( ) . execute ( Command . viewEnv ( ) , folder . uri . fsPath , false ) ) ;
5046 } catch ( ignore ) {
@@ -61,7 +57,7 @@ async function getComponentsInWorkspace(): Promise<WorkspaceFolderComponent[]> {
6157 const pathToS2iConfig = path . join ( result . cwd . toString ( ) , '.odo' , 'config.yaml' ) ;
6258 if ( pathExistsSync ( pathToS2iConfig ) ) {
6359 // reconstruct env view form yaml file data
64- const s2iConf = jsYaml . load ( readFileSync ( pathToS2iConfig , 'utf8' ) ) as any ;
60+ const s2iConf : any = jsYaml . load ( readFileSync ( pathToS2iConfig , 'utf8' ) ) ;
6561 compData = {
6662 spec : {
6763 appName : s2iConf . ComponentSettings . Application ,
@@ -81,7 +77,7 @@ async function getComponentsInWorkspace(): Promise<WorkspaceFolderComponent[]> {
8177 `Project: ${ project } ` ,
8278 `Application: ${ application } ` ,
8379 `Context: ${ contextUri . fsPath } ` ,
84- ] . join ( '\n' ) ;
80+ ] . join ( '\n' ) ;
8581 const description = `${ project } /${ application } ` ;
8682 return {
8783 project,
@@ -120,9 +116,9 @@ export class ComponentsTreeDataProvider extends BaseTreeDataProvider<Entry> {
120116 }
121117
122118 @vsCommand ( 'openshift.component.revealInExplorer' )
123- public static async revealInExplorer ( context : Entry ) : Promise < void > {
124- if ( isWorkspaceFolderComponent ( context ) ) {
125- await vsc . commands . executeCommand ( 'workbench.view.explorer' , ) ;
119+ public static async revealInExplorer ( context : WorkspaceFolderComponent ) : Promise < void > {
120+ if ( context . contextUri ) {
121+ await vsc . commands . executeCommand ( 'workbench.view.explorer' , ) ;
126122 await vsc . commands . executeCommand ( 'revealInExplorer' , context . contextUri ) ;
127123 }
128124 }
@@ -143,10 +139,8 @@ export class ComponentsTreeDataProvider extends BaseTreeDataProvider<Entry> {
143139 return ComponentsTreeDataProvider . dataProviderInstance ;
144140 }
145141
146- getTreeItem ( element : Entry ) : vsc . TreeItem {
147- if ( isWorkspaceFolderComponent ( element ) ) {
148- return element ;
149- }
142+ getTreeItem ( element : WorkspaceFolderComponent ) : vsc . TreeItem {
143+ return element ;
150144 }
151145
152146 getChildren ( element ?: Entry ) : vsc . ProviderResult < Entry [ ] > {
@@ -156,4 +150,4 @@ export class ComponentsTreeDataProvider extends BaseTreeDataProvider<Entry> {
156150 return result ;
157151 } )
158152 }
159- }
153+ }
0 commit comments