CEC-371 Update car ECUs display (#78)
* Clean up className styles Update car status page to show update and ECUs * Add update ecu version button Show all ECUs on car status page Only show car ecus for search
This commit is contained in:
@@ -2,16 +2,17 @@ import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { Chip } from "@material-ui/core";
|
||||
|
||||
const ECUList = ({ list, delimiter, search }) => {
|
||||
const ECUList = ({ list, delimiter, search, searchedOnly }) => {
|
||||
if (!list) return null;
|
||||
if (!delimiter) delimiter = ",";
|
||||
|
||||
const items = list.split(delimiter);
|
||||
|
||||
return items.map((item, index) => {
|
||||
const match = search
|
||||
? item.toLowerCase().split(" ").indexOf(search.toLowerCase())
|
||||
: -1;
|
||||
|
||||
if (searchedOnly && match === -1) return null;
|
||||
return (
|
||||
<Chip
|
||||
key={index}
|
||||
@@ -29,6 +30,7 @@ ECUList.propTypes = {
|
||||
list: PropTypes.string,
|
||||
delimiter: PropTypes.string,
|
||||
search: PropTypes.string,
|
||||
searchedOnly: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default ECUList;
|
||||
|
||||
@@ -30,7 +30,7 @@ const SearchField = (props) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<FormControl className={clsx(classes.margin, classes.textField)}>
|
||||
<FormControl className={clsx(classes.margin, classes.fullWidth)}>
|
||||
<InputLabel htmlFor="search">Search</InputLabel>
|
||||
<Input
|
||||
id="search"
|
||||
|
||||
Reference in New Issue
Block a user