From 7a0b75e3e310b0e0725edad9b95f941814ed2961 Mon Sep 17 00:00:00 2001 From: ahmed sefiani Date: Wed, 1 Jul 2026 14:25:08 +0200 Subject: [PATCH] feat(dedicated): adding badge when host is gen 2 ref: #MANAGER-21869 Signed-off-by: ahmed sefiani --- ...edCloud-datacenter-host-order.constants.js | 76 +++++++++++++++++++ ...dCloud-datacenter-host-order.controller.js | 16 +++- .../dedicatedCloud-datacenter-host-order.html | 5 ++ 3 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.constants.js diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.constants.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.constants.js new file mode 100644 index 000000000000..15b7be058452 --- /dev/null +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.constants.js @@ -0,0 +1,76 @@ +export const GEN2_HOST_PROFILES = [ + // GP-1 + 'pcc-host-vsphere-gp1-16x128', + 'pcc-host-premier-gp1-16x128', + 'pcc-host-sddc2016-gp1-16x128', + 'pcc-host-sddc2018-gp1-16x128', + 'pcc-host-essentials-gp1-16x128', + 'pcc-host-nsx-gp1-16x128', + // GP-2 + 'pcc-host-vsphere-gp2-16x256', + 'pcc-host-premier-gp2-16x256', + 'pcc-host-sddc2016-gp2-16x256', + 'pcc-host-sddc2018-gp2-16x256', + 'pcc-host-essentials-gp2-16x256', + 'pcc-host-nsx-gp2-16x256', + // GP-3 + 'pcc-host-vsphere-gp3-24x512', + 'pcc-host-premier-gp3-24x512', + 'pcc-host-sddc2016-gp3-24x512', + 'pcc-host-sddc2018-gp3-24x512', + 'pcc-host-essentials-gp3-24x512', + 'pcc-host-nsx-gp3-24x512', + // GP-4 + 'pcc-host-vsphere-gp4-36x1024', + 'pcc-host-premier-gp4-36x1024', + 'pcc-host-sddc2016-gp4-36x1024', + 'pcc-host-sddc2018-gp4-36x1024', + 'pcc-host-essentials-gp4-36x1024', + 'pcc-host-nsx-gp4-36x1024', + // GP-5 + 'pcc-host-vsphere-gp5-48x1536', + 'pcc-host-premier-gp5-48x1536', + 'pcc-host-sddc2016-gp5-48x1536', + 'pcc-host-sddc2018-gp5-48x1536', + 'pcc-host-essentials-gp5-48x1536', + 'pcc-host-nsx-gp5-48x1536', + // STO-1 + 'pcc-host-vsphere-sto1-24x256', + 'pcc-host-premier-sto1-24x256', + 'pcc-host-sddc2016-sto1-24x256', + 'pcc-host-sddc2018-sto1-24x256', + 'pcc-host-nsx-sto1-24x256', + // STO-2 + 'pcc-host-vsphere-sto2-36x512', + 'pcc-host-premier-sto2-36x512', + 'pcc-host-sddc2016-sto2-36x512', + 'pcc-host-sddc2018-sto2-36x512', + 'pcc-host-nsx-sto2-36x512', + // STO-3 + 'pcc-host-vsphere-sto3-48x1024', + 'pcc-host-premier-sto3-48x1024', + 'pcc-host-sddc2016-sto3-48x1024', + 'pcc-host-sddc2018-sto3-48x1024', + 'pcc-host-nsx-sto3-48x1024', + // STO-4 + 'pcc-host-vsphere-sto4-72x1536', + 'pcc-host-premier-sto4-72x1536', + 'pcc-host-sddc2016-sto4-72x1536', + 'pcc-host-sddc2018-sto4-72x1536', + 'pcc-host-nsx-sto4-72x1536', +]; + +export const GEN2_HOST_BADGE_LABEL = 'new'; + +const GEN2_HOST_PROFILES_SET = new Set(GEN2_HOST_PROFILES); + +export const isGen2Host = (name) => GEN2_HOST_PROFILES_SET.has(name); + +export const isStorageHost = (name) => /-sto\d/.test(name); + +export default { + GEN2_HOST_PROFILES, + GEN2_HOST_BADGE_LABEL, + isGen2Host, + isStorageHost, +}; diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.controller.js b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.controller.js index a2edbcc2bf3d..060ee1df9fe0 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.controller.js +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.controller.js @@ -1,3 +1,9 @@ +import { + GEN2_HOST_BADGE_LABEL, + isGen2Host, + isStorageHost, +} from './dedicatedCloud-datacenter-host-order.constants'; + export default class { /* @ngInject */ constructor($q, $translate, $http, OvhHttp, User) { @@ -13,6 +19,7 @@ export default class { this.selectedOffer = null; this.quantity = 1; this.expressOrderUrl = null; + this.gen2BadgeLabel = GEN2_HOST_BADGE_LABEL; return this.fetchInitialData(); } @@ -95,13 +102,20 @@ export default class { ...offer, planCode: privatePlan ? privatePlan.planCode : offer.planCode, profile: profiles.find((p) => p.name === offer.planCode), + isGen2: isGen2Host(offer.planCode), prices, }; }) .sort( (offerA, offerB) => offerA.prices[0].price.value - offerB.prices[0].price.value, - ); + ) + .sort( + (offerA, offerB) => + isStorageHost(offerA.planCode) - + isStorageHost(offerB.planCode), + ) + .sort((offerA, offerB) => offerB.isGen2 - offerA.isGen2); [this.selectedOffer] = sortedResult; return sortedResult; diff --git a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.html b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.html index 1219b108e00b..379b4b0b77ce 100644 --- a/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.html +++ b/packages/manager/apps/dedicated/client/app/components/dedicated-cloud/datacenter/host/order/dedicatedCloud-datacenter-host-order.html @@ -31,6 +31,11 @@ data-model="$ctrl.selectedOffer" data-value="$row" > +