mirror of
https://github.com/prymitive/karma
synced 2026-05-09 03:36:44 +00:00
This adds a checkbox in the settings form to control if navbar autohide is on or off Fixes #530
62 lines
1.4 KiB
JavaScript
62 lines
1.4 KiB
JavaScript
import React, { Component } from "react";
|
|
import PropTypes from "prop-types";
|
|
|
|
import { observable, action, toJS } from "mobx";
|
|
import { observer } from "mobx-react";
|
|
|
|
import InputRange from "react-input-range";
|
|
|
|
import { Settings } from "Stores/Settings";
|
|
|
|
import "./InputRange.scss";
|
|
|
|
const FetchConfiguration = observer(
|
|
class FetchConfiguration extends Component {
|
|
static propTypes = {
|
|
settingsStore: PropTypes.instanceOf(Settings).isRequired
|
|
};
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.config = observable({
|
|
fetchInterval: toJS(props.settingsStore.fetchConfig.config.interval)
|
|
});
|
|
}
|
|
|
|
onChange = action(value => {
|
|
this.config.fetchInterval = value;
|
|
});
|
|
|
|
onChangeComplete = action(value => {
|
|
const { settingsStore } = this.props;
|
|
|
|
settingsStore.fetchConfig.setInterval(value);
|
|
});
|
|
|
|
formatLabel(value) {
|
|
return `${value}s`;
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div className="form-group text-center">
|
|
<label className="mb-4 font-weight-bold">Refresh interval</label>
|
|
<InputRange
|
|
minValue={10}
|
|
maxValue={120}
|
|
step={10}
|
|
value={this.config.fetchInterval}
|
|
id="formControlRange"
|
|
formatLabel={this.formatLabel}
|
|
onChange={this.onChange}
|
|
onChangeComplete={this.onChangeComplete}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
);
|
|
|
|
export { FetchConfiguration };
|