(props: Props)
| 9 | } |
| 10 | |
| 11 | const 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 | |
| 39 | export default DataTableView; |
nothing calls this directly
no outgoing calls
no test coverage detected