Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(cyclops-cs): show compute pricing on usage page (#7262)

r33drichards615de680f6e6
diff --git a/libs/fleet/e2e/billing.spec.ts b/libs/fleet/e2e/billing.spec.ts
index aa77e4b20b..eaccd81359 100644
--- a/libs/fleet/e2e/billing.spec.ts
+++ b/libs/fleet/e2e/billing.spec.ts
@@ -62,6 +62,9 @@ test("usage shows reserved resources and calculated cost by pool", async ({ page
await mockResourceUsage(page);
await page.goto("/usage");
await expect(page.getByRole("button", { name: "Usage history range Last 24 hours" })).toBeVisible();
+ const pricing = page.locator(".usage-pricing");
+ await expect(pricing.getByText("CPU: $0.044625/vCPU/hour")).toBeVisible();
+ await expect(pricing.getByText("Memory: $0.0223125/GB/hour")).toBeVisible();
await expect(page.getByText("Cost", { exact: true }).first()).toBeVisible();
const summary = page.getByLabel("Usage summary");
await expect(summary.getByText("$43.51")).toBeVisible();
@@ -83,6 +86,9 @@ test("usage cost uses pricing returned by api config", async ({ page }) => {
});
await mockResourceUsage(page);
await page.goto("/usage");
+ const pricing = page.locator(".usage-pricing");
+ await expect(pricing.getByText("CPU: $0.1/vCPU/hour")).toBeVisible();
+ await expect(pricing.getByText("Memory: $0.2/GB/hour")).toBeVisible();
await expect(page.getByLabel("Usage summary").getByText("$291.00")).toBeVisible();
await expect(page.getByRole("cell", { name: "$216.00" })).toBeVisible();
});
diff --git a/libs/fleet/src/pages/BillingUsage.css b/libs/fleet/src/pages/BillingUsage.css
index 24926b11c2..0ebcb6e6d0 100644
--- a/libs/fleet/src/pages/BillingUsage.css
+++ b/libs/fleet/src/pages/BillingUsage.css
@@ -3,6 +3,14 @@
gap: 20px;
}
+.usage-pricing {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 4px 18px;
+ color: var(--cua-color-text-body, rgba(224, 230, 238, 0.84));
+ font-variant-numeric: tabular-nums;
+}
+
.usage-admin {
display: grid;
gap: 8px;
diff --git a/libs/fleet/src/pages/BillingUsage.tsx b/libs/fleet/src/pages/BillingUsage.tsx
index 14a34ab4c9..f3e32954b3 100644
--- a/libs/fleet/src/pages/BillingUsage.tsx
+++ b/libs/fleet/src/pages/BillingUsage.tsx
@@ -30,6 +30,12 @@ const moneyFormatter = new Intl.NumberFormat(undefined, {
minimumFractionDigits: 2,
maximumFractionDigits: 2,
})
+const rateFormatter = new Intl.NumberFormat("en-US", {
+ style: "currency",
+ currency: "USD",
+ minimumFractionDigits: 0,
+ maximumFractionDigits: 7,
+})
const resourceFormatter = new Intl.NumberFormat(undefined, {
maximumFractionDigits: 2,
})
@@ -159,6 +165,13 @@ export function BillingUsagePage() {
<PageShell
eyebrow="Billing"
title="Usage"
+ description={
+ <span className="usage-pricing">
+ <strong>Pricing:</strong>
+ <span>CPU: {rateFormatter.format(usagePricing.vcpuHourUSD)}/vCPU/hour</span>
+ <span>Memory: {rateFormatter.format(usagePricing.memoryGiBHourUSD)}/GB/hour</span>
+ </span>
+ }
actions={
<Select
ariaLabel="Usage history range"