From 77a30a120c8fa9237bc0421d1edc57ac128f4fef Mon Sep 17 00:00:00 2001 From: ryan-crabbe-berri Date: Fri, 10 Jul 2026 10:57:12 -0700 Subject: [PATCH] refactor(ui): colocate agents and guardrails views, keeping shared selectors and types (#32728) * refactor(ui): colocate agents and guardrails views, keeping shared selectors and types The last two group-1 colocation splits. Both are file-plus-folder combos: the page view is a top-level file (agents.tsx / guardrails.tsx) sitting beside a supporting folder of the same name, and part of that folder is shared. agents: agents/types (imported by the agents hook) stays in @/components/agents; agents.tsx and the rest of the agents/ folder move into agents/_components (the view file becomes _components/index.tsx). guardrails: GuardrailSelector (imported by the Playground, the key edit view, and the agents add-guardrail form) and types stay in @/components/guardrails; guardrails.tsx and the other 47 folder files (including the tool_permission, custom_code, content_filter, and llm_judge subfolders) move into guardrails/_components. Moved files' imports of the retained shared files become @/components paths, other escaping relative imports are absolutized against @/, and moved test files have their from/vi.mock/vi.importActual paths rewritten to match. Lint suppressions are re-keyed for moved files only (the staying selector/types keep their src/components keys). The shared selectors did not move, so their external consumers are untouched. No behavior change. * fix(ui): move the orphaned agents/guardrails view tests and drop dead GuardrailItem Greptile follow-ups on the agents/guardrails colocation: - agents.tsx and guardrails.tsx moved to their _components/index.tsx, but their sibling test files (src/components/agents.test.tsx, guardrails.test.tsx) were left behind still importing ./agents and ./guardrails, which broke a full vitest run. Move them to the matching _components/index.test.tsx and rewrite their view import to ./index, folder mocks to local ./ siblings, and networking to @/components/networking. - Remove the unused GuardrailItem interface and its GuardrailDefinitionLocation import from the guardrails view (dead code carried over from before the move; state is typed as Guardrail[]). --- ui/litellm-dashboard/eslint-metrics.json | 2 +- ui/litellm-dashboard/eslint-suppressions.json | 50 +++++++++--------- .../agents/_components}/add_agent_form.tsx | 16 +++--- .../agent_card_discovery.test.tsx | 8 +-- .../_components}/agent_card_discovery.tsx | 2 +- .../agents/_components}/agent_config.ts | 0 .../agents/_components}/agent_cost_view.tsx | 2 +- .../agent_discovery_utils.test.ts | 0 .../_components}/agent_discovery_utils.ts | 2 +- .../agents/_components}/agent_form_fields.tsx | 0 .../agents/_components}/agent_info.tsx | 8 +-- .../agents/_components}/agent_type_utils.ts | 4 +- .../_components}/agent_virtual_keys.test.tsx | 4 +- .../_components}/agent_virtual_keys.tsx | 2 +- .../_components}/cost_config_fields.tsx | 0 .../dynamic_agent_form_fields.tsx | 2 +- .../agents/_components/index.test.tsx} | 10 ++-- .../(dashboard)/agents/_components/index.tsx} | 14 ++--- .../src/app/(dashboard)/agents/page.tsx | 2 +- .../_components}/GuardrailTestPanel.test.tsx | 0 .../_components}/GuardrailTestPanel.tsx | 2 +- .../GuardrailTestPlayground.test.tsx | 2 +- .../_components}/GuardrailTestPlayground.tsx | 4 +- .../GuardrailTestResults.test.tsx | 0 .../_components}/GuardrailTestResults.tsx | 2 +- .../guardrails/_components}/README.md | 0 .../_components}/TeamGuardrailsTab.tsx | 0 .../_components}/add_guardrail_form.test.tsx | 2 +- .../_components}/add_guardrail_form.tsx | 4 +- .../content_filter/CategoryTable.tsx | 0 .../CompetitorIntentConfiguration.tsx | 2 +- .../ContentCategoryConfiguration.tsx | 2 +- .../ContentFilterConfiguration.tsx | 4 +- .../content_filter/ContentFilterDisplay.tsx | 0 .../ContentFilterManager.test.tsx | 0 .../content_filter/ContentFilterManager.tsx | 0 .../CustomPatternModal.test.tsx | 0 .../content_filter/CustomPatternModal.tsx | 0 .../content_filter/KeywordModal.tsx | 0 .../content_filter/KeywordTable.tsx | 0 .../content_filter/PatternModal.test.tsx | 0 .../content_filter/PatternModal.tsx | 0 .../content_filter/PatternTable.tsx | 0 .../custom_code/CustomCodeModal.tsx | 4 +- .../_components}/custom_code/index.ts | 0 .../_components}/edit_guardrail_form.tsx | 4 +- .../_components}/guardrail_garden.tsx | 0 .../guardrail_garden_card.test.tsx | 0 .../_components}/guardrail_garden_card.tsx | 0 .../_components}/guardrail_garden_configs.ts | 0 .../_components}/guardrail_garden_data.ts | 0 .../_components}/guardrail_garden_detail.tsx | 0 .../_components}/guardrail_info.test.tsx | 0 .../_components}/guardrail_info.tsx | 2 +- .../guardrail_info_helpers.test.tsx | 0 .../_components}/guardrail_info_helpers.tsx | 0 .../guardrail_optional_params.tsx | 2 +- .../guardrail_provider_fields.tsx | 4 +- .../_components}/guardrail_table.test.tsx | 2 +- .../_components}/guardrail_table.tsx | 2 +- .../guardrails/_components/index.test.tsx} | 18 +++---- .../guardrails/_components/index.tsx} | 38 +++++-------- .../_components}/llm_judge/LLMJudgeFields.tsx | 0 .../_components}/pii_components.test.tsx | 2 +- .../_components}/pii_components.tsx | 2 +- .../_components}/pii_configuration.test.tsx | 0 .../_components}/pii_configuration.tsx | 2 +- .../_components}/prompt_security.png | Bin .../ToolPermissionRulesEditor.test.tsx | 0 .../ToolPermissionRulesEditor.tsx | 0 .../src/app/(dashboard)/guardrails/page.tsx | 2 +- .../tests/CreateKeyPage.expiredToken.test.tsx | 2 +- 72 files changed, 112 insertions(+), 126 deletions(-) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/add_agent_form.tsx (98%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_card_discovery.test.tsx (97%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_card_discovery.tsx (99%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_config.ts (100%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_cost_view.tsx (95%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_discovery_utils.test.ts (100%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_discovery_utils.ts (99%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_form_fields.tsx (100%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_info.tsx (98%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_type_utils.ts (95%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_virtual_keys.test.tsx (93%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/agent_virtual_keys.tsx (95%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/cost_config_fields.tsx (100%) rename ui/litellm-dashboard/src/{components/agents => app/(dashboard)/agents/_components}/dynamic_agent_form_fields.tsx (98%) rename ui/litellm-dashboard/src/{components/agents.test.tsx => app/(dashboard)/agents/_components/index.test.tsx} (95%) rename ui/litellm-dashboard/src/{components/agents.tsx => app/(dashboard)/agents/_components/index.tsx} (94%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/GuardrailTestPanel.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/GuardrailTestPanel.tsx (98%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/GuardrailTestPlayground.test.tsx (98%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/GuardrailTestPlayground.tsx (98%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/GuardrailTestResults.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/GuardrailTestResults.tsx (98%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/README.md (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/TeamGuardrailsTab.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/add_guardrail_form.test.tsx (95%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/add_guardrail_form.tsx (99%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/CategoryTable.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/CompetitorIntentConfiguration.tsx (99%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/ContentCategoryConfiguration.tsx (99%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/ContentFilterConfiguration.tsx (98%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/ContentFilterDisplay.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/ContentFilterManager.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/ContentFilterManager.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/CustomPatternModal.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/CustomPatternModal.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/KeywordModal.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/KeywordTable.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/PatternModal.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/PatternModal.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/content_filter/PatternTable.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/custom_code/CustomCodeModal.tsx (99%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/custom_code/index.ts (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/edit_guardrail_form.tsx (99%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_garden.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_garden_card.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_garden_card.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_garden_configs.ts (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_garden_data.ts (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_garden_detail.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_info.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_info.tsx (99%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_info_helpers.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_info_helpers.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_optional_params.tsx (99%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_provider_fields.tsx (98%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_table.test.tsx (96%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/guardrail_table.tsx (99%) rename ui/litellm-dashboard/src/{components/guardrails.test.tsx => app/(dashboard)/guardrails/_components/index.test.tsx} (85%) rename ui/litellm-dashboard/src/{components/guardrails.tsx => app/(dashboard)/guardrails/_components/index.tsx} (87%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/llm_judge/LLMJudgeFields.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/pii_components.test.tsx (94%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/pii_components.tsx (98%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/pii_configuration.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/pii_configuration.tsx (97%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/prompt_security.png (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/tool_permission/ToolPermissionRulesEditor.test.tsx (100%) rename ui/litellm-dashboard/src/{components/guardrails => app/(dashboard)/guardrails/_components}/tool_permission/ToolPermissionRulesEditor.tsx (100%) diff --git a/ui/litellm-dashboard/eslint-metrics.json b/ui/litellm-dashboard/eslint-metrics.json index 2e204c63a48..c6d4bfc9ac8 100644 --- a/ui/litellm-dashboard/eslint-metrics.json +++ b/ui/litellm-dashboard/eslint-metrics.json @@ -1,5 +1,5 @@ { - "@typescript-eslint/no-explicit-any": 1978, + "@typescript-eslint/no-explicit-any": 1977, "complexity": 129, "local/no-large-inline-object-arg": 512, "local/no-long-condition-chain": 233, diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.json index 200e1175c7f..544565ee207 100644 --- a/ui/litellm-dashboard/eslint-suppressions.json +++ b/ui/litellm-dashboard/eslint-suppressions.json @@ -1261,7 +1261,7 @@ "count": 1 } }, - "src/components/agents.tsx": { + "src/app/(dashboard)/agents/_components/index.tsx": { "no-restricted-imports": { "count": 1 }, @@ -1269,7 +1269,7 @@ "count": 1 } }, - "src/components/agents/add_agent_form.tsx": { + "src/app/(dashboard)/agents/_components/add_agent_form.tsx": { "no-nested-ternary": { "count": 3 }, @@ -1283,7 +1283,7 @@ "count": 1 } }, - "src/components/agents/agent_card_discovery.tsx": { + "src/app/(dashboard)/agents/_components/agent_card_discovery.tsx": { "react-hooks/refs": { "count": 3 }, @@ -1291,17 +1291,17 @@ "count": 1 } }, - "src/components/agents/agent_cost_view.tsx": { + "src/app/(dashboard)/agents/_components/agent_cost_view.tsx": { "no-restricted-imports": { "count": 1 } }, - "src/components/agents/agent_form_fields.tsx": { + "src/app/(dashboard)/agents/_components/agent_form_fields.tsx": { "no-nested-ternary": { "count": 1 } }, - "src/components/agents/agent_info.tsx": { + "src/app/(dashboard)/agents/_components/agent_info.tsx": { "no-nested-ternary": { "count": 1 }, @@ -1312,12 +1312,12 @@ "count": 1 } }, - "src/components/agents/agent_virtual_keys.tsx": { + "src/app/(dashboard)/agents/_components/agent_virtual_keys.tsx": { "no-nested-ternary": { "count": 1 } }, - "src/components/agents/dynamic_agent_form_fields.tsx": { + "src/app/(dashboard)/agents/_components/dynamic_agent_form_fields.tsx": { "no-nested-ternary": { "count": 2 } @@ -1534,27 +1534,27 @@ "count": 1 } }, - "src/components/guardrails.tsx": { + "src/app/(dashboard)/guardrails/_components/index.tsx": { "react-hooks/set-state-in-effect": { "count": 1 } }, - "src/components/guardrails/GuardrailTestPanel.tsx": { + "src/app/(dashboard)/guardrails/_components/GuardrailTestPanel.tsx": { "no-restricted-imports": { "count": 1 } }, - "src/components/guardrails/GuardrailTestPlayground.tsx": { + "src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.tsx": { "no-nested-ternary": { "count": 1 } }, - "src/components/guardrails/GuardrailTestResults.tsx": { + "src/app/(dashboard)/guardrails/_components/GuardrailTestResults.tsx": { "no-restricted-imports": { "count": 1 } }, - "src/components/guardrails/TeamGuardrailsTab.tsx": { + "src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx": { "no-nested-ternary": { "count": 2 }, @@ -1562,7 +1562,7 @@ "count": 1 } }, - "src/components/guardrails/add_guardrail_form.tsx": { + "src/app/(dashboard)/guardrails/_components/add_guardrail_form.tsx": { "no-nested-ternary": { "count": 4 }, @@ -1573,7 +1573,7 @@ "count": 2 } }, - "src/components/guardrails/content_filter/CompetitorIntentConfiguration.tsx": { + "src/app/(dashboard)/guardrails/_components/content_filter/CompetitorIntentConfiguration.tsx": { "no-nested-ternary": { "count": 1 }, @@ -1581,7 +1581,7 @@ "count": 1 } }, - "src/components/guardrails/content_filter/ContentCategoryConfiguration.tsx": { + "src/app/(dashboard)/guardrails/_components/content_filter/ContentCategoryConfiguration.tsx": { "no-nested-ternary": { "count": 3 }, @@ -1589,12 +1589,12 @@ "count": 1 } }, - "src/components/guardrails/content_filter/ContentFilterDisplay.tsx": { + "src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterDisplay.tsx": { "no-restricted-imports": { "count": 1 } }, - "src/components/guardrails/content_filter/ContentFilterManager.tsx": { + "src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterManager.tsx": { "max-params": { "count": 2 }, @@ -1602,7 +1602,7 @@ "count": 1 } }, - "src/components/guardrails/custom_code/CustomCodeModal.tsx": { + "src/app/(dashboard)/guardrails/_components/custom_code/CustomCodeModal.tsx": { "no-nested-ternary": { "count": 6 }, @@ -1613,7 +1613,7 @@ "count": 1 } }, - "src/components/guardrails/edit_guardrail_form.tsx": { + "src/app/(dashboard)/guardrails/_components/edit_guardrail_form.tsx": { "no-restricted-imports": { "count": 1 }, @@ -1624,7 +1624,7 @@ "count": 1 } }, - "src/components/guardrails/guardrail_info.tsx": { + "src/app/(dashboard)/guardrails/_components/guardrail_info.tsx": { "max-params": { "count": 1 }, @@ -1635,7 +1635,7 @@ "count": 3 } }, - "src/components/guardrails/guardrail_optional_params.tsx": { + "src/app/(dashboard)/guardrails/_components/guardrail_optional_params.tsx": { "no-nested-ternary": { "count": 5 }, @@ -1643,7 +1643,7 @@ "count": 1 } }, - "src/components/guardrails/guardrail_provider_fields.tsx": { + "src/app/(dashboard)/guardrails/_components/guardrail_provider_fields.tsx": { "no-nested-ternary": { "count": 5 }, @@ -1651,7 +1651,7 @@ "count": 1 } }, - "src/components/guardrails/guardrail_table.tsx": { + "src/app/(dashboard)/guardrails/_components/guardrail_table.tsx": { "no-nested-ternary": { "count": 1 }, @@ -1659,7 +1659,7 @@ "count": 1 } }, - "src/components/guardrails/tool_permission/ToolPermissionRulesEditor.tsx": { + "src/app/(dashboard)/guardrails/_components/tool_permission/ToolPermissionRulesEditor.tsx": { "no-restricted-imports": { "count": 1 }, diff --git a/ui/litellm-dashboard/src/components/agents/add_agent_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/agents/add_agent_form.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.tsx index 5b146adeebe..8ca2b5afe16 100644 --- a/ui/litellm-dashboard/src/components/agents/add_agent_form.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/add_agent_form.tsx @@ -4,7 +4,7 @@ import MessageManager from "@/components/molecules/message_manager"; import { resolveLogoSrc } from "@/lib/assetPaths"; import { Button } from "@tremor/react"; import { CheckCircleFilled, KeyOutlined, RobotOutlined, AppstoreOutlined, InfoCircleOutlined } from "@ant-design/icons"; -import CreatedKeyDisplay from "../shared/CreatedKeyDisplay"; +import CreatedKeyDisplay from "@/components/shared/CreatedKeyDisplay"; import { createAgentCall, getAgentCreateMetadata, @@ -14,19 +14,19 @@ import { keyUpdateCall, modelAvailableCall, AgentCreateInfo, -} from "../networking"; +} from "@/components/networking"; import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized"; -import { getModelDisplayName } from "../key_team_helpers/fetch_available_models_team_key"; -import { Team } from "../key_team_helpers/key_list"; -import TeamDropdown from "../common_components/team_dropdown"; +import { getModelDisplayName } from "@/components/key_team_helpers/fetch_available_models_team_key"; +import { Team } from "@/components/key_team_helpers/key_list"; +import TeamDropdown from "@/components/common_components/team_dropdown"; import AgentFormFields from "./agent_form_fields"; import AgentCardDiscovery, { DiscoveredAgentCardSelection } from "./agent_card_discovery"; import { buildDiscoveryRequest, overlayDiscoveredCardParams } from "./agent_discovery_utils"; import DynamicAgentFormFields, { buildDynamicAgentData } from "./dynamic_agent_form_fields"; import { getDefaultFormValues, buildAgentDataFromForm } from "./agent_config"; -import MCPServerSelector from "../mcp_server_management/MCPServerSelector"; -import MCPToolPermissions from "../mcp_server_management/MCPToolPermissions"; -import GuardrailSelector from "../guardrails/GuardrailSelector"; +import MCPServerSelector from "@/components/mcp_server_management/MCPServerSelector"; +import MCPToolPermissions from "@/components/mcp_server_management/MCPToolPermissions"; +import GuardrailSelector from "@/components/guardrails/GuardrailSelector"; const { Step } = Steps; diff --git a/ui/litellm-dashboard/src/components/agents/agent_card_discovery.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_card_discovery.test.tsx similarity index 97% rename from ui/litellm-dashboard/src/components/agents/agent_card_discovery.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_card_discovery.test.tsx index 3a9b7cbb41c..dc70aaa409b 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_card_discovery.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_card_discovery.test.tsx @@ -2,18 +2,18 @@ import React from "react"; import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; 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 AgentCardDiscovery from "./agent_card_discovery"; -vi.mock("../networking", async () => { - const actual = await vi.importActual("../networking"); +vi.mock("@/components/networking", async () => { + const actual = await vi.importActual("@/components/networking"); return { ...actual, discoverAgentCardCall: vi.fn(), }; }); -import { discoverAgentCardCall } from "../networking"; +import { discoverAgentCardCall } from "@/components/networking"; const mockDiscover = discoverAgentCardCall as unknown as ReturnType; diff --git a/ui/litellm-dashboard/src/components/agents/agent_card_discovery.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_card_discovery.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/agents/agent_card_discovery.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_card_discovery.tsx index 87effb95278..5ea7458f643 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_card_discovery.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_card_discovery.tsx @@ -11,7 +11,7 @@ import { SearchOutlined, } from "@ant-design/icons"; -import { DiscoveredAgentCard, discoverAgentCardCall } from "../networking"; +import { DiscoveredAgentCard, discoverAgentCardCall } from "@/components/networking"; import { ALLOWED_CAPABILITY_KEYS, selectionsFromSavedAgentCard, diff --git a/ui/litellm-dashboard/src/components/agents/agent_config.ts b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_config.ts similarity index 100% rename from ui/litellm-dashboard/src/components/agents/agent_config.ts rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_config.ts diff --git a/ui/litellm-dashboard/src/components/agents/agent_cost_view.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_cost_view.tsx similarity index 95% rename from ui/litellm-dashboard/src/components/agents/agent_cost_view.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_cost_view.tsx index 04837fe823f..e5d88ecc721 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_cost_view.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_cost_view.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Title } from "@tremor/react"; import { Descriptions } from "antd"; -import { Agent } from "./types"; +import { Agent } from "@/components/agents/types"; interface AgentCostViewProps { agent: Agent; diff --git a/ui/litellm-dashboard/src/components/agents/agent_discovery_utils.test.ts b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_discovery_utils.test.ts similarity index 100% rename from ui/litellm-dashboard/src/components/agents/agent_discovery_utils.test.ts rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_discovery_utils.test.ts diff --git a/ui/litellm-dashboard/src/components/agents/agent_discovery_utils.ts b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_discovery_utils.ts similarity index 99% rename from ui/litellm-dashboard/src/components/agents/agent_discovery_utils.ts rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_discovery_utils.ts index 8040bb3089b..fd34ec471eb 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_discovery_utils.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_discovery_utils.ts @@ -1,4 +1,4 @@ -import { AgentCreateInfo, DiscoveredAgentCard, DiscoveryMode } from "../networking"; +import { AgentCreateInfo, DiscoveredAgentCard, DiscoveryMode } from "@/components/networking"; export interface DiscoveryRequestPlan { url: string; diff --git a/ui/litellm-dashboard/src/components/agents/agent_form_fields.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_form_fields.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/agents/agent_form_fields.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_form_fields.tsx diff --git a/ui/litellm-dashboard/src/components/agents/agent_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/agents/agent_info.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.tsx index 46ffa9b5ccf..d82ef82df8c 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_info.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_info.tsx @@ -3,11 +3,11 @@ import { Card, Title, Text, Button as TremorButton, Tab, TabGroup, TabList, TabP import { Form, Input, InputNumber, Button as AntButton, Spin, Descriptions, Divider } from "antd"; import MessageManager from "@/components/molecules/message_manager"; import { ArrowLeftIcon } from "@heroicons/react/outline"; -import { getAgentInfo, patchAgentCall, getAgentCreateMetadata, AgentCreateInfo } from "../networking"; -import { Agent } from "./types"; -import { KeyResponse } from "../key_team_helpers/key_list"; +import { getAgentInfo, patchAgentCall, getAgentCreateMetadata, AgentCreateInfo } from "@/components/networking"; +import { Agent } from "@/components/agents/types"; +import { KeyResponse } from "@/components/key_team_helpers/key_list"; import { useKeys } from "@/app/(dashboard)/hooks/keys/useKeys"; -import KeyInfoView from "../templates/key_info_view"; +import KeyInfoView from "@/components/templates/key_info_view"; import AgentVirtualKeys from "./agent_virtual_keys"; import AgentFormFields from "./agent_form_fields"; import DynamicAgentFormFields, { buildDynamicAgentData } from "./dynamic_agent_form_fields"; diff --git a/ui/litellm-dashboard/src/components/agents/agent_type_utils.ts b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_type_utils.ts similarity index 95% rename from ui/litellm-dashboard/src/components/agents/agent_type_utils.ts rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_type_utils.ts index 5bcdd0abe64..f91590c5732 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_type_utils.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_type_utils.ts @@ -1,5 +1,5 @@ -import { Agent } from "./types"; -import { AgentCreateInfo } from "../networking"; +import { Agent } from "@/components/agents/types"; +import { AgentCreateInfo } from "@/components/networking"; /** * Detects the agent type from an agent's litellm_params. diff --git a/ui/litellm-dashboard/src/components/agents/agent_virtual_keys.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_virtual_keys.test.tsx similarity index 93% rename from ui/litellm-dashboard/src/components/agents/agent_virtual_keys.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_virtual_keys.test.tsx index 9a58ad557a2..ce13c22dfbf 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_virtual_keys.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_virtual_keys.test.tsx @@ -2,9 +2,9 @@ import React from "react"; import { describe, it, expect, vi } from "vitest"; 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 AgentVirtualKeys from "./agent_virtual_keys"; -import type { KeyResponse } from "../key_team_helpers/key_list"; +import type { KeyResponse } from "@/components/key_team_helpers/key_list"; const makeKey = (overrides: Partial): KeyResponse => ({ diff --git a/ui/litellm-dashboard/src/components/agents/agent_virtual_keys.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_virtual_keys.tsx similarity index 95% rename from ui/litellm-dashboard/src/components/agents/agent_virtual_keys.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_virtual_keys.tsx index b2ddf5efb2a..9a7001ae941 100644 --- a/ui/litellm-dashboard/src/components/agents/agent_virtual_keys.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/agent_virtual_keys.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Button, Tooltip, Typography } from "antd"; import { KeyOutlined } from "@ant-design/icons"; -import { KeyResponse } from "../key_team_helpers/key_list"; +import { KeyResponse } from "@/components/key_team_helpers/key_list"; const { Title, Text } = Typography; diff --git a/ui/litellm-dashboard/src/components/agents/cost_config_fields.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/cost_config_fields.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/agents/cost_config_fields.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/cost_config_fields.tsx diff --git a/ui/litellm-dashboard/src/components/agents/dynamic_agent_form_fields.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/dynamic_agent_form_fields.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/agents/dynamic_agent_form_fields.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/dynamic_agent_form_fields.tsx index 3edea4362c9..435e628bfc0 100644 --- a/ui/litellm-dashboard/src/components/agents/dynamic_agent_form_fields.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/dynamic_agent_form_fields.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Form, Input, Select, Collapse } from "antd"; -import { AgentCreateInfo, AgentCredentialFieldMetadata } from "../networking"; +import { AgentCreateInfo, AgentCredentialFieldMetadata } from "@/components/networking"; import { AGENT_FORM_CONFIG } from "./agent_config"; import CostConfigFields from "./cost_config_fields"; diff --git a/ui/litellm-dashboard/src/components/agents.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/index.test.tsx similarity index 95% rename from ui/litellm-dashboard/src/components/agents.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/index.test.tsx index 848b8d5e891..6228253222a 100644 --- a/ui/litellm-dashboard/src/components/agents.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/index.test.tsx @@ -1,19 +1,19 @@ import React from "react"; import { render, screen, waitFor, act, fireEvent, within } from "@testing-library/react"; import { describe, it, expect, vi, beforeEach } from "vitest"; -import AgentsPanel from "./agents"; -import * as networking from "./networking"; +import AgentsPanel from "./index"; +import * as networking from "@/components/networking"; -vi.mock("./networking", () => ({ +vi.mock("@/components/networking", () => ({ getAgentsList: vi.fn().mockResolvedValue({ agents: [] }), deleteAgentCall: vi.fn(), })); -vi.mock("./agents/add_agent_form", () => ({ +vi.mock("./add_agent_form", () => ({ default: () =>
, })); -vi.mock("./agents/agent_info", () => ({ +vi.mock("./agent_info", () => ({ default: () =>
, })); diff --git a/ui/litellm-dashboard/src/components/agents.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/index.tsx similarity index 94% rename from ui/litellm-dashboard/src/components/agents.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/agents/_components/index.tsx index e3703f6c588..84634620426 100644 --- a/ui/litellm-dashboard/src/components/agents.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/_components/index.tsx @@ -13,15 +13,15 @@ import { } from "@tremor/react"; import { Modal, Alert, Tooltip, Skeleton, Switch } from "antd"; import { CheckCircleOutlined } from "@ant-design/icons"; -import { getAgentsList, deleteAgentCall } from "./networking"; -import AddAgentForm from "./agents/add_agent_form"; +import { getAgentsList, deleteAgentCall } from "@/components/networking"; +import AddAgentForm from "./add_agent_form"; import { isAdminRole } from "@/utils/roles"; -import AgentInfoView from "./agents/agent_info"; -import NotificationsManager from "./molecules/notifications_manager"; -import { Agent } from "./agents/types"; -import { Team } from "./key_team_helpers/key_list"; +import AgentInfoView from "./agent_info"; +import NotificationsManager from "@/components/molecules/notifications_manager"; +import { Agent } from "@/components/agents/types"; +import { Team } from "@/components/key_team_helpers/key_list"; import { DateCell, IdCell, MoneyCell, StatusBadge } from "@/components/shared/table_cells"; -import TableIconActionButton from "./common_components/IconActionButton/TableIconActionButtons/TableIconActionButton"; +import TableIconActionButton from "@/components/common_components/IconActionButton/TableIconActionButtons/TableIconActionButton"; interface AgentsPanelProps { accessToken: string | null; diff --git a/ui/litellm-dashboard/src/app/(dashboard)/agents/page.tsx b/ui/litellm-dashboard/src/app/(dashboard)/agents/page.tsx index d60daae13a7..98085ab20a9 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/agents/page.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/agents/page.tsx @@ -1,6 +1,6 @@ "use client"; -import AgentsPanel from "@/components/agents"; +import AgentsPanel from "./_components"; import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized"; import { useTeams } from "@/app/(dashboard)/hooks/teams/useTeams"; diff --git a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPanel.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPanel.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPanel.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPanel.tsx index 81a9edb91c6..a65b980d8b8 100644 --- a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPanel.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPanel.tsx @@ -2,7 +2,7 @@ import React, { useState } from "react"; import { Button } from "@tremor/react"; import { Input, Typography, Tooltip } from "antd"; import { CopyOutlined, InfoCircleOutlined } from "@ant-design/icons"; -import NotificationsManager from "../molecules/notifications_manager"; +import NotificationsManager from "@/components/molecules/notifications_manager"; import GuardrailTestResults from "./GuardrailTestResults"; const { TextArea } = Input; diff --git a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPlayground.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.test.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/guardrails/GuardrailTestPlayground.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.test.tsx index 2a8d58a58cc..252b01dbc4b 100644 --- a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPlayground.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.test.tsx @@ -3,7 +3,7 @@ import userEvent from "@testing-library/user-event"; import { beforeEach, describe, expect, it, vi } from "vitest"; import GuardrailTestPlayground from "./GuardrailTestPlayground"; -vi.mock("../networking"); +vi.mock("@/components/networking"); Object.defineProperty(window, "matchMedia", { writable: true, diff --git a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPlayground.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/guardrails/GuardrailTestPlayground.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.tsx index 5774d078cbf..45612d9fba3 100644 --- a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestPlayground.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestPlayground.tsx @@ -2,8 +2,8 @@ import React, { useState } from "react"; import { Card, List, Empty, Spin, Input, Typography } from "antd"; import { ExperimentOutlined, SearchOutlined } from "@ant-design/icons"; import GuardrailTestPanel from "./GuardrailTestPanel"; -import { applyGuardrail } from "../networking"; -import NotificationsManager from "../molecules/notifications_manager"; +import { applyGuardrail } from "@/components/networking"; +import NotificationsManager from "@/components/molecules/notifications_manager"; interface GuardrailItem { guardrail_id?: string; diff --git a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestResults.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestResults.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/GuardrailTestResults.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestResults.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestResults.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestResults.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/guardrails/GuardrailTestResults.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestResults.tsx index ff6fc5744b6..3c974de3632 100644 --- a/ui/litellm-dashboard/src/components/guardrails/GuardrailTestResults.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/GuardrailTestResults.tsx @@ -2,7 +2,7 @@ import React, { useState } from "react"; import { Button, Card } from "@tremor/react"; import { Typography } from "antd"; import { CopyOutlined, CheckCircleOutlined, ClockCircleOutlined, DownOutlined, RightOutlined } from "@ant-design/icons"; -import NotificationsManager from "../molecules/notifications_manager"; +import NotificationsManager from "@/components/molecules/notifications_manager"; const { Text } = Typography; diff --git a/ui/litellm-dashboard/src/components/guardrails/README.md b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/README.md similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/README.md rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/README.md diff --git a/ui/litellm-dashboard/src/components/guardrails/TeamGuardrailsTab.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/TeamGuardrailsTab.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/TeamGuardrailsTab.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/add_guardrail_form.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx similarity index 95% rename from ui/litellm-dashboard/src/components/guardrails/add_guardrail_form.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx index a13f12e4b42..8fc0d36c2b4 100644 --- a/ui/litellm-dashboard/src/components/guardrails/add_guardrail_form.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx @@ -1,6 +1,6 @@ import React from "react"; import { fireEvent, screen } from "@testing-library/react"; -import { renderWithProviders } from "../../../tests/test-utils"; +import { renderWithProviders } from "@/../tests/test-utils"; import { beforeEach, describe, expect, it, vi } from "vitest"; import AddGuardrailForm from "./add_guardrail_form"; diff --git a/ui/litellm-dashboard/src/components/guardrails/add_guardrail_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/guardrails/add_guardrail_form.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.tsx index 847c3557280..9a45bf0be0d 100644 --- a/ui/litellm-dashboard/src/components/guardrails/add_guardrail_form.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.tsx @@ -1,12 +1,12 @@ import { Form, Input, Modal, Select, Tag, Typography, Button } from "antd"; import React, { useEffect, useMemo, useState } from "react"; -import NotificationsManager from "../molecules/notifications_manager"; +import NotificationsManager from "@/components/molecules/notifications_manager"; import { createGuardrailCall, getGuardrailProviderSpecificParams, getGuardrailUISettings, modelAvailableCall, -} from "../networking"; +} from "@/components/networking"; import ContentFilterConfiguration from "./content_filter/ContentFilterConfiguration"; import { choiceToSkipSystemForCreate, diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/CategoryTable.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CategoryTable.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/CategoryTable.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CategoryTable.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/CompetitorIntentConfiguration.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CompetitorIntentConfiguration.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/CompetitorIntentConfiguration.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CompetitorIntentConfiguration.tsx index 4e740b03b21..e3867156d01 100644 --- a/ui/litellm-dashboard/src/components/guardrails/content_filter/CompetitorIntentConfiguration.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CompetitorIntentConfiguration.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { Card, Typography, Select, Switch, Form, Space, InputNumber } from "antd"; -import { getMajorAirlines } from "../../networking"; +import { getMajorAirlines } from "@/components/networking"; const { Title, Text } = Typography; const { Option } = Select; diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/ContentCategoryConfiguration.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentCategoryConfiguration.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/ContentCategoryConfiguration.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentCategoryConfiguration.tsx index e646daf51fe..713694f98e7 100644 --- a/ui/litellm-dashboard/src/components/guardrails/content_filter/ContentCategoryConfiguration.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentCategoryConfiguration.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Card, Typography, Select, Table, Tag, Collapse, Button } from "antd"; import { DeleteOutlined, PlusOutlined, FileTextOutlined } from "@ant-design/icons"; -import { getCategoryYaml } from "../../networking"; +import { getCategoryYaml } from "@/components/networking"; const { Title, Text } = Typography; const { Option } = Select; diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterConfiguration.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterConfiguration.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterConfiguration.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterConfiguration.tsx index 34f92b8618c..337520fac7d 100644 --- a/ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterConfiguration.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterConfiguration.tsx @@ -1,8 +1,8 @@ import React, { useState } from "react"; import { Typography, Space, Upload, Card, Button } from "antd"; import { PlusOutlined, UploadOutlined } from "@ant-design/icons"; -import { validateBlockedWordsFile } from "../../networking"; -import NotificationsManager from "../../molecules/notifications_manager"; +import { validateBlockedWordsFile } from "@/components/networking"; +import NotificationsManager from "@/components/molecules/notifications_manager"; import PatternModal from "./PatternModal"; import CustomPatternModal from "./CustomPatternModal"; import KeywordModal from "./KeywordModal"; diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterDisplay.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterDisplay.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterDisplay.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterDisplay.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterManager.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterManager.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterManager.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterManager.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterManager.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterManager.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/ContentFilterManager.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/ContentFilterManager.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/CustomPatternModal.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CustomPatternModal.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/CustomPatternModal.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CustomPatternModal.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/CustomPatternModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CustomPatternModal.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/CustomPatternModal.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/CustomPatternModal.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/KeywordModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/KeywordModal.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/KeywordModal.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/KeywordModal.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/KeywordTable.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/KeywordTable.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/KeywordTable.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/KeywordTable.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/PatternModal.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/PatternModal.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/PatternModal.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/PatternModal.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/PatternModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/PatternModal.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/PatternModal.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/PatternModal.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/content_filter/PatternTable.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/PatternTable.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/content_filter/PatternTable.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/content_filter/PatternTable.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/custom_code/CustomCodeModal.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/custom_code/CustomCodeModal.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/guardrails/custom_code/CustomCodeModal.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/custom_code/CustomCodeModal.tsx index 411c2ed13ae..79cd9e19e6f 100644 --- a/ui/litellm-dashboard/src/components/guardrails/custom_code/CustomCodeModal.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/custom_code/CustomCodeModal.tsx @@ -11,8 +11,8 @@ import { UsergroupAddOutlined, ExportOutlined, } from "@ant-design/icons"; -import { createGuardrailCall, updateGuardrailCall, testCustomCodeGuardrail } from "../../networking"; -import NotificationsManager from "../../molecules/notifications_manager"; +import { createGuardrailCall, updateGuardrailCall, testCustomCodeGuardrail } from "@/components/networking"; +import NotificationsManager from "@/components/molecules/notifications_manager"; const { Panel } = Collapse; const { TextArea } = Input; diff --git a/ui/litellm-dashboard/src/components/guardrails/custom_code/index.ts b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/custom_code/index.ts similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/custom_code/index.ts rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/custom_code/index.ts diff --git a/ui/litellm-dashboard/src/components/guardrails/edit_guardrail_form.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/edit_guardrail_form.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/guardrails/edit_guardrail_form.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/edit_guardrail_form.tsx index 73857f85fb3..83c21718a6e 100644 --- a/ui/litellm-dashboard/src/components/guardrails/edit_guardrail_form.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/edit_guardrail_form.tsx @@ -9,9 +9,9 @@ import { type SkipToolMessageChoice, } from "./guardrail_info_helpers"; import { resolveLogoSrc } from "@/lib/assetPaths"; -import { getGuardrailUISettings, getGlobalLitellmHeaderName } from "../networking"; +import { getGuardrailUISettings, getGlobalLitellmHeaderName } from "@/components/networking"; import PiiConfiguration from "./pii_configuration"; -import NotificationsManager from "../molecules/notifications_manager"; +import NotificationsManager from "@/components/molecules/notifications_manager"; const { Title, Text } = Typography; const { Option } = Select; diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_garden.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_garden.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_garden_card.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_card.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_garden_card.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_card.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_garden_card.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_card.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_garden_card.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_card.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_garden_configs.ts b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_configs.ts similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_garden_configs.ts rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_configs.ts diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_garden_data.ts b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.ts similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_garden_data.ts rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_data.ts diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_garden_detail.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_detail.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_garden_detail.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_garden_detail.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_info.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_info.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_info.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_info.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx index e8fec98a40c..1941ec94a60 100644 --- a/ui/litellm-dashboard/src/components/guardrails/guardrail_info.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info.tsx @@ -11,7 +11,7 @@ import { Badge, Card, Grid, Tab, TabGroup, TabList, TabPanel, TabPanels, Text, T import { Button, Divider, Form, Input, Select, Tooltip } from "antd"; import { CheckIcon, CopyIcon } from "lucide-react"; import React, { useCallback, useEffect, useState } from "react"; -import NotificationsManager from "../molecules/notifications_manager"; +import NotificationsManager from "@/components/molecules/notifications_manager"; import ContentFilterManager, { formatContentFilterDataForAPI } from "./content_filter/ContentFilterManager"; import CustomCodeModal, { EditGuardrailData } from "./custom_code/CustomCodeModal"; import { diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_info_helpers.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_info_helpers.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_info_helpers.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_info_helpers.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_info_helpers.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_optional_params.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_optional_params.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_optional_params.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_optional_params.tsx index 061bff90045..8b119c4933c 100644 --- a/ui/litellm-dashboard/src/components/guardrails/guardrail_optional_params.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_optional_params.tsx @@ -1,6 +1,6 @@ import React from "react"; import { Form, Select, Typography, Input, Button } from "antd"; -import NumericalInput from "../shared/numerical_input"; +import NumericalInput from "@/components/shared/numerical_input"; const { Title } = Typography; diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_provider_fields.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_provider_fields.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_provider_fields.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_provider_fields.tsx index b9629749310..123aae0dd62 100644 --- a/ui/litellm-dashboard/src/components/guardrails/guardrail_provider_fields.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_provider_fields.tsx @@ -6,8 +6,8 @@ import { populateGuardrailProviderMap, shouldRenderContentFilterConfigSettings, } from "./guardrail_info_helpers"; -import { getGuardrailProviderSpecificParams } from "../networking"; -import NumericalInput from "../shared/numerical_input"; +import { getGuardrailProviderSpecificParams } from "@/components/networking"; +import NumericalInput from "@/components/shared/numerical_input"; interface GuardrailProviderFieldsProps { selectedProvider: string | null; diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_table.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_table.test.tsx similarity index 96% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_table.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_table.test.tsx index dcc67677357..70b5998ad95 100644 --- a/ui/litellm-dashboard/src/components/guardrails/guardrail_table.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_table.test.tsx @@ -1,7 +1,7 @@ import GuardrailTable from "./guardrail_table"; import { render } from "@testing-library/react"; import { describe, it, expect } from "vitest"; -import { GuardrailDefinitionLocation } from "./types"; +import { GuardrailDefinitionLocation } from "@/components/guardrails/types"; describe("GuardrailTable", () => { it("should render", () => { const { getByText } = render( diff --git a/ui/litellm-dashboard/src/components/guardrails/guardrail_table.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_table.tsx similarity index 99% rename from ui/litellm-dashboard/src/components/guardrails/guardrail_table.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_table.tsx index 99f6b2793fd..4ea4505f506 100644 --- a/ui/litellm-dashboard/src/components/guardrails/guardrail_table.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/guardrail_table.tsx @@ -18,7 +18,7 @@ import { skipToolMessageToChoice, } from "./guardrail_info_helpers"; import EditGuardrailForm from "./edit_guardrail_form"; -import { Guardrail, GuardrailDefinitionLocation } from "./types"; +import { Guardrail, GuardrailDefinitionLocation } from "@/components/guardrails/types"; interface GuardrailTableProps { guardrailsList: Guardrail[]; diff --git a/ui/litellm-dashboard/src/components/guardrails.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/index.test.tsx similarity index 85% rename from ui/litellm-dashboard/src/components/guardrails.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/index.test.tsx index 99c2474347e..ee33276cfd6 100644 --- a/ui/litellm-dashboard/src/components/guardrails.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/index.test.tsx @@ -1,19 +1,19 @@ import { render, screen, fireEvent } from "@testing-library/react"; import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest"; -import GuardrailsPanel from "./guardrails"; -import { getGuardrailsList } from "./networking"; +import GuardrailsPanel from "./index"; +import { getGuardrailsList } from "@/components/networking"; -vi.mock("./networking", () => ({ +vi.mock("@/components/networking", () => ({ getGuardrailsList: vi.fn(), deleteGuardrailCall: vi.fn(), })); -vi.mock("./guardrails/add_guardrail_form", () => ({ +vi.mock("./add_guardrail_form", () => ({ __esModule: true, default: () =>
Mock Add Guardrail Form
, })); -vi.mock("./guardrails/guardrail_table", () => ({ +vi.mock("./guardrail_table", () => ({ __esModule: true, default: ({ guardrailsList, onDeleteClick }: any) => (
@@ -30,17 +30,17 @@ vi.mock("./guardrails/guardrail_table", () => ({ ), })); -vi.mock("./guardrails/guardrail_info", () => ({ +vi.mock("./guardrail_info", () => ({ __esModule: true, default: () =>
Mock Guardrail Info View
, })); -vi.mock("./guardrails/GuardrailTestPlayground", () => ({ +vi.mock("./GuardrailTestPlayground", () => ({ __esModule: true, default: () =>
Mock Guardrail Test Playground
, })); -vi.mock("./guardrails/TeamGuardrailsTab", () => ({ +vi.mock("./TeamGuardrailsTab", () => ({ TeamGuardrailsTab: () =>
Mock Team Guardrails Tab
, })); @@ -48,7 +48,7 @@ vi.mock("@/utils/roles", () => ({ isAdminRole: vi.fn((role: string) => role === "admin"), })); -vi.mock("./guardrails/guardrail_info_helpers", () => ({ +vi.mock("./guardrail_info_helpers", () => ({ getGuardrailLogoAndName: vi.fn(() => ({ logo: null, displayName: "Test Provider", diff --git a/ui/litellm-dashboard/src/components/guardrails.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/index.tsx similarity index 87% rename from ui/litellm-dashboard/src/components/guardrails.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/index.tsx index 4a74989d142..af4c85d0b9f 100644 --- a/ui/litellm-dashboard/src/components/guardrails.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/index.tsx @@ -1,39 +1,25 @@ import React, { useState, useEffect } from "react"; import { Button, Dropdown, Tabs } from "antd"; import { DownOutlined, PlusOutlined, CodeOutlined } from "@ant-design/icons"; -import { getGuardrailsList, deleteGuardrailCall } from "./networking"; -import AddGuardrailForm from "./guardrails/add_guardrail_form"; -import GuardrailTable from "./guardrails/guardrail_table"; +import { getGuardrailsList, deleteGuardrailCall } from "@/components/networking"; +import AddGuardrailForm from "./add_guardrail_form"; +import GuardrailTable from "./guardrail_table"; import { isAdminRole } from "@/utils/roles"; -import GuardrailInfoView from "./guardrails/guardrail_info"; -import GuardrailTestPlayground from "./guardrails/GuardrailTestPlayground"; -import NotificationsManager from "./molecules/notifications_manager"; -import { Guardrail, GuardrailDefinitionLocation } from "./guardrails/types"; -import DeleteResourceModal from "./common_components/DeleteResourceModal"; -import { getGuardrailLogoAndName } from "./guardrails/guardrail_info_helpers"; -import { CustomCodeModal } from "./guardrails/custom_code"; -import GuardrailGarden from "./guardrails/guardrail_garden"; -import { TeamGuardrailsTab } from "./guardrails/TeamGuardrailsTab"; +import GuardrailInfoView from "./guardrail_info"; +import GuardrailTestPlayground from "./GuardrailTestPlayground"; +import NotificationsManager from "@/components/molecules/notifications_manager"; +import { Guardrail } from "@/components/guardrails/types"; +import DeleteResourceModal from "@/components/common_components/DeleteResourceModal"; +import { getGuardrailLogoAndName } from "./guardrail_info_helpers"; +import { CustomCodeModal } from "./custom_code"; +import GuardrailGarden from "./guardrail_garden"; +import { TeamGuardrailsTab } from "./TeamGuardrailsTab"; interface GuardrailsPanelProps { accessToken: string | null; userRole?: string; } -interface GuardrailItem { - guardrail_id?: string; - guardrail_name: string | null; - litellm_params: { - guardrail: string; - mode: string; - default_on: boolean; - }; - guardrail_info: Record | null; - created_at?: string; - updated_at?: string; - guardrail_definition_location: GuardrailDefinitionLocation; -} - interface GuardrailsResponse { guardrails: Guardrail[]; } diff --git a/ui/litellm-dashboard/src/components/guardrails/llm_judge/LLMJudgeFields.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/llm_judge/LLMJudgeFields.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/llm_judge/LLMJudgeFields.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/llm_judge/LLMJudgeFields.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/pii_components.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_components.test.tsx similarity index 94% rename from ui/litellm-dashboard/src/components/guardrails/pii_components.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_components.test.tsx index 3accbf13bd1..2f839487111 100644 --- a/ui/litellm-dashboard/src/components/guardrails/pii_components.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_components.test.tsx @@ -1,7 +1,7 @@ import { render } from "@testing-library/react"; import { describe, it, expect } from "vitest"; import { CategoryFilter, QuickActions, PiiEntityList } from "./pii_components"; -import type { PiiEntityCategory } from "./types"; +import type { PiiEntityCategory } from "@/components/guardrails/types"; describe("CategoryFilter", () => { it("should render", () => { diff --git a/ui/litellm-dashboard/src/components/guardrails/pii_components.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_components.tsx similarity index 98% rename from ui/litellm-dashboard/src/components/guardrails/pii_components.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_components.tsx index 6d35122c69f..3043832ddc4 100644 --- a/ui/litellm-dashboard/src/components/guardrails/pii_components.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_components.tsx @@ -1,7 +1,7 @@ import React from "react"; import { Typography, Select, Button, Checkbox, Tooltip, Tag } from "antd"; import { CloseOutlined, EyeInvisibleOutlined, StopOutlined, FilterOutlined } from "@ant-design/icons"; -import { PiiEntityCategory } from "./types"; +import { PiiEntityCategory } from "@/components/guardrails/types"; const { Text } = Typography; const { Option } = Select; diff --git a/ui/litellm-dashboard/src/components/guardrails/pii_configuration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/pii_configuration.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/pii_configuration.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.tsx similarity index 97% rename from ui/litellm-dashboard/src/components/guardrails/pii_configuration.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.tsx index be2c9ff0298..14408b121ee 100644 --- a/ui/litellm-dashboard/src/components/guardrails/pii_configuration.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/pii_configuration.tsx @@ -1,7 +1,7 @@ import { Typography } from "antd"; import React, { useState } from "react"; import { CategoryFilter, PiiEntityList, QuickActions } from "./pii_components"; -import { PiiConfigurationProps } from "./types"; +import { PiiConfigurationProps } from "@/components/guardrails/types"; const { Title, Text } = Typography; diff --git a/ui/litellm-dashboard/src/components/guardrails/prompt_security.png b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/prompt_security.png similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/prompt_security.png rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/prompt_security.png diff --git a/ui/litellm-dashboard/src/components/guardrails/tool_permission/ToolPermissionRulesEditor.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/tool_permission/ToolPermissionRulesEditor.test.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/tool_permission/ToolPermissionRulesEditor.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/tool_permission/ToolPermissionRulesEditor.test.tsx diff --git a/ui/litellm-dashboard/src/components/guardrails/tool_permission/ToolPermissionRulesEditor.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/tool_permission/ToolPermissionRulesEditor.tsx similarity index 100% rename from ui/litellm-dashboard/src/components/guardrails/tool_permission/ToolPermissionRulesEditor.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/tool_permission/ToolPermissionRulesEditor.tsx diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/page.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/page.tsx index 4e7fa88f70f..2d378437371 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/page.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/page.tsx @@ -1,6 +1,6 @@ "use client"; -import GuardrailsPanel from "@/components/guardrails"; +import GuardrailsPanel from "./_components"; import useAuthorized from "@/app/(dashboard)/hooks/useAuthorized"; export default function Guardrails() { diff --git a/ui/litellm-dashboard/tests/CreateKeyPage.expiredToken.test.tsx b/ui/litellm-dashboard/tests/CreateKeyPage.expiredToken.test.tsx index 5add4a2ed48..e871bbe8272 100644 --- a/ui/litellm-dashboard/tests/CreateKeyPage.expiredToken.test.tsx +++ b/ui/litellm-dashboard/tests/CreateKeyPage.expiredToken.test.tsx @@ -127,7 +127,7 @@ vi.mock("@/components/chat_ui/ChatUI", () => ({ default: stub("chat-ui") })); vi.mock("@/components/leftnav", () => ({ default: stub("sidebar") })); vi.mock("@/app/(dashboard)/old-usage/_components/usage", () => ({ default: stub("usage") })); vi.mock("@/components/cache_dashboard", () => ({ default: stub("cache-dashboard") })); -vi.mock("@/components/guardrails", () => ({ default: stub("guardrails") })); +vi.mock("@/app/(dashboard)/guardrails/_components", () => ({ default: stub("guardrails") })); vi.mock("@/components/prompts", () => ({ default: stub("prompts") })); vi.mock("@/components/transform_request", () => ({ default: stub("transform-request") })); vi.mock("@/components/mcp_tools", () => ({ MCPServers: stub("mcp-servers") }));