mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Add readable secondaries and sync secondary to commit to SQL MIAA create (#19740)
* Added syncSecondaryToCommit to SQL update and create, as well as notebook, wizard, and compute+storage interfaces * Added readable secondaries and syncSecondaryToCommit to cost and SQL MI create * Added readable secondaries to notebook * removed resource-deployment changes Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
@@ -44,6 +44,12 @@ export const serviceTierVarName = 'AZDATA_NB_VAR_SQL_SERVICE_TIER';
|
||||
export const devUseVarName = 'AZDATA_NB_VAR_SQL_DEV_USE';
|
||||
export const vcoresLimitVarName = 'AZDATA_NB_VAR_SQL_CORES_LIMIT';
|
||||
export const licenseTypeVarName = 'AZDATA_NB_VAR_SQL_LICENSE_TYPE';
|
||||
export const readableSecondaries = 'AZDATA_NB_VAR_READABLE_SECONDARIES';
|
||||
|
||||
// Gets number of replicas charged
|
||||
export function numBillableReplicas(mapping: { [key: string]: InputValueType }): number {
|
||||
return 1 + Math.max(0, <number>mapping[readableSecondaries] - 1);
|
||||
}
|
||||
|
||||
// Estimated base price for one vCore.
|
||||
export function estimatedBasePriceForOneVCore(mapping: { [key: string]: InputValueType }): number {
|
||||
@@ -87,12 +93,12 @@ export function numCores(mapping: { [key: string]: InputValueType }): number {
|
||||
|
||||
// Full price for all selected vCores.
|
||||
export function vCoreFullPriceForAllCores(mapping: { [key: string]: InputValueType }): number {
|
||||
return fullPriceForOneVCore(mapping) * numCores(mapping);
|
||||
return fullPriceForOneVCore(mapping) * numCores(mapping) * numBillableReplicas(mapping);
|
||||
}
|
||||
|
||||
// SQL Server License price for all vCores. This is shown on the cost summary card if customer has SQL server license.
|
||||
export function vCoreSqlServerLicensePriceForAllCores(mapping: { [key: string]: InputValueType }): number {
|
||||
return estimatedSqlServerLicensePriceForOneVCore(mapping) * numCores(mapping);
|
||||
return estimatedSqlServerLicensePriceForOneVCore(mapping) * numCores(mapping) * numBillableReplicas(mapping);
|
||||
}
|
||||
|
||||
// If the customer doesn't already have SQL Server License, AHB discount is set to zero because the price will be included
|
||||
|
||||
@@ -89,6 +89,14 @@ export async function activate(context: vscode.ExtensionContext): Promise<arc.IE
|
||||
}
|
||||
}));
|
||||
|
||||
// Register valueprovider for getting the number of billable replicas.
|
||||
context.subscriptions.push(rdApi.registerValueProvider({
|
||||
id: 'params-to-billable-replicas',
|
||||
getValue: async (mapping: { [key: string]: rd.InputValueType }) => {
|
||||
return 'x ' + pricing.numBillableReplicas(mapping).toString();
|
||||
}
|
||||
}));
|
||||
|
||||
// Register valueprovider for getting the amount of hybrid benefit discount to be applied.
|
||||
context.subscriptions.push(rdApi.registerValueProvider({
|
||||
id: 'params-to-hybrid-benefit-discount',
|
||||
|
||||
@@ -223,6 +223,7 @@ export const coordinatorMemoryLimit = localize('arc.coordinatorMemoryLimit', "Co
|
||||
export const memoryRequest = localize('arc.memoryRequest', "Memory request (in GB)");
|
||||
export const workerMemoryRequest = localize('arc.workerMemoryRequest', "Worker Nodes Memory request (in GB)");
|
||||
export const coordinatorMemoryRequest = localize('arc.coordinatorMemoryRequest', "Coordinator Node Memory request (in GB)");
|
||||
export const syncSecondaryToCommit = localize('arc.syncSecondaryToCommit', "Sync Secondary To Commit");
|
||||
export const arcResources = localize('arc.arcResources', "Azure Arc Resources");
|
||||
export const enterANonEmptyPassword = localize('arc.enterANonEmptyPassword', "Enter a non empty password or press escape to exit.");
|
||||
export const thePasswordsDoNotMatch = localize('arc.thePasswordsDoNotMatch', "The passwords do not match. Confirm the password or press escape to exit.");
|
||||
|
||||
@@ -19,6 +19,7 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
|
||||
private coresRequestBox?: azdata.InputBoxComponent;
|
||||
private memoryLimitBox?: azdata.InputBoxComponent;
|
||||
private memoryRequestBox?: azdata.InputBoxComponent;
|
||||
private syncSecondaryToCommitBox?: azdata.InputBoxComponent;
|
||||
|
||||
private discardButton?: azdata.ButtonComponent;
|
||||
private saveButton?: azdata.ButtonComponent;
|
||||
@@ -27,7 +28,8 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
|
||||
coresLimit?: string,
|
||||
coresRequest?: string,
|
||||
memoryLimit?: string,
|
||||
memoryRequest?: string
|
||||
memoryRequest?: string,
|
||||
syncSecondaryToCommit?: string
|
||||
} = {};
|
||||
|
||||
private readonly _azApi: azExt.IExtension;
|
||||
@@ -180,6 +182,7 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
|
||||
try {
|
||||
this.editCores();
|
||||
this.editMemory();
|
||||
this.editSyncSecondaryToCommit();
|
||||
} catch (error) {
|
||||
vscode.window.showErrorMessage(loc.pageDiscardFailed(error));
|
||||
} finally {
|
||||
@@ -266,19 +269,39 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
|
||||
})
|
||||
);
|
||||
|
||||
this.syncSecondaryToCommitBox = this.modelView.modelBuilder.inputBox().withProps({
|
||||
readOnly: false,
|
||||
min: -1,
|
||||
inputType: 'number',
|
||||
placeHolder: loc.loading,
|
||||
ariaLabel: loc.syncSecondaryToCommit
|
||||
}).component();
|
||||
|
||||
this.disposables.push(
|
||||
this.syncSecondaryToCommitBox.onTextChanged(() => {
|
||||
if (!(this.handleOnTextChanged(this.syncSecondaryToCommitBox!))) {
|
||||
this.saveArgs.syncSecondaryToCommit = undefined;
|
||||
} else {
|
||||
this.saveArgs.syncSecondaryToCommit = this.syncSecondaryToCommitBox!.value;
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private createUserInputSection(): azdata.Component[] {
|
||||
if (this._miaaModel.configLastUpdated) {
|
||||
this.editCores();
|
||||
this.editMemory();
|
||||
this.editSyncSecondaryToCommit();
|
||||
}
|
||||
|
||||
return [
|
||||
this.createConfigurationSectionContainer(loc.coresRequest, this.coresRequestBox!),
|
||||
this.createConfigurationSectionContainer(loc.coresLimit, this.coresLimitBox!),
|
||||
this.createConfigurationSectionContainer(loc.memoryRequest, this.memoryRequestBox!),
|
||||
this.createConfigurationSectionContainer(loc.memoryLimit, this.memoryLimitBox!)
|
||||
this.createConfigurationSectionContainer(loc.memoryLimit, this.memoryLimitBox!),
|
||||
this.createConfigurationSectionContainer(loc.syncSecondaryToCommit, this.syncSecondaryToCommitBox!),
|
||||
|
||||
];
|
||||
}
|
||||
@@ -380,8 +403,18 @@ export class MiaaComputeAndStoragePage extends DashboardPage {
|
||||
this.saveArgs.memoryLimit = undefined;
|
||||
}
|
||||
|
||||
private editSyncSecondaryToCommit(): void {
|
||||
let currentSyncSecondaryToCommit = this._miaaModel.config?.spec?.syncSecondaryToCommit;
|
||||
|
||||
this.syncSecondaryToCommitBox!.placeHolder = currentSyncSecondaryToCommit!;
|
||||
this.syncSecondaryToCommitBox!.value = '';
|
||||
|
||||
this.saveArgs.syncSecondaryToCommit = undefined;
|
||||
}
|
||||
|
||||
private handleServiceUpdated() {
|
||||
this.editCores();
|
||||
this.editMemory();
|
||||
this.editSyncSecondaryToCommit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user