CEC-4546: add ecu search (#391)

* CEC-4546: add ecu search

* CEC-4546: add checkbox to filter current

* add column

* set initial state to true for unique
This commit is contained in:
Tristan Timblin
2023-07-18 12:50:27 -04:00
committed by GitHub
parent 7dff3be1da
commit e767e6dfdd
4 changed files with 184 additions and 6 deletions

View File

@@ -58,11 +58,15 @@ const tableColumns = [
id: "updated_at",
label: "Updated",
},
{
id: "epoch_usec",
label: "Epoch",
},
];
const PAGE_SIZE = "CAR_ECUS_TABLE_PAGE_SIZE";
const CarECUsTable = ({ vin, token, classes }) => {
const CarECUsTable = ({ vin, token, classes, search, unique }) => {
const [ecus, setECUs] = useState([]);
const [total, setTotal] = useState(0);
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
@@ -79,6 +83,8 @@ const CarECUsTable = ({ vin, token, classes }) => {
const result = await getECUs(
{
vin,
search,
unique,
limit: pageSize,
offset: pageSize * pageIndex,
order: `${orderBy} ${order}`,
@@ -93,7 +99,7 @@ const CarECUsTable = ({ vin, token, classes }) => {
}
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [vin, token, pageIndex, pageSize, orderBy, order]);
}, [vin, token, pageIndex, pageSize, orderBy, order, search, unique]);
const handleChangePageIndex = (event, newIndex) => {
setPageIndex(newIndex);