mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Creating WROLModeMessage to warn users why functionality is disabled.
This commit is contained in:
parent
491db17fac
commit
ae9737e52b
4 changed files with 42 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ import {
|
|||
startDownloads
|
||||
} from "../api";
|
||||
import TimezoneSelect from 'react-timezone-select';
|
||||
import {secondsToDate, secondsToFrequency} from "./Common";
|
||||
import {secondsToDate, secondsToFrequency, WROLModeMessage} from "./Common";
|
||||
|
||||
class Settings extends React.Component {
|
||||
|
||||
|
|
@ -77,6 +77,7 @@ class Settings extends React.Component {
|
|||
|
||||
return (
|
||||
<Container fluid>
|
||||
<WROLModeMessage content='Settings are disabled because WROL Mode is enabled.'/>
|
||||
<p>
|
||||
The global settings for your server.
|
||||
</p>
|
||||
|
|
@ -298,7 +299,7 @@ class Downloads extends React.Component {
|
|||
recurring_downloads: null,
|
||||
pending_downloads: null,
|
||||
stopOpen: false,
|
||||
disabled: true,
|
||||
disabled: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -427,6 +428,7 @@ class Downloads extends React.Component {
|
|||
|
||||
return (
|
||||
<div>
|
||||
<WROLModeMessage content='Downloads are disabled because WROL Mode is enabled.'/>
|
||||
{allButton}
|
||||
<Header as='h1'>Downloads</Header>
|
||||
{onceTable}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,15 @@ import {
|
|||
} from "../api";
|
||||
import _ from "lodash";
|
||||
import Container from "semantic-ui-react/dist/commonjs/elements/Container";
|
||||
import {APIForm, frequencyOptions, humanFileSize, RequiredAsterisk, secondsToDate, secondsToFrequency} from "./Common";
|
||||
import {
|
||||
APIForm,
|
||||
frequencyOptions,
|
||||
humanFileSize,
|
||||
RequiredAsterisk,
|
||||
secondsToDate,
|
||||
secondsToFrequency,
|
||||
WROLModeMessage
|
||||
} from "./Common";
|
||||
import {Link} from "react-router-dom";
|
||||
import Message from "semantic-ui-react/dist/commonjs/collections/Message";
|
||||
import Confirm from "semantic-ui-react/dist/commonjs/addons/Confirm";
|
||||
|
|
@ -278,6 +286,7 @@ class ChannelPage extends APIForm {
|
|||
return (
|
||||
<Container fluid>
|
||||
<Header as="h1">{this.props.header}</Header>
|
||||
<WROLModeMessage content='Channel page is disabled while WROL Mode is enabled.'/>
|
||||
<Form
|
||||
id="editChannel"
|
||||
onSubmit={this.handleSubmit}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import React, {useState} from "react";
|
||||
import React, {useEffect, useState} from "react";
|
||||
import {Card, Container, Form, Icon, Image, Input, Pagination, Progress} from 'semantic-ui-react';
|
||||
import {Link} from "react-router-dom";
|
||||
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";
|
||||
|
||||
export const API_URI = `http://${window.location.host}/api`;
|
||||
export const VIDEOS_API = `${API_URI}/videos`;
|
||||
|
|
@ -583,3 +585,26 @@ export function MoreButton(props) {
|
|||
</Grid>
|
||||
)
|
||||
}
|
||||
|
||||
export const useWROLMode = () => {
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
|
||||
const fetchStatus = async () => {
|
||||
let config = await getConfig();
|
||||
setEnabled(config['wrol_mode']);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
fetchStatus();
|
||||
}, []);
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
export function WROLModeMessage({content}) {
|
||||
let enabled = useWROLMode();
|
||||
if (enabled) {
|
||||
return <Message icon='lock' header='WROL Mode Enabled' content={content}/>
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import React from "react";
|
||||
import {Button, Dropdown, Form, Header, Segment, TextArea} from "semantic-ui-react";
|
||||
import {getDownloaders, postDownload} from "../api";
|
||||
import {WROLModeMessage} from "./Common";
|
||||
|
||||
const validUrl = /^(http|https):\/\/[^ "]+$/;
|
||||
|
||||
|
|
@ -67,6 +68,7 @@ class Downloader extends React.Component {
|
|||
|
||||
return (
|
||||
<Form onSubmit={this.submitDownload}>
|
||||
<WROLModeMessage content='Downloading is disabled while WROL Mode is enabled'/>
|
||||
<Header as='h4'>Enter the URLs you wish to save offline.</Header>
|
||||
<Form.Field>
|
||||
<TextArea
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue