CPU can be throttled in UI.

This commit is contained in:
Roland 2022-02-07 13:37:58 -07:00
parent 703f916c53
commit 1222a39867
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
8 changed files with 199 additions and 5 deletions

View file

@ -21,6 +21,7 @@ import {
secondsToFrequency,
TabLinks,
textEllipsis,
ThrottleToggle,
WROLModeMessage
} from "./Common";
import {Route} from "react-router-dom";
@ -80,6 +81,8 @@ class Settings extends React.Component {
<WROLModeMessage content='Settings are disabled because WROL Mode is enabled.'/>
<HotspotToggle/>
<br/>
<ThrottleToggle style={{marginTop: '0.5em'}}/>
<Divider/>
<p>

View file

@ -5,7 +5,7 @@ import Button from "semantic-ui-react/dist/commonjs/elements/Button";
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
import {getConfig} from "../api";
import {useDownloaders, useHotspot} from "../hooks/customHooks";
import {useDownloaders, useHotspot, useThrottle} from "../hooks/customHooks";
export const API_URI = `http://${window.location.host}/api`;
export const VIDEOS_API = `${API_URI}/videos`;
@ -645,9 +645,9 @@ export function CardGroupCentered(props) {
)
}
export function HotspotToggle() {
export function HotspotToggle(props) {
let {on, setHotspot} = useHotspot();
return <Checkbox toggle
return <Checkbox toggle {...props}
label='WiFi Hotspot'
disabled={on === null}
checked={on === true}
@ -655,6 +655,16 @@ export function HotspotToggle() {
/>;
}
export function ThrottleToggle(props) {
let {on, setThrottle} = useThrottle();
return <Checkbox toggle {...props}
label='CPU Power-save'
disabled={on === null}
checked={on === true}
onChange={(e, data) => setThrottle(data.checked)}
/>;
}
export function DisableDownloadsToggle() {
let {on, setDownloads} = useDownloaders();
return <Checkbox toggle