CEC-2291 Remote Commands (#194)

This commit is contained in:
arpanetus
2022-09-07 23:21:57 +06:00
committed by GitHub
parent 153c6bdcf7
commit aa5a1e20e0
19 changed files with 1187 additions and 148 deletions

View File

@@ -0,0 +1,73 @@
import PropTypes from "prop-types";
import {FormControl} from "@material-ui/core";
import useStyles from "../../useStyles";
import {MuiPickersUtilsProvider} from "@material-ui/pickers";
import DateFnsUtils from "@date-io/date-fns";
export const Dates = (
{
startDateFunc,
endDateFunc,
startDate,
handleStartChange,
endDate,
handleEndChange,
}) => {
if (startDateFunc && endDateFunc) {
return (<MuiPickersUtilsProvider utils={DateFnsUtils}>
{startDateFunc(startDate, handleStartChange)}
{endDateFunc(endDate, handleEndChange, startDate)}
</MuiPickersUtilsProvider>);
}
return null;
}
Dates.propTypes = {
startDateFunc: PropTypes.func,
endDateFunc: PropTypes.func,
startDate: PropTypes.instanceOf(Date),
handleStartChange: PropTypes.func,
endDate: PropTypes.instanceOf(Date),
handleEndChange: PropTypes.func
}
export const Parameters = (props) => {
const {params} = props;
const classes = useStyles();
if (params === null || params === undefined || params === "") {
return null;
}
const {data, handleDataChange} = props;
const {startDate, handleStartChange} = props;
const {endDate, handleEndChange} = props;
return (
<FormControl size="small" className={classes.formControl}>
<div style={{width: "300px", marginTop: "1em"}}>
{params.dataFunc(data, handleDataChange)}
</div>
<Dates
startDateFunc={params.startDateFunc}
endDateFunc={params.endDateFunc}
startDate={startDate}
handleStartChange={handleStartChange}
endDate={endDate}
handleEndChange={handleEndChange}
></Dates>
</FormControl>
)
}
Parameters.propTypes = {
params: PropTypes.any,
data: PropTypes.any,
handleDataChange: PropTypes.func,
startDate: PropTypes.instanceOf(Date),
handleStartChange: PropTypes.func,
endDate: PropTypes.instanceOf(Date),
handleEndChange: PropTypes.func
};