mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 06:56:38 +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 };
|
||||
|
||||
|
@ -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);
|
||||
|
||||
if ('id' in locationsList) {
|
||||
const locationId = locationsList.id;
|
||||
return locationId.substring(locationId.lastIndexOf('/') + 1);
|
||||
if ("id" in locationsList) {
|
||||
const locationId = locationsList.id;
|
||||
return locationId.substring(locationId.lastIndexOf("/") + 1);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const getFetchPricesPathForRegion = (subscriptionId: string): string => {
|
||||
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}`);
|
||||
}
|
||||
|
||||
const offeringId = item.id;
|
||||
const offeringId = item.id;
|
||||
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);
|
||||
}
|
||||
priceMap.set(region, regionPriceMap);
|
||||
@ -265,10 +265,7 @@ export const getOfferingIds = async (regions: Array<RegionItem>): Promise<Offeri
|
||||
method: "GET",
|
||||
apiVersion: "2023-05-01-preview",
|
||||
queryParams: {
|
||||
filter:
|
||||
"armRegionName eq '" +
|
||||
regionShortName +
|
||||
"'",
|
||||
filter: "armRegionName eq '" + regionShortName + "'",
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -42,12 +42,12 @@ export type PriceItem = {
|
||||
export type PriceType = {
|
||||
type: string;
|
||||
unitPrice: number;
|
||||
}
|
||||
};
|
||||
|
||||
export type PriceError = {
|
||||
type: string;
|
||||
description: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type PriceMapAndCurrencyCode = {
|
||||
priceMap: Map<string, Map<string, number>>;
|
||||
@ -66,12 +66,12 @@ export type OfferingIdItem = {
|
||||
|
||||
export type OfferingProperties = {
|
||||
offeringId: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type OfferingIdRequest = {
|
||||
ids: Array<string>;
|
||||
location: string,
|
||||
}
|
||||
location: string;
|
||||
};
|
||||
|
||||
export type OfferingIdMap = Map<string, Map<string, string>>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user