From 377d54e6946fff87a76a9d30c188ed10a4e1b896 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Sat, 18 Jul 2026 11:37:39 -0700 Subject: [PATCH] refactor(ui): migrate policy attachments table onto shared DataTable (#33827) * refactor(ui): migrate policy attachments table onto shared DataTable * refactor(ui): pass a specific success message to the attachment copy action --- ui/litellm-dashboard/eslint-suppressions.json | 13 - ...able.test.tsx => AttachmentTable.test.tsx} | 113 ++++--- .../policies/_components/AttachmentTable.tsx | 66 ++++ .../_components/AttachmentTableColumns.tsx | 186 +++++++++++ .../policies/_components/attachment_table.tsx | 291 ------------------ .../policies/_components/index.test.tsx | 23 +- .../policies/_components/index.tsx | 2 +- 7 files changed, 309 insertions(+), 385 deletions(-) rename ui/litellm-dashboard/src/app/(dashboard)/policies/_components/{attachment_table.test.tsx => AttachmentTable.test.tsx} (55%) create mode 100644 ui/litellm-dashboard/src/app/(dashboard)/policies/_components/AttachmentTable.tsx create mode 100644 ui/litellm-dashboard/src/app/(dashboard)/policies/_components/AttachmentTableColumns.tsx delete mode 100644 ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.tsx diff --git a/ui/litellm-dashboard/eslint-suppressions.json b/ui/litellm-dashboard/eslint-suppressions.json index dcf482450e9..c775af81ba8 100644 --- a/ui/litellm-dashboard/eslint-suppressions.json +++ b/ui/litellm-dashboard/eslint-suppressions.json @@ -881,19 +881,6 @@ "count": 1 } }, - "src/app/(dashboard)/policies/_components/attachment_table.test.tsx": { - "react/display-name": { - "count": 1 - } - }, - "src/app/(dashboard)/policies/_components/attachment_table.tsx": { - "no-nested-ternary": { - "count": 1 - }, - "no-restricted-imports": { - "count": 1 - } - }, "src/app/(dashboard)/policies/_components/guardrail_selection_modal.tsx": { "no-nested-ternary": { "count": 1 diff --git a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/AttachmentTable.test.tsx similarity index 55% rename from ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.test.tsx rename to ui/litellm-dashboard/src/app/(dashboard)/policies/_components/AttachmentTable.test.tsx index c53881e5cce..b544c44d190 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/attachment_table.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/policies/_components/AttachmentTable.test.tsx @@ -1,63 +1,17 @@ import React from "react"; -import { screen } from "@testing-library/react"; +import { screen, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { renderWithProviders } from "@/../tests/test-utils"; import { beforeEach, describe, expect, it, vi } from "vitest"; -import AttachmentTable from "./attachment_table"; +import AttachmentTable from "./AttachmentTable"; import { PolicyAttachment } from "@/components/policies/types"; vi.mock("./impact_popover", () => ({ - default: () =>