From 92a7e20c24a7baf83c57f4e94548330a0b755892 Mon Sep 17 00:00:00 2001 From: Zhijie Huang Date: Tue, 17 Dec 2024 15:19:55 +0800 Subject: [PATCH 1/5] integrate `Azure AI Foundry` vscode extension --- api/src/AzExtResourceType.ts | 2 ++ api/src/getAzExtResourceType.ts | 10 ++++++++++ resources/azureIcons/AiFoundry.svg | 1 + src/azureExtensions.ts | 10 +++++++++- src/utils/azureUtils.ts | 1 + 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 resources/azureIcons/AiFoundry.svg diff --git a/api/src/AzExtResourceType.ts b/api/src/AzExtResourceType.ts index 43a4b171..894f5d63 100644 --- a/api/src/AzExtResourceType.ts +++ b/api/src/AzExtResourceType.ts @@ -24,6 +24,7 @@ export enum AzExtResourceType { ResourceGroup = 'ResourceGroup', // Below are not supported but have icons in the Resources extension + AiFoundry = 'AiFoundry', ApiManagementService = 'ApiManagementService', ApplicationInsights = 'ApplicationInsights', AppServiceKubernetesEnvironment = 'AppServiceKubernetesEnvironment', @@ -48,6 +49,7 @@ export enum AzExtResourceType { LoadBalancers = 'LoadBalancers', LogicApp = 'LogicApp', LogicWorkflows = 'LogicWorkflows', + MachineLearningWorkspace = 'MachineLearningWorkspace', ManagedIdentityUserAssignedIdentities = 'ManagedIdentityUserAssignedIdentities', MysqlServers = 'MysqlServers', NetworkApplicationGateways = 'NetworkApplicationGateways', diff --git a/api/src/getAzExtResourceType.ts b/api/src/getAzExtResourceType.ts index 1b24cbc1..ee3ca338 100644 --- a/api/src/getAzExtResourceType.ts +++ b/api/src/getAzExtResourceType.ts @@ -7,6 +7,7 @@ import { AzExtResourceType } from "./AzExtResourceType"; const FunctionAppKind = 'functionapp'; const LogicAppKind = 'workflowapp'; +const AiFoundryProjectKind = 'project'; /** * Gets a normalized type for an Azure resource, accounting for the fact that some @@ -29,6 +30,14 @@ export function getAzExtResourceType(resource: { type: string; kind?: string; }) return AzExtResourceType.AppServices; } + case 'microsoft.machinelearningservices/workspaces': + // Azure Machine Learning Workspace and Azure Foundry have the same type + if (kind.includes(AiFoundryProjectKind)) { + return AzExtResourceType.AiFoundry; + } else { + return AzExtResourceType.MachineLearningWorkspace; + } + default: return azureTypeToAzExtResourceTypeMap[type]; } @@ -46,6 +55,7 @@ const azureTypeToAzExtResourceTypeMap: RecordIcon-machinelearning-167 \ No newline at end of file diff --git a/src/azureExtensions.ts b/src/azureExtensions.ts index 37d3f3f4..00d385e5 100644 --- a/src/azureExtensions.ts +++ b/src/azureExtensions.ts @@ -138,7 +138,7 @@ export const azureExtensions: IAzExtMetadata[] = [ }, { name: 'vscode-azurelogicapps', - publisher: "ms-azuretools", + publisher: 'ms-azuretools', label: 'Logic Apps', resourceTypes: [ AzExtResourceType.LogicApp, @@ -157,9 +157,17 @@ export const azureExtensions: IAzExtMetadata[] = [ ], reportIssueCommandId: 'azureWebPubSub.reportIssue' }, + { + name: 'vscode-ai-foundry-extension', + publisher: 'microsoft-devdiv', + label: 'AI Foundry', + resourceTypes: [AzExtResourceType.AiFoundry], + reportIssueCommandId: 'azure-ai-extension.reportIssue' + }, ]; export const legacyTypeMap: Partial> = { + AiFoundry: 'microsoft.machinelearningservices/workspaces', FunctionApp: 'microsoft.web/functionapp', AppServices: 'microsoft.web/sites', StaticWebApps: 'microsoft.web/staticsites', diff --git a/src/utils/azureUtils.ts b/src/utils/azureUtils.ts index 99ebc119..ba2ecb71 100644 --- a/src/utils/azureUtils.ts +++ b/src/utils/azureUtils.ts @@ -85,6 +85,7 @@ interface AzExtResourceTypeDisplayInfo { } const azExtDisplayInfo: Partial> = { + AiFoundry: { displayName: localize('aiFoundry', 'AI Foundry') }, ApplicationInsights: { displayName: localize('insightsComponents', 'Application Insights') }, AppServiceKubernetesEnvironment: { displayName: localize('containerService', 'App Service Kubernetes Environment') }, AppServicePlans: { displayName: localize('serverFarms', 'App Service plans') }, From 4339c0d4857873aa74b9c0a6e461b06d64bebf22 Mon Sep 17 00:00:00 2001 From: Zhijie Huang Date: Tue, 17 Dec 2024 15:20:21 +0800 Subject: [PATCH 2/5] add debugging configuration --- .vscode/launch.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index 1366f0de..3da73db1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -19,6 +19,24 @@ "NODE_DEBUG": "" } }, + { + "name": "Launch Extension(azure-ai)", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}", + "--extensionDevelopmentPath=${workspaceFolder}/../azure-ai-extension", + ], + "outFiles": [ + "${workspaceFolder}/out/**/*.js" + ], + "preLaunchTask": "${defaultBuildTask}", + "env": { + "DEBUGTELEMETRY": "v", + "NODE_DEBUG": "" + } + }, { "name": "Launch Extension(s)", "type": "extensionHost", From 21539ea389e895496abf8f3c073a8a81ac7edd79 Mon Sep 17 00:00:00 2001 From: Zhijie Huang Date: Thu, 2 Jan 2025 11:30:17 +0800 Subject: [PATCH 3/5] hide installation button for private extension --- src/AzExtWrapper.ts | 4 ++++ src/azureExtensions.ts | 4 +++- src/tree/azure/DefaultAzureResourceItem.ts | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/AzExtWrapper.ts b/src/AzExtWrapper.ts index 3e42b990..00d87326 100644 --- a/src/AzExtWrapper.ts +++ b/src/AzExtWrapper.ts @@ -82,6 +82,10 @@ export class AzExtWrapper { return !!this.getCodeExtension(); } + public isPrivate(): boolean { + return this._data.private === true; + } + public meetsMinVersion(): boolean { // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access return this.getCodeExtension()?.packageJSON?.contributes?.[contributesKey] !== undefined; diff --git a/src/azureExtensions.ts b/src/azureExtensions.ts index 00d385e5..4e8dd38a 100644 --- a/src/azureExtensions.ts +++ b/src/azureExtensions.ts @@ -162,7 +162,8 @@ export const azureExtensions: IAzExtMetadata[] = [ publisher: 'microsoft-devdiv', label: 'AI Foundry', resourceTypes: [AzExtResourceType.AiFoundry], - reportIssueCommandId: 'azure-ai-extension.reportIssue' + reportIssueCommandId: 'azure-ai-extension.reportIssue', + private: true }, ]; @@ -187,6 +188,7 @@ export interface IAzExtMetadata { resourceTypes: AzExtResourceType[]; tutorial?: IAzExtTutorial; reportIssueCommandId?: string; + private?: boolean; } export interface IAzExtResourceType { diff --git a/src/tree/azure/DefaultAzureResourceItem.ts b/src/tree/azure/DefaultAzureResourceItem.ts index 4df0bd3b..b7b89e54 100644 --- a/src/tree/azure/DefaultAzureResourceItem.ts +++ b/src/tree/azure/DefaultAzureResourceItem.ts @@ -25,7 +25,7 @@ export class DefaultAzureResourceItem implements ResourceGroupsItem { public readonly id: string = this.resource.id; getChildren(): Promise { - if (this.resourceTypeExtension && !this.resourceTypeExtension.isInstalled()) { + if (this.resourceTypeExtension && !this.resourceTypeExtension.isInstalled() && !this.resourceTypeExtension.isPrivate()) { return Promise.resolve([ new GenericItem( localize('installExtensionToEnableFeatures', 'Install extension to enable additional features...'), From 85fc45418bfb63d636bd7db8b1189af6ce966758 Mon Sep 17 00:00:00 2001 From: Zhijie Huang Date: Wed, 8 Jan 2025 13:33:10 +0800 Subject: [PATCH 4/5] Revert "add debugging configuration" This reverts commit e3e80d29c0d82f4aade69c40a99f26bad0bfd2cd. --- .vscode/launch.json | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 3da73db1..1366f0de 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -19,24 +19,6 @@ "NODE_DEBUG": "" } }, - { - "name": "Launch Extension(azure-ai)", - "type": "extensionHost", - "request": "launch", - "runtimeExecutable": "${execPath}", - "args": [ - "--extensionDevelopmentPath=${workspaceFolder}", - "--extensionDevelopmentPath=${workspaceFolder}/../azure-ai-extension", - ], - "outFiles": [ - "${workspaceFolder}/out/**/*.js" - ], - "preLaunchTask": "${defaultBuildTask}", - "env": { - "DEBUGTELEMETRY": "v", - "NODE_DEBUG": "" - } - }, { "name": "Launch Extension(s)", "type": "extensionHost", From c78e594c8d7e7a5ac853b1fac011f1a4c9e6adc6 Mon Sep 17 00:00:00 2001 From: zhihuan Date: Fri, 10 Jan 2025 16:05:05 +0800 Subject: [PATCH 5/5] update metadata --- src/azureExtensions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azureExtensions.ts b/src/azureExtensions.ts index 4e8dd38a..89cf82da 100644 --- a/src/azureExtensions.ts +++ b/src/azureExtensions.ts @@ -158,8 +158,8 @@ export const azureExtensions: IAzExtMetadata[] = [ reportIssueCommandId: 'azureWebPubSub.reportIssue' }, { - name: 'vscode-ai-foundry-extension', - publisher: 'microsoft-devdiv', + name: 'vscode-ai-foundry', + publisher: 'ms-toolsai', label: 'AI Foundry', resourceTypes: [AzExtResourceType.AiFoundry], reportIssueCommandId: 'azure-ai-extension.reportIssue',