Skip to content

Commit ded2fbc

Browse files
authored
fix(organization): describe the budget's running-deployment switch as funding, not top-ups (#4552)
Users never see top-ups as a concept, since Console funds running deployments from the balance on its own. The budget dialog, the project panel and the alert email now say running deployments stay funded or stop being funded at the budget.
1 parent 66fbed7 commit ded2fbc

6 files changed

Lines changed: 27 additions & 25 deletions

File tree

‎apps/api/src/notifications/services/notification-templates/project-budget-alert-notification.spec.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ describe(projectBudgetAlertNotification.name, () => {
1414
expect(result.payload.summary).toBe("Project staging has committed 85% of its monthly budget");
1515
expect(result.payload.description).toBe(
1616
"Deposits committed for <strong>staging</strong> this month total <strong>$85.50</strong> of its <strong>$100.00</strong> monthly budget. " +
17-
"New deployments in this project are refused once a deposit would go past the budget. Its running deployments keep being topped up. " +
17+
"New deployments in this project are refused once a deposit would go past the budget. Its running deployments keep being funded. " +
1818
"An owner or admin can change the budget."
1919
);
2020
expect(result.payload.actions).toEqual([{ label: "View project", url: "https://console.akash.network/projects/project-1" }]);
2121
expect(result.user).toEqual({ id: "user-123", email: "user@example.com" });
2222
});
2323

24-
it("names the deposit that was not signed and says running deployments stop being topped up when that was chosen", () => {
24+
it("names the deposit that was not signed and says running deployments stop being funded when that was chosen", () => {
2525
const user = createUser({ id: "user-123" });
2626

2727
const result = projectBudgetAlertNotification(user, createVars({ committedUsd: 40, budgetUsd: 100, refusedUsd: 70, stopTopUps: true }));
@@ -30,8 +30,8 @@ describe(projectBudgetAlertNotification.name, () => {
3030
expect(result.payload.description).toContain(
3131
"monthly budget. A deposit of <strong>$70.00</strong> was not signed because it would have gone past the budget. New deployments"
3232
);
33-
expect(result.payload.description).toContain("Top-ups of its running deployments stop at the budget too.");
34-
expect(result.payload.description).not.toContain("keep being topped up");
33+
expect(result.payload.description).toContain("Its running deployments stop being funded at the budget too.");
34+
expect(result.payload.description).not.toContain("keep being funded");
3535
});
3636

3737
it("escapes the project name in the markup and keeps it plain in the summary, which the email layout escapes", () => {

‎apps/api/src/notifications/services/notification-templates/project-budget-alert-notification.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export function projectBudgetAlertNotification(user: UserOutput, vars: ProjectBu
2020
const percent = Math.floor((vars.committedUsd * 100) / vars.budgetUsd);
2121
const refusal =
2222
vars.refusedUsd > 0 ? ` A deposit of <strong>${formatter.format(vars.refusedUsd)}</strong> was not signed because it would have gone past the budget.` : "";
23-
const runningDeployments = vars.stopTopUps ? "Top-ups of its running deployments stop at the budget too." : "Its running deployments keep being topped up.";
23+
const runningDeployments = vars.stopTopUps ? "Its running deployments stop being funded at the budget too." : "Its running deployments keep being funded.";
2424

2525
return {
2626
notificationId: `projectBudgetAlert.${vars.projectId}.${vars.period}.${user.id}`,

‎apps/deploy-web/src/components/projects/ProjectBudgetDialog/ProjectBudgetDialog.spec.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { render, screen } from "@testing-library/react";
1010
import userEvent from "@testing-library/user-event";
1111

1212
describe(ProjectBudgetDialog.name, () => {
13-
it("sets a first budget with the default alert threshold and top-ups left running", async () => {
13+
it("sets a first budget with the default alert threshold and running deployments left funded", async () => {
1414
const { createBudget, onClose, enqueueSnackbar } = setup({ budget: null });
1515

1616
await userEvent.type(screen.getByLabelText("Monthly budget (USD)"), "750.5");
@@ -29,21 +29,21 @@ describe(ProjectBudgetDialog.name, () => {
2929
expect(screen.getByRole("heading", { name: "Set a monthly budget" })).toBeInTheDocument();
3030
expect(screen.getByText(/New deployments in storefront are refused once this month's deposits would pass the budget/)).toBeInTheDocument();
3131
expect(screen.getByText(/doesn't set money aside for the project or cap what running deployments use/)).toBeInTheDocument();
32-
expect(screen.getByText(/Running deployments can then run out of funds and close\. Off by default\./)).toBeInTheDocument();
32+
expect(screen.getByText(/Running deployments in this project normally stay funded past the budget/)).toBeInTheDocument();
3333
expect(screen.queryByRole("button", { name: "Remove budget" })).not.toBeInTheDocument();
3434
});
3535

36-
it("edits the existing budget, opting into stopping top-ups", async () => {
36+
it("edits the existing budget, opting into cutting off running deployments", async () => {
3737
const { updateBudget, createBudget } = setup({ budget: budget() });
3838

3939
expect(screen.getByRole("heading", { name: "Edit monthly budget" })).toBeInTheDocument();
4040
expect(screen.getByLabelText("Monthly budget (USD)")).toHaveValue("500");
4141
expect(screen.getByLabelText("Alert threshold (%)")).toHaveValue("90");
42-
expect(screen.getByRole("switch", { name: "Stop top-ups when over budget" })).not.toBeChecked();
42+
expect(screen.getByRole("switch", { name: "Stop funding running deployments at the budget" })).not.toBeChecked();
4343

4444
await userEvent.clear(screen.getByLabelText("Alert threshold (%)"));
4545
await userEvent.type(screen.getByLabelText("Alert threshold (%)"), "75");
46-
await userEvent.click(screen.getByRole("switch", { name: "Stop top-ups when over budget" }));
46+
await userEvent.click(screen.getByRole("switch", { name: "Stop funding running deployments at the budget" }));
4747
await userEvent.click(screen.getByRole("button", { name: "Save budget" }));
4848

4949
expect(updateBudget).toHaveBeenCalledWith({ id: "budget-1", data: { monthlyAmountUsd: 500, alertThresholdPercent: 75, stopTopUps: true } });

‎apps/deploy-web/src/components/projects/ProjectBudgetDialog/ProjectBudgetDialog.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ export function ProjectBudgetDialog({ projectId, projectName, budget, onClose, d
165165
<div className="flex items-start justify-between gap-4 rounded-lg border border-border px-3.5 py-3">
166166
<div className="space-y-1">
167167
<Label htmlFor={stopTopUpsId} className="text-[13px]">
168-
Stop top-ups when over budget
168+
Stop funding running deployments at the budget
169169
</Label>
170170
<p id={`${stopTopUpsId}-hint`} className="text-xs text-muted-foreground">
171-
Also refuse manual and automatic top-ups of this project&apos;s running deployments that would pass the budget. Running deployments can then
172-
run out of funds and close. Off by default.
171+
Running deployments in this project normally stay funded past the budget. Turn this on to cut them off at the budget too, so they can run out
172+
of funds and close.
173173
</p>
174174
</div>
175175
<Switch id={stopTopUpsId} checked={stopTopUps} aria-describedby={`${stopTopUpsId}-hint`} onCheckedChange={setStopTopUps} />

‎apps/deploy-web/src/components/projects/ProjectBudgetPanel/ProjectBudgetPanel.spec.tsx‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,16 @@ describe(ProjectBudgetPanel.name, () => {
107107
expect(screen.queryByRole("status")).not.toBeInTheDocument();
108108
});
109109

110-
it("says whether top-ups stop at the budget", () => {
110+
it("says when running deployments stop being funded at the budget", () => {
111111
setup({ budget: budget({ stopTopUps: true }) });
112112

113-
expect(screen.getByText("Top-ups stop at the budget.")).toBeInTheDocument();
113+
expect(screen.getByText("Running deployments stop being funded at the budget.")).toBeInTheDocument();
114114
});
115115

116-
it("says top-ups continue past the budget by default", () => {
116+
it("says running deployments stay funded past the budget by default", () => {
117117
setup({ budget: budget({ stopTopUps: false }) });
118118

119-
expect(screen.getByText("Top-ups continue past the budget.")).toBeInTheDocument();
119+
expect(screen.getByText("Running deployments stay funded past the budget.")).toBeInTheDocument();
120120
});
121121

122122
it("lets an owner set a budget for a project without one", async () => {
@@ -170,7 +170,7 @@ describe(ProjectBudgetPanel.name, () => {
170170
expect(screen.getByText("$9.00")).toBeInTheDocument();
171171
expect(screen.queryByText(/monthly budget/)).not.toBeInTheDocument();
172172
expect(screen.queryByRole("progressbar")).not.toBeInTheDocument();
173-
expect(screen.queryByText(/Top-ups/)).not.toBeInTheDocument();
173+
expect(screen.queryByText(/^Running deployments/)).not.toBeInTheDocument();
174174
});
175175

176176
it("does not mistake another member's admin grant for the caller's", () => {
@@ -198,25 +198,25 @@ describe(ProjectBudgetPanel.name, () => {
198198

199199
expect(
200200
screen.getByText(
201-
"A budget limits new deposits into this project each month and doesn't set money aside. Running deployments keep their funding unless top-ups stop at the budget."
201+
"A budget limits new deposits into this project each month and doesn't set money aside. Running deployments keep their funding unless the budget is set to cut them off."
202202
)
203203
).toBeInTheDocument();
204204
});
205205

206-
it("warns that running deployments can run out of funds once top-ups stop at the budget", () => {
206+
it("warns that running deployments can run out of funds once they stop being funded at the budget", () => {
207207
setup({ budget: budget({ stopTopUps: true }) });
208208

209209
expect(
210210
screen.getByText(
211-
"A budget limits new deposits into this project each month and doesn't set money aside. Top-ups stop at the budget, so running deployments can run out of funds and close."
211+
"A budget limits new deposits into this project each month and doesn't set money aside. Running deployments stop being funded at the budget too, so they can run out of funds and close."
212212
)
213213
).toBeInTheDocument();
214214
});
215215

216216
it("keeps the default footnote for a project without a budget", () => {
217217
setup({ budget: null });
218218

219-
expect(screen.getByText(/Running deployments keep their funding unless top-ups stop at the budget\./)).toBeInTheDocument();
219+
expect(screen.getByText(/Running deployments keep their funding unless the budget is set to cut them off\./)).toBeInTheDocument();
220220
});
221221

222222
function setup(input: {

‎apps/deploy-web/src/components/projects/ProjectBudgetPanel/ProjectBudgetPanel.tsx‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ export function ProjectBudgetPanel({ projectId, projectName, dependencies: d = D
7474
<p className="border-t border-border bg-muted/40 px-4 py-2.5 text-xs text-muted-foreground">
7575
A budget limits new deposits into this project each month and doesn&apos;t set money aside.{" "}
7676
{budget?.stopTopUps
77-
? "Top-ups stop at the budget, so running deployments can run out of funds and close."
78-
: "Running deployments keep their funding unless top-ups stop at the budget."}
77+
? "Running deployments stop being funded at the budget too, so they can run out of funds and close."
78+
: "Running deployments keep their funding unless the budget is set to cut them off."}
7979
</p>
8080
</div>
8181

@@ -142,7 +142,9 @@ function BudgetSettings({ budget, canManage, onEdit }: { budget: ProjectBudget |
142142

143143
return (
144144
<div className="flex items-center justify-between gap-3 border-t border-border px-4 py-3">
145-
<span className="text-xs text-muted-foreground">{budget.stopTopUps ? "Top-ups stop at the budget." : "Top-ups continue past the budget."}</span>
145+
<span className="text-xs text-muted-foreground">
146+
{budget.stopTopUps ? "Running deployments stop being funded at the budget." : "Running deployments stay funded past the budget."}
147+
</span>
146148
{canManage && (
147149
<Button variant="outline" size="sm" className="text-xs" onClick={onEdit}>
148150
Edit budget

0 commit comments

Comments
 (0)