Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integrate Azure AI Foundry vscode extension #1015

Merged
merged 5 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/src/AzExtResourceType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -48,6 +49,7 @@ export enum AzExtResourceType {
LoadBalancers = 'LoadBalancers',
LogicApp = 'LogicApp',
LogicWorkflows = 'LogicWorkflows',
MachineLearningWorkspace = 'MachineLearningWorkspace',
ManagedIdentityUserAssignedIdentities = 'ManagedIdentityUserAssignedIdentities',
MysqlServers = 'MysqlServers',
NetworkApplicationGateways = 'NetworkApplicationGateways',
Expand Down
10 changes: 10 additions & 0 deletions api/src/getAzExtResourceType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];
}
Expand All @@ -46,6 +55,7 @@ const azureTypeToAzExtResourceTypeMap: Record<string, AzExtResourceType | undefi
'microsoft.storage/storageaccounts': AzExtResourceType.StorageAccounts,
'microsoft.web/staticsites': AzExtResourceType.StaticWebApps,
// The below are not supported by the Azure extensions but have icons in the Resources extension
'microsoft.machinelearningservices/workspaces': AzExtResourceType.AiFoundry,
'microsoft.apimanagement/service': AzExtResourceType.ApiManagementService,
'microsoft.batch/batchaccounts': AzExtResourceType.BatchAccounts,
'microsoft.cache/redis': AzExtResourceType.CacheRedis,
Expand Down
1 change: 1 addition & 0 deletions resources/azureIcons/AiFoundry.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/AzExtWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion src/azureExtensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const azureExtensions: IAzExtMetadata[] = [
},
{
name: 'vscode-azurelogicapps',
publisher: "ms-azuretools",
publisher: 'ms-azuretools',
label: 'Logic Apps',
resourceTypes: [
AzExtResourceType.LogicApp,
Expand All @@ -157,9 +157,18 @@ export const azureExtensions: IAzExtMetadata[] = [
],
reportIssueCommandId: 'azureWebPubSub.reportIssue'
},
{
name: 'vscode-ai-foundry',
publisher: 'ms-toolsai',
label: 'AI Foundry',
resourceTypes: [AzExtResourceType.AiFoundry],
reportIssueCommandId: 'azure-ai-extension.reportIssue',
private: true
},
];

export const legacyTypeMap: Partial<Record<AzExtResourceType, string>> = {
AiFoundry: 'microsoft.machinelearningservices/workspaces',
FunctionApp: 'microsoft.web/functionapp',
AppServices: 'microsoft.web/sites',
StaticWebApps: 'microsoft.web/staticsites',
Expand All @@ -179,6 +188,7 @@ export interface IAzExtMetadata {
resourceTypes: AzExtResourceType[];
tutorial?: IAzExtTutorial;
reportIssueCommandId?: string;
private?: boolean;
}

export interface IAzExtResourceType {
Expand Down
2 changes: 1 addition & 1 deletion src/tree/azure/DefaultAzureResourceItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class DefaultAzureResourceItem implements ResourceGroupsItem {
public readonly id: string = this.resource.id;

getChildren(): Promise<ResourceGroupsItem[] | undefined> {
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...'),
Expand Down
1 change: 1 addition & 0 deletions src/utils/azureUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ interface AzExtResourceTypeDisplayInfo {
}

const azExtDisplayInfo: Partial<Record<AzExtResourceType, AzExtResourceTypeDisplayInfo>> = {
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') },
Expand Down
Loading