CEC-5982 - Allow selecting all VINs in a fleet for bulk Flashpack update action

This commit is contained in:
padamsen_fisker
2024-04-19 09:40:17 -04:00
parent fcf9971fbe
commit eb3047372f
6 changed files with 137 additions and 16 deletions

View File

@@ -38,12 +38,53 @@ exports[`FleetVehiclesTable Render 1`] = `
</svg>
</a>
</div>
<div
class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-2"
>
<label
class="MuiFormControlLabel-root"
>
<span
aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-0 MuiCheckbox-root MuiCheckbox-colorSecondary MuiIconButton-colorSecondary"
>
<span
class="MuiIconButton-label"
>
<input
class="PrivateSwitchBase-input-0"
data-indeterminate="false"
type="checkbox"
value=""
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
/>
</svg>
</span>
<span
class="MuiTouchRipple-root"
/>
</span>
<span
class="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
>
Select All Vehicles
</span>
</label>
</div>
<div
class="MuiGrid-root MuiGrid-item MuiGrid-grid-md-4"
/>
<div
align="right"
class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-7"
class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-5"
>
<div
class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"

View File

@@ -1,5 +1,6 @@
import {
Checkbox,
FormControlLabel,
Grid,
LinearProgress,
Table,
@@ -70,6 +71,7 @@ const MainForm = ({ name }) => {
const [order, setOrder] = useState("desc");
const [search, setSearch] = useState("");
const [selected, setSelected] = useState([]);
const [selectAllSelected, setSelectAllSelected] = useState(false);
const componentMounted = useRef(true);
const classes = useStyles();
const { setMessage } = useStatusContext();
@@ -174,15 +176,28 @@ const MainForm = ({ name }) => {
<AddCircleIcon fontSize="large" />
</Link>
</Grid>
<Grid item md={2} className={classes.textJustifyAlign}>
<FormControlLabel control={
<Checkbox
checked={selectAllSelected}
onChange={() => setSelectAllSelected(selectAllSelected => !selectAllSelected)}
/>
} label="Select All Vehicles" />
</Grid>
<Grid item md={4}>
<BulkActions
actions={["updateFleetVehicles", "addTags", "sms", "updateConfig", "remoteCommand", "diagnostic", "updateFlashpackNumbers"]}
actions={
selectAllSelected ?
["updateFlashpackNumbers"] :
["updateFleetVehicles", "addTags", "sms", "updateConfig", "remoteCommand", "diagnostic", "updateFlashpackNumbers"]
}
ids={selected}
fleet={name}
selectAll={selectAllSelected}
callback={bulkActionCallback}
/>
</Grid>
<Grid item md={7} align="right" className={classes.textCenterAlign}>
<Grid item md={5} align="right" className={classes.textCenterAlign}>
<SearchField classes={classes} onSearch={handleSearch} />
</Grid>
</Grid>

View File

@@ -37,12 +37,53 @@ exports[`VehiclesTab Render 1`] = `
</svg>
</a>
</div>
<div
class="MuiGrid-root makeStyles-textJustifyAlign-0 MuiGrid-item MuiGrid-grid-md-2"
>
<label
class="MuiFormControlLabel-root"
>
<span
aria-disabled="false"
class="MuiButtonBase-root MuiIconButton-root PrivateSwitchBase-root-0 MuiCheckbox-root MuiCheckbox-colorSecondary MuiIconButton-colorSecondary"
>
<span
class="MuiIconButton-label"
>
<input
class="PrivateSwitchBase-input-0"
data-indeterminate="false"
type="checkbox"
value=""
/>
<svg
aria-hidden="true"
class="MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
/>
</svg>
</span>
<span
class="MuiTouchRipple-root"
/>
</span>
<span
class="MuiTypography-root MuiFormControlLabel-label MuiTypography-body1"
>
Select All Vehicles
</span>
</label>
</div>
<div
class="MuiGrid-root MuiGrid-item MuiGrid-grid-md-4"
/>
<div
align="right"
class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-7"
class="MuiGrid-root makeStyles-textCenterAlign-0 MuiGrid-item MuiGrid-grid-md-5"
>
<div
class="MuiFormControl-root makeStyles-margin-0 makeStyles-fullWidth-0"