sending device state as a field contains instead of a search field
This commit is contained in:
parent
871cbf424e
commit
3732d76156
3 changed files with 23 additions and 13 deletions
|
|
@ -33,11 +33,11 @@ const useStyles = makeStyles((theme: Theme) => {
|
|||
});
|
||||
|
||||
interface Props {
|
||||
setSearch: React.Dispatch<React.SetStateAction<string>>,
|
||||
setFieldContains: React.Dispatch<React.SetStateAction<Map<string, string>>>,
|
||||
}
|
||||
|
||||
export default function DevicesSummary(props: Props) {
|
||||
const { setSearch } = props;
|
||||
const { setFieldContains } = props;
|
||||
const deviceAPI = useDeviceAPI()
|
||||
const theme = useTheme()
|
||||
const classes = useStyles()
|
||||
|
|
@ -66,16 +66,16 @@ export default function DevicesSummary(props: Props) {
|
|||
useEffect(() => {
|
||||
switch (selected) {
|
||||
case "total":
|
||||
setSearch("");
|
||||
setFieldContains(new Map<string, string>());
|
||||
break;
|
||||
case "active":
|
||||
setSearch("DEVICE_STATE_OK");
|
||||
setFieldContains(new Map<string, string>([["state", "DEVICE_STATE_OK"]]));
|
||||
break;
|
||||
case "warning":
|
||||
setSearch("DEVICE_STATE_LOW_POWER");
|
||||
setFieldContains(new Map<string, string>([["state", "DEVICE_STATE_LOW_POWER"]]));
|
||||
break;
|
||||
case "offline":
|
||||
setSearch("DEVICE_STATE_MISSING");
|
||||
setFieldContains(new Map<string, string>([["state", "DEVICE_STATE_MISSING"]]));
|
||||
break;
|
||||
}
|
||||
}, [selected])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue