Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Polish Reset Spend button and modal

yuneng-jiang5b2110ddb564
diff --git a/ui/litellm-dashboard/src/components/templates/KeyInfoHeader.tsx b/ui/litellm-dashboard/src/components/templates/KeyInfoHeader.tsx
index c750b1b4ac7..93ebae9c4be 100644
--- a/ui/litellm-dashboard/src/components/templates/KeyInfoHeader.tsx
+++ b/ui/litellm-dashboard/src/components/templates/KeyInfoHeader.tsx
@@ -80,11 +80,6 @@ export function KeyInfoHeader({
</div>
{canModifyKey && (
<Space>
- {onResetSpend && (
- <Button danger icon={<TransactionOutlined />} onClick={onResetSpend}>
- Reset Spend
- </Button>
- )}
<Tooltip title={regenerateTooltip || ""}>
<span>
<Button icon={<SyncOutlined />} onClick={onRegenerate} disabled={regenerateDisabled}>
@@ -92,6 +87,11 @@ export function KeyInfoHeader({
</Button>
</span>
</Tooltip>
+ {onResetSpend && (
+ <Button danger icon={<TransactionOutlined />} onClick={onResetSpend}>
+ Reset Spend
+ </Button>
+ )}
<Button danger icon={<DeleteOutlined />} onClick={onDelete}>
Delete Key
</Button>
diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.test.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.test.tsx
index c19866e5d84..f269ad96a27 100644
--- a/ui/litellm-dashboard/src/components/templates/key_info_view.test.tsx
+++ b/ui/litellm-dashboard/src/components/templates/key_info_view.test.tsx
@@ -642,7 +642,7 @@ describe("KeyInfoView", () => {
await waitFor(() => {
expect(screen.getByText("Reset Key Spend")).toBeInTheDocument();
- expect(screen.getByText(/reset to \$0/i)).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: /^reset$/i })).toBeInTheDocument();
});
});
@@ -670,7 +670,7 @@ describe("KeyInfoView", () => {
});
// Click the confirm button in the modal
- await userEvent.click(screen.getByRole("button", { name: /reset to \$0/i }));
+ await userEvent.click(screen.getByRole("button", { name: /^reset$/i }));
await waitFor(() => {
expect(mockResetKeySpendMutate).toHaveBeenCalledWith(
diff --git a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
index b77b13b1591..6733cd6a595 100644
--- a/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
+++ b/ui/litellm-dashboard/src/components/templates/key_info_view.tsx
@@ -442,7 +442,8 @@ export default function KeyInfoView({
open={isResetSpendModalOpen}
onOk={handleResetSpend}
onCancel={() => setIsResetSpendModalOpen(false)}
- okText="Reset to $0"
+ okText="Reset"
+ okButtonProps={{ danger: true }}
confirmLoading={resetSpendLoading}
>
<p>