mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-25 17:36:18 -05:00
controller: Desktop start/stop toggle; rename hotspot/bluetooth actions to what they do
Add a Desktop toggle to the Controller (both UIs) that starts/stops display-manager.service. Fail open: the unit is never enabled/disabled, so the desktop always returns on reboot; users who want it disabled across reboots can set the default target themselves. Rename the hotspot and bluetooth actions to reflect their real behavior: - enable/disable_hotspot -> start/stop_hotspot (/api/hotspot/start|stop) - enable/disable_bluetooth -> unblock/block_bluetooth (rfkill semantics, /api/bluetooth/unblock|block) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
a4eeba14ee
commit
3e559e1bf8
14 changed files with 712 additions and 132 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import {Checkbox, Container, Dropdown, Form, Icon, Input} from "semantic-ui-react";
|
||||
import {Button, Confirm, Header, Loader, Modal, Segment, Table} from "../Theme";
|
||||
import {APIButton, BluetoothToggle, DirectorySearch, HandPointMessage, HotspotToggle, InfoMessage, ThrottleToggle, Toggle,} from "../Common";
|
||||
import {APIButton, BluetoothToggle, DesktopToggle, DirectorySearch, HandPointMessage, HotspotToggle, InfoMessage, ThrottleToggle, Toggle,} from "../Common";
|
||||
import {useDockerized, useMediaDirectory} from "../../hooks/customHooks";
|
||||
import {Media} from "../../contexts/contexts";
|
||||
import {
|
||||
|
|
@ -1589,6 +1589,7 @@ function AdminControlsSection() {
|
|||
|
||||
<HotspotToggle/>
|
||||
<BluetoothToggle/>
|
||||
<DesktopToggle/>
|
||||
<ThrottleToggle/>
|
||||
|
||||
<HotspotSettingsForm/>
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ jest.mock('../../hooks/customHooks', () => ({
|
|||
useDockerized: jest.fn().mockReturnValue(false),
|
||||
useMediaDirectory: jest.fn().mockReturnValue('/media/wrolpi'),
|
||||
useBluetooth: jest.fn().mockReturnValue({on: false, setBluetooth: jest.fn()}),
|
||||
useDesktop: jest.fn().mockReturnValue({on: true, setDesktop: jest.fn()}),
|
||||
useHotspot: jest.fn().mockReturnValue({on: true, setHotspot: jest.fn()}),
|
||||
useThrottle: jest.fn().mockReturnValue({on: false, setThrottle: jest.fn()}),
|
||||
}));
|
||||
|
|
@ -89,6 +90,7 @@ jest.mock('../Common', () => {
|
|||
return {
|
||||
...actual,
|
||||
BluetoothToggle: () => <div data-testid="bluetooth-toggle">BluetoothToggle</div>,
|
||||
DesktopToggle: () => <div data-testid="desktop-toggle">DesktopToggle</div>,
|
||||
HotspotToggle: () => <div data-testid="hotspot-toggle">HotspotToggle</div>,
|
||||
ThrottleToggle: () => <div data-testid="throttle-toggle">ThrottleToggle</div>,
|
||||
Toggle: ({label, checked, onChange}) => (
|
||||
|
|
@ -174,6 +176,10 @@ describe('ControllerPage', () => {
|
|||
await waitFor(() => {
|
||||
expect(screen.getByText('Hardware Controls')).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.getByTestId('hotspot-toggle')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('bluetooth-toggle')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('desktop-toggle')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('throttle-toggle')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('calls getServices on mount', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue