55
66import { OpenInPortalOptions } from '@microsoft/vscode-azext-azureutils' ;
77import { AzExtResourceType , createContextValue , ISubscriptionContext , TreeItemIconPath } from '@microsoft/vscode-azext-utils' ;
8- import { AzureResource , AzureResourceBranchDataProvider , AzureResourceModel , AzureSubscription } from '@microsoft/vscode-azext-utils/hostapi.v2' ;
8+ import { AzureResource , AzureResourceBranchDataProvider , AzureResourceModel , AzureSubscription , ViewPropertiesModel } from '@microsoft/vscode-azext-utils/hostapi.v2' ;
99import * as vscode from 'vscode' ;
10+ import { ITagsModel , ResourceTags } from '../../../commands/tags/TagFileSystem' ;
1011import { getIconPath } from '../../../utils/azureUtils' ;
1112import { BranchDataItemOptions } from '../BranchDataProviderItem' ;
1213import { ResourceGroupsItem } from '../ResourceGroupsItem' ;
@@ -25,6 +26,9 @@ function createPortalUrl(subscription: AzureSubscription, id: string, options?:
2526export class GroupingItem implements ResourceGroupsItem {
2627 private description : string | undefined ;
2728
29+ readonly viewProperties ?: ViewPropertiesModel ;
30+ readonly tagsModel ?: ITagsModel ;
31+
2832 constructor (
2933 public readonly context : ResourceGroupsTreeContext ,
3034 private readonly resourceItemFactory : ResourceItemFactory < AzureResource > ,
@@ -34,8 +38,17 @@ export class GroupingItem implements ResourceGroupsItem {
3438 public readonly label : string ,
3539 public readonly resources : AzureResource [ ] ,
3640 public readonly resourceType : AzExtResourceType | undefined ,
37- public readonly parent ?: ResourceGroupsItem
38- ) { }
41+ public readonly parent ?: ResourceGroupsItem ,
42+ resourceGroup ?: AzureResource ,
43+ ) {
44+ if ( resourceGroup ) {
45+ this . tagsModel = new ResourceTags ( resourceGroup ) ;
46+ this . viewProperties = {
47+ label : resourceGroup . name ,
48+ data : resourceGroup . raw
49+ } ;
50+ }
51+ }
3952
4053 // Needed for context menu commands on the group tree items. E.g. "Create..."
4154 public get subscription ( ) : ISubscriptionContext {
@@ -98,8 +111,8 @@ export class GroupingItem implements ResourceGroupsItem {
98111 }
99112}
100113
101- export type GroupingItemFactory = ( context : ResourceGroupsTreeContext , contextValues : string [ ] | undefined , iconPath : TreeItemIconPath | undefined , label : string , resources : AzureResource [ ] , resourceType : AzExtResourceType | undefined , parent : ResourceGroupsItem ) => GroupingItem ;
114+ export type GroupingItemFactory = ( context : ResourceGroupsTreeContext , contextValues : string [ ] | undefined , iconPath : TreeItemIconPath | undefined , label : string , resources : AzureResource [ ] , resourceType : AzExtResourceType | undefined , parent : ResourceGroupsItem , resourceGroup ?: AzureResource ) => GroupingItem ;
102115
103116export function createGroupingItemFactory ( resourceItemFactory : ResourceItemFactory < AzureResource > , branchDataProviderFactory : BranchDataProviderFactory ) : GroupingItemFactory {
104- return ( context , contextValues , iconPath , label , resources , resourceType , parent ) => new GroupingItem ( context , resourceItemFactory , branchDataProviderFactory , contextValues , iconPath , label , resources , resourceType , parent ) ;
117+ return ( context , contextValues , iconPath , label , resources , resourceType , parent , resourceGroup ) => new GroupingItem ( context , resourceItemFactory , branchDataProviderFactory , contextValues , iconPath , label , resources , resourceType , parent , resourceGroup ) ;
105118}
0 commit comments