diff --git a/src/fireedge/src/client/components/Tables/Hosts/index.js b/src/fireedge/src/client/components/Tables/Hosts/index.js index d55c565734..ec46853faa 100644 --- a/src/fireedge/src/client/components/Tables/Hosts/index.js +++ b/src/fireedge/src/client/components/Tables/Hosts/index.js @@ -5,11 +5,11 @@ import { useFetch } from 'client/hooks' import { useHost, useHostApi } from 'client/features/One' import { EnhancedTable } from 'client/components/Tables' -import { HostCard } from 'client/components/Cards' -import Columns from 'client/components/Tables/Hosts/columns' +import HostColumns from 'client/components/Tables/Hosts/columns' +import HostRow from 'client/components/Tables/Hosts/row' const HostsTable = () => { - const columns = React.useMemo(() => Columns, []) + const columns = React.useMemo(() => HostColumns, []) const hosts = useHost() const { getHosts } = useHostApi() @@ -24,7 +24,8 @@ const HostsTable = () => { columns={columns} data={hosts} isLoading={loading || reloading} - MobileComponentRow={HostCard} + getRowId={row => String(row.ID)} + RowComponent={HostRow} /> ) } diff --git a/src/fireedge/src/client/components/Tables/Hosts/row.js b/src/fireedge/src/client/components/Tables/Hosts/row.js new file mode 100644 index 0000000000..b3764e1a90 --- /dev/null +++ b/src/fireedge/src/client/components/Tables/Hosts/row.js @@ -0,0 +1,68 @@ +import * as React from 'react' +import PropTypes from 'prop-types' + +import { Server, ModernTv } from 'iconoir-react' +import { Typography } from '@material-ui/core' + +import { StatusCircle, LinearProgressWithLabel, StatusChip } from 'client/components/Status' +import { rowStyles } from 'client/components/Tables/styles' + +import * as HostModel from 'client/models/Host' + +const Row = ({ value, ...props }) => { + const classes = rowStyles() + const { ID, NAME, IM_MAD, VM_MAD, VMS, CLUSTER } = value + + const { + percentCpuUsed, + percentCpuLabel, + percentMemUsed, + percentMemLabel + } = HostModel.getAllocatedInfo(value) + + const state = HostModel.getState(value) + const runningVms = [VMS?.ID ?? []].flat().length || 0 + + const labels = [...new Set([IM_MAD, VM_MAD])] + + return ( +