import FormControl from '@material-ui/core/FormControl'; import Paper from '@material-ui/core/Paper'; import Table from '@material-ui/core/Table'; import TableBody from '@material-ui/core/TableBody'; import TableHead from '@material-ui/core/TableHead'; import TableRow from '@material-ui/core/TableRow'; import TextField from '@material-ui/core/TextField'; import Typography from '@material-ui/core/Typography'; import { debounce } from 'lodash'; import * as React from 'react'; import Execution from './Execution'; import { IGlobalWindow, ISchedulableRecordsProps, ISchedulableRecordsStates } from './interfaces'; import SchedulableRecord from './SchedulableRecord'; import SchedulableRecordTableCell from './SchedulableRecordTableCell'; declare var window: IGlobalWindow; class SchedulableRecords extends React.Component { private fetchLoop: any; private executionFetchLoop: any; private handleTimeRangeFilterChange = debounce((event: any) => { this.setState({timeRangeMinute: parseInt(event.target.value, 10)}); this.fetchSchedulableRecord(); }, 500) constructor(props: ISchedulableRecordsProps) { super(props); this.state = {records: [], timeRangeMinute: 10, executions: []}; } public componentDidMount() { this.fetchSchedulableRecord(); this.setFetchSchedulableRecordLoop(); this.fetchExecution(); this.setFetchExecutionLoop(); } public componentWillUnmount() { if (this.fetchLoop) { clearTimeout(this.fetchLoop); } if (this.executionFetchLoop) { clearTimeout(this.executionFetchLoop); } } public setFetchSchedulableRecordLoop(): void { this.fetchLoop = setTimeout(() => { this.fetchSchedulableRecord(); this.setFetchSchedulableRecordLoop(); }, 3000); } public fetchSchedulableRecord(): void { const that = this; fetch(`${window.mountPath}/models/${this.props.model_name}.json?after=${this.state.timeRangeMinute}`) .then((res) => res.json()) .then((data) => { that.setState(data); }).catch((err) => { console.error(err); }); } public setFetchExecutionLoop(): void { this.fetchLoop = setTimeout(() => { this.fetchExecution(); this.setFetchExecutionLoop(); }, 3000); } public fetchExecution(): void { const that = this; fetch(`${window.mountPath}/models/${this.props.model_name}/executions.json`) .then((res) => res.json()) .then((data) => { that.setState({executions: data.records}); }).catch((err) => { console.error(err); }); } public render() { return (
Status ID Cron Next Execute At Delay Sec Execute Lock Time To Unlock Last Executed At Locked By Last Error Time Retry Count Detail Ops {this.state.records.map((record) => ( ))}

Executions Status ID ScheduleID ScheduleType WorkerID Executed At Completed At Error Name Error Reason Detail Ops {this.state.executions.map((execution) => ( ))}
) } private wrappedHandleTimeRangeFilterChange = (event: any) => { event.persist(); this.handleTimeRangeFilterChange(event); } } export default SchedulableRecords;