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]

refactor(ui): colocate the policies view, keeping PolicySelector shared (#32720)

ryan-crabbe-berri2a12707372e0
diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.json
index 1c15d51d6b6..200e1175c7f 100644
--- a/ui/litellm-dashboard/eslint-suppressions.json
+++ b/ui/litellm-dashboard/eslint-suppressions.json
@@ -2080,7 +2080,7 @@
"count": 1
}
},
- "src/components/policies/add_attachment_form.tsx": {
+ "src/app/(dashboard)/policies/_components/add_attachment_form.tsx": {
"no-restricted-imports": {
"count": 1
},
@@ -2088,7 +2088,7 @@
"count": 1
}
},
- "src/components/policies/add_policy_form.tsx": {
+ "src/app/(dashboard)/policies/_components/add_policy_form.tsx": {
"no-restricted-imports": {
"count": 1
},
@@ -2099,7 +2099,7 @@
"count": 1
}
},
- "src/components/policies/ai_suggestion_modal.tsx": {
+ "src/app/(dashboard)/policies/_components/ai_suggestion_modal.tsx": {
"no-nested-ternary": {
"count": 10
},
@@ -2110,12 +2110,12 @@
"count": 1
}
},
- "src/components/policies/attachment_table.test.tsx": {
+ "src/app/(dashboard)/policies/_components/attachment_table.test.tsx": {
"react/display-name": {
"count": 1
}
},
- "src/components/policies/attachment_table.tsx": {
+ "src/app/(dashboard)/policies/_components/attachment_table.tsx": {
"no-nested-ternary": {
"count": 1
},
@@ -2123,7 +2123,7 @@
"count": 1
}
},
- "src/components/policies/guardrail_selection_modal.tsx": {
+ "src/app/(dashboard)/policies/_components/guardrail_selection_modal.tsx": {
"no-nested-ternary": {
"count": 1
},
@@ -2131,12 +2131,12 @@
"count": 1
}
},
- "src/components/policies/impact_popover.test.tsx": {
+ "src/app/(dashboard)/policies/_components/impact_popover.test.tsx": {
"react/display-name": {
"count": 1
}
},
- "src/components/policies/impact_popover.tsx": {
+ "src/app/(dashboard)/policies/_components/impact_popover.tsx": {
"no-nested-ternary": {
"count": 1
},
@@ -2144,12 +2144,12 @@
"count": 1
}
},
- "src/components/policies/index.test.tsx": {
+ "src/app/(dashboard)/policies/_components/index.test.tsx": {
"react/display-name": {
"count": 1
}
},
- "src/components/policies/index.tsx": {
+ "src/app/(dashboard)/policies/_components/index.tsx": {
"no-restricted-imports": {
"count": 1
},
@@ -2157,7 +2157,7 @@
"count": 1
}
},
- "src/components/policies/pipeline_flow_builder.tsx": {
+ "src/app/(dashboard)/policies/_components/pipeline_flow_builder.tsx": {
"no-nested-ternary": {
"count": 1
},
@@ -2168,7 +2168,7 @@
"count": 2
}
},
- "src/components/policies/policy_info.tsx": {
+ "src/app/(dashboard)/policies/_components/policy_info.tsx": {
"no-restricted-imports": {
"count": 1
},
@@ -2176,12 +2176,12 @@
"count": 1
}
},
- "src/components/policies/policy_table.test.tsx": {
+ "src/app/(dashboard)/policies/_components/policy_table.test.tsx": {
"react/display-name": {
"count": 1
}
},
- "src/components/policies/policy_table.tsx": {
+ "src/app/(dashboard)/policies/_components/policy_table.tsx": {
"no-nested-ternary": {
"count": 2
},
@@ -2189,7 +2189,7 @@
"count": 1
}
},
- "src/components/policies/policy_test_panel.tsx": {
+ "src/app/(dashboard)/policies/_components/policy_test_panel.tsx": {
"no-restricted-imports": {
"count": 1
},
@@ -2197,7 +2197,7 @@
"count": 1
}
},
- "src/components/policies/template_parameter_modal.tsx": {
+ "src/app/(dashboard)/policies/_components/template_parameter_modal.tsx": {
"no-restricted-imports": {
"count": 1
},
diff --git a/ui/litellm-dashboard/src/components/policies/add_attachment_form.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.test.tsx
similarity index 96%
rename from ui/litellm-dashboard/src/components/policies/add_attachment_form.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.test.tsx
index adbbb1b6997..6788e97d25d 100644
--- a/ui/litellm-dashboard/src/components/policies/add_attachment_form.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.test.tsx
@@ -1,15 +1,15 @@
import React from "react";
import { screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
-import * as networking from "../networking";
+import * as networking from "@/components/networking";
import AddAttachmentForm from "./add_attachment_form";
-import { Policy } from "./types";
+import { Policy } from "@/components/policies/types";
-vi.mock("../networking");
+vi.mock("@/components/networking");
-vi.mock("../molecules/notifications_manager", () => ({
+vi.mock("@/components/molecules/notifications_manager", () => ({
default: { success: vi.fn(), fromBackend: vi.fn(), error: vi.fn(), info: vi.fn() },
}));
diff --git a/ui/litellm-dashboard/src/components/policies/add_attachment_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx
similarity index 98%
rename from ui/litellm-dashboard/src/components/policies/add_attachment_form.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx
index dd4d07b3f35..57203e9ccce 100644
--- a/ui/litellm-dashboard/src/components/policies/add_attachment_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_attachment_form.tsx
@@ -1,9 +1,9 @@
import React, { useState, useEffect } from "react";
import { Modal, Form, Select, Radio, Divider, Typography } from "antd";
import { Button } from "@tremor/react";
-import { Policy } from "./types";
-import { teamListCall, keyListCall, modelAvailableCall, estimateAttachmentImpactCall } from "../networking";
-import NotificationsManager from "../molecules/notifications_manager";
+import { Policy } from "@/components/policies/types";
+import { teamListCall, keyListCall, modelAvailableCall, estimateAttachmentImpactCall } from "@/components/networking";
+import NotificationsManager from "@/components/molecules/notifications_manager";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
import { buildAttachmentData } from "./build_attachment_data";
import { getInvalidTeamEntries } from "./scope_validation";
diff --git a/ui/litellm-dashboard/src/components/policies/add_policy_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_policy_form.tsx
similarity index 98%
rename from ui/litellm-dashboard/src/components/policies/add_policy_form.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_policy_form.tsx
index 744f77c74a7..8da2d3af36f 100644
--- a/ui/litellm-dashboard/src/components/policies/add_policy_form.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/add_policy_form.tsx
@@ -1,10 +1,10 @@
import React, { useState, useEffect } from "react";
import { Form, Select, Modal, Divider, Typography, Tag, Alert, Radio } from "antd";
import { Button, TextInput, Textarea } from "@tremor/react";
-import { Policy, PolicyCreateRequest, PolicyUpdateRequest } from "./types";
-import { Guardrail } from "../guardrails/types";
-import { getResolvedGuardrails, modelAvailableCall } from "../networking";
-import NotificationsManager from "../molecules/notifications_manager";
+import { Policy, PolicyCreateRequest, PolicyUpdateRequest } from "@/components/policies/types";
+import { Guardrail } from "@/components/guardrails/types";
+import { getResolvedGuardrails, modelAvailableCall } from "@/components/networking";
+import NotificationsManager from "@/components/molecules/notifications_manager";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
const { Text } = Typography;
diff --git a/ui/litellm-dashboard/src/components/policies/ai_suggestion_modal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/ai_suggestion_modal.tsx
similarity index 99%
rename from ui/litellm-dashboard/src/components/policies/ai_suggestion_modal.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/ai_suggestion_modal.tsx
index 3727db4d9cf..34204624702 100644
--- a/ui/litellm-dashboard/src/components/policies/ai_suggestion_modal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/ai_suggestion_modal.tsx
@@ -8,7 +8,12 @@ import {
DownOutlined,
RightOutlined,
} from "@ant-design/icons";
-import { suggestPolicyTemplates, modelHubCall, testPolicyTemplate, enrichPolicyTemplateStream } from "../networking";
+import {
+ suggestPolicyTemplates,
+ modelHubCall,
+ testPolicyTemplate,
+ enrichPolicyTemplateStream,
+} from "@/components/networking";
const { TextArea } = Input;
const { Text } = Typography;
diff --git a/ui/litellm-dashboard/src/components/policies/attachment_table.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.test.tsx
similarity index 98%
rename from ui/litellm-dashboard/src/components/policies/attachment_table.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.test.tsx
index 0cfd4e41e0a..c53881e5cce 100644
--- a/ui/litellm-dashboard/src/components/policies/attachment_table.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.test.tsx
@@ -1,10 +1,10 @@
import React from "react";
import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
import AttachmentTable from "./attachment_table";
-import { PolicyAttachment } from "./types";
+import { PolicyAttachment } from "@/components/policies/types";
vi.mock("./impact_popover", () => ({
default: () => <button aria-label="View blast radius" />,
diff --git a/ui/litellm-dashboard/src/components/policies/attachment_table.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.tsx
similarity index 99%
rename from ui/litellm-dashboard/src/components/policies/attachment_table.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.tsx
index fa482552fd5..b0328b3d7ad 100644
--- a/ui/litellm-dashboard/src/components/policies/attachment_table.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.tsx
@@ -11,7 +11,7 @@ import {
useReactTable,
} from "@tanstack/react-table";
import { DateCell, IdCell } from "@/components/shared/table_cells";
-import { PolicyAttachment } from "./types";
+import { PolicyAttachment } from "@/components/policies/types";
import ImpactPopover from "./impact_popover";
interface AttachmentTableProps {
diff --git a/ui/litellm-dashboard/src/components/policies/build_attachment_data.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/build_attachment_data.test.ts
similarity index 100%
rename from ui/litellm-dashboard/src/components/policies/build_attachment_data.test.ts
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/build_attachment_data.test.ts
diff --git a/ui/litellm-dashboard/src/components/policies/build_attachment_data.ts b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/build_attachment_data.ts
similarity index 92%
rename from ui/litellm-dashboard/src/components/policies/build_attachment_data.ts
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/build_attachment_data.ts
index 01724661227..fe994a480ee 100644
--- a/ui/litellm-dashboard/src/components/policies/build_attachment_data.ts
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/build_attachment_data.ts
@@ -1,4 +1,4 @@
-import { PolicyAttachmentCreateRequest } from "./types";
+import { PolicyAttachmentCreateRequest } from "@/components/policies/types";
/**
* Builds a PolicyAttachmentCreateRequest from form values.
diff --git a/ui/litellm-dashboard/src/components/policies/guardrail_selection_modal.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.test.tsx
similarity index 98%
rename from ui/litellm-dashboard/src/components/policies/guardrail_selection_modal.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.test.tsx
index e730de71e6b..4446933a929 100644
--- a/ui/litellm-dashboard/src/components/policies/guardrail_selection_modal.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.test.tsx
@@ -1,7 +1,7 @@
import React from "react";
import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
import GuardrailSelectionModal from "./guardrail_selection_modal";
diff --git a/ui/litellm-dashboard/src/components/policies/guardrail_selection_modal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.tsx
similarity index 100%
rename from ui/litellm-dashboard/src/components/policies/guardrail_selection_modal.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/guardrail_selection_modal.tsx
diff --git a/ui/litellm-dashboard/src/components/policies/impact_popover.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_popover.test.tsx
similarity index 97%
rename from ui/litellm-dashboard/src/components/policies/impact_popover.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_popover.test.tsx
index 4951fbc096a..ecd26b24936 100644
--- a/ui/litellm-dashboard/src/components/policies/impact_popover.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_popover.test.tsx
@@ -1,13 +1,13 @@
import React from "react";
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
-import * as networking from "../networking";
+import * as networking from "@/components/networking";
import ImpactPopover from "./impact_popover";
-import { PolicyAttachment } from "./types";
+import { PolicyAttachment } from "@/components/policies/types";
-vi.mock("../networking");
+vi.mock("@/components/networking");
vi.mock("@heroicons/react/outline", () => ({
EyeIcon: function EyeIcon() {
diff --git a/ui/litellm-dashboard/src/components/policies/impact_popover.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_popover.tsx
similarity index 95%
rename from ui/litellm-dashboard/src/components/policies/impact_popover.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_popover.tsx
index 632d1fab1c9..887e6a1c058 100644
--- a/ui/litellm-dashboard/src/components/policies/impact_popover.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_popover.tsx
@@ -2,8 +2,8 @@ import React, { useState } from "react";
import { Icon } from "@tremor/react";
import { EyeIcon } from "@heroicons/react/outline";
import { Tooltip, Tag, Popover, Spin } from "antd";
-import { PolicyAttachment } from "./types";
-import { estimateAttachmentImpactCall } from "../networking";
+import { PolicyAttachment } from "@/components/policies/types";
+import { estimateAttachmentImpactCall } from "@/components/networking";
const ImpactPopover: React.FC<{ attachment: PolicyAttachment; accessToken: string | null }> = ({
attachment,
diff --git a/ui/litellm-dashboard/src/components/policies/impact_preview_alert.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_preview_alert.test.tsx
similarity index 97%
rename from ui/litellm-dashboard/src/components/policies/impact_preview_alert.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_preview_alert.test.tsx
index b79ca7b5681..6c405d7492a 100644
--- a/ui/litellm-dashboard/src/components/policies/impact_preview_alert.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_preview_alert.test.tsx
@@ -1,5 +1,5 @@
import { screen } from "@testing-library/react";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { describe, expect, it } from "vitest";
import ImpactPreviewAlert from "./impact_preview_alert";
diff --git a/ui/litellm-dashboard/src/components/policies/impact_preview_alert.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_preview_alert.tsx
similarity index 100%
rename from ui/litellm-dashboard/src/components/policies/impact_preview_alert.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/impact_preview_alert.tsx
diff --git a/ui/litellm-dashboard/src/components/policies/index.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/index.test.tsx
similarity index 98%
rename from ui/litellm-dashboard/src/components/policies/index.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/index.test.tsx
index 16bf80eacb6..85d8c408032 100644
--- a/ui/litellm-dashboard/src/components/policies/index.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/index.test.tsx
@@ -1,7 +1,7 @@
import React from "react";
import { screen, waitFor, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
import PoliciesPanel from "./index";
@@ -48,7 +48,7 @@ const networkingMocks = vi.hoisted(() => ({
enrichPolicyTemplate: vi.fn(),
}));
-vi.mock("../networking", () => ({
+vi.mock("@/components/networking", () => ({
...networkingMocks,
}));
diff --git a/ui/litellm-dashboard/src/components/policies/index.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/index.tsx
similarity index 99%
rename from ui/litellm-dashboard/src/components/policies/index.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/index.tsx
index d5963b39d88..0545e2f86dc 100644
--- a/ui/litellm-dashboard/src/components/policies/index.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/index.tsx
@@ -28,10 +28,10 @@ import {
createPolicyAttachmentCall,
createGuardrailCall,
enrichPolicyTemplate,
-} from "../networking";
-import { Policy, PolicyAttachment } from "./types";
-import { Guardrail } from "../guardrails/types";
-import DeleteResourceModal from "../common_components/DeleteResourceModal";
+} from "@/components/networking";
+import { Policy, PolicyAttachment } from "@/components/policies/types";
+import { Guardrail } from "@/components/guardrails/types";
+import DeleteResourceModal from "@/components/common_components/DeleteResourceModal";
interface PoliciesPanelProps {
accessToken: string | null;
diff --git a/ui/litellm-dashboard/src/components/policies/pipeline_flow_builder.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/pipeline_flow_builder.tsx
similarity index 99%
rename from ui/litellm-dashboard/src/components/policies/pipeline_flow_builder.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/pipeline_flow_builder.tsx
index 70f66018574..5bfb657f4b7 100644
--- a/ui/litellm-dashboard/src/components/policies/pipeline_flow_builder.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/pipeline_flow_builder.tsx
@@ -11,12 +11,17 @@ import {
PolicyCreateRequest,
PolicyUpdateRequest,
Policy,
-} from "./types";
-import { Guardrail } from "../guardrails/types";
-import { testPipelineCall, listPolicyVersions, createPolicyVersion, updatePolicyVersionStatus } from "../networking";
-import NotificationsManager from "../molecules/notifications_manager";
-import { getComplianceDatasetPrompts, getFrameworks } from "../../data/compliancePrompts";
-import type { CompliancePrompt } from "../../data/compliancePrompts";
+} from "@/components/policies/types";
+import { Guardrail } from "@/components/guardrails/types";
+import {
+ testPipelineCall,
+ listPolicyVersions,
+ createPolicyVersion,
+ updatePolicyVersionStatus,
+} from "@/components/networking";
+import NotificationsManager from "@/components/molecules/notifications_manager";
+import { getComplianceDatasetPrompts, getFrameworks } from "@/data/compliancePrompts";
+import type { CompliancePrompt } from "@/data/compliancePrompts";
const TEST_SOURCE_QUICK = "quick_chat";
const TEST_SOURCE_ALL = "__all__";
diff --git a/ui/litellm-dashboard/src/components/policies/policy_info.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_info.test.tsx
similarity index 96%
rename from ui/litellm-dashboard/src/components/policies/policy_info.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_info.test.tsx
index 6e12a17f2c4..7fb06ba3aa7 100644
--- a/ui/litellm-dashboard/src/components/policies/policy_info.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_info.test.tsx
@@ -1,12 +1,12 @@
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
-import * as networking from "../networking";
+import * as networking from "@/components/networking";
import PolicyInfoView from "./policy_info";
-import { Policy } from "./types";
+import { Policy } from "@/components/policies/types";
-vi.mock("../networking");
+vi.mock("@/components/networking");
vi.mock("./pipeline_flow_builder", () => ({
PipelineInfoDisplay: () => <div data-testid="pipeline-info" />,
}));
diff --git a/ui/litellm-dashboard/src/components/policies/policy_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_info.tsx
similarity index 98%
rename from ui/litellm-dashboard/src/components/policies/policy_info.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_info.tsx
index a0ec5dd2b2a..50e359fb62d 100644
--- a/ui/litellm-dashboard/src/components/policies/policy_info.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_info.tsx
@@ -2,9 +2,9 @@ import React, { useState, useEffect, useCallback } from "react";
import { Card, Badge, Button } from "@tremor/react";
import { ArrowLeftIcon, PencilIcon } from "@heroicons/react/outline";
import { Descriptions, Tag, Spin, Divider, Typography, Alert } from "antd";
-import { Policy } from "./types";
+import { Policy } from "@/components/policies/types";
import { PipelineInfoDisplay } from "./pipeline_flow_builder";
-import { getResolvedGuardrails } from "../networking";
+import { getResolvedGuardrails } from "@/components/networking";
const { Title, Text } = Typography;
diff --git a/ui/litellm-dashboard/src/components/policies/policy_table.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_table.test.tsx
similarity index 98%
rename from ui/litellm-dashboard/src/components/policies/policy_table.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_table.test.tsx
index 2b84152e9be..934114f5405 100644
--- a/ui/litellm-dashboard/src/components/policies/policy_table.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_table.test.tsx
@@ -1,10 +1,10 @@
import React from "react";
import { screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
import PolicyTable from "./policy_table";
-import { Policy } from "./types";
+import { Policy } from "@/components/policies/types";
vi.mock("@heroicons/react/outline", () => ({
TrashIcon: function TrashIcon() {
diff --git a/ui/litellm-dashboard/src/components/policies/policy_table.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_table.tsx
similarity index 99%
rename from ui/litellm-dashboard/src/components/policies/policy_table.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_table.tsx
index 1716f5aea84..278773069e6 100644
--- a/ui/litellm-dashboard/src/components/policies/policy_table.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_table.tsx
@@ -11,7 +11,7 @@ import {
useReactTable,
} from "@tanstack/react-table";
import { DateCell } from "@/components/shared/table_cells";
-import { Policy } from "./types";
+import { Policy } from "@/components/policies/types";
/** One row per policy name; primaryPolicy is used for display and for Edit (FlowBuilder loads all versions) */
interface PolicyRow {
diff --git a/ui/litellm-dashboard/src/components/policies/policy_templates.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_templates.test.tsx
similarity index 97%
rename from ui/litellm-dashboard/src/components/policies/policy_templates.test.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_templates.test.tsx
index a783b34bf89..5b74f882f90 100644
--- a/ui/litellm-dashboard/src/components/policies/policy_templates.test.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_templates.test.tsx
@@ -1,12 +1,12 @@
import React from "react";
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { renderWithProviders } from "../../../tests/test-utils";
+import { renderWithProviders } from "@/../tests/test-utils";
import { beforeEach, describe, expect, it, vi } from "vitest";
-import * as networking from "../networking";
+import * as networking from "@/components/networking";
import PolicyTemplates from "./policy_templates";
-vi.mock("../networking");
+vi.mock("@/components/networking");
vi.mock("@heroicons/react/outline", () => ({
ShieldCheckIcon: function ShieldCheckIcon() {
diff --git a/ui/litellm-dashboard/src/components/policies/policy_templates.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_templates.tsx
similarity index 99%
rename from ui/litellm-dashboard/src/components/policies/policy_templates.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_templates.tsx
index 6b8d0f6007c..fd864f904ab 100644
--- a/ui/litellm-dashboard/src/components/policies/policy_templates.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_templates.tsx
@@ -8,7 +8,7 @@ import {
CurrencyDollarIcon,
CheckCircleIcon,
} from "@heroicons/react/outline";
-import { getPolicyTemplates } from "../networking";
+import { getPolicyTemplates } from "@/components/networking";
interface PolicyTemplateCardProps {
title: string;
diff --git a/ui/litellm-dashboard/src/components/policies/policy_test_panel.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_test_panel.tsx
similarity index 99%
rename from ui/litellm-dashboard/src/components/policies/policy_test_panel.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_test_panel.tsx
index 7e304bc3b0e..8b3d623655b 100644
--- a/ui/litellm-dashboard/src/components/policies/policy_test_panel.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/policy_test_panel.tsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from "react";
import { Form, Select, Alert, Tag, Empty, Typography } from "antd";
import { Button } from "@tremor/react";
-import { resolvePoliciesCall, teamListCall, keyListCall, modelAvailableCall } from "../networking";
+import { resolvePoliciesCall, teamListCall, keyListCall, modelAvailableCall } from "@/components/networking";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
const { Text } = Typography;
diff --git a/ui/litellm-dashboard/src/components/policies/scope_validation.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/scope_validation.test.ts
similarity index 100%
rename from ui/litellm-dashboard/src/components/policies/scope_validation.test.ts
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/scope_validation.test.ts
diff --git a/ui/litellm-dashboard/src/components/policies/scope_validation.ts b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/scope_validation.ts
similarity index 100%
rename from ui/litellm-dashboard/src/components/policies/scope_validation.ts
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/scope_validation.ts
diff --git a/ui/litellm-dashboard/src/components/policies/template_parameter_modal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/template_parameter_modal.tsx
similarity index 99%
rename from ui/litellm-dashboard/src/components/policies/template_parameter_modal.tsx
rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/template_parameter_modal.tsx
index 3f025e83536..600970c6a6b 100644
--- a/ui/litellm-dashboard/src/components/policies/template_parameter_modal.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/template_parameter_modal.tsx
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from "react";
import { Modal, Spin, Radio, Select } from "antd";
import { Button, TextInput } from "@tremor/react";
-import { modelHubCall, enrichPolicyTemplateStream } from "../networking";
+import { modelHubCall, enrichPolicyTemplateStream } from "@/components/networking";
interface TemplateParameter {
name: string;
diff --git a/ui/litellm-dashboard/src/app/(dashboard)/policies/page.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/page.tsx
index eb7840d8795..8dfa54701c9 100644
--- a/ui/litellm-dashboard/src/app/(dashboard)/policies/page.tsx
+++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/page.tsx
@@ -1,6 +1,6 @@
"use client";
-import PoliciesPanel from "@/components/policies";
+import PoliciesPanel from "./_components";
import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized";
export default function Policies() {