mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Added SQL MI tile and sub resource types to resource deployment (#14043)
* Made azure arc as resourcesubtype Added new azure arc resource type Added support for different eula statement for different subtypes Consolidated getSelectedOption * Fixed some PR based comments * Fixed more pr comments * Fixed the error in unit test by deep copying extension resourceTypes (to keep the original one intact) * Fixed property name 'agreement' to 'agreements' * Cloning subresourceTypes
This commit is contained in:
21
extensions/resource-deployment/images/managed-instance.svg
Normal file
21
extensions/resource-deployment/images/managed-instance.svg
Normal file
@@ -0,0 +1,21 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18">
|
||||
<defs>
|
||||
<linearGradient id="ef376e2c-38fd-4835-83bc-bb24ee960fff" x1="6.267" y1="13.967" x2="6.267" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#949494"/>
|
||||
<stop offset="1" stop-color="#b3b3b3"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="e033a847-5835-46c3-85cf-d40f22eafd80" x1="10.135" y1="14.02" x2="10.135" y2="5.219" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#0078d4"/>
|
||||
<stop offset="1" stop-color="#5ea0ef"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<g id="f77d0813-503e-4294-a8a2-c0c5e582bfd9">
|
||||
<path d="M17.549,15.146c-.16.7-1.035,1.391-2.617,1.929a21.585,21.585,0,0,1-12.125.017C1.35,16.578.564,15.922.441,15.25c-.022-.118,0-1.966,0-1.966l17.136-.16S17.569,15.061,17.549,15.146Z" fill="#5ea0ef"/>
|
||||
<ellipse cx="9.001" cy="13.246" rx="8.576" ry="2.965" transform="translate(-0.133 0.091) rotate(-0.575)" fill="#50e6ff"/>
|
||||
<path d="M10.368,13.491a.484.484,0,0,1-.476.476H2.641a.476.476,0,0,1-.476-.476V.476A.468.468,0,0,1,2.624,0H9.892a.476.476,0,0,1,.476.476Z" fill="url(#ef376e2c-38fd-4835-83bc-bb24ee960fff)"/>
|
||||
<path d="M3.368,4.895a.893.893,0,0,1,.886-.885H8.347a.893.893,0,0,1,.918.868v.017h0a.9.9,0,0,1-.894.9H4.254A.893.893,0,0,1,3.368,4.895Zm.886-1.754h4.11a.893.893,0,0,0,.9-.885h0a.226.226,0,0,0,0-.026.893.893,0,0,0-.918-.868H4.254a.89.89,0,0,0,0,1.779Z" fill="#003067"/>
|
||||
<path d="M4.3,1.654a.6.6,0,1,1-.6.6A.6.6,0,0,1,4.3,1.654ZM3.7,4.895a.6.6,0,1,0,.6-.6A.6.6,0,0,0,3.7,4.895Z" fill="#50e6ff"/>
|
||||
<path d="M16.366,11.252a2.806,2.806,0,0,0-2.431-2.689A3.524,3.524,0,0,0,10.3,5.221,3.611,3.611,0,0,0,6.843,7.543,3.342,3.342,0,0,0,3.9,10.76a3.39,3.39,0,0,0,3.508,3.257h6.174A2.831,2.831,0,0,0,16.366,11.252Z" fill="url(#e033a847-5835-46c3-85cf-d40f22eafd80)"/>
|
||||
<path d="M13.117,11.562V8.755H12.34V12.2h2.047v-.634ZM7.186,10.183a1.852,1.852,0,0,1-.426-.259.368.368,0,0,1-.1-.267.286.286,0,0,1,.126-.251.555.555,0,0,1,.351-.1,1.387,1.387,0,0,1,.835.242V8.83a2.4,2.4,0,0,0-.835-.125,1.41,1.41,0,0,0-.911.275.92.92,0,0,0-.342.744,1.117,1.117,0,0,0,.785,1,2.089,2.089,0,0,1,.509.3.353.353,0,0,1,.126.267.286.286,0,0,1-.126.251.631.631,0,0,1-.376.1,1.358,1.358,0,0,1-.9-.351v.769a1.889,1.889,0,0,0,.861.192,1.589,1.589,0,0,0,.96-.234.9.9,0,0,0,.36-.76.837.837,0,0,0-.209-.585A1.972,1.972,0,0,0,7.186,10.183ZM11.5,11.5a1.977,1.977,0,0,0,.276-1.053,1.91,1.91,0,0,0-.209-.935,1.474,1.474,0,0,0-.576-.618A1.619,1.619,0,0,0,10.1,8.68a1.844,1.844,0,0,0-.835.242,1.562,1.562,0,0,0-.61.643,2.114,2.114,0,0,0-.226.952,1.888,1.888,0,0,0,.2.877,1.567,1.567,0,0,0,.568.619,1.674,1.674,0,0,0,.835.242l.71.835h1l-.994-.919A1.515,1.515,0,0,0,11.5,11.5Zm-.777-.209a.818.818,0,0,1-1.261-.008,1.254,1.254,0,0,1-.234-.836,1.221,1.221,0,0,1,.242-.835.769.769,0,0,1,.643-.309.72.72,0,0,1,.619.309,1.288,1.288,0,0,1,.234.835A1.228,1.228,0,0,1,10.719,11.294Z" fill="#f2f2f2"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
@@ -71,7 +71,10 @@
|
||||
"description": "%resource-type-sql-image-description%",
|
||||
"platforms": "*",
|
||||
"icon": "./images/sql_server_container.svg",
|
||||
"tags": ["On-premises", "SQL Server"],
|
||||
"tags": [
|
||||
"On-premises",
|
||||
"SQL Server"
|
||||
],
|
||||
"options": [
|
||||
{
|
||||
"name": "version",
|
||||
@@ -200,7 +203,11 @@
|
||||
"description": "%resource-type-sql-bdc-description%",
|
||||
"platforms": "*",
|
||||
"icon": "./images/sql_bdc.svg",
|
||||
"tags": ["On-premises", "SQL Server", "Cloud"],
|
||||
"tags": [
|
||||
"On-premises",
|
||||
"SQL Server",
|
||||
"Cloud"
|
||||
],
|
||||
"options": [
|
||||
{
|
||||
"name": "version",
|
||||
@@ -329,23 +336,26 @@
|
||||
"when": "target=existing-openshift&&version=bdc2019"
|
||||
}
|
||||
],
|
||||
"agreement": {
|
||||
"template": "%bdc-agreement%",
|
||||
"links": [
|
||||
{
|
||||
"text": "%microsoft-privacy-statement%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
|
||||
},
|
||||
{
|
||||
"text": "%bdc-agreement-bdc-eula%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=2002534"
|
||||
},
|
||||
{
|
||||
"text": "%bdc-agreement-azdata-eula%",
|
||||
"url": "https://aka.ms/eula-azdata-en"
|
||||
}
|
||||
]
|
||||
}
|
||||
"agreements": [
|
||||
{
|
||||
"template": "%bdc-agreement%",
|
||||
"links": [
|
||||
{
|
||||
"text": "%microsoft-privacy-statement%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
|
||||
},
|
||||
{
|
||||
"text": "%bdc-agreement-bdc-eula%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=2002534"
|
||||
},
|
||||
{
|
||||
"text": "%bdc-agreement-azdata-eula%",
|
||||
"url": "https://aka.ms/eula-azdata-en"
|
||||
}
|
||||
],
|
||||
"when": "true"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "sql-windows-setup",
|
||||
@@ -359,7 +369,10 @@
|
||||
"light": "./images/sql_server_on_windows.svg",
|
||||
"dark": "./images/sql_server_on_windows_inverse.svg"
|
||||
},
|
||||
"tags": ["On-premises", "SQL Server"],
|
||||
"tags": [
|
||||
"On-premises",
|
||||
"SQL Server"
|
||||
],
|
||||
"options": [
|
||||
{
|
||||
"name": "version",
|
||||
@@ -391,11 +404,15 @@
|
||||
},
|
||||
{
|
||||
"name": "sql-azure-setup",
|
||||
"displayIndex": 4,
|
||||
"displayName": "%azure-sqldb-display-name%",
|
||||
"description": "%azure-sqldb-description%",
|
||||
"platforms": "*",
|
||||
"icon": "./images/azure-sql-db.svg",
|
||||
"tags": ["SQL Server", "Cloud"],
|
||||
"tags": [
|
||||
"SQL Server",
|
||||
"Cloud"
|
||||
],
|
||||
"okButtonText": [
|
||||
{
|
||||
"value": "%azure-sqldb-notebook-ok-button-text%",
|
||||
@@ -432,7 +449,7 @@
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"azureSQLDBWizard":{
|
||||
"azureSQLDBWizard": {
|
||||
"notebook": "./notebooks/azuredb/create-sqldb.ipynb"
|
||||
},
|
||||
"requiredTools": [
|
||||
@@ -453,31 +470,38 @@
|
||||
"when": "resource-type=database-server"
|
||||
}
|
||||
],
|
||||
"agreement": {
|
||||
"template": "%azure-sqldb-agreement%",
|
||||
"links": [
|
||||
{
|
||||
"text": "%microsoft-privacy-statement%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sqldb-agreement-sqldb-eula%",
|
||||
"url": "https://azure.microsoft.com/support/legal/"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sqldb-agreement-azdata-eula%",
|
||||
"url": "https://aka.ms/eula-azdata-en"
|
||||
}
|
||||
]
|
||||
}
|
||||
"agreements": [
|
||||
{
|
||||
"template": "%azure-sqldb-agreement%",
|
||||
"links": [
|
||||
{
|
||||
"text": "%microsoft-privacy-statement%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sqldb-agreement-sqldb-eula%",
|
||||
"url": "https://azure.microsoft.com/support/legal/"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sqldb-agreement-azdata-eula%",
|
||||
"url": "https://aka.ms/eula-azdata-en"
|
||||
}
|
||||
],
|
||||
"when": "true"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "azure-sql-vm",
|
||||
"displayIndex": 5,
|
||||
"displayName": "%azure-sqlvm-display-name%",
|
||||
"description": "%azure-sqlvm-description%",
|
||||
"platforms": "*",
|
||||
"icon": "./images/azure-sql-vm.svg",
|
||||
"tags": ["SQL Server", "Cloud"],
|
||||
"tags": [
|
||||
"SQL Server",
|
||||
"Cloud"
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"azureSQLVMWizard": {
|
||||
@@ -491,23 +515,79 @@
|
||||
"when": true
|
||||
}
|
||||
],
|
||||
"agreement": {
|
||||
"template": "%azure-sqlvm-agreement%",
|
||||
"links": [
|
||||
{
|
||||
"text": "%microsoft-privacy-statement%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sqlvm-agreement-sqlvm-eula%",
|
||||
"url": "https://azure.microsoft.com/support/legal/"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sqlvm-agreement-azdata-eula%",
|
||||
"url": "https://aka.ms/eula-azdata-en"
|
||||
}
|
||||
]
|
||||
}
|
||||
"agreements": [
|
||||
{
|
||||
"template": "%azure-sqlvm-agreement%",
|
||||
"links": [
|
||||
{
|
||||
"text": "%microsoft-privacy-statement%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sqlvm-agreement-sqlvm-eula%",
|
||||
"url": "https://azure.microsoft.com/support/legal/"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sqlvm-agreement-azdata-eula%",
|
||||
"url": "https://aka.ms/eula-azdata-en"
|
||||
}
|
||||
],
|
||||
"when": "true"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "azure-sql-mi",
|
||||
"displayIndex": 6,
|
||||
"displayName": "%azure-sql-mi-display-name%",
|
||||
"description": "%azure-sql-mi-display-description%",
|
||||
"platforms": "*",
|
||||
"icon": "./images/managed-instance.svg",
|
||||
"tags": [
|
||||
"SQL Server",
|
||||
"Cloud"
|
||||
],
|
||||
"providers": [
|
||||
{
|
||||
"webPageUrl": "https://portal.azure.com/#create/Microsoft.SQLManagedInstance",
|
||||
"requiredTools": [],
|
||||
"when": "mi-type=azure-sql-mi"
|
||||
}
|
||||
],
|
||||
"okButtonText": [
|
||||
{
|
||||
"value": "%azure-sql-mi-okButton-text%",
|
||||
"when": "mi-type=azure-sql-mi"
|
||||
}
|
||||
],
|
||||
"options": [
|
||||
{
|
||||
"name": "mi-type",
|
||||
"displayName": "%azure-sql-mi-resource-type-option-label%",
|
||||
"values": [
|
||||
{
|
||||
"name": "azure-sql-mi",
|
||||
"displayName": "%azure-sql-mi-display-name%"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"agreements": [
|
||||
{
|
||||
"template": "%azure-sql-mi-agreement%",
|
||||
"links": [
|
||||
{
|
||||
"text": "%microsoft-privacy-statement%",
|
||||
"url": "https://go.microsoft.com/fwlink/?LinkId=853010"
|
||||
},
|
||||
{
|
||||
"text": "%azure-sql-mi-agreement-eula%",
|
||||
"url": "https://azure.microsoft.com/support/legal/"
|
||||
}
|
||||
],
|
||||
"when": "mi-type=azure-sql-mi"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
"azure-sqlvm-agreement": "I accept {0}, {1} and {2}.",
|
||||
"azure-sqlvm-agreement-sqlvm-eula": "Azure SQL VM License Terms",
|
||||
"azure-sqlvm-agreement-azdata-eula": "azdata License Terms",
|
||||
"azure-sqlvm-azure-account-page-label":"Azure information",
|
||||
"azure-sqlvm-azure-account-page-label": "Azure information",
|
||||
"azure-sqlvm-azure-location-label": "Azure locations",
|
||||
"azure-sqlvm-vm-information-page-label": "VM information",
|
||||
"azure-sqlvm-image-label": "Image",
|
||||
@@ -80,5 +80,11 @@
|
||||
"sql-azure-database-server-display-name": "Database Server",
|
||||
"azure-sqldb-agreement": "I accept {0}, {1} and {2}.",
|
||||
"azure-sqldb-agreement-sqldb-eula": "Azure SQL DB License Terms",
|
||||
"azure-sqldb-agreement-azdata-eula": "azdata License Terms"
|
||||
"azure-sqldb-agreement-azdata-eula": "azdata License Terms",
|
||||
"azure-sql-mi-display-name": "Azure SQL managed instance",
|
||||
"azure-sql-mi-display-description": "Create a SQL Managed Instance. Best for most migrations to the cloud.",
|
||||
"azure-sql-mi-okButton-text": "Open in Portal",
|
||||
"azure-sql-mi-resource-type-option-label": "Resource Type",
|
||||
"azure-sql-mi-agreement": "I accept {0} and {1}.",
|
||||
"azure-sql-mi-agreement-eula": "Azure SQL MI License Terms"
|
||||
}
|
||||
|
||||
@@ -18,17 +18,35 @@ export interface ResourceType {
|
||||
icon: { light: string; dark: string } | string;
|
||||
options: ResourceTypeOption[];
|
||||
providers: DeploymentProvider[];
|
||||
agreement?: AgreementInfo;
|
||||
agreements?: AgreementInfo[];
|
||||
displayIndex?: number;
|
||||
okButtonText?: OkButtonTextValue[];
|
||||
getOkButtonText(selectedOptions: { option: string, value: string }[]): string | undefined;
|
||||
getProvider(selectedOptions: { option: string, value: string }[]): DeploymentProvider | undefined;
|
||||
getAgreementInfo(selectedOptions: { option: string, value: string }[]): AgreementInfo | undefined;
|
||||
getHelpText(selectedOption: { option: string, value: string }[]): string | undefined;
|
||||
tags?: string[];
|
||||
}
|
||||
|
||||
export interface ResourceSubType {
|
||||
/**
|
||||
* The name should match the name in Resource Type
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The option name should have a matching name in ResourceType.options
|
||||
*/
|
||||
options: ResourceTypeOption[];
|
||||
tags?: string[];
|
||||
provider: DeploymentProvider;
|
||||
okButtonText?: OkButtonTextValue;
|
||||
agreement?: AgreementInfo;
|
||||
}
|
||||
|
||||
export interface AgreementInfo {
|
||||
template: string;
|
||||
links: azdata.LinkArea[];
|
||||
when: string;
|
||||
}
|
||||
|
||||
export interface ResourceTypeOption {
|
||||
|
||||
@@ -9,7 +9,7 @@ import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { DeploymentProvider, instanceOfAzureSQLVMDeploymentProvider, instanceOfAzureSQLDBDeploymentProvider, instanceOfCommandDeploymentProvider, instanceOfDialogDeploymentProvider, instanceOfDownloadDeploymentProvider, instanceOfNotebookBasedDialogInfo, instanceOfNotebookDeploymentProvider, instanceOfNotebookWizardDeploymentProvider, instanceOfWebPageDeploymentProvider, instanceOfWizardDeploymentProvider, NotebookInfo, NotebookPathInfo, ResourceType, ResourceTypeOption } from '../interfaces';
|
||||
import { DeploymentProvider, instanceOfAzureSQLVMDeploymentProvider, instanceOfAzureSQLDBDeploymentProvider, instanceOfCommandDeploymentProvider, instanceOfDialogDeploymentProvider, instanceOfDownloadDeploymentProvider, instanceOfNotebookBasedDialogInfo, instanceOfNotebookDeploymentProvider, instanceOfNotebookWizardDeploymentProvider, instanceOfWebPageDeploymentProvider, instanceOfWizardDeploymentProvider, NotebookInfo, NotebookPathInfo, ResourceType, ResourceTypeOption, ResourceSubType, AgreementInfo } from '../interfaces';
|
||||
import { AzdataService } from './azdataService';
|
||||
import { KubeService } from './kubeService';
|
||||
import { INotebookService } from './notebookService';
|
||||
@@ -39,19 +39,20 @@ export class ResourceTypeService implements IResourceTypeService {
|
||||
getResourceTypes(filterByPlatform: boolean = true): ResourceType[] {
|
||||
if (this._resourceTypes.length === 0) {
|
||||
vscode.extensions.all.forEach((extension) => {
|
||||
const extensionResourceTypes = extension.packageJSON.contributes && extension.packageJSON.contributes.resourceDeploymentTypes as ResourceType[];
|
||||
if (extensionResourceTypes) {
|
||||
extensionResourceTypes.forEach((extensionResourceType: ResourceType) => {
|
||||
// Clone the object - we modify it by adding complex types and so if we modify the original contribution then
|
||||
// we can break VS Code functionality since it will sometimes pass this object over the RPC layer which requires
|
||||
// stringifying it - which can break with some of the complex types we add.
|
||||
const resourceType = deepClone(extensionResourceType);
|
||||
this.updatePathProperties(resourceType, extension.extensionPath);
|
||||
resourceType.getProvider = (selectedOptions) => { return this.getProvider(resourceType, selectedOptions); };
|
||||
resourceType.getOkButtonText = (selectedOptions) => { return this.getOkButtonText(resourceType, selectedOptions); };
|
||||
this._resourceTypes.push(resourceType);
|
||||
});
|
||||
}
|
||||
const extensionResourceTypes = extension.packageJSON.contributes?.resourceDeploymentTypes as ResourceType[];
|
||||
extensionResourceTypes?.forEach((extensionResourceType: ResourceType) => {
|
||||
// Clone the object - we modify it by adding complex types and so if we modify the original contribution then
|
||||
// we can break VS Code functionality since it will sometimes pass this object over the RPC layer which requires
|
||||
// stringifying it - which can break with some of the complex types we add.
|
||||
const resourceType = deepClone(extensionResourceType);
|
||||
this.updatePathProperties(resourceType, extension.extensionPath);
|
||||
resourceType.getProvider = (selectedOptions) => { return this.getProvider(resourceType, selectedOptions); };
|
||||
resourceType.getOkButtonText = (selectedOptions) => { return this.getOkButtonText(resourceType, selectedOptions); };
|
||||
resourceType.getAgreementInfo = (selectedOptions) => { return this.getAgreementInfo(resourceType, selectedOptions); };
|
||||
this.getResourceSubTypes(filterByPlatform, resourceType);
|
||||
this._resourceTypes.push(resourceType);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -71,26 +72,30 @@ export class ResourceTypeService implements IResourceTypeService {
|
||||
resourceType.icon.light = path.join(extensionPath, resourceType.icon.light);
|
||||
}
|
||||
resourceType.providers.forEach((provider) => {
|
||||
if (instanceOfNotebookDeploymentProvider(provider)) {
|
||||
this.updateNotebookPath(provider, extensionPath);
|
||||
} else if (instanceOfDialogDeploymentProvider(provider) && instanceOfNotebookBasedDialogInfo(provider.dialog)) {
|
||||
this.updateNotebookPath(provider.dialog, extensionPath);
|
||||
}
|
||||
else if ('bdcWizard' in provider) {
|
||||
this.updateNotebookPath(provider.bdcWizard, extensionPath);
|
||||
}
|
||||
else if ('notebookWizard' in provider) {
|
||||
this.updateNotebookPath(provider.notebookWizard, extensionPath);
|
||||
}
|
||||
else if ('azureSQLVMWizard' in provider) {
|
||||
this.updateNotebookPath(provider.azureSQLVMWizard, extensionPath);
|
||||
}
|
||||
else if ('azureSQLDBWizard' in provider) {
|
||||
this.updateNotebookPath(provider.azureSQLDBWizard, extensionPath);
|
||||
}
|
||||
this.updateProviderPathProperties(provider, extensionPath);
|
||||
});
|
||||
}
|
||||
|
||||
private updateProviderPathProperties(provider: DeploymentProvider, extensionPath: string): void {
|
||||
if (instanceOfNotebookDeploymentProvider(provider)) {
|
||||
this.updateNotebookPath(provider, extensionPath);
|
||||
} else if (instanceOfDialogDeploymentProvider(provider) && instanceOfNotebookBasedDialogInfo(provider.dialog)) {
|
||||
this.updateNotebookPath(provider.dialog, extensionPath);
|
||||
}
|
||||
else if ('bdcWizard' in provider) {
|
||||
this.updateNotebookPath(provider.bdcWizard, extensionPath);
|
||||
}
|
||||
else if ('notebookWizard' in provider) {
|
||||
this.updateNotebookPath(provider.notebookWizard, extensionPath);
|
||||
}
|
||||
else if ('azureSQLVMWizard' in provider) {
|
||||
this.updateNotebookPath(provider.azureSQLVMWizard, extensionPath);
|
||||
}
|
||||
else if ('azureSQLDBWizard' in provider) {
|
||||
this.updateNotebookPath(provider.azureSQLDBWizard, extensionPath);
|
||||
}
|
||||
}
|
||||
|
||||
private updateNotebookPath(objWithNotebookProperty: { notebook: string | NotebookPathInfo | NotebookInfo[] } | undefined, extensionPath: string): void {
|
||||
if (objWithNotebookProperty && objWithNotebookProperty.notebook) {
|
||||
if (typeof objWithNotebookProperty.notebook === 'string') {
|
||||
@@ -113,6 +118,40 @@ export class ResourceTypeService implements IResourceTypeService {
|
||||
}
|
||||
}
|
||||
|
||||
private getResourceSubTypes(filterByPlatform: boolean = true, resourceType: ResourceType): void {
|
||||
const resourceSubTypes: ResourceSubType[] = [];
|
||||
vscode.extensions.all.forEach((extension) => {
|
||||
const extensionResourceSubTypes = extension.packageJSON.contributes?.resourceDeploymentSubTypes as ResourceSubType[];
|
||||
extensionResourceSubTypes?.forEach((extensionResourceSubType: ResourceSubType) => {
|
||||
const resourceSubType = deepClone(extensionResourceSubType);
|
||||
if (resourceSubType.name === resourceType.name) {
|
||||
this.updateProviderPathProperties(resourceSubType.provider, extension.extensionPath);
|
||||
resourceSubTypes.push(resourceSubType);
|
||||
const tagSet = new Set(resourceType.tags);
|
||||
resourceSubType.tags?.forEach(tag => tagSet.add(tag));
|
||||
resourceType.tags = Array.from(tagSet);
|
||||
resourceType.providers.push(resourceSubType.provider);
|
||||
if (resourceSubType.okButtonText) {
|
||||
resourceType.okButtonText?.push(resourceSubType.okButtonText!);
|
||||
}
|
||||
if (resourceSubType.options) {
|
||||
resourceType.options.forEach((roption) => {
|
||||
resourceSubType.options.forEach((soption) => {
|
||||
if (roption.name === soption.name) {
|
||||
roption.values = roption.values.concat(soption.values);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (resourceSubType.agreement) {
|
||||
resourceType.agreements?.push(resourceSubType.agreement!);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the resource types and returns validation error messages if any.
|
||||
* @param resourceTypes resource types to be validated
|
||||
@@ -177,6 +216,7 @@ export class ResourceTypeService implements IResourceTypeService {
|
||||
|
||||
if (dupePositions.length !== 0) {
|
||||
errorMessages.push(`Option values with same name or display name are found at the following positions: ${i + 1}, ${dupePositions.join(',')}.${positionInfo} `);
|
||||
errorMessages.push(JSON.stringify(option));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,6 +290,16 @@ export class ResourceTypeService implements IResourceTypeService {
|
||||
return loc.select;
|
||||
}
|
||||
|
||||
private getAgreementInfo(resourceType: ResourceType, selectedOptions: { option: string, value: string }[]): AgreementInfo | undefined {
|
||||
if (resourceType.agreements) {
|
||||
for (const possibleOption of resourceType.agreements) {
|
||||
if (processWhenClause(possibleOption.when, selectedOptions)) {
|
||||
return possibleOption;
|
||||
}
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public startDeployment(resourceType: ResourceType): void {
|
||||
const wizard = new ResourceTypeWizard(resourceType, new KubeService(), new AzdataService(this.platformService), this.notebookService, this.toolsService, this.platformService, this);
|
||||
|
||||
@@ -164,7 +164,7 @@ export class ToolsAndEulaPage extends ResourceTypePage {
|
||||
);
|
||||
return view.initializeModel(this.form!.withLayout({ width: '100%' }).component()).then(() => {
|
||||
this._agreementContainer.clearItems();
|
||||
if (this._resourceType.agreement) {
|
||||
if (this._resourceType.agreements) {
|
||||
const agreementTitle = this.view.modelBuilder.text().withProps({
|
||||
value: localize('resourceDeployment.AgreementTitle', "Accept terms of use"),
|
||||
CSSStyles: {
|
||||
@@ -173,7 +173,6 @@ export class ToolsAndEulaPage extends ResourceTypePage {
|
||||
}
|
||||
}).component();
|
||||
this._agreementContainer.addItem(agreementTitle);
|
||||
this._agreementContainer.addItem(this.createAgreementCheckbox(this._resourceType.agreement));
|
||||
} else {
|
||||
this.form.removeFormItem({
|
||||
component: this._agreementContainer
|
||||
@@ -227,6 +226,9 @@ export class ToolsAndEulaPage extends ResourceTypePage {
|
||||
});
|
||||
}
|
||||
|
||||
if (this._agreementContainer) {
|
||||
this._agreementContainer.addItem(this.createAgreementCheckbox());
|
||||
}
|
||||
this.updateOkButtonText();
|
||||
this.updateToolsDisplayTable();
|
||||
});
|
||||
@@ -235,7 +237,8 @@ export class ToolsAndEulaPage extends ResourceTypePage {
|
||||
}
|
||||
|
||||
|
||||
private createAgreementCheckbox(agreementInfo: AgreementInfo): azdata.FlexContainer {
|
||||
private createAgreementCheckbox(): azdata.FlexContainer {
|
||||
const agreementInfo = this._resourceType.getAgreementInfo(this.getSelectedOptions())!;
|
||||
this._agreementCheckBox = this.view.modelBuilder.checkBox().withProperties<azdata.CheckBoxProperties>({
|
||||
ariaLabel: this.getAgreementDisplayText(agreementInfo),
|
||||
required: true
|
||||
@@ -275,26 +278,24 @@ export class ToolsAndEulaPage extends ResourceTypePage {
|
||||
}
|
||||
|
||||
private getCurrentProvider(): DeploymentProvider {
|
||||
const options: { option: string, value: string }[] = [];
|
||||
|
||||
this._optionDropDownMap.forEach((selectBox, option) => {
|
||||
let selectedValue: azdata.CategoryValue = selectBox.value as azdata.CategoryValue;
|
||||
options.push({ option: option, value: selectedValue.name });
|
||||
});
|
||||
const options = this.getSelectedOptions();
|
||||
|
||||
this.resourceProvider = this._resourceType.getProvider(options)!;
|
||||
return this._resourceType.getProvider(options)!;
|
||||
}
|
||||
|
||||
private getCurrentOkText(): string {
|
||||
const options: { option: string, value: string }[] = [];
|
||||
return this._resourceType.getOkButtonText(this.getSelectedOptions())!;
|
||||
}
|
||||
|
||||
private getSelectedOptions(): { option: string, value: string }[] {
|
||||
const options: { option: string, value: string }[] = [];
|
||||
this._optionDropDownMap.forEach((selectBox, option) => {
|
||||
let selectedValue: azdata.CategoryValue = selectBox.value as azdata.CategoryValue;
|
||||
options.push({ option: option, value: selectedValue.name });
|
||||
});
|
||||
|
||||
return this._resourceType.getOkButtonText(options)!;
|
||||
return options;
|
||||
}
|
||||
|
||||
private updateOkButtonText(): void {
|
||||
|
||||
Reference in New Issue
Block a user