Improved Validations for ARC Wizards (#12945)

This commit is contained in:
Arvind Ranasaria
2020-11-18 22:03:59 -08:00
committed by GitHub
parent e63e4f0901
commit c7cca5afea
12 changed files with 728 additions and 456 deletions

View File

@@ -1,41 +1,133 @@
{
"name": "sample-resource-deployment",
"displayName": "%extension-displayName%",
"description": "%extension-description%",
"version": "0.0.1",
"publisher": "Contoso",
"preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
"icon": "images/sqlserver.png",
"aiKey": "AIF-37eefaf0-8022-4671-a3fb-64752724682e",
"engines": {
"vscode": "*",
"azdata": ">=1.19.0"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/azuredatastudio.git"
},
"extensionDependencies": [
"microsoft.mssql",
"microsoft.notebook",
"microsoft.resource-deployment"
],
"contributes": {
"resourceDeploymentTypes": [
{
"name": "sample-resource-deployment",
"displayName": "%extension-displayName%",
"description": "%extension-description%",
"version": "0.0.1",
"publisher": "Contoso",
"preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",
"icon": "images/sqlserver.png",
"aiKey": "AIF-37eefaf0-8022-4671-a3fb-64752724682e",
"engines": {
"vscode": "*",
"azdata": ">=1.19.0"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/azuredatastudio.git"
},
"extensionDependencies": [
"microsoft.mssql",
"microsoft.notebook",
"microsoft.resource-deployment"
],
"contributes": {
"resourceDeploymentTypes": [
{
"name": "validations-wizard",
"displayName": "%validation.wizard.display.name%",
"description": "%validation.wizard.description%",
"platforms": "*",
"icon": {
"light": "./images/book.svg",
"dark": "./images/book_inverse.svg"
},
"providers": [
{
"notebookWizard": {
"notebook": "%deployment-notebook-1%",
"runNotebook": false,
"codeCellInsertionPosition": 1,
"actionText": "%deploy.wizard.action%",
"title": "%wizard.new.wizard.title%",
"name": "wizard.new.wizard",
"labelPosition": "left",
"generateSummaryPage": false,
"pages": [
{
"title": "%wizard.select.cluster.title%",
"sections": [
{
"fields": [
{
"label": "%cores-limit.label%",
"description": "%cores-limit.description%",
"variableName": "AZDATA_NB_VAR_CORES_LIMIT",
"type": "number",
"defaultValue": 5,
"required": false,
"validations": [
{
"type": "is_integer",
"description": "%cores.limit.should.be.integer%"
},
{
"type": ">=",
"target": "AZDATA_NB_VAR_CORES_REQUEST",
"description": "%cores.limit.greater.than.or.equal.to.requested.cores%"
}
]
},
{
"label": "%cores-request.label%",
"description": "%cores-request.description%",
"variableName": "AZDATA_NB_VAR_CORES_REQUEST",
"type": "number",
"defaultValue": 2,
"required": false,
"validations": [
{
"type": "is_integer",
"description": "%requested.cores.should.be.integer%"
},
{
"type": "<=",
"target": "AZDATA_NB_VAR_CORES_LIMIT",
"description": "%requested.cores.less.than.or.equal.to.cores.limit%"
}
]
}
]
}
]
}
]
},
"requiredTools": [
{
"name": "kubectl"
}
],
"when": true
}
],
"agreement": {
"template": "%wizard.data.controller.agreement%",
"links": [
{
"text": "%contoso.agreement.privacy.statement%",
"url": "https://go.contoso.com/fwlink/?LinkId=853010"
},
{
"text": "%wizard.agreement.contosoCmd.eula%",
"url": "https://aka.ms/eula-contosoCmd-en"
}
]
}
},
{
"name": "test-wizard",
"displayName": "%resource.type.wizard.display.name%",
"description": "%resource.type.wizard.description%",
"platforms": "*",
"icon": {
"light": "./images/book.svg",
"dark": "./images/book_inverse.svg"
},
"icon": {
"light": "./images/book.svg",
"dark": "./images/book_inverse.svg"
},
"providers": [
{
"notebookWizard": {
"notebook": "%deployment-notebook-1%",
"notebook": "%deployment-notebook-1%",
"type": "new-arc-control-plane",
"runNotebook": false,
"codeCellInsertionPosition": 1,
@@ -67,7 +159,7 @@
"sections": [
{
"fields": [
{
{
"type": "readonly_text",
"label": "%wizard.project.details.description%",
"labelWidth": "600px"
@@ -90,39 +182,39 @@
"defaultValue": "aks-dev-test",
"optionsType": "radio"
}
},
{
},
{
"type": "options",
"label": "%wizard.data.controllers%",
"required": true,
"variableName": "AZDATA_NB_VAR_CONTROLLER",
"editable": false,
"options": {
"source": {
"type": "ArcControllersOptionsSource",
"variableNames": {
"endpoint": "AZDATA_NB_VAR_CONTROLLER_ENDPOINT",
"username": "AZDATA_NB_VAR_CONTROLLER_USERNAME",
"password": "AZDATA_NB_VAR_CONTROLLER_PASSWORD"
}
},
"source": {
"type": "ArcControllersOptionsSource",
"variableNames": {
"endpoint": "AZDATA_NB_VAR_CONTROLLER_ENDPOINT",
"username": "AZDATA_NB_VAR_CONTROLLER_USERNAME",
"password": "AZDATA_NB_VAR_CONTROLLER_PASSWORD"
}
},
"values":[
"ignored1",
"ignored2"
],
"optionsType": "dropdown"
}
},
{
"label": "%wizard.dropdown.options.field%",
"variableName": "AZDATA_NB_VAR_DROPDOWN_OPTIONS",
"type": "options",
"options": {
"values": ["1","2","3"],
"defaultValue": "2",
"optionsType": "dropdown"
}
}
},
{
"label": "%wizard.dropdown.options.field%",
"variableName": "AZDATA_NB_VAR_DROPDOWN_OPTIONS",
"type": "options",
"options": {
"values": ["1","2","3"],
"defaultValue": "2",
"optionsType": "dropdown"
}
}
]
}
]
@@ -273,31 +365,31 @@
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_DROPDOWN_OPTIONS)"
},
{
"label": "%wizard.summary.controller%",
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_CONTROLLER)"
},
{
"label": "%wizard.summary.controller.endpoint%",
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_ENDPOINT)"
},
{
"label": "%wizard.summary.controller.username%",
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_USERNAME)"
},
{
"label": "%wizard.summary.controller.password%",
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_PASSWORD)"
}
},
{
"label": "%wizard.summary.controller%",
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_CONTROLLER)"
},
{
"label": "%wizard.summary.controller.endpoint%",
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_ENDPOINT)"
},
{
"label": "%wizard.summary.controller.username%",
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_USERNAME)"
},
{
"label": "%wizard.summary.controller.password%",
"type": "readonly_text",
"isEvaluated": true,
"defaultValue": "$(AZDATA_NB_VAR_CONTROLLER_PASSWORD)"
}
]
}
]
@@ -326,159 +418,159 @@
]
}
},
{
"name": "x-data-service",
"displayName": "%resource-type-display-name%",
"description": "%resource-type-description%",
"platforms": [
"darwin",
"win32",
"linux"
],
"icon": {
"light": "./images/book.svg",
"dark": "./images/book_inverse.svg"
},
"options": [
{
"name": "edition",
"displayName": "%option-display-name%",
"values": [
{
"name": "evaluation",
"displayName": "%option-value-name-1%"
},
{
"name": "standard",
"displayName": "%option-value-name-2%"
}
]
}
],
"providers": [
{
"dialog": {
"notebook": "%deployment-notebook-1%",
"title": "%dialog-title-1%",
"name": "dialog1",
"tabs": [
{
"title": "",
"sections": [
{
"title": "",
"fields": [
{
"label": "%text-field%",
"variableName": "AZDATA_NB_VAR_TEXT",
"type": "text",
"defaultValue": "abc",
"required": true
},
{
"label": "%password-field%",
"variableName": "AZDATA_NB_VAR_PASSWORD",
"type": "password",
"confirmationRequired": true,
"confirmationLabel": "%confirm-password%",
"defaultValue": "",
"required": true
},
{
"type": "kube_cluster_context_picker",
"label": "%kube.cluster.context%",
"required": true,
"inputWidth": "350px",
"variableName": "AZDATA_NB_VAR_CLUSTER_CONTEXT",
"configFileVariableName": "AZDATA_NB_VAR_CONFIG_FILE"
},
{
"label": "%number-field%",
"variableName": "AZDATA_NB_VAR_NUMBER",
"type": "number",
"defaultValue": "100",
"required": true,
"min": 1,
"max": 65535
}
]
}
]
}
]
},
"requiredTools": [
{
"name": "kubectl"
}
],
"when": "edition=evaluation"
},
{
"dialog": {
"notebook": "%deployment-notebook-2%",
"title": "%dialog-title-2%",
"name": "dialog2",
"tabs": [
{
"title": "",
"sections": [
{
"title": "",
"fields": [
{
"label": "%text-field%",
"variableName": "AZDATA_NB_VAR_TEXT",
"type": "text",
"defaultValue": "abc",
"required": true
},
{
"label": "%password-field%",
"variableName": "AZDATA_NB_VAR_PASSWORD",
"type": "password",
"confirmationRequired": true,
"confirmationLabel": "%confirm-password%",
"defaultValue": "",
"required": true
},
{
"label": "%number-field%",
"variableName": "AZDATA_NB_VAR_NUMBER",
"type": "number",
"defaultValue": "100",
"required": true,
"min": 1,
"max": 65535
}
]
}
]
}
]
},
"requiredTools": [
{
"name": "docker"
}
],
"when": "edition=standard"
}
],
"agreement": {
"template": "%agreement%",
"links": [
{
"text": "%agreement-1-name%",
"url": "https://www.contoso.com"
},
{
"text": "%agreement-2-name%",
"url": "https://portal.azure.com"
}
]
}
}
]
}
{
"name": "x-data-service",
"displayName": "%resource-type-display-name%",
"description": "%resource-type-description%",
"platforms": [
"darwin",
"win32",
"linux"
],
"icon": {
"light": "./images/book.svg",
"dark": "./images/book_inverse.svg"
},
"options": [
{
"name": "edition",
"displayName": "%option-display-name%",
"values": [
{
"name": "evaluation",
"displayName": "%option-value-name-1%"
},
{
"name": "standard",
"displayName": "%option-value-name-2%"
}
]
}
],
"providers": [
{
"dialog": {
"notebook": "%deployment-notebook-1%",
"title": "%dialog-title-1%",
"name": "dialog1",
"tabs": [
{
"title": "",
"sections": [
{
"title": "",
"fields": [
{
"label": "%text-field%",
"variableName": "AZDATA_NB_VAR_TEXT",
"type": "text",
"defaultValue": "abc",
"required": true
},
{
"label": "%password-field%",
"variableName": "AZDATA_NB_VAR_PASSWORD",
"type": "password",
"confirmationRequired": true,
"confirmationLabel": "%confirm-password%",
"defaultValue": "",
"required": true
},
{
"type": "kube_cluster_context_picker",
"label": "%kube.cluster.context%",
"required": true,
"inputWidth": "350px",
"variableName": "AZDATA_NB_VAR_CLUSTER_CONTEXT",
"configFileVariableName": "AZDATA_NB_VAR_CONFIG_FILE"
},
{
"label": "%number-field%",
"variableName": "AZDATA_NB_VAR_NUMBER",
"type": "number",
"defaultValue": "100",
"required": true,
"min": 1,
"max": 65535
}
]
}
]
}
]
},
"requiredTools": [
{
"name": "kubectl"
}
],
"when": "edition=evaluation"
},
{
"dialog": {
"notebook": "%deployment-notebook-2%",
"title": "%dialog-title-2%",
"name": "dialog2",
"tabs": [
{
"title": "",
"sections": [
{
"title": "",
"fields": [
{
"label": "%text-field%",
"variableName": "AZDATA_NB_VAR_TEXT",
"type": "text",
"defaultValue": "abc",
"required": true
},
{
"label": "%password-field%",
"variableName": "AZDATA_NB_VAR_PASSWORD",
"type": "password",
"confirmationRequired": true,
"confirmationLabel": "%confirm-password%",
"defaultValue": "",
"required": true
},
{
"label": "%number-field%",
"variableName": "AZDATA_NB_VAR_NUMBER",
"type": "number",
"defaultValue": "100",
"required": true,
"min": 1,
"max": 65535
}
]
}
]
}
]
},
"requiredTools": [
{
"name": "docker"
}
],
"when": "edition=standard"
}
],
"agreement": {
"template": "%agreement%",
"links": [
{
"text": "%agreement-1-name%",
"url": "https://www.contoso.com"
},
{
"text": "%agreement-2-name%",
"url": "https://portal.azure.com"
}
]
}
}
]
}
}