• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 20237133797

15 Dec 2025 03:10PM UTC coverage: 79.68% (-0.4%) from 80.089%
20237133797

Pull #783

github

web-flow
Merge 8aebebbbf into cced0c7fe
Pull Request #783: feat: implement MCP-UI support

1471 of 1927 branches covered (76.34%)

Branch coverage included in aggregate %.

57 of 238 new or added lines in 13 files covered. (23.95%)

26 existing lines in 1 file now uncovered.

6744 of 8383 relevant lines covered (80.45%)

84.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

2.33
/src/ui/components/ListDatabases/ListDatabases.tsx
1
import React from "react";
3✔
NEW
2
import { useRenderData } from "../../hooks/index.js";
×
NEW
3
import {
×
4
    Cell as LGCell,
5
    HeaderCell as LGHeaderCell,
6
    HeaderRow,
7
    Row as LGRow,
8
    Table,
9
    TableBody,
10
    TableHead,
11
} from "@leafygreen-ui/table";
NEW
12
import { tableStyles } from "./ListDatabases.styles.js";
×
13
import type { ListDatabasesOutput } from "../../../tools/mongodb/metadata/listDatabases.js";
14

NEW
15
const HeaderCell = LGHeaderCell as React.FC<React.ComponentPropsWithoutRef<"th">>;
×
NEW
16
const Cell = LGCell as React.FC<React.ComponentPropsWithoutRef<"td">>;
×
NEW
17
const Row = LGRow as React.FC<React.ComponentPropsWithoutRef<"tr">>;
×
18

NEW
19
function formatBytes(bytes: number): string {
×
NEW
20
    if (bytes === 0) return "0 Bytes";
×
21

NEW
22
    const k = 1024;
×
NEW
23
    const sizes = ["Bytes", "KB", "MB", "GB", "TB"];
×
NEW
24
    const i = Math.floor(Math.log(bytes) / Math.log(k));
×
25

NEW
26
    return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i];
×
NEW
27
}
×
28

NEW
29
export const ListDatabases = (): React.ReactElement | null => {
×
NEW
30
    const { data, isLoading, error } = useRenderData<ListDatabasesOutput>();
×
31

NEW
32
    if (isLoading) {
×
NEW
33
        return <div>Loading...</div>;
×
NEW
34
    }
×
35

NEW
36
    if (error) {
×
NEW
37
        return <div>Error: {error}</div>;
×
NEW
38
    }
×
39

NEW
40
    if (!data) {
×
NEW
41
        return null;
×
NEW
42
    }
×
43

NEW
44
    return (
×
NEW
45
        <Table className={tableStyles}>
×
NEW
46
            <TableHead>
×
NEW
47
                <HeaderRow>
×
NEW
48
                    <HeaderCell>DB Name</HeaderCell>
×
NEW
49
                    <HeaderCell>DB Size</HeaderCell>
×
NEW
50
                </HeaderRow>
×
NEW
51
            </TableHead>
×
NEW
52
            <TableBody>
×
NEW
53
                {data.databases.map((db) => (
×
NEW
54
                    <Row key={db.name}>
×
NEW
55
                        <Cell>{db.name}</Cell>
×
NEW
56
                        <Cell>{formatBytes(db.size)}</Cell>
×
NEW
57
                    </Row>
×
NEW
58
                ))}
×
NEW
59
            </TableBody>
×
NEW
60
        </Table>
×
61
    );
NEW
62
};
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc