CEC-2152 Add persistent page size for tables (#175)

* Add persistent page size

* Add permissions for sms as well

Co-authored-by: jwu-fisker <jwu@fiskerinc.com>
This commit is contained in:
arpanetus
2022-08-05 17:03:38 +06:00
committed by GitHub
parent 93926d3c01
commit 260a8033bb
15 changed files with 109 additions and 14 deletions

View File

@@ -14,6 +14,7 @@ import TableHeaderSortable from "../../Table/HeaderSortable";
import { useVehicleContext } from "../../Contexts/VehicleContext";
import { useStatusContext } from "../../Contexts/StatusContext";
import { logger } from "../../../services/monitoring";
import {useLocalStorage} from "../../useLocalStorage";
const tableColumns = [
{
@@ -42,10 +43,12 @@ const tableColumns = [
},
];
const PAGE_SIZE = "CAR_ECUS_TABLE_PAGE_SIZE";
const CarECUsTable = ({ vin, token, classes }) => {
const [ecus, setECUs] = useState([]);
const [total, setTotal] = useState(0);
const [pageSize, setPageSize] = useState(10);
const [pageSize, setPageSize] = useLocalStorage(PAGE_SIZE, 10);
const [pageIndex, setPageIndex] = useState(0);
const [orderBy, setOrderBy] = useState("ecu");
const [order, setOrder] = useState("desc");