@@ -457,8 +457,9 @@ async function serverNamespaces(element: ServerTreeItem, params?: any): Promise<
457
457
children . push ( new OfflineTreeItem ( { parent : element , label : name , id : name } , serverSpec . username || 'UnknownUser' ) ) ;
458
458
credentialCache [ params . serverName ] = undefined ;
459
459
} else {
460
+ const serverApiVersion = response . data . result . content . api ;
460
461
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 ) ) ;
462
463
} ) ;
463
464
}
464
465
}
@@ -473,6 +474,7 @@ export class NamespaceTreeItem extends SMTreeItem {
473
474
element : ISMItem ,
474
475
name : string ,
475
476
serverName : string ,
477
+ serverApiVersion : number
476
478
) {
477
479
const parentFolderId = element . parent ?. id || "" ;
478
480
const id = parentFolderId + ":" + name ;
@@ -482,10 +484,10 @@ export class NamespaceTreeItem extends SMTreeItem {
482
484
parent : element . parent ,
483
485
tooltip : `${ name } on ${ serverName } ` ,
484
486
getChildren : namespaceFeatures ,
485
- params : { serverName }
487
+ params : { serverName, serverApiVersion }
486
488
} ) ;
487
489
this . name = name ;
488
- this . contextValue = name === "%SYS" ? "sysnamespace" : "namespace" ;
490
+ this . contextValue = ` ${ serverApiVersion . toString ( ) } / ${ name === "%SYS" ? "sysnamespace" : "namespace" } ` ;
489
491
this . iconPath = new vscode . ThemeIcon ( "archive" ) ;
490
492
}
491
493
}
@@ -499,16 +501,17 @@ export class NamespaceTreeItem extends SMTreeItem {
499
501
*/
500
502
async function namespaceFeatures ( element : NamespaceTreeItem , params ?: any ) : Promise < FeatureTreeItem [ ] | undefined > {
501
503
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 )
504
506
] ;
505
507
}
506
508
507
509
export class ProjectsTreeItem extends FeatureTreeItem {
508
510
public readonly name : string ;
509
511
constructor (
510
512
element : ISMItem ,
511
- serverName : string
513
+ serverName : string ,
514
+ serverApiVersion : number
512
515
) {
513
516
const parentFolderId = element . parent ?. id || '' ;
514
517
super ( {
@@ -517,10 +520,10 @@ export class ProjectsTreeItem extends FeatureTreeItem {
517
520
id : parentFolderId + ':projects' ,
518
521
tooltip : `Projects in this namespace` ,
519
522
getChildren : namespaceProjects ,
520
- params : { serverName, ns : element . label }
523
+ params : { serverName, serverApiVersion , ns : element . label }
521
524
} ) ;
522
525
this . name = 'Projects' ;
523
- this . contextValue = ' projects';
526
+ this . contextValue = serverApiVersion . toString ( ) + '/ projects';
524
527
this . iconPath = new vscode . ThemeIcon ( 'library' ) ;
525
528
}
526
529
}
@@ -560,7 +563,7 @@ async function namespaceProjects(element: ProjectsTreeItem, params?: any): Promi
560
563
return undefined ;
561
564
}
562
565
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 ) ) ;
564
567
} ) ;
565
568
}
566
569
}
@@ -573,7 +576,8 @@ export class ProjectTreeItem extends SMTreeItem {
573
576
constructor (
574
577
element : ISMItem ,
575
578
name : string ,
576
- description : string
579
+ description : string ,
580
+ serverApiVersion : number
577
581
) {
578
582
const parentFolderId = element . parent ?. id || '' ;
579
583
const id = parentFolderId + ':' + name ;
@@ -584,7 +588,7 @@ export class ProjectTreeItem extends SMTreeItem {
584
588
tooltip : description
585
589
} ) ;
586
590
this . name = name ;
587
- this . contextValue = ' project';
591
+ this . contextValue = serverApiVersion . toString ( ) + '/ project';
588
592
this . iconPath = new vscode . ThemeIcon ( 'files' ) ;
589
593
}
590
594
}
@@ -593,7 +597,8 @@ export class WebAppsTreeItem extends FeatureTreeItem {
593
597
public readonly name : string ;
594
598
constructor (
595
599
element : ISMItem ,
596
- serverName : string
600
+ serverName : string ,
601
+ serverApiVersion : number
597
602
) {
598
603
const parentFolderId = element . parent ?. id || '' ;
599
604
super ( {
@@ -602,10 +607,10 @@ export class WebAppsTreeItem extends FeatureTreeItem {
602
607
id : parentFolderId + ':webapps' ,
603
608
tooltip : `Web Applications in this namespace` ,
604
609
getChildren : namespaceWebApps ,
605
- params : { serverName, ns : element . label }
610
+ params : { serverName, serverApiVersion , ns : element . label }
606
611
} ) ;
607
612
this . name = 'Web Applications' ;
608
- this . contextValue = ' webapps';
613
+ this . contextValue = serverApiVersion . toString ( ) + '/ webapps';
609
614
this . iconPath = new vscode . ThemeIcon ( 'library' ) ;
610
615
}
611
616
}
@@ -638,7 +643,7 @@ async function namespaceWebApps(element: ProjectsTreeItem, params?: any): Promis
638
643
return undefined ;
639
644
}
640
645
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 ) ) ;
642
647
} ) ;
643
648
}
644
649
}
@@ -648,7 +653,7 @@ async function namespaceWebApps(element: ProjectsTreeItem, params?: any): Promis
648
653
649
654
export class WebAppTreeItem extends SMTreeItem {
650
655
public readonly name : string ;
651
- constructor ( element : ISMItem , name : string ) {
656
+ constructor ( element : ISMItem , name : string , serverApiVersion : number ) {
652
657
const parentFolderId = element . parent ?. id || '' ;
653
658
const id = parentFolderId + ':' + name ;
654
659
super ( {
@@ -657,7 +662,7 @@ export class WebAppTreeItem extends SMTreeItem {
657
662
id
658
663
} ) ;
659
664
this . name = name ;
660
- this . contextValue = ' webapp';
665
+ this . contextValue = serverApiVersion . toString ( ) + '/ webapp';
661
666
this . iconPath = new vscode . ThemeIcon ( 'file-code' ) ;
662
667
}
663
668
}
0 commit comments