@@ -8,7 +8,7 @@ import { uiUtils } from '@microsoft/vscode-azext-azureutils';
88import { IActionContext , nonNullProp , TreeItemIconPath } from '@microsoft/vscode-azext-utils' ;
99import { GroupingConfig , GroupNodeConfiguration } from '@microsoft/vscode-azext-utils/hostapi' ;
1010import { ThemeIcon } from 'vscode' ;
11- import { azureExtensions } from '../azureExtensions' ;
11+ import type { IAzExtMetadata } from '../azureExtensions' ;
1212import { ext } from '../extensionVariables' ;
1313import { createResourceClient } from './azureClients' ;
1414import { localize } from './localize' ;
@@ -67,9 +67,9 @@ export function createGroupConfigFromResource(resource: GenericResource, subscri
6767 return groupConfig ;
6868}
6969
70- export function createAzureExtensionsGroupConfig ( subscriptionId : string ) : GroupNodeConfiguration [ ] {
70+ export function createAzureExtensionsGroupConfig ( extensions : IAzExtMetadata [ ] , subscriptionId : string ) : GroupNodeConfiguration [ ] {
7171 const azExtGroupConfigs : GroupNodeConfiguration [ ] = [ ] ;
72- for ( const azExt of azureExtensions ) {
72+ for ( const azExt of extensions ) {
7373 for ( const resourceType of azExt . resourceTypes ) {
7474 const type = typeof resourceType === 'string' ? resourceType : resourceType . name ;
7575 const kind = azExt . name === 'vscode-azurefunctions' ? 'functionapp' : undefined ;
@@ -118,6 +118,7 @@ export async function getArmTagKeys(context: IActionContext): Promise<Set<string
118118// Execute `npm run listIcons` from root of repo to re-generate this list after adding an icon
119119export const supportedIconTypes = [
120120 'microsoft.web/functionapp' ,
121+ 'microsoft.web/logicapp' ,
121122 'microsoft.web/hostingenvironments' ,
122123 'microsoft.web/kubeenvironments' ,
123124 'microsoft.web/serverfarms' ,
@@ -183,14 +184,8 @@ interface SupportedType {
183184}
184185
185186function getName ( type ?: string , kind ?: string ) : string | undefined {
186- type = type ?. toLowerCase ( ) ;
187- if ( isFunctionApp ( type , kind ) ) {
188- type = 'microsoft.web/functionapp' ;
189- }
190- if ( type ) {
191- return supportedTypes [ type as SupportedTypes ] ?. displayName ;
192- }
193- return undefined ;
187+ const rType : string = getResourceType ( type , kind ) . toLowerCase ( ) ;
188+ return supportedTypes [ rType as SupportedTypes ] ?. displayName ;
194189}
195190
196191// intersect with Record<stirng, SupportedType> so we can add info for resources we don't have icons for
@@ -200,6 +195,7 @@ const supportedTypes: SupportedTypeMap = {
200195 'microsoft.web/sites' : { displayName : localize ( 'webApp' , 'App Services' ) } ,
201196 'microsoft.web/staticsites' : { displayName : localize ( 'staticWebApp' , 'Static Web Apps' ) } ,
202197 'microsoft.web/functionapp' : { displayName : localize ( 'functionApp' , 'Function App' ) } ,
198+ 'microsoft.web/logicapp' : { displayName : localize ( 'logicApp' , 'Logic App' ) } ,
203199 'microsoft.compute/virtualmachines' : { displayName : localize ( 'virtualMachines' , 'Virtual machines' ) } ,
204200 'microsoft.storage/storageaccounts' : { displayName : localize ( 'storageAccounts' , 'Storage accounts' ) } ,
205201 'microsoft.network/networksecuritygroups' : { displayName : localize ( 'networkSecurityGroups' , 'Network security groups' ) } ,
@@ -230,19 +226,39 @@ const supportedTypes: SupportedTypeMap = {
230226 'microsoft.app/containerapps' : { displayName : localize ( 'containerApp' , 'Container Apps' ) } ,
231227}
232228
233- export function isFunctionApp ( type ?: string , kind ?: string ) : boolean {
229+ export function isFunctionApp ( resource : GenericResource ) : boolean {
230+ const { type, kind } = resource ;
231+ if ( type ?. toLowerCase ( ) === 'microsoft.web/sites' ) {
232+ if ( kind ?. toLowerCase ( ) . includes ( 'functionapp' ) && ! kind ?. toLowerCase ( ) . includes ( 'workflowapp' ) ) {
233+ return true ;
234+ }
235+ }
236+ return false ;
237+ }
238+
239+ export function isLogicApp ( resource : GenericResource ) : boolean {
240+ const { type, kind } = resource ;
234241 if ( type ?. toLowerCase ( ) === 'microsoft.web/sites' ) {
235- if ( kind ?. toLowerCase ( ) . includes ( 'functionapp' ) ) {
242+ if ( kind ?. toLowerCase ( ) . includes ( 'functionapp' ) && kind ?. toLowerCase ( ) . includes ( 'workflowapp' ) ) {
236243 return true ;
237244 }
238245 }
239246 return false ;
240247}
241248
249+ export function isAppServiceApp ( resource : GenericResource ) : boolean {
250+ return resource . type ?. toLowerCase ( ) === 'microsoft.web/sites'
251+ && ! isFunctionApp ( resource )
252+ && ! isLogicApp ( resource ) ;
253+ }
254+
242255function getRelevantKind ( type ?: string , kind ?: string ) : string | undefined {
243- if ( isFunctionApp ( type , kind ) ) {
256+ if ( isFunctionApp ( { type, kind } ) ) {
244257 return 'functionapp' ;
245258 }
259+ if ( isLogicApp ( { type, kind } ) ) {
260+ return 'logicapp' ;
261+ }
246262 return undefined ;
247263}
248264
0 commit comments