mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
fix format
This commit is contained in:
parent
6ba2ff6000
commit
c7c0a3a979
@ -254,4 +254,3 @@ export async function initializeConfiguration(): Promise<ConfigContext> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export { configContext };
|
export { configContext };
|
||||||
|
|
||||||
|
@ -170,15 +170,15 @@ export const getRegions = async (): Promise<Array<RegionItem>> => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRegionShortName = async (regionDisplayName: string) : Promise<string> => {
|
export const getRegionShortName = async (regionDisplayName: string): Promise<string> => {
|
||||||
const locationsList = await get(userContext.subscriptionId, regionDisplayName);
|
const locationsList = await get(userContext.subscriptionId, regionDisplayName);
|
||||||
|
|
||||||
if ('id' in locationsList) {
|
if ("id" in locationsList) {
|
||||||
const locationId = locationsList.id;
|
const locationId = locationsList.id;
|
||||||
return locationId.substring(locationId.lastIndexOf('/') + 1);
|
return locationId.substring(locationId.lastIndexOf("/") + 1);
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
};
|
||||||
|
|
||||||
const getFetchPricesPathForRegion = (subscriptionId: string): string => {
|
const getFetchPricesPathForRegion = (subscriptionId: string): string => {
|
||||||
return `/subscriptions/${subscriptionId}/providers/Microsoft.CostManagement/fetchPrices`;
|
return `/subscriptions/${subscriptionId}/providers/Microsoft.CostManagement/fetchPrices`;
|
||||||
@ -223,9 +223,9 @@ export const getPriceMapAndCurrencyCode = async (map: OfferingIdMap): Promise<Pr
|
|||||||
throw Error(`Get price error ${item.error.type} for ${item.id}: ${item.error.description}`);
|
throw Error(`Get price error ${item.error.type} for ${item.id}: ${item.error.description}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const offeringId = item.id;
|
const offeringId = item.id;
|
||||||
const skuName = map.get(region).get(offeringId);
|
const skuName = map.get(region).get(offeringId);
|
||||||
const unitPrice = item.prices.find(x => x.type == "Consumption")?.unitPrice;
|
const unitPrice = item.prices.find((x) => x.type == "Consumption")?.unitPrice;
|
||||||
regionPriceMap.set(skuName, unitPrice);
|
regionPriceMap.set(skuName, unitPrice);
|
||||||
}
|
}
|
||||||
priceMap.set(region, regionPriceMap);
|
priceMap.set(region, regionPriceMap);
|
||||||
@ -265,10 +265,7 @@ export const getOfferingIds = async (regions: Array<RegionItem>): Promise<Offeri
|
|||||||
method: "GET",
|
method: "GET",
|
||||||
apiVersion: "2023-05-01-preview",
|
apiVersion: "2023-05-01-preview",
|
||||||
queryParams: {
|
queryParams: {
|
||||||
filter:
|
filter: "armRegionName eq '" + regionShortName + "'",
|
||||||
"armRegionName eq '" +
|
|
||||||
regionShortName +
|
|
||||||
"'",
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@ export type PriceItem = {
|
|||||||
export type PriceType = {
|
export type PriceType = {
|
||||||
type: string;
|
type: string;
|
||||||
unitPrice: number;
|
unitPrice: number;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type PriceError = {
|
export type PriceError = {
|
||||||
type: string;
|
type: string;
|
||||||
description: string;
|
description: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type PriceMapAndCurrencyCode = {
|
export type PriceMapAndCurrencyCode = {
|
||||||
priceMap: Map<string, Map<string, number>>;
|
priceMap: Map<string, Map<string, number>>;
|
||||||
@ -66,12 +66,12 @@ export type OfferingIdItem = {
|
|||||||
|
|
||||||
export type OfferingProperties = {
|
export type OfferingProperties = {
|
||||||
offeringId: string;
|
offeringId: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type OfferingIdRequest = {
|
export type OfferingIdRequest = {
|
||||||
ids: Array<string>;
|
ids: Array<string>;
|
||||||
location: string,
|
location: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
export type OfferingIdMap = Map<string, Map<string, string>>;
|
export type OfferingIdMap = Map<string, Map<string, string>>;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user