From 31293baae98b503b8962c30662b7a5fe4805e7d1 Mon Sep 17 00:00:00 2001 From: Quentin Pavy Date: Tue, 13 Feb 2024 17:43:14 +0100 Subject: [PATCH] fix(dedicated): fix kvm order when datacenter name is eri ref: INC0019752 Signed-off-by: Quentin Pavy --- .../bm-server-components/src/ipmi/constants.js | 5 +++++ .../bm-server-components/src/ipmi/service.js | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/packages/manager/modules/bm-server-components/src/ipmi/constants.js b/packages/manager/modules/bm-server-components/src/ipmi/constants.js index 007fc5178eee..f3735ca8be4c 100644 --- a/packages/manager/modules/bm-server-components/src/ipmi/constants.js +++ b/packages/manager/modules/bm-server-components/src/ipmi/constants.js @@ -26,8 +26,13 @@ export const KVM_PLAN_CODE = 'usb-kvm-ip'; export const KVM_ORDER_TRACKING_PREFIX = 'dedicated::dedicated-server::server::ipmi::order-kvm'; +export const DATACENTER_AGORA_NAME = { + eri: 'lon', +}; + export default { getIpmiGuideUrl, KVM_PLAN_CODE, KVM_TRACKING_PREFIX: KVM_ORDER_TRACKING_PREFIX, + DATACENTER_AGORA_NAME, }; diff --git a/packages/manager/modules/bm-server-components/src/ipmi/service.js b/packages/manager/modules/bm-server-components/src/ipmi/service.js index a4fccaf82b0a..33c8b2dbd28d 100644 --- a/packages/manager/modules/bm-server-components/src/ipmi/service.js +++ b/packages/manager/modules/bm-server-components/src/ipmi/service.js @@ -1,4 +1,4 @@ -import { KVM_PLAN_CODE } from './constants'; +import { DATACENTER_AGORA_NAME, KVM_PLAN_CODE } from './constants'; export default class BmServerComponentsIpmiService { /* @ngInject */ @@ -123,6 +123,9 @@ export default class BmServerComponentsIpmiService { addKvmConfigurationToCart(itemId, cartId, serviceName, datacenter) { return this.$q.all([ + // TODO: It should be possible to order without the datacenter as we give the server + // In the case the API is updataed that way, remove this first post and also remove the + // getRealDCAgoraName function as well as the associated constant this.$http.post(`/order/cart/${cartId}/item/${itemId}/configuration`, { label: 'dedicated_datacenter', value: datacenter, @@ -160,7 +163,12 @@ export default class BmServerComponentsIpmiService { return this.addKvmOptionToCart(cartId, 'P1M', 'default', 1); }) .then(({ itemId }) => - this.addKvmConfigurationToCart(itemId, cartId, serviceName, datacenter), + this.addKvmConfigurationToCart( + itemId, + cartId, + serviceName, + this.constructor.getRealDCAgoraName(datacenter), + ), ) .then(() => this.getCart(cartId)) .catch(() => this.$http.delete(`/order/cart/${cartId}`)); @@ -169,4 +177,8 @@ export default class BmServerComponentsIpmiService { orderKvm(cartId) { return this.checkoutCart(cartId); } + + static getRealDCAgoraName(datacenterName) { + return DATACENTER_AGORA_NAME[datacenterName] || datacenterName; + } }