mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Added a dynamic Cost Summary section to SQL MIAA Deployment Wizard (#17420)
* Added valueprovider for pricing. Pushing this for troubleshooting help. * Committing changes for troubleshooting help. Moved InputValueType to typings file. * Add readonly inputs to list * Fixed ordering of package.json merge items * Estimated cost moved to input page, ValueProvider only takes in a triggerfields[] and not a single string, fixed pricing logic. * Removed pricingModel.ts * Reverted some comments and code changes that were used in debugging. * Changed some values from localizedConstants to single-quote constants' * Changed some values from localizedConstants to single-quote constants' * Added copyright header to pricingUtils.ts * Removed try catch in extension.ts valueproviders, made some values in PricingUtils.ts top-level instead of exporting. * Minor changes, added some comments and localized USD. * Changes pricingutils classes to be constants, and added disposable to Hookupvalueprovider Co-authored-by: Candice Ye <canye@microsoft.com> Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import { ConnectToControllerDialog } from './ui/dialogs/connectControllerDialog'
|
||||
import { AzureArcTreeDataProvider } from './ui/tree/azureArcTreeDataProvider';
|
||||
import { ControllerTreeNode } from './ui/tree/controllerTreeNode';
|
||||
import { TreeNode } from './ui/tree/treeNode';
|
||||
import * as pricing from './common/pricingUtils';
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext): Promise<arc.IExtension> {
|
||||
IconPathHelper.setExtensionContext(context);
|
||||
@@ -61,6 +62,38 @@ export async function activate(context: vscode.ExtensionContext): Promise<arc.IE
|
||||
const rdApi = <rd.IExtension>vscode.extensions.getExtension(rd.extension.name)?.exports;
|
||||
context.subscriptions.push(rdApi.registerOptionsSourceProvider(new ArcControllersOptionsSourceProvider(treeDataProvider)));
|
||||
|
||||
// Register valueprovider for getting the calculated cost per VCore.
|
||||
context.subscriptions.push(rdApi.registerValueProvider({
|
||||
id: 'params-to-cost-per-vcore',
|
||||
getValue: async (mapping: { [key: string]: rd.InputValueType }) => {
|
||||
return pricing.fullPriceForOneVCore(mapping);
|
||||
}
|
||||
}));
|
||||
|
||||
// Register valueprovider for getting the number of CPU VCores Limit input by the user.
|
||||
context.subscriptions.push(rdApi.registerValueProvider({
|
||||
id: 'params-to-vcore-limit',
|
||||
getValue: async (mapping: { [key: string]: rd.InputValueType }) => {
|
||||
return 'x ' + pricing.numCores(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',
|
||||
getValue: async (mapping: { [key: string]: rd.InputValueType }) => {
|
||||
return '- ' + pricing.azureHybridBenefitDiscount(mapping).toString();
|
||||
}
|
||||
}));
|
||||
|
||||
// Register valueprovider for getting the total estimated cost.
|
||||
context.subscriptions.push(rdApi.registerValueProvider({
|
||||
id: 'params-to-estimated-cost',
|
||||
getValue: async (mapping: { [key: string]: rd.InputValueType }) => {
|
||||
return pricing.total(mapping).toString() + ' ' + loc.USD;
|
||||
}
|
||||
}));
|
||||
|
||||
return arcApi(treeDataProvider);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user