mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-13 16:07:26 +01:00
get dedicated gateway value from API response
This commit is contained in:
@@ -24,6 +24,7 @@ export enum ResourceStatus {
|
|||||||
|
|
||||||
export interface DedicatedGatewayResponse {
|
export interface DedicatedGatewayResponse {
|
||||||
sku: string;
|
sku: string;
|
||||||
|
dedicatedGatewayType: string;
|
||||||
instances: number;
|
instances: number;
|
||||||
status: string;
|
status: string;
|
||||||
endpoint: string;
|
endpoint: string;
|
||||||
@@ -42,7 +43,7 @@ export const updateDedicatedGatewayResource = async (
|
|||||||
const body: UpdateDedicatedGatewayRequestParameters = {
|
const body: UpdateDedicatedGatewayRequestParameters = {
|
||||||
properties: {
|
properties: {
|
||||||
instanceSize: sku,
|
instanceSize: sku,
|
||||||
// TODO: pass in DedicatedGatewayType into the properties on Update
|
dedicatedGatewayType: dedicatedGatewayType,
|
||||||
instanceCount: instances,
|
instanceCount: instances,
|
||||||
serviceType: "SqlDedicatedGateway",
|
serviceType: "SqlDedicatedGateway",
|
||||||
},
|
},
|
||||||
@@ -114,12 +115,19 @@ export const getCurrentProvisioningState = async (): Promise<DedicatedGatewayRes
|
|||||||
const response = await getDedicatedGatewayResource();
|
const response = await getDedicatedGatewayResource();
|
||||||
return {
|
return {
|
||||||
sku: response.properties.instanceSize,
|
sku: response.properties.instanceSize,
|
||||||
|
dedicatedGatewayType: response.properties.dedicatedGatewayType,
|
||||||
instances: response.properties.instanceCount,
|
instances: response.properties.instanceCount,
|
||||||
status: response.properties.status,
|
status: response.properties.status,
|
||||||
endpoint: response.properties.sqlxEndPoint,
|
endpoint: response.properties.sqlxEndPoint,
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return { sku: undefined, instances: undefined, status: undefined, endpoint: undefined };
|
return {
|
||||||
|
sku: undefined,
|
||||||
|
dedicatedGatewayType: undefined,
|
||||||
|
instances: undefined,
|
||||||
|
status: undefined,
|
||||||
|
endpoint: undefined,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -408,8 +408,7 @@ export default class SqlX extends SelfServeBaseClass {
|
|||||||
if (response.status && response.status !== "Deleting") {
|
if (response.status && response.status !== "Deleting") {
|
||||||
defaults.set("enableDedicatedGateway", { value: true });
|
defaults.set("enableDedicatedGateway", { value: true });
|
||||||
defaults.set("sku", { value: response.sku, disabled: true });
|
defaults.set("sku", { value: response.sku, disabled: true });
|
||||||
// TODO: Replace mocked value with real API response value later on initilization
|
defaults.set("dedicatedGatewayType", { value: response.dedicatedGatewayType || IntegratedCache, disabled: true });
|
||||||
defaults.set("dedicatedGatewayType", { value: IntegratedCache, disabled: true });
|
|
||||||
defaults.set("instances", { value: response.instances, disabled: false });
|
defaults.set("instances", { value: response.instances, disabled: false });
|
||||||
defaults.set("costPerHour", { value: calculateCost(response.sku, response.instances) });
|
defaults.set("costPerHour", { value: calculateCost(response.sku, response.instances) });
|
||||||
defaults.set("connectionString", {
|
defaults.set("connectionString", {
|
||||||
@@ -451,14 +450,6 @@ export default class SqlX extends SelfServeBaseClass {
|
|||||||
})
|
})
|
||||||
enableDedicatedGateway: boolean;
|
enableDedicatedGateway: boolean;
|
||||||
|
|
||||||
@OnChange(onSKUChange)
|
|
||||||
@Values({
|
|
||||||
labelTKey: "SKUs",
|
|
||||||
choices: getSkus,
|
|
||||||
placeholderTKey: "SKUsPlaceHolder",
|
|
||||||
})
|
|
||||||
sku: ChoiceItem;
|
|
||||||
|
|
||||||
@OnChange(onDedicatedGatewayTypeChange)
|
@OnChange(onDedicatedGatewayTypeChange)
|
||||||
@Values({
|
@Values({
|
||||||
labelTKey: "Dedicated Gateway Type",
|
labelTKey: "Dedicated Gateway Type",
|
||||||
@@ -467,6 +458,14 @@ export default class SqlX extends SelfServeBaseClass {
|
|||||||
})
|
})
|
||||||
dedicatedGatewayType: ChoiceItem;
|
dedicatedGatewayType: ChoiceItem;
|
||||||
|
|
||||||
|
@OnChange(onSKUChange)
|
||||||
|
@Values({
|
||||||
|
labelTKey: "SKUs",
|
||||||
|
choices: getSkus,
|
||||||
|
placeholderTKey: "SKUsPlaceHolder",
|
||||||
|
})
|
||||||
|
sku: ChoiceItem;
|
||||||
|
|
||||||
@OnChange(onNumberOfInstancesChange)
|
@OnChange(onNumberOfInstancesChange)
|
||||||
@PropertyInfo(NumberOfInstancesDropdownInfo)
|
@PropertyInfo(NumberOfInstancesDropdownInfo)
|
||||||
@Values({
|
@Values({
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export type SqlxServiceProps = {
|
|||||||
creationTime: string;
|
creationTime: string;
|
||||||
status: string;
|
status: string;
|
||||||
instanceSize: string;
|
instanceSize: string;
|
||||||
|
dedicatedGatewayType: string;
|
||||||
instanceCount: number;
|
instanceCount: number;
|
||||||
sqlxEndPoint: string;
|
sqlxEndPoint: string;
|
||||||
};
|
};
|
||||||
@@ -26,6 +27,7 @@ export type UpdateDedicatedGatewayRequestParameters = {
|
|||||||
|
|
||||||
export type UpdateDedicatedGatewayRequestProperties = {
|
export type UpdateDedicatedGatewayRequestProperties = {
|
||||||
instanceSize: string;
|
instanceSize: string;
|
||||||
|
dedicatedGatewayType: string;
|
||||||
instanceCount: number;
|
instanceCount: number;
|
||||||
serviceType: string;
|
serviceType: string;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user