2022-11-22 12:16:34 +00:00
|
|
|
import { Datatable as GenericDatatable } from '@@/datatables';
|
|
|
|
import { createPersistedStore } from '@@/datatables/types';
|
2023-05-02 06:42:16 +00:00
|
|
|
import { useTableState } from '@@/datatables/useTableState';
|
2022-04-19 18:43:36 +00:00
|
|
|
|
2022-11-22 12:16:34 +00:00
|
|
|
import { columns } from './columns';
|
2023-03-06 20:25:04 +00:00
|
|
|
import { Filter } from './Filter';
|
2023-05-14 02:26:11 +00:00
|
|
|
import { TableActions } from './TableActions';
|
2023-03-06 20:25:04 +00:00
|
|
|
import { useEnvironments } from './useEnvironments';
|
2022-04-19 18:43:36 +00:00
|
|
|
|
2022-11-22 12:16:34 +00:00
|
|
|
const storageKey = 'edge-devices-waiting-room';
|
|
|
|
|
2023-09-04 09:33:07 +00:00
|
|
|
const settingsStore = createPersistedStore(storageKey, 'name');
|
2022-04-19 18:43:36 +00:00
|
|
|
|
2023-03-06 20:25:04 +00:00
|
|
|
export function Datatable() {
|
2023-05-02 06:42:16 +00:00
|
|
|
const tableState = useTableState(settingsStore, storageKey);
|
2023-08-15 03:05:10 +00:00
|
|
|
const {
|
|
|
|
data: environments,
|
|
|
|
totalCount,
|
|
|
|
isLoading,
|
|
|
|
page,
|
|
|
|
setPage,
|
|
|
|
} = useEnvironments({
|
|
|
|
pageLimit: tableState.pageSize,
|
|
|
|
search: tableState.search,
|
|
|
|
});
|
|
|
|
|
2022-04-19 18:43:36 +00:00
|
|
|
return (
|
2022-11-22 12:16:34 +00:00
|
|
|
<GenericDatatable
|
2023-05-02 06:42:16 +00:00
|
|
|
settingsManager={tableState}
|
2022-11-22 12:16:34 +00:00
|
|
|
columns={columns}
|
2023-03-06 20:25:04 +00:00
|
|
|
dataset={environments}
|
2022-11-22 12:16:34 +00:00
|
|
|
title="Edge Devices Waiting Room"
|
|
|
|
emptyContentLabel="No Edge Devices found"
|
|
|
|
renderTableActions={(selectedRows) => (
|
2023-05-14 02:26:11 +00:00
|
|
|
<TableActions selectedRows={selectedRows} />
|
2022-11-22 12:16:34 +00:00
|
|
|
)}
|
|
|
|
isLoading={isLoading}
|
2023-08-22 06:36:31 +00:00
|
|
|
isServerSidePagination
|
2023-08-15 03:05:10 +00:00
|
|
|
page={page}
|
|
|
|
onPageChange={setPage}
|
2023-08-22 06:36:31 +00:00
|
|
|
totalCount={totalCount}
|
2023-03-06 20:25:04 +00:00
|
|
|
description={<Filter />}
|
2022-11-22 12:16:34 +00:00
|
|
|
/>
|
2022-04-19 18:43:36 +00:00
|
|
|
);
|
|
|
|
}
|