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: Kube checkout bar copy #9615

Merged
merged 3 commits into from
Aug 31, 2023
Merged
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
7 changes: 3 additions & 4 deletions packages/manager/src/components/CheckoutBar/CheckoutBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ interface CheckoutBarProps {
isMakingRequest?: boolean;
onDeploy: () => void;
priceHelperText?: string;
priceSelectionText?: string;
submitText?: string;
}

Expand All @@ -35,6 +36,7 @@ const CheckoutBar = (props: CheckoutBarProps) => {
isMakingRequest,
onDeploy,
priceHelperText,
priceSelectionText,
submitText,
} = props;

Expand All @@ -61,10 +63,7 @@ const CheckoutBar = (props: CheckoutBarProps) => {
{price ? (
<DisplayPrice interval="mo" price={price} />
) : (
<Typography>
Select a Region and add a Node Pool to view pricing and create a
cluster.
</Typography>
<Typography>{priceSelectionText}</Typography>
)}
{priceHelperText && price > 0 && (
<Typography
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { waitForElementToBeRemoved } from '@testing-library/react';
import * as React from 'react';

import { nodePoolFactory } from 'src/factories/kubernetesCluster';
import { LKE_HA_PRICE } from 'src/utilities/pricing/constants';
import {
LKE_CREATE_CLUSTER_CHECKOUT,
LKE_HA_PRICE,
} from 'src/utilities/pricing/constants';
import { renderWithTheme } from 'src/utilities/testHelpers';

import KubeCheckoutBar, { Props } from './KubeCheckoutBar';
Expand All @@ -27,19 +30,14 @@ const renderComponent = (_props: Props) =>
renderWithTheme(<KubeCheckoutBar {..._props} />);

describe('KubeCheckoutBar', () => {
it('with DC-specific pricing feature flag, should render helper text and disable create button until a region has been selected', async () => {
it('should render helper text and disable create button until a region has been selected', async () => {
const { findByText, getByTestId, getByText } = renderWithTheme(
<KubeCheckoutBar {...props} region="" />,
{
flags: { dcSpecificPricing: true },
}
<KubeCheckoutBar {...props} region="" />
);

await waitForElementToBeRemoved(getByTestId('circle-progress'));

await findByText(
'Select a Region and add a Node Pool to view pricing and create a cluster.'
);
await findByText(LKE_CREATE_CLUSTER_CHECKOUT);
expect(getByText('Create Cluster').closest('button')).toBeDisabled();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { isEURegion } from 'src/utilities/formatRegion';

import { getTotalClusterPrice, nodeWarning } from '../kubeUtils';
import NodePoolSummary from './NodePoolSummary';
import { LKE_CREATE_CLUSTER_CHECKOUT } from 'src/utilities/pricing/constants';

export interface Props {
createCluster: () => void;
Expand Down Expand Up @@ -96,6 +97,7 @@ export const KubeCheckoutBar: React.FC<Props> = (props) => {
)
: undefined
}
priceSelectionText={LKE_CREATE_CLUSTER_CHECKOUT}
data-qa-checkout-bar
disabled={disableCheckout}
heading="Cluster Summary"
Expand Down
3 changes: 3 additions & 0 deletions packages/manager/src/utilities/pricing/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
export const NODEBALANCER_PRICE = 10;

export const LKE_HA_PRICE = 60;

export const LKE_CREATE_CLUSTER_CHECKOUT =
'Select a Region, HA choice, and add a Node Pool to view pricing and create a cluster.';