Enabled dynamic options to use CategoryValue type. SQL MIAA deploy now up to parity with Portal. (#18279)

* Removed extra backup policy field in MIAA deploy. Re-ordered fields in MIAA deploy for parity.

* Enabled dynamic options to work with categoryvalue type objects.

* Removed defaultValue CategoryValue typing, fixed some type checks.

* Added a clarifying comment to setModelValues and removed unnecessary type from defaultValue

* Removed CategoryValue from selection

* Undo parenthesis for single type
This commit is contained in:
Candice Ye
2022-02-11 11:19:30 -08:00
committed by GitHub
parent 56f72e33b1
commit 85cfde7421
5 changed files with 70 additions and 77 deletions

View File

@@ -1045,16 +1045,50 @@
"fields": [
{
"type": "options",
"label": "%arc.sql.replicas%",
"label": "%arc.sql.service.tier.label%",
"variableName": "AZDATA_NB_VAR_SQL_SERVICE_TIER",
"description": "%arc.sql.service.tier.description%",
"required": true,
"options": {
"values": [
{
"name": "BusinessCritical",
"displayName": "%arc.sql.service.tier.business.critical%"
},
{
"name": "GeneralPurpose",
"displayName": "%arc.sql.service.tier.general.purpose%"
}
],
"defaultValue": "BusinessCritical",
"optionsType": "radio"
}
},
{
"type": "checkbox",
"label": "%arc.sql.dev.use.label%",
"variableName": "AZDATA_NB_VAR_SQL_DEV_USE",
"description": "%arc.sql.dev.use.description%",
"defaultValue": false
},
{
"type": "options",
"label": "%arc.sql.high.availability%",
"description": "%arc.sql.high.availability.description%",
"required": true,
"variableName": "AZDATA_NB_VAR_SQL_REPLICAS",
"options": {
"values": [
"%arc.sql.two.replicas%",
"%arc.sql.three.replicas%"
{
"name": "2",
"displayName": "%arc.sql.two.replicas%"
},
{
"name": "3",
"displayName": "%arc.sql.three.replicas%"
}
],
"defaultValue": "%arc.sql.two.replicas%",
"defaultValue": "2",
"optionsType": "radio"
},
"dynamicOptions":
@@ -1062,15 +1096,25 @@
"target": "AZDATA_NB_VAR_SQL_SERVICE_TIER",
"alternates": [
{
"selection": "%arc.sql.service.tier.general.purpose%",
"selection": "GeneralPurpose",
"alternateValues": [
"%arc.sql.one.replica%"
{
"name": "1",
"displayName": "%arc.sql.one.replica%"
}
],
"defaultValue": "%arc.sql.one.replica%"
"defaultValue": "1"
}
]
}
},
{
"type": "checkbox",
"label": "%arc.sql.license.type.label%",
"variableName": "AZDATA_NB_VAR_SQL_LICENSE_TYPE",
"description": "%arc.sql.license.type.description%",
"defaultValue": false
},
{
"label": "%arc.storage-class.data.label%",
"description": "%arc.sql.storage-class.data.description%",
@@ -1198,62 +1242,6 @@
"description": "%memory.limit.greater.than.or.equal.to.requested.memory%"
}
]
},
{
"type": "options",
"label": "%arc.sql.service.tier.label%",
"variableName": "AZDATA_NB_VAR_SQL_SERVICE_TIER",
"description": "%arc.sql.service.tier.description%",
"required": true,
"options": {
"values": [
"%arc.sql.service.tier.business.critical%",
"%arc.sql.service.tier.general.purpose%"
],
"defaultValue": "%arc.sql.service.tier.business.critical%",
"optionsType": "radio"
}
},
{
"type": "checkbox",
"label": "%arc.sql.dev.use.label%",
"variableName": "AZDATA_NB_VAR_SQL_DEV_USE",
"description": "%arc.sql.dev.use.description%",
"defaultValue": false
},
{
"type": "checkbox",
"label": "%arc.sql.license.type.label%",
"variableName": "AZDATA_NB_VAR_SQL_LICENSE_TYPE",
"description": "%arc.sql.license.type.description%",
"defaultValue": false
}
]
},
{
"title": "%arc.sql.instance.retention.policy.title%",
"fields": [
{
"type": "readonly_text",
"label": "%arc.sql.pitr.retention.description%",
"labelWidth": "600px",
"enabled": true,
"fieldHeight": "10px",
"links": [
{
"text": "%arc.agreement.sql.help.text.learn.more%",
"url": "https://docs.microsoft.com/azure/azure-arc/data/point-in-time-restore"
}
]
},
{
"label": "%arc.sql.retention.days.label%",
"description": "%arc.sql.retention.days.description%",
"variableName": "AZDATA_NB_VAR_SQL_RETENTION_DAYS",
"type": "number",
"min": 0,
"max": 35,
"required": false
}
]
},

View File

@@ -99,13 +99,13 @@
"arc.sql.invalid.instance.name": "Instance name must consist of lower case alphanumeric characters or '-', start with a letter, end with an alphanumeric character, and be 13 characters or fewer in length.",
"arc.storage-class.dc.label": "Storage Class",
"arc.sql.storage-class.dc.description": "The storage class to be used for all data and logs persistent volumes for all data controller pods that require them.",
"arc.sql.replicas": "Replicas",
"arc.sql.high.availability.description": "Enable additional replicas for high availabilty. The compute and storage configuration selected below will be applied to all replicas. Choose from: General Purpose (Up to 24 vCores and 128 Gi of RAM, standard high availability) or [PREVIEW] Business Critical (Unlimited vCores and RAM, advanced high availability).",
"arc.sql.service.tier.general.purpose": "GeneralPurpose",
"arc.sql.service.tier.business.critical": "BusinessCritical",
"arc.sql.one.replica": "1",
"arc.sql.two.replicas": "2",
"arc.sql.three.replicas": "3",
"arc.sql.high.availability": "High availability",
"arc.sql.high.availability.description": "Enable additional replicas for high availabilty. The compute and storage configuration selected below will be applied to all replicas.",
"arc.sql.service.tier.general.purpose": "General Purpose (Up to 24 vCores and 128 Gi of RAM, standard high availability)",
"arc.sql.service.tier.business.critical": "[PREVIEW] Business Critical (Unlimited vCores and RAM, advanced high availability)",
"arc.sql.one.replica": "1 replica",
"arc.sql.two.replicas": "2 replicas",
"arc.sql.three.replicas": "3 replicas",
"arc.storage-class.data.label": "Storage Class (Data)",
"arc.sql.storage-class.data.description": "The storage class to be used for data (.mdf). If no value is specified, the default storage class will be used.",
"arc.sql.cost.summary.sql.miaa.cost.summary": "SQL Managed Instance - Azure Arc Cost Summary",
@@ -121,7 +121,7 @@
"arc.sql.cost.summary.azure.hybrid.benefit.discount": "Azure Hybrid Benefit discount (in USD)",
"arc.sql.cost.summary.sql.connection.info": "SQL Connection Information",
"arc.sql.cost.summary.sql.instance.settings": "SQL Instance Settings",
"arc.sql.cost.summary.service.tier.learn.more.description": "Select from the latest vCore service tiers available for SQL Managed Instance - Azure Arc including General Purpose and Business Critical. {0}",
"arc.sql.cost.summary.service.tier.learn.more.description": "Select from the latest vCore service tiers available for SQL Managed Instance - Azure Arc including General Purpose and Business Critical.",
"arc.sql.cost.summary.service.tier.learn.more.text": "Learn more",
"arc.sql.cost.summary.basics": "Basics",
"arc.sql.cost.summary.subscription": "Subscription",
@@ -157,7 +157,7 @@
"arc.memory-request.label": "Memory Request",
"arc.sql.memory-request.description": "The request for the capacity of the managed instance as an integer amount of memory in GBs.",
"arc.sql.service.tier.label": "Service Tier",
"arc.sql.service.tier.description": "Select from the latest vCore service tiers available for SQL Managed Instance - Azure Arc including General Purpose and Business Critical. {0}",
"arc.sql.service.tier.description": "Select from the latest vCore service tiers available for SQL Managed Instance - Azure Arc including General Purpose and Business Critical.",
"arc.sql.dev.use.label": "For development use only",
"arc.sql.license.type.label": "I already have a SQL Server License",
"arc.sql.license.type.description": "Apply the Azure Hybrid Benefit if you already own a SQL Server License",

View File

@@ -300,8 +300,8 @@ export interface DynamicOptionsInfo {
}
export interface DynamicOptionsAlternates {
selection: string,
alternateValues: string[],
selection: string
alternateValues: string[] | azdata.CategoryValue[],
defaultValue: string
}

View File

@@ -24,7 +24,7 @@ declare module 'resource-deployment' {
getIsPassword?: (variableName: string) => boolean | Promise<boolean>;
}
export type InputValueType = string | number | boolean | undefined;
export type InputValueType = string | number | boolean | azdata.CategoryValue | undefined;
export interface IValueProvider {
/**

View File

@@ -438,7 +438,7 @@ async function hookUpDynamicOptions(context: WizardPageContext): Promise<void> {
const updateOptions = async () => {
const currentValue = await targetComponent.getValue();
if (field.dynamicOptions && field.options && fieldComponent && fieldComponent.setOptions) {
const targetValueFound = field.dynamicOptions.alternates.find(item => item.selection === currentValue);
let targetValueFound = field.dynamicOptions.alternates.find(item => item.selection === currentValue);
if (targetValueFound) {
fieldComponent.setOptions(<OptionsInfo>{
values: targetValueFound.alternateValues,
@@ -1646,7 +1646,12 @@ export function getPasswordMismatchMessage(fieldName: string): string {
export async function setModelValues(inputComponents: InputComponents, model: Model): Promise<void> {
await Promise.all(Object.keys(inputComponents).map(async key => {
const value = await inputComponents[key].getValue();
model.setPropertyValue(key, value);
// Check if value is of type CategoryValue. If so, we need to get the name from the CategoryValue object.
if (typeof (value) === 'object') {
model.setPropertyValue(key, value.name);
} else {
model.setPropertyValue(key, value);
}
}));
}