Added polling for watcher.

This commit is contained in:
Patrick Fic
2020-10-20 10:53:50 -07:00
parent 900724f660
commit c277f6d32d
20 changed files with 205 additions and 19 deletions

View File

@@ -0,0 +1,54 @@
import { InputNumber, Switch } from "antd";
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import ipcTypes from "../../../ipc.types";
import { selectSettings } from "../../../redux/application/application.selectors";
import DataLabel from "../../atoms/data-label/data-label.atom";
const { ipcRenderer } = window;
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
appSettings: selectSettings,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export function WatcherPollingMolecule({ appSettings }) {
const handlePollingToggle = (val) => {
ipcRenderer.send(ipcTypes.default.store.set, { "polling.enabled": val });
};
const handleIntervalChange = (val) => {
ipcRenderer.send(ipcTypes.default.store.set, {
"polling.pollingInterval": val,
});
};
return (
<div>
<DataLabel label="Polling Enabled? (Recommended for Network Monitoring)">
<Switch
onChange={handlePollingToggle}
checked={
appSettings && appSettings.polling && appSettings.polling.enabled
}
/>
</DataLabel>
<DataLabel label="Polling Interval">
<InputNumber
onChange={handleIntervalChange}
value={
appSettings &&
appSettings.polling &&
appSettings.polling.pollingInterval
}
/>
</DataLabel>
</div>
);
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(WatcherPollingMolecule);