Added polling for watcher.
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user