Skip to content

Commit

Permalink
feat: add savings plan banner for kubernetes
Browse files Browse the repository at this point in the history
Signed-off-by: Lionel Bueno <[email protected]>
  • Loading branch information
Lionel Bueno committed Oct 21, 2024
1 parent 63b5471 commit 78e18dc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"kubernetes_add_billing_auto_scaling_monthly_warning": "Attention : Vous activez simultanément l'autoscaling et le forfait mensuel pour ce nodepool. Chaque création de nœud par l'autoscaling va entrainer la facturation immédiate d'un nœud au prorata du temps restant sur le mois en cours. Nous vous conseillons d'éviter cette combinaison si vous anticipez que la taille de votre nodepool sera fréquemment réduite.",
"kubernetes_add_billing_type_payment_method": "Vous serez facturé sur votre mode de paiement par défaut",
"kubernetes_add_billing_anti_affinity_title": "Facturation et anti-affinité",
"kubernetes_add_billing_anti_affinity_coming_soon_message_title": "Prix mensuels",
"kubernetes_add_billing_anti_affinity_coming_soon_message_description": "Les tarifications mensuelles seront prochainement disponibles avec l'arrivée des Saving Plans.",
"kubernetes_add_billing_savings_plan_banner": "Bénéficiez de tarifs mensuels avantageux grâce aux Savings Plans, tout en gardant la flexibilité des instances à l'heure.",
"kubernetes_add_billing_savings_plan_cta": "Configurez vos Savings Plans",
"kube_add_node_pool_config_title": "Configuration générale",
"kube_add_node_pool_name_label": "Nom du pool de nœuds",
"kube_add_node_pool_creating": "Création d'un pool de nœuds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"kubernetes_add_billing_auto_scaling_monthly_warning": "Attention : Vous activez simultanément l'autoscaling et le forfait mensuel pour ce nodepool. Chaque création de nœud par l'autoscaling va entrainer la facturation immédiate d'un nœud au prorata du temps restant sur le mois en cours. Nous vous conseillons d'éviter cette combinaison si vous anticipez que la taille de votre nodepool sera fréquemment réduite.",
"kubernetes_add_billing_type_payment_method": "Vous serez facturé sur votre mode de paiement par défaut",
"kubernetes_add_billing_anti_affinity_title": "Facturation et anti-affinité",
"kubernetes_add_billing_anti_affinity_coming_soon_message_title": "Prix mensuels",
"kubernetes_add_billing_anti_affinity_coming_soon_message_description": "Les tarifications mensuelles seront prochainement disponibles avec l'arrivée des Saving Plans.",
"kubernetes_add_billing_savings_plan_banner": "Bénéficiez de tarifs mensuels avantageux grâce aux Savings Plans, tout en gardant la flexibilité des instances à l'heure.",
"kubernetes_add_billing_savings_plan_cta": "Configurez vos Savings Plans",
"kubernetes_node_pool_anti_affinity": "Anti-affinité",
"kubernetes_node_pool_anti_affinity_description": "En activant l'anti-affinité, les nœuds présents et futurs seront lancés sur des hyperviseurs (serveurs physiques) différents, garantissant une plus grande tolérance à la panne. Les pools de nœuds avec anti-affinité ne peuvent compter que jusque {{ maxNodes }} nœuds."
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
OsdsCheckbox,
OsdsCheckboxButton,
OsdsLink,
OsdsMessage,
OsdsText,
OsdsTile,
Expand All @@ -18,7 +19,11 @@ import {
ODS_THEME_TYPOGRAPHY_SIZE,
} from '@ovhcloud/ods-common-theming';
import { useTranslation } from 'react-i18next';
import { useCatalogPrice } from '@ovh-ux/manager-react-components';
import {
ActionBanner,
useCatalogPrice,
useProjectUrl,
} from '@ovh-ux/manager-react-components';
import { ANTI_AFFINITY_MAX_NODES } from '@/constants';

const checkedClass =
Expand Down Expand Up @@ -52,6 +57,9 @@ export default function BillingStep(props: TBillingStepProps): JSX.Element {
getFormattedHourlyCatalogPrice,
} = useCatalogPrice(4, { exclVat: true });

const projectURL = useProjectUrl('public-cloud');

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Anti affinity checkbox > the checkbox should be disabled from props

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Anti affinity checkbox > the checkbox should be enabled from props

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Anti affinity checkbox > the checkbox should be checked from props

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Anti affinity checkbox > the checkbox should be unchecked from props

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Hourly billing > should render hourly billing tile with price from props

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Monthly billing > tile > should not show monthly billing tile when monthlyBilling.isComingSoon is true

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Monthly billing > tile > should show monthly billing tile when monthlyBilling.isComingSoon is false

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Monthly billing > Coming soon > should show is coming soon message if monthly billing coming soon

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Monthly billing > Coming soon > should not show is coming soon message if monthly billing is not coming soon

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7

Check failure on line 60 in packages/manager/apps/pci-kubernetes/src/components/create/BillingStep.component.tsx

View workflow job for this annotation

GitHub Actions / test

src/components/create/BillingStep.spec.tsx > BillingStep > Warn message > should show warn message if it's enabled

Error: [vitest] No "useProjectUrl" export is defined on the "@ovh-ux/manager-react-components" mock. Did you forget to return it from "vi.mock"? If you need to partially mock a module, you can use "importOriginal" helper inside: vi.mock("@ovh-ux/manager-react-components", async (importOriginal) => { const actual = await importOriginal() return { ...actual, // your mocked methods } }) ❯ BillingStep src/components/create/BillingStep.component.tsx:60:22 ❯ renderWithHooks ../../../../node_modules/react-dom/cjs/react-dom.development.js:16305:18 ❯ mountIndeterminateComponent ../../../../node_modules/react-dom/cjs/react-dom.development.js:20074:13 ❯ beginWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:21587:16 ❯ beginWork$1 ../../../../node_modules/react-dom/cjs/react-dom.development.js:27426:14 ❯ performUnitOfWork ../../../../node_modules/react-dom/cjs/react-dom.development.js:26560:12 ❯ workLoopSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26466:5 ❯ renderRootSync ../../../../node_modules/react-dom/cjs/react-dom.development.js:26434:7
const savingsPlanUrl = `${projectURL}/savings-plan`;

return (
<>
<div className="mb-6">
Expand Down Expand Up @@ -100,24 +108,20 @@ export default function BillingStep(props: TBillingStepProps): JSX.Element {
color={ODS_THEME_COLOR_INTENT.info}
>
<div className="flex flex-col">
<OsdsText
level={ODS_THEME_TYPOGRAPHY_LEVEL.heading}
size={ODS_THEME_TYPOGRAPHY_SIZE._400}
color={ODS_THEME_COLOR_INTENT.text}
>
{t(
'kubernetes_add_billing_anti_affinity_coming_soon_message_title',
)}
</OsdsText>
<OsdsText
level={ODS_THEME_TYPOGRAPHY_LEVEL.body}
size={ODS_THEME_TYPOGRAPHY_SIZE._400}
color={ODS_THEME_COLOR_INTENT.text}
>
{t(
'kubernetes_add_billing_anti_affinity_coming_soon_message_description',
)}
{t('kubernetes_add_billing_savings_plan_banner')}
</OsdsText>
<OsdsLink
className="mt-2"
color={ODS_THEME_COLOR_INTENT.primary}
href={savingsPlanUrl}
>
{t('kubernetes_add_billing_savings_plan_cta')}
</OsdsLink>
</div>
</OsdsMessage>
) : (
Expand Down

0 comments on commit 78e18dc

Please sign in to comment.