mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-22 16:06:19 -05:00
Adding timezone to WROLPi config to schedule download window.
This commit is contained in:
parent
c2bab03f42
commit
c2c5d237d7
8 changed files with 162 additions and 3 deletions
|
|
@ -3,7 +3,17 @@ import {SettingsContext, StatusContext} from "../../contexts/contexts";
|
|||
import {checkUpgrade, postRestart, postShutdown, saveSettings as saveSettingsApi, triggerUpgrade} from "../../api";
|
||||
import {getServices, startService, stopService} from "../../api/controller";
|
||||
import {Button, Divider, Form, Header, Loader, Modal, Segment} from "../Theme";
|
||||
import {ButtonGroup, Container, Dimmer, Dropdown, GridColumn, GridRow, Icon, Input} from "semantic-ui-react";
|
||||
import {
|
||||
ButtonGroup,
|
||||
Container,
|
||||
Dimmer,
|
||||
Dropdown,
|
||||
FormDropdown,
|
||||
GridColumn,
|
||||
GridRow,
|
||||
Icon,
|
||||
Input
|
||||
} from "semantic-ui-react";
|
||||
import {
|
||||
APIButton,
|
||||
ErrorMessage,
|
||||
|
|
@ -301,6 +311,7 @@ export function SettingsPage() {
|
|||
|
||||
// Get current settings from the API.
|
||||
const {settings, saveSettings, fetchSettings} = React.useContext(SettingsContext);
|
||||
const {status} = React.useContext(StatusContext);
|
||||
// Used to track changes to the settings form between saves/loads.
|
||||
const [state, setState] = React.useState({});
|
||||
|
||||
|
|
@ -445,6 +456,7 @@ export function SettingsPage() {
|
|||
download_wait: settings.download_wait,
|
||||
download_window_start: settings.download_window_start || '',
|
||||
download_window_end: settings.download_window_end || '',
|
||||
timezone: settings.timezone || '',
|
||||
hotspot_device: settings.hotspot_device,
|
||||
hotspot_on_startup: settings.hotspot_on_startup,
|
||||
hotspot_password: settings.hotspot_password,
|
||||
|
|
@ -492,6 +504,10 @@ export function SettingsPage() {
|
|||
<Icon name='qrcode' size='big'/>
|
||||
</Button>;
|
||||
|
||||
const timezoneOptions = Intl.supportedValuesOf('timeZone').map(tz => (
|
||||
{key: tz, value: tz, text: tz}
|
||||
));
|
||||
|
||||
const navColorOptions = Object.keys(semanticUIColorMap).map(i => {
|
||||
return {key: i, value: i, text: i.charAt(0).toUpperCase() + i.slice(1)}
|
||||
});
|
||||
|
|
@ -709,6 +725,25 @@ export function SettingsPage() {
|
|||
/>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Field width={3}>
|
||||
<label><b>Timezone</b>
|
||||
<InfoPopup
|
||||
content='IANA timezone (e.g. America/Denver). Leave empty to use system timezone.'/>
|
||||
</label>
|
||||
<FormDropdown
|
||||
placeholder='System default'
|
||||
options={timezoneOptions}
|
||||
value={state.timezone || ''}
|
||||
disabled={disabled}
|
||||
search
|
||||
selection
|
||||
clearable
|
||||
onChange={(e, {value}) => setState({...state, timezone: value || ''})}
|
||||
/>
|
||||
</Form.Field>
|
||||
{status && status.local_time &&
|
||||
<p>Current local time: <b>{status.local_time.slice(0, 16).replace('T', ' ')}</b></p>}
|
||||
|
||||
<Divider/>
|
||||
|
||||
<Header as='h3'>Special Directories</Header>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue