Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dedicated): fix kvm order when datacenter name is eri #10909

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { KVM_PLAN_CODE } from './constants';
import { DATACENTER_AGORA_NAME, KVM_PLAN_CODE } from './constants';

export default class BmServerComponentsIpmiService {
/* @ngInject */
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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}`));
Expand All @@ -169,4 +177,8 @@ export default class BmServerComponentsIpmiService {
orderKvm(cartId) {
return this.checkoutCart(cartId);
}

static getRealDCAgoraName(datacenterName) {
return DATACENTER_AGORA_NAME[datacenterName] || datacenterName;
}
}
Loading