@@ -20,7 +20,7 @@ import { Platform } from './util/platform';
20
20
import * as odo from './odo/config' ;
21
21
import { GlyphChars } from './util/constants' ;
22
22
import { Application } from './odo/application' ;
23
- import { ComponentType , ComponentTypesJson , ComponentKind , ComponentTypeAdapter , Registry , RegistryList } from './odo/componentType' ;
23
+ import { ComponentType , ComponentTypesJson , ComponentTypeAdapter , Registry , RegistryList } from './odo/componentType' ;
24
24
import { Project } from './odo/project' ;
25
25
import { ComponentsJson , NotAvailable } from './odo/component' ;
26
26
import { Url } from './odo/url' ;
@@ -65,7 +65,6 @@ export interface OpenShiftObject extends QuickPickItem {
65
65
contextPath ?: Uri ;
66
66
path ?: string ;
67
67
iconPath ?: Uri ;
68
- kind ?: ComponentKind ;
69
68
}
70
69
71
70
function compareNodes ( a : OpenShiftObject , b : OpenShiftObject ) : number {
@@ -262,14 +261,19 @@ export class OpenShiftLoginRequired extends OpenShiftObjectImpl {
262
261
}
263
262
264
263
export class OpenShiftComponent extends OpenShiftObjectImpl {
264
+
265
265
constructor ( parent : OpenShiftObject ,
266
266
name : string ,
267
267
contextValue : ContextType ,
268
268
contextPath : Uri = undefined ,
269
- compType : string = undefined ,
270
- public readonly kind : ComponentKind ) {
269
+ compType : string = undefined ) {
271
270
super ( parent , name , contextValue , '' , Collapsed , contextPath , compType ) ;
272
271
}
272
+
273
+ isOdoManaged ( ) : boolean {
274
+ return this . compType === NotAvailable ;
275
+ }
276
+
273
277
get iconPath ( ) : Uri {
274
278
return Uri . file ( path . join ( __dirname , '../../images/component' , 'workspace.png' ) ) ;
275
279
}
@@ -568,25 +572,18 @@ export class OdoImpl implements Odo {
568
572
const components = [ ...componentsJson . otherComponents , ...componentsJson . devfileComponents ] ;
569
573
570
574
const deployedComponents = components . map < OpenShiftComponent > ( ( value ) => {
571
- return new OpenShiftComponent ( application , value . metadata . name , value . spec . componentType === NotAvailable ? ContextType . COMPONENT_OTHER : ContextType . COMPONENT_NO_CONTEXT , value . kind ) ;
575
+ const defaultContext = value . spec . type === NotAvailable ? ContextType . COMPONENT_OTHER : ContextType . COMPONENT_NO_CONTEXT ;
576
+ return new OpenShiftComponent ( application , value . metadata . name , defaultContext , undefined , value . spec . type ) ;
572
577
} ) ;
573
578
const targetAppName = application . getName ( ) ;
574
579
const targetPrjName = application . getParent ( ) . getName ( ) ;
575
580
576
581
OdoImpl . data . getSettings ( ) . filter ( ( comp ) => comp . spec . app === targetAppName && comp . metadata . namespace === targetPrjName ) . forEach ( ( comp ) => {
577
- const jsonItem = components . find ( ( item ) => item . name === comp . metadata . name ) ;
582
+ const jsonItem = components . find ( ( item ) => item . metadata . name === comp . metadata . name ) ;
578
583
let item : OpenShiftObject ;
579
584
if ( jsonItem ) {
580
585
item = deployedComponents . find ( ( component ) => component . getName ( ) === comp . metadata . name ) ;
581
586
}
582
- const builderImage = comp . spec . type . includes ( ':' ) ?
583
- {
584
- name : comp . spec . type . split ( ':' ) [ 0 ] ,
585
- tag : comp . spec . type . split ( ':' ) [ 1 ]
586
- } : {
587
- name : comp . spec . type ,
588
- tag : 'latest'
589
- } ;
590
587
if ( item && item . contextValue === ContextType . COMPONENT_NO_CONTEXT ) {
591
588
item . contextPath = Uri . file ( comp . status . context ) ;
592
589
item . contextValue = ContextType . COMPONENT_PUSHED ;
@@ -597,8 +594,7 @@ export class OdoImpl implements Odo {
597
594
comp . metadata . name ,
598
595
item ? item . contextValue : ContextType . COMPONENT ,
599
596
Uri . file ( comp . status . context ) ,
600
- comp . spec . type === 'Not available' ? odo . SourceType . UNKNOWN : odo . SourceType . LOCAL ,
601
- comp . spec . type === 'Not available' ? ComponentKind . OTHER : ComponentKind . DEVFILE
597
+ comp . spec . type
602
598
)
603
599
) ;
604
600
}
@@ -634,7 +630,7 @@ export class OdoImpl implements Odo {
634
630
const devfileItems : ComponentTypeAdapter [ ] = [ ] ;
635
631
636
632
if ( compTypesJson ?. items ) {
637
- compTypesJson . items . map ( ( item ) => devfileItems . push ( new ComponentTypeAdapter ( ComponentKind . DEVFILE , item . Name , undefined , item . Description , undefined , item . Registry . Name ) ) ) ;
633
+ compTypesJson . items . map ( ( item ) => devfileItems . push ( new ComponentTypeAdapter ( item . Name , undefined , item . Description , undefined , item . Registry . Name ) ) ) ;
638
634
}
639
635
640
636
return devfileItems ;
@@ -881,7 +877,7 @@ export class OdoImpl implements Odo {
881
877
if ( ! targetApplication ) {
882
878
await this . insertAndReveal ( application ) ;
883
879
}
884
- await this . insertAndReveal ( new OpenShiftComponent ( application , name , ContextType . COMPONENT , location , 'local' , ComponentKind . DEVFILE ) , notification ) ;
880
+ await this . insertAndReveal ( new OpenShiftComponent ( application , name , ContextType . COMPONENT , location , type ) , notification ) ;
885
881
} else {
886
882
OdoImpl . data . delete ( application ) ;
887
883
OdoImpl . data . delete ( application . getParent ( ) ) ;
@@ -1033,7 +1029,7 @@ export class OdoImpl implements Odo {
1033
1029
comp . contextValue = ContextType . COMPONENT_PUSHED ;
1034
1030
this . subject . next ( new OdoEventImpl ( 'changed' , comp ) ) ;
1035
1031
} else if ( ! comp ) {
1036
- const newComponent = new OpenShiftComponent ( app , added . metadata . name , ContextType . COMPONENT , Uri . file ( added . status . context ) , added . spec . sourceType , added . spec . sourceType ? ComponentKind . S2I : ComponentKind . DEVFILE ) ;
1032
+ const newComponent = new OpenShiftComponent ( app , added . metadata . name , ContextType . COMPONENT , Uri . file ( added . status . context ) , added . spec . type ) ;
1037
1033
this . insertAndRefresh ( newComponent ) ;
1038
1034
}
1039
1035
} else if ( ! app ) {
0 commit comments