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

Update plans to Development/Production/Enterprise without deploy-api code changes #953

Merged
merged 3 commits into from
Oct 16, 2024
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
8 changes: 4 additions & 4 deletions src/app/test/no-payment-found.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe("Payment page takeover", () => {
{
...testPlan,
id: fixedIdForTests,
name: "growth",
name: "development",
},
testEnterprisePlan,
],
Expand All @@ -90,13 +90,13 @@ describe("Payment page takeover", () => {
render(<App />);

await screen.findByText(/Choose a Plan/);
await screen.findByText(/Growth/);
await screen.findByText(/Development/);
const el = await screen.findAllByRole("button", {
name: /Select Plan/,
});

fireEvent.click(el[0]);
await screen.findByText(/Successfully updated plan to Growth/);
await screen.findByText(/Successfully updated plan to Development/);
});
});

Expand Down Expand Up @@ -162,7 +162,7 @@ describe("Payment page takeover", () => {
{
...testPlan,
id: fixedIdForTests,
name: "growth",
name: "development",
},
testEnterprisePlan,
],
Expand Down
2 changes: 2 additions & 0 deletions src/deploy/plan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ export const selectPlansForView = createSelector(
const init: Record<PlanName, DeployPlan> = {
none: defaultPlan({ name: "none" }),
starter: defaultPlan({ name: "starter" }),
development: defaultPlan({ name: "development" }),
growth: defaultPlan({ name: "growth" }),
scale: defaultPlan({ name: "scale" }),
production: defaultPlan({ name: "production" }),
enterprise: defaultPlan({ name: "enterprise" }),
};
return plans.reduce((acc, plan) => {
Expand Down
2 changes: 1 addition & 1 deletion src/mocks/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ export const testEnterprisePlan = defaultPlanResponse({

export const testActivePlan = defaultActivePlanResponse({
id: createId(),
available_plans: ["growth", "scale"],
available_plans: ["development", "production"],
organization_id: testOrg.id,
_links: {
organization: defaultHalHref(
Expand Down
2 changes: 1 addition & 1 deletion src/schema/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ export const defaultActivePlan = (
return {
id: "",
automatedBackupLimitPerDb: 0,
availablePlans: ["starter", "growth", "scale"],
availablePlans: ["starter", "development", "growth", "scale", "production"],
complianceDashboardAccess: false,
containerMemoryLimit: 0,
costCents: 0,
Expand Down
9 changes: 8 additions & 1 deletion src/types/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,14 @@ export interface DeployPrereleaseCommand extends Timestamps {
index: number;
}

export type PlanName = "starter" | "growth" | "scale" | "enterprise" | "none";
export type PlanName =
| "starter"
| "development"
| "growth"
| "scale"
| "production"
| "enterprise"
| "none";
export interface DeployPlan extends Timestamps {
id: string;
automatedBackupLimitPerDb: number;
Expand Down
11 changes: 7 additions & 4 deletions src/ui/pages/create-stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ export const CreateStackPage = () => {
);
// must have a non-starter active plan or,
// an empty active plan (empty active plan means legacy enterprise)
const canRequestStack = ["growth", "scale", "enterprise"].includes(
selectedPlan.name,
);
const canRequestStack = [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we might consider moving this logic to deploy-api in the future.

"growth",
"scale",
"production",
"enterprise",
].includes(selectedPlan.name);

const [stackName, setStackName] = useState("");
const [region, setRegion] = useState("none");
Expand Down Expand Up @@ -193,7 +196,7 @@ export const CreateStackPage = () => {
{selectedPlan.id === "" || canRequestStack ? null : (
<Banner variant="info">
Dedicated stacks are only available for{" "}
<strong>Growth, Scale, and Enterprise</strong> plans &mdash;{" "}
<strong>Production and Enterprise</strong> plans &mdash;{" "}
<Link to={plansUrl()}>Upgrade your plan for access.</Link>
</Banner>
)}
Expand Down
8 changes: 4 additions & 4 deletions src/ui/pages/plans.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const setupActionablePlanResponses = (extra: RestHandler[] = []) => {
{
...testPlan,
id: fixedIdForTests,
name: "growth",
name: "development",
},
testEnterprisePlan,
],
Expand Down Expand Up @@ -100,7 +100,7 @@ describe("Plans page", () => {
);
setupActionablePlanResponses();
await screen.findByText("Choose a Plan");
await screen.findByText("Growth");
await screen.findByText("Development");

const errText = screen.queryByText(
"Unable to load plan data to allow for selection.",
Expand All @@ -112,7 +112,7 @@ describe("Plans page", () => {
});

fireEvent.click(el[0]);
await screen.findByText(/Successfully updated plan to Growth/);
await screen.findByText(/Successfully updated plan to Development/);
});

it("the plans page is visible, renders with plans found, but errors when user selects", async () => {
Expand All @@ -127,7 +127,7 @@ describe("Plans page", () => {
);

await screen.findByText("Choose a Plan");
await screen.findByText("Growth");
await screen.findByText("Development");

const el = await screen.findAllByRole("button", {
name: /Select Plan/,
Expand Down
Loading
Loading