@@ -457,8 +457,9 @@ async function serverNamespaces(element: ServerTreeItem, params?: any): Promise<
457457 children . push ( new OfflineTreeItem ( { parent : element , label : name , id : name } , serverSpec . username || 'UnknownUser' ) ) ;
458458 credentialCache [ params . serverName ] = undefined ;
459459 } else {
460+ const serverApiVersion = response . data . result . content . api ;
460461 response . data . result . content . namespaces . map ( ( namespace ) => {
461- children . push ( new NamespaceTreeItem ( { parent : element , label : name , id : name } , namespace , name ) ) ;
462+ children . push ( new NamespaceTreeItem ( { parent : element , label : name , id : name } , namespace , name , serverApiVersion ) ) ;
462463 } ) ;
463464 }
464465 }
@@ -473,6 +474,7 @@ export class NamespaceTreeItem extends SMTreeItem {
473474 element : ISMItem ,
474475 name : string ,
475476 serverName : string ,
477+ serverApiVersion : number
476478 ) {
477479 const parentFolderId = element . parent ?. id || "" ;
478480 const id = parentFolderId + ":" + name ;
@@ -482,10 +484,10 @@ export class NamespaceTreeItem extends SMTreeItem {
482484 parent : element . parent ,
483485 tooltip : `${ name } on ${ serverName } ` ,
484486 getChildren : namespaceFeatures ,
485- params : { serverName }
487+ params : { serverName, serverApiVersion }
486488 } ) ;
487489 this . name = name ;
488- this . contextValue = name === "%SYS" ? "sysnamespace" : "namespace" ;
490+ this . contextValue = ` ${ serverApiVersion . toString ( ) } / ${ name === "%SYS" ? "sysnamespace" : "namespace" } ` ;
489491 this . iconPath = new vscode . ThemeIcon ( "archive" ) ;
490492 }
491493}
@@ -499,16 +501,17 @@ export class NamespaceTreeItem extends SMTreeItem {
499501 */
500502async function namespaceFeatures ( element : NamespaceTreeItem , params ?: any ) : Promise < FeatureTreeItem [ ] | undefined > {
501503 return [
502- new ProjectsTreeItem ( { parent : element , id : element . name , label : element . name } , params . serverName ) ,
503- new WebAppsTreeItem ( { parent : element , id : element . name , label : element . name } , params . serverName )
504+ new ProjectsTreeItem ( { parent : element , id : element . name , label : element . name } , params . serverName , params . serverApiVersion ) ,
505+ new WebAppsTreeItem ( { parent : element , id : element . name , label : element . name } , params . serverName , params . serverApiVersion )
504506 ] ;
505507}
506508
507509export class ProjectsTreeItem extends FeatureTreeItem {
508510 public readonly name : string ;
509511 constructor (
510512 element : ISMItem ,
511- serverName : string
513+ serverName : string ,
514+ serverApiVersion : number
512515 ) {
513516 const parentFolderId = element . parent ?. id || '' ;
514517 super ( {
@@ -517,10 +520,10 @@ export class ProjectsTreeItem extends FeatureTreeItem {
517520 id : parentFolderId + ':projects' ,
518521 tooltip : `Projects in this namespace` ,
519522 getChildren : namespaceProjects ,
520- params : { serverName, ns : element . label }
523+ params : { serverName, serverApiVersion , ns : element . label }
521524 } ) ;
522525 this . name = 'Projects' ;
523- this . contextValue = ' projects';
526+ this . contextValue = serverApiVersion . toString ( ) + '/ projects';
524527 this . iconPath = new vscode . ThemeIcon ( 'library' ) ;
525528 }
526529}
@@ -560,7 +563,7 @@ async function namespaceProjects(element: ProjectsTreeItem, params?: any): Promi
560563 return undefined ;
561564 }
562565 response . data . result . content . map ( ( project ) => {
563- children . push ( new ProjectTreeItem ( { parent : element , label : name , id : name } , project . Name , project . Description ) ) ;
566+ children . push ( new ProjectTreeItem ( { parent : element , label : name , id : name } , project . Name , project . Description , params . serverApiVersion ) ) ;
564567 } ) ;
565568 }
566569 }
@@ -573,7 +576,8 @@ export class ProjectTreeItem extends SMTreeItem {
573576 constructor (
574577 element : ISMItem ,
575578 name : string ,
576- description : string
579+ description : string ,
580+ serverApiVersion : number
577581 ) {
578582 const parentFolderId = element . parent ?. id || '' ;
579583 const id = parentFolderId + ':' + name ;
@@ -584,7 +588,7 @@ export class ProjectTreeItem extends SMTreeItem {
584588 tooltip : description
585589 } ) ;
586590 this . name = name ;
587- this . contextValue = ' project';
591+ this . contextValue = serverApiVersion . toString ( ) + '/ project';
588592 this . iconPath = new vscode . ThemeIcon ( 'files' ) ;
589593 }
590594}
@@ -593,7 +597,8 @@ export class WebAppsTreeItem extends FeatureTreeItem {
593597 public readonly name : string ;
594598 constructor (
595599 element : ISMItem ,
596- serverName : string
600+ serverName : string ,
601+ serverApiVersion : number
597602 ) {
598603 const parentFolderId = element . parent ?. id || '' ;
599604 super ( {
@@ -602,10 +607,10 @@ export class WebAppsTreeItem extends FeatureTreeItem {
602607 id : parentFolderId + ':webapps' ,
603608 tooltip : `Web Applications in this namespace` ,
604609 getChildren : namespaceWebApps ,
605- params : { serverName, ns : element . label }
610+ params : { serverName, serverApiVersion , ns : element . label }
606611 } ) ;
607612 this . name = 'Web Applications' ;
608- this . contextValue = ' webapps';
613+ this . contextValue = serverApiVersion . toString ( ) + '/ webapps';
609614 this . iconPath = new vscode . ThemeIcon ( 'library' ) ;
610615 }
611616}
@@ -638,7 +643,7 @@ async function namespaceWebApps(element: ProjectsTreeItem, params?: any): Promis
638643 return undefined ;
639644 }
640645 response . data . result . content . map ( ( webapp : string ) => {
641- children . push ( new WebAppTreeItem ( { parent : element , label : name , id : name } , webapp ) ) ;
646+ children . push ( new WebAppTreeItem ( { parent : element , label : name , id : name } , webapp , params . serverApiVersion ) ) ;
642647 } ) ;
643648 }
644649 }
@@ -648,7 +653,7 @@ async function namespaceWebApps(element: ProjectsTreeItem, params?: any): Promis
648653
649654export class WebAppTreeItem extends SMTreeItem {
650655 public readonly name : string ;
651- constructor ( element : ISMItem , name : string ) {
656+ constructor ( element : ISMItem , name : string , serverApiVersion : number ) {
652657 const parentFolderId = element . parent ?. id || '' ;
653658 const id = parentFolderId + ':' + name ;
654659 super ( {
@@ -657,7 +662,7 @@ export class WebAppTreeItem extends SMTreeItem {
657662 id
658663 } ) ;
659664 this . name = name ;
660- this . contextValue = ' webapp';
665+ this . contextValue = serverApiVersion . toString ( ) + '/ webapp';
661666 this . iconPath = new vscode . ThemeIcon ( 'file-code' ) ;
662667 }
663668}
0 commit comments