mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 10:51:30 +00:00
Compare commits
6 Commits
documentdb
...
users/tara
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
feec5fb3e2 | ||
|
|
09b2862d40 | ||
|
|
bce026036b | ||
|
|
5e83b81540 | ||
|
|
b26dd70bbd | ||
|
|
4158ea9a5a |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"DedicatedGatewayDescription": "Provision a dedicated gateway cluster for your Azure Cosmos DB account. A dedicated gateway is compute that is a front-end to data in your Azure Cosmos DB account. Your dedicated gateway automatically includes the integrated cache, which can improve read performance.",
|
||||
"DedicatedGatewayDescription": "Provision a dedicated gateway cluster for your Azure Cosmos DB account. A dedicated gateway is compute that is a front-end to data in your Azure Cosmos DB account. You can configure your dedicated gateway cluster and choose which feature to deploy.",
|
||||
"DedicatedGateway": "Dedicated Gateway",
|
||||
"Provisioned": "Provisioned",
|
||||
"Deprovisioned": "Deprovisioned",
|
||||
@@ -8,6 +8,7 @@
|
||||
"DedicatedGatewayPricing": "Learn more about dedicated gateway pricing.",
|
||||
"SKUs": "SKUs",
|
||||
"SKUsPlaceHolder": "Select SKUs",
|
||||
"DedicatedGatewayTypePlaceHolder": "Select Dedicated Gateway Type",
|
||||
"NumberOfInstances": "Number of instances",
|
||||
"CosmosD4s": "Cosmos.D4s (General Purpose Cosmos Compute with 4 vCPUs, 16 GB Memory)",
|
||||
"CosmosD8s": "Cosmos.D8s (General Purpose Cosmos Compute with 8 vCPUs, 32 GB Memory)",
|
||||
@@ -49,6 +50,8 @@
|
||||
"MetricsText": "Monitor the CPU and memory usage for the dedicated gateway instances in ",
|
||||
"MetricsBlade": "the metrics blade.",
|
||||
"MonitorUsage": "Monitor Usage",
|
||||
"DedicatedGatewayTypeText": "Each dedicated gateway feature comes with different benefits. ",
|
||||
"DedicatedGatewayTypeLink": "Learn more about the dedicated gateway features.",
|
||||
"ResizingDecisionText": "To understand if the dedicated gateway is the right size, ",
|
||||
"ResizingDecisionLink": "learn more about dedicated gateway sizing.",
|
||||
"WarningBannerOnUpdate": "Adding or modifying dedicated gateway instances may affect your bill.",
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
UpdateDedicatedGatewayRequestParameters,
|
||||
} from "./SqlxTypes";
|
||||
|
||||
const apiVersion = "2021-04-01-preview";
|
||||
const apiVersion = "2024-02-15-preview";
|
||||
|
||||
export enum ResourceStatus {
|
||||
Running = "Running",
|
||||
@@ -24,6 +24,7 @@ export enum ResourceStatus {
|
||||
|
||||
export interface DedicatedGatewayResponse {
|
||||
sku: string;
|
||||
dedicatedGatewayType: string;
|
||||
instances: number;
|
||||
status: string;
|
||||
endpoint: string;
|
||||
@@ -33,11 +34,16 @@ export const getPath = (subscriptionId: string, resourceGroup: string, name: str
|
||||
return `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroup}/providers/Microsoft.DocumentDB/databaseAccounts/${name}/services/SqlDedicatedGateway`;
|
||||
};
|
||||
|
||||
export const updateDedicatedGatewayResource = async (sku: string, instances: number): Promise<string> => {
|
||||
export const updateDedicatedGatewayResource = async (
|
||||
sku: string,
|
||||
dedicatedGatewayType: string,
|
||||
instances: number,
|
||||
): Promise<string> => {
|
||||
const path = getPath(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name);
|
||||
const body: UpdateDedicatedGatewayRequestParameters = {
|
||||
properties: {
|
||||
instanceSize: sku,
|
||||
dedicatedGatewayType: dedicatedGatewayType,
|
||||
instanceCount: instances,
|
||||
serviceType: "SqlDedicatedGateway",
|
||||
},
|
||||
@@ -109,12 +115,19 @@ export const getCurrentProvisioningState = async (): Promise<DedicatedGatewayRes
|
||||
const response = await getDedicatedGatewayResource();
|
||||
return {
|
||||
sku: response.properties.instanceSize,
|
||||
dedicatedGatewayType: response.properties.dedicatedGatewayType,
|
||||
instances: response.properties.instanceCount,
|
||||
status: response.properties.status,
|
||||
endpoint: response.properties.sqlxEndPoint,
|
||||
};
|
||||
} catch (e) {
|
||||
return { sku: undefined, instances: undefined, status: undefined, endpoint: undefined };
|
||||
return {
|
||||
sku: undefined,
|
||||
dedicatedGatewayType: undefined,
|
||||
instances: undefined,
|
||||
status: undefined,
|
||||
endpoint: undefined,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -70,6 +70,17 @@ const onSKUChange = (newValue: InputType, currentValues: Map<string, SmartUiInpu
|
||||
return currentValues;
|
||||
};
|
||||
|
||||
const IntegratedCache = "IntegratedCache";
|
||||
const DistributedQuery = "DistributedQuery";
|
||||
|
||||
const onDedicatedGatewayTypeChange = (
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
): Map<string, SmartUiInput> => {
|
||||
currentValues.set("dedicatedGatewayType", { value: newValue });
|
||||
return currentValues;
|
||||
};
|
||||
|
||||
const onNumberOfInstancesChange = (
|
||||
newValue: InputType,
|
||||
currentValues: Map<string, SmartUiInput>,
|
||||
@@ -109,6 +120,7 @@ const onEnableDedicatedGatewayChange = (
|
||||
const dedicatedGatewayOriginallyEnabled = baselineValues.get("enableDedicatedGateway")?.value as boolean;
|
||||
if (dedicatedGatewayOriginallyEnabled === newValue) {
|
||||
currentValues.set("sku", baselineValues.get("sku"));
|
||||
currentValues.set("dedicatedGatewayType", baselineValues.get("dedicatedGatewayType"));
|
||||
currentValues.set("instances", baselineValues.get("instances"));
|
||||
currentValues.set("costPerHour", baselineValues.get("costPerHour"));
|
||||
currentValues.set("warningBanner", baselineValues.get("warningBanner"));
|
||||
@@ -149,6 +161,7 @@ const onEnableDedicatedGatewayChange = (
|
||||
currentValues.set("costPerHour", { value: costPerHourDefaultValue, hidden: true });
|
||||
}
|
||||
const sku = currentValues.get("sku");
|
||||
const dedicatedGatewayType = currentValues.get("dedicatedGatewayType");
|
||||
const instances = currentValues.get("instances");
|
||||
const hideAttributes = newValue === undefined || !(newValue as boolean);
|
||||
currentValues.set("sku", {
|
||||
@@ -156,6 +169,11 @@ const onEnableDedicatedGatewayChange = (
|
||||
hidden: hideAttributes,
|
||||
disabled: dedicatedGatewayOriginallyEnabled,
|
||||
});
|
||||
currentValues.set("dedicatedGatewayType", {
|
||||
value: dedicatedGatewayType.value,
|
||||
hidden: hideAttributes,
|
||||
disabled: dedicatedGatewayOriginallyEnabled,
|
||||
});
|
||||
currentValues.set("instances", {
|
||||
value: instances.value,
|
||||
hidden: hideAttributes,
|
||||
@@ -185,6 +203,15 @@ const getSkus = async (): Promise<ChoiceItem[]> => {
|
||||
return skuDropDownItems;
|
||||
};
|
||||
|
||||
const dedicatedGatewayTypeDropDownItems: ChoiceItem[] = [
|
||||
{ labelTKey: "Integrated Cache", key: IntegratedCache },
|
||||
{ labelTKey: "Distributed Query", key: DistributedQuery },
|
||||
];
|
||||
|
||||
const getDedicatedGatewayType = async (): Promise<ChoiceItem[]> => {
|
||||
return dedicatedGatewayTypeDropDownItems;
|
||||
};
|
||||
|
||||
const getInstancesMin = async (): Promise<number> => {
|
||||
return 1;
|
||||
};
|
||||
@@ -193,6 +220,14 @@ const getInstancesMax = async (): Promise<number> => {
|
||||
return 5;
|
||||
};
|
||||
|
||||
const DedicatedGatewayTypeDropdownInfo: Info = {
|
||||
messageTKey: "DedicatedGatewayTypeText",
|
||||
link: {
|
||||
href: "https://aka.ms/cosmos-db-dedicated-gateway-size",
|
||||
textTKey: "DedicatedGatewayTypeLink",
|
||||
},
|
||||
};
|
||||
|
||||
const NumberOfInstancesDropdownInfo: Info = {
|
||||
messageTKey: "ResizingDecisionText",
|
||||
link: {
|
||||
@@ -312,8 +347,9 @@ export default class SqlX extends SelfServeBaseClass {
|
||||
};
|
||||
} else {
|
||||
const sku = currentValues.get("sku")?.value as string;
|
||||
const dedicatedGatewayType = currentValues.get("dedicatedGatewayType")?.value as string;
|
||||
const instances = currentValues.get("instances").value as number;
|
||||
const operationStatusUrl = await updateDedicatedGatewayResource(sku, instances);
|
||||
const operationStatusUrl = await updateDedicatedGatewayResource(sku, dedicatedGatewayType, instances);
|
||||
return {
|
||||
operationStatusUrl: operationStatusUrl,
|
||||
portalNotification: {
|
||||
@@ -334,8 +370,9 @@ export default class SqlX extends SelfServeBaseClass {
|
||||
}
|
||||
} else {
|
||||
const sku = currentValues.get("sku")?.value as string;
|
||||
const dedicatedGatewayType = currentValues.get("dedicatedGatewayType")?.value as string;
|
||||
const instances = currentValues.get("instances").value as number;
|
||||
const operationStatusUrl = await updateDedicatedGatewayResource(sku, instances);
|
||||
const operationStatusUrl = await updateDedicatedGatewayResource(sku, dedicatedGatewayType, instances);
|
||||
return {
|
||||
operationStatusUrl: operationStatusUrl,
|
||||
portalNotification: {
|
||||
@@ -361,6 +398,7 @@ export default class SqlX extends SelfServeBaseClass {
|
||||
const defaults = new Map<string, SmartUiInput>();
|
||||
defaults.set("enableDedicatedGateway", { value: false });
|
||||
defaults.set("sku", { value: CosmosD4s, hidden: true });
|
||||
defaults.set("dedicatedGatewayType", { value: IntegratedCache, hidden: true });
|
||||
defaults.set("instances", { value: await getInstancesMin(), hidden: true });
|
||||
defaults.set("costPerHour", undefined);
|
||||
defaults.set("connectionString", undefined);
|
||||
@@ -378,6 +416,7 @@ export default class SqlX extends SelfServeBaseClass {
|
||||
if (response.status && response.status !== "Deleting") {
|
||||
defaults.set("enableDedicatedGateway", { value: true });
|
||||
defaults.set("sku", { value: response.sku, disabled: true });
|
||||
defaults.set("dedicatedGatewayType", { value: response.dedicatedGatewayType || IntegratedCache, disabled: true });
|
||||
defaults.set("instances", { value: response.instances, disabled: false });
|
||||
defaults.set("costPerHour", { value: calculateCost(response.sku, response.instances) });
|
||||
defaults.set("connectionString", {
|
||||
@@ -419,6 +458,15 @@ export default class SqlX extends SelfServeBaseClass {
|
||||
})
|
||||
enableDedicatedGateway: boolean;
|
||||
|
||||
@OnChange(onDedicatedGatewayTypeChange)
|
||||
@PropertyInfo(DedicatedGatewayTypeDropdownInfo)
|
||||
@Values({
|
||||
labelTKey: "Dedicated Gateway Features",
|
||||
choices: getDedicatedGatewayType,
|
||||
placeholderTKey: "DedicatedGatewayTypePlaceHolder",
|
||||
})
|
||||
dedicatedGatewayType: ChoiceItem;
|
||||
|
||||
@OnChange(onSKUChange)
|
||||
@Values({
|
||||
labelTKey: "SKUs",
|
||||
|
||||
@@ -10,6 +10,7 @@ export type SqlxServiceProps = {
|
||||
creationTime: string;
|
||||
status: string;
|
||||
instanceSize: string;
|
||||
dedicatedGatewayType: string;
|
||||
instanceCount: number;
|
||||
sqlxEndPoint: string;
|
||||
};
|
||||
@@ -26,6 +27,7 @@ export type UpdateDedicatedGatewayRequestParameters = {
|
||||
|
||||
export type UpdateDedicatedGatewayRequestProperties = {
|
||||
instanceSize: string;
|
||||
dedicatedGatewayType: string;
|
||||
instanceCount: number;
|
||||
serviceType: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user