@@ -27,15 +27,15 @@ import * as Helm from './helm/helm';
2727import { HelmRepo } from './helm/helmChartType' ;
2828import { Oc } from './oc/ocWrapper' ;
2929import { Component } from './openshift/component' ;
30- import { getServiceKindStubs } from './openshift/serviceHelpers' ;
30+ import { getServiceKindStubs , getServices } from './openshift/serviceHelpers' ;
3131import { PortForward } from './port-forward' ;
3232import { KubeConfigUtils , getKubeConfigFiles , getNamespaceKind } from './util/kubeUtils' ;
3333import { LoginUtil } from './util/loginUtil' ;
3434import { Platform } from './util/platform' ;
3535import { Progress } from './util/progress' ;
3636import { FileContentChangeNotifier , WatchUtil } from './util/watch' ;
3737import { vsCommand } from './vscommand' ;
38- import { CustomResourceDefinitionStub } from './webview/common/createServiceTypes' ;
38+ import { CustomResourceDefinitionStub , K8sResourceKind } from './webview/common/createServiceTypes' ;
3939import { OpenShiftTerminalManager } from './webview/openshift-terminal/openShiftTerminal' ;
4040import { getOutputFormat , helmfsUri , kubefsUri } from './k8s/vfs/kuberesources.virtualfs' ;
4141
@@ -355,6 +355,16 @@ export class OpenShiftExplorer implements TreeDataProvider<ExplorerItem>, Dispos
355355 // operator framework is not installed on cluster; do nothing
356356 }
357357 void commands . executeCommand ( 'setContext' , 'showCreateService' , serviceKinds . length > 0 ) ;
358+
359+ // The 'Create Route' menu visibility
360+ let services : K8sResourceKind [ ] = [ ] ;
361+ try {
362+ services = await getServices ( ) ;
363+ }
364+ catch ( _ ) {
365+ // operator framework is not installed on cluster; do nothing
366+ }
367+ void commands . executeCommand ( 'setContext' , 'showCreateRoute' , services . length > 0 ) ;
358368 } else if ( 'kind' in element && element . kind === 'helmContexts' ) {
359369 const helmRepos = {
360370 kind : 'helmRepos' ,
@@ -411,6 +421,12 @@ export class OpenShiftExplorer implements TreeDataProvider<ExplorerItem>, Dispos
411421 name : 'pods'
412422 } ,
413423 } as OpenShiftObject ;
424+ const routes = {
425+ kind : 'routes' ,
426+ metadata : {
427+ name : 'routes'
428+ } ,
429+ } as OpenShiftObject ;
414430 const statefulSets = {
415431 kind : 'statefulsets' ,
416432 metadata : {
@@ -456,7 +472,7 @@ export class OpenShiftExplorer implements TreeDataProvider<ExplorerItem>, Dispos
456472 result . push ( pods ,
457473 statefulSets , daemonSets , jobs , cronJobs ) ;
458474 if ( isOpenshiftCluster ) {
459- result . push ( deploymentConfigs , imageStreams , buildConfigs ) ;
475+ result . push ( deploymentConfigs , imageStreams , buildConfigs , routes ) ;
460476 }
461477 } else if ( 'kind' in element ) {
462478 const collectableServices : CustomResourceDefinitionStub [ ] = await this . getServiceKinds ( ) ;
0 commit comments