MCPcopy Create free account
hub / github.com/sqlchat/sqlchat / DataTableView

Function DataTableView

src/components/ExecutionView/DataTableView.tsx:11–37  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

9}
10
11const DataTableView = (props: Props) => {
12 const { rawResults } = props;
13 const { t } = useTranslation();
14 const columns = Object.keys(head(rawResults) || {}).map((key) => {
15 return {
16 name: key,
17 sortable: true,
18 selector: (row: any) => row[key],
19 };
20 });
21
22 return rawResults.length === 0 ? (
23 <div className="w-full flex flex-col justify-center items-center py-6 pt-10">
24 <Icon.BsBox2 className="w-7 h-auto opacity-70" />
25 <span className="text-sm font-mono text-gray-500 mt-2">{t("execution.message.no-data")}</span>
26 </div>
27 ) : (
28 <DataTable
29 className="w-full border !rounded-lg dark:border-zinc-700"
30 columns={columns}
31 data={rawResults}
32 fixedHeader
33 pagination
34 responsive
35 />
36 );
37};
38
39export default DataTableView;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected