Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,6 @@ describe("Devices list", () => {
screen.getByPlaceholderText("Search by hostname..."),
).toBeInTheDocument();
});

it('renders the "Custom Fields" column header', () => {
vi.mocked(useDevices).mockReturnValue({
...defaultHookState,
devices: [makeDevice()],
totalCount: 1,
});
renderPage();
expect(
screen.getByRole("columnheader", { name: "Custom Fields" }),
).toBeInTheDocument();
});
});

describe("loading state", () => {
Expand Down Expand Up @@ -284,48 +272,6 @@ describe("Devices list", () => {
});
});

describe("custom fields column", () => {
it("renders '—' when device has no custom fields", () => {
vi.mocked(useDevices).mockReturnValue({
...defaultHookState,
devices: [makeDevice({ custom_fields: {} })],
totalCount: 1,
});
renderPage();
expect(screen.getByText("—")).toBeInTheDocument();
});

it("renders key and value badges for each custom field", () => {
vi.mocked(useDevices).mockReturnValue({
...defaultHookState,
devices: [
makeDevice({ custom_fields: { env: "production", owner: "team-a" } }),
],
totalCount: 1,
});
renderPage();
expect(screen.getByText("env")).toBeInTheDocument();
expect(screen.getByText("production")).toBeInTheDocument();
expect(screen.getByText("owner")).toBeInTheDocument();
expect(screen.getByText("team-a")).toBeInTheDocument();
});

it("renders multiple custom field badges for multiple fields", () => {
vi.mocked(useDevices).mockReturnValue({
...defaultHookState,
devices: [makeDevice({ custom_fields: { a: "1", b: "2", c: "3" } })],
totalCount: 1,
});
renderPage();
expect(screen.getByText("a")).toBeInTheDocument();
expect(screen.getByText("1")).toBeInTheDocument();
expect(screen.getByText("b")).toBeInTheDocument();
expect(screen.getByText("2")).toBeInTheDocument();
expect(screen.getByText("c")).toBeInTheDocument();
expect(screen.getByText("3")).toBeInTheDocument();
});
});

describe("error state", () => {
it("renders an error message when hook returns an error", () => {
vi.mocked(useDevices).mockReturnValue({
Expand Down
28 changes: 0 additions & 28 deletions ui-react/apps/console/src/pages/devices/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,34 +136,6 @@ export default function Devices() {
<TagsPopover device={device} onFilterTag={addFilterTag} />
),
},
{
key: "custom_fields",
header: "Custom Fields",
render: (device) => {
const entries = Object.entries(device.custom_fields ?? {});
if (entries.length === 0)
return (
<span className="text-2xs text-text-muted/30 font-mono">—</span>
);
return (
<div className="flex flex-wrap gap-1">
{entries.map(([k, v]) => (
<span
key={k}
className="inline-flex items-center text-2xs rounded overflow-hidden border border-border font-mono"
>
<span className="px-1.5 py-0.5 bg-surface text-text-muted">
{k}
</span>
<span className="px-1.5 py-0.5 bg-card text-text-primary font-medium">
{v}
</span>
</span>
))}
</div>
);
},
},
{
key: "last_seen",
header: "Last Seen",
Expand Down
Loading