mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 03:46:29 -05:00
Moving FileGroups instead of refreshing files after they have been moved.
This commit is contained in:
parent
6fe8a7b704
commit
0f232fd533
59 changed files with 1902 additions and 1040 deletions
|
|
@ -118,13 +118,6 @@ function ArchivePage() {
|
|||
description: 'Archive update has been scheduled.',
|
||||
time: 2000,
|
||||
});
|
||||
} else {
|
||||
toast({
|
||||
type: 'error',
|
||||
title: 'Archive Downloading',
|
||||
description: 'Archive update failed.',
|
||||
time: 2000,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import React, {useState} from "react";
|
||||
import {Dimmer, Dropdown, Grid, Label, StatisticLabel, StatisticValue, TableCell, TableRow,} from "semantic-ui-react";
|
||||
import {Dimmer, Dropdown, Grid, Input, StatisticLabel, StatisticValue, TableCell, TableRow,} from "semantic-ui-react";
|
||||
import {
|
||||
createChannel,
|
||||
createChannelDownload,
|
||||
|
|
@ -19,6 +19,7 @@ import {
|
|||
frequencyOptions,
|
||||
HelpHeader,
|
||||
humanFileSize,
|
||||
humanNumber,
|
||||
RequiredAsterisk,
|
||||
SearchInput,
|
||||
secondsToFrequency,
|
||||
|
|
@ -77,6 +78,10 @@ function ChannelStatistics({statistics}) {
|
|||
<StatisticValue>{secondsToFullDuration(statistics.length)}</StatisticValue>
|
||||
<StatisticLabel>Total Duration</StatisticLabel>
|
||||
</Statistic>
|
||||
<Statistic>
|
||||
<StatisticValue>{humanNumber(statistics.video_tags)}</StatisticValue>
|
||||
<StatisticLabel>Video Tags</StatisticLabel>
|
||||
</Statistic>
|
||||
</Segment>
|
||||
}
|
||||
|
||||
|
|
@ -231,15 +236,7 @@ function ChannelPage({create, header}) {
|
|||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
const response = await refreshChannel(channelId);
|
||||
if (response.status !== 204) {
|
||||
toast({
|
||||
type: 'error',
|
||||
title: 'Failed to refresh',
|
||||
description: "Failed to refresh this channel's directory",
|
||||
time: 5000,
|
||||
})
|
||||
}
|
||||
await refreshChannel(channelId);
|
||||
}
|
||||
|
||||
const handleDelete = async () => {
|
||||
|
|
@ -295,19 +292,36 @@ function ChannelPage({create, header}) {
|
|||
>
|
||||
<ModalHeader>{channel.tag_name ? 'Modify Tag' : 'Add Tag'}</ModalHeader>
|
||||
<ModalContent>
|
||||
<TagsSelector
|
||||
limit={1}
|
||||
selectedTagNames={newTagName ? [newTagName] : []}
|
||||
onAdd={handleTagSelect}
|
||||
onRemove={() => handleTagSelect(null)}
|
||||
/>
|
||||
<br/>
|
||||
<Toggle
|
||||
label='Move to directory: '
|
||||
checked={moveToTagDirectory}
|
||||
onChange={setMoveToTagDirectory}
|
||||
/>
|
||||
{newTagDirectory && <Label size='large'>{newTagDirectory}</Label>}
|
||||
<Grid columns={1}>
|
||||
<Grid.Row>
|
||||
<Grid.Column>
|
||||
<TagsSelector
|
||||
limit={1}
|
||||
selectedTagNames={newTagName ? [newTagName] : []}
|
||||
onAdd={handleTagSelect}
|
||||
onRemove={() => handleTagSelect(null)}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
<Grid.Row>
|
||||
<Grid.Column>
|
||||
<Toggle
|
||||
label='Move to directory: '
|
||||
checked={moveToTagDirectory}
|
||||
onChange={setMoveToTagDirectory}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
<Grid.Row>
|
||||
<Grid.Column>
|
||||
<Input fluid
|
||||
value={newTagDirectory}
|
||||
onChange={(e, {value}) => setNewTagDirectory(value)}
|
||||
disabled={!moveToTagDirectory}
|
||||
/>
|
||||
</Grid.Column>
|
||||
</Grid.Row>
|
||||
</Grid>
|
||||
</ModalContent>
|
||||
<ModalActions>
|
||||
<Button onClick={() => setTagModalOpen(false)}>Cancel</Button>
|
||||
|
|
@ -354,7 +368,6 @@ function ChannelPage({create, header}) {
|
|||
Directory <RequiredAsterisk/>
|
||||
</label>
|
||||
<DirectoryInput required
|
||||
disabled={create === undefined}
|
||||
value={channel.directory}
|
||||
setInput={value => changeValue('directory', value)}
|
||||
placeholder='videos/channel directory'
|
||||
|
|
@ -756,16 +769,21 @@ export function ChannelsPage() {
|
|||
</div>;
|
||||
|
||||
const headers = [
|
||||
{key: 'name', text: 'Name', sortBy: 'name', width: 8},
|
||||
{key: 'tag', text: 'Tag', sortBy: 'tag_name', width: 2},
|
||||
{key: 'video_count', text: 'Videos', sortBy: 'video_count', width: 2},
|
||||
{key: 'download_frequency', text: 'Download Frequency', sortBy: 'minimum_frequency', width: 2},
|
||||
{key: 'size', text: 'Size', sortBy: 'size', width: 2},
|
||||
{key: 'name', text: 'Name', sortBy: [i => i['name'].toLowerCase()], width: 8},
|
||||
{key: 'tag', text: 'Tag', sortBy: [i => i['tag_name'], i => i['name'].toLowerCase()], width: 2},
|
||||
{key: 'video_count', text: 'Videos', sortBy: [i => i['video_count'], i => i['name'].toLowerCase()], width: 2},
|
||||
{
|
||||
key: 'download_frequency',
|
||||
text: 'Download Frequency',
|
||||
sortBy: [i => i['minimum_frequency'], i => i['name'].toLowerCase()],
|
||||
width: 2
|
||||
},
|
||||
{key: 'size', text: 'Size', sortBy: [i => i['size'], i => i['name'].toLowerCase()], width: 2},
|
||||
{key: 'manage', text: 'Manage', width: 2},
|
||||
];
|
||||
const mobileHeaders = [
|
||||
{key: 'name', text: 'Name', sortBy: 'name'},
|
||||
{key: 'video_count', text: 'Videos', sortBy: 'video_count'},
|
||||
{key: 'name', text: 'Name', sortBy: [i => i['name'].toLowerCase()]},
|
||||
{key: 'video_count', text: 'Videos', sortBy: [i => i['video_count'], i => i['name'].toLowerCase()]},
|
||||
{key: 'manage', text: 'Manage'},
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ export const DEFAULT_LIMIT = 20;
|
|||
export const NAME = process.env && process.env.REACT_APP_NAME ? process.env.REACT_APP_NAME : null;
|
||||
|
||||
// Other services on a WROLPi.
|
||||
export const FILES_MEDIA_URI = `https://${window.location.hostname}:${window.location.port}/media/`;
|
||||
export const MAP_VIEWER_URI = `https://${window.location.hostname}:8084`;
|
||||
export const ZIM_VIEWER_URI = `https://${window.location.hostname}:8085`;
|
||||
export const HELP_VIEWER_URI = `https://${window.location.hostname}:8086`;
|
||||
|
|
@ -1281,7 +1282,10 @@ export function DirectoryInput({disabled, error, placeholder, setInput, value, r
|
|||
setDirectory(value);
|
||||
}
|
||||
|
||||
const {media_directory} = settings;
|
||||
let {media_directory} = settings;
|
||||
if (media_directory && !media_directory.endsWith('/')) {
|
||||
media_directory = `${media_directory}/`;
|
||||
}
|
||||
error = error || isDirectory && !isDir;
|
||||
|
||||
return <div>
|
||||
|
|
|
|||
|
|
@ -43,10 +43,8 @@ class Downloader extends React.Component {
|
|||
this.setState({pending: true, submitted: false});
|
||||
try {
|
||||
let response = await postDownload(urls, downloader, null, null, null, destination, tagNames);
|
||||
if (response.status === 204) {
|
||||
if (response.ok) {
|
||||
this.setState({urls: '', pending: false, submitted: true});
|
||||
} else {
|
||||
toast({type: 'error', title: 'Error', description: 'Failed to create download!'});
|
||||
}
|
||||
} finally {
|
||||
this.setState({pending: false});
|
||||
|
|
@ -216,8 +214,7 @@ class ChannelDownload extends React.Component {
|
|||
if (response.status === 204) {
|
||||
this.setState({pending: false, disabled: false, success: true, url: '', ready: false});
|
||||
} else {
|
||||
const content = await response.json();
|
||||
let error = content.message || null;
|
||||
let error = (await response.json()).message || null;
|
||||
this.setState({pending: false, disabled: false, success: false, error});
|
||||
}
|
||||
}
|
||||
|
|
@ -355,8 +352,7 @@ class RSSDownload extends ChannelDownload {
|
|||
if (response.status === 204) {
|
||||
this.setState({pending: false, disabled: false, success: true, url: '', ready: false});
|
||||
} else {
|
||||
const content = await response.json();
|
||||
let error = content.message || null;
|
||||
let error = (await response.json()).message || null;
|
||||
this.setState({pending: false, disabled: false, success: false, error});
|
||||
}
|
||||
}
|
||||
|
|
@ -487,15 +483,8 @@ class ScrapeDownloader extends Downloader {
|
|||
suffix,
|
||||
max_pages,
|
||||
);
|
||||
if (response.status === 204) {
|
||||
if (response.ok) {
|
||||
this.setState({urls: '', pending: false, submitted: true});
|
||||
} else {
|
||||
const content = await response.json();
|
||||
let error = 'Failed to create download!';
|
||||
if (content && content['error']) {
|
||||
error = content['error'];
|
||||
}
|
||||
toast({type: 'error', title: 'Error', description: error});
|
||||
}
|
||||
} finally {
|
||||
this.setState({pending: false});
|
||||
|
|
|
|||
|
|
@ -20,7 +20,9 @@ import {
|
|||
ErrorMessage,
|
||||
ExternalCardLink,
|
||||
FileIcon,
|
||||
FILES_MEDIA_URI,
|
||||
findPosterPath,
|
||||
HandPointMessage,
|
||||
humanFileSize,
|
||||
isoDatetimeToString,
|
||||
mimetypeColor,
|
||||
|
|
@ -583,6 +585,10 @@ function FilesPage() {
|
|||
return <>
|
||||
<FilesRefreshProgress/>
|
||||
<FileBrowser/>
|
||||
|
||||
<HandPointMessage>
|
||||
<p>You can also view your media directory at <a href={FILES_MEDIA_URI}>{FILES_MEDIA_URI}</a></p>
|
||||
</HandPointMessage>
|
||||
</>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -504,35 +504,19 @@ class EditInventory extends React.Component {
|
|||
|
||||
handleSubmit = async (inventory, closeCallback) => {
|
||||
let inventoryId = inventory.id;
|
||||
delete inventory['id'];
|
||||
let response = await updateInventory(inventoryId, inventory);
|
||||
|
||||
if (response.status === 204) {
|
||||
if (response.ok) {
|
||||
await this.props.success();
|
||||
closeCallback();
|
||||
} else {
|
||||
toast({
|
||||
type: 'error',
|
||||
header: 'Failed to save inventory!',
|
||||
description: 'Server responded with an error.',
|
||||
time: 5000,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
handleDelete = async (inventory, closeCallback) => {
|
||||
let response = await deleteInventory(inventory.id);
|
||||
|
||||
if (response.status === 204) {
|
||||
if (response.ok) {
|
||||
await this.props.success();
|
||||
closeCallback();
|
||||
} else {
|
||||
toast({
|
||||
type: 'error',
|
||||
header: 'Failed to delete inventory!',
|
||||
description: 'Server responded with an error.',
|
||||
time: 5000,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -554,16 +538,9 @@ class NewInventory extends React.Component {
|
|||
delete inventory.id;
|
||||
let response = await saveInventory(inventory);
|
||||
|
||||
if (response.status === 201) {
|
||||
if (response.ok) {
|
||||
await this.props.success();
|
||||
closeCallback();
|
||||
} else {
|
||||
toast({
|
||||
type: 'error',
|
||||
header: 'Failed to save inventory!',
|
||||
description: 'Server responded with an error.',
|
||||
time: 5000,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -953,18 +930,11 @@ class InventoryAddList extends React.Component {
|
|||
expiration_date: this.state.expiration_date,
|
||||
};
|
||||
let response = await saveItem(this.state.inventory.id, item);
|
||||
if (response.status === 204) {
|
||||
if (response.ok) {
|
||||
await this.clearInputs();
|
||||
await this.fetchItems();
|
||||
await this.fetchCategories();
|
||||
await this.fetchBrands();
|
||||
} else {
|
||||
toast({
|
||||
type: 'error',
|
||||
header: 'Failed to save item!',
|
||||
description: 'Server responded with an error.',
|
||||
time: 5000,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,24 @@
|
|||
import React, {useState} from "react";
|
||||
import {Route, Routes, useNavigate} from "react-router-dom";
|
||||
import {Link, Route, Routes, useNavigate} from "react-router-dom";
|
||||
import {FilesSearchView} from "./Files";
|
||||
import {useLatestRequest, usePages, useSearchDate, useSearchFilter} from "../hooks/customHooks";
|
||||
import {useLatestRequest, usePages, useSearchChannels, useSearchDate, useSearchFilter} from "../hooks/customHooks";
|
||||
import {ZimSearchView} from "./Zim";
|
||||
import {searchEstimateFiles, searchEstimateZims, searchSuggestions} from "../api";
|
||||
import {searchEstimateFiles, searchEstimateOthers, searchEstimateZims, searchSuggestions} from "../api";
|
||||
import {filterToMimetypes, fuzzyMatch, normalizeEstimate, SearchResultsInput, TabLinks} from "./Common";
|
||||
import _ from "lodash";
|
||||
import {TagsContext} from "../Tags";
|
||||
import {Button as SButton, Header as SHeader, Label} from "semantic-ui-react";
|
||||
import {Modal, ModalContent} from "./Theme";
|
||||
import {QueryContext} from "../contexts/contexts";
|
||||
import {
|
||||
AccordionContent,
|
||||
AccordionTitle,
|
||||
Button as SButton,
|
||||
Grid,
|
||||
GridColumn,
|
||||
GridRow,
|
||||
Header as SHeader,
|
||||
Label
|
||||
} from "semantic-ui-react";
|
||||
import {Accordion, Header, Icon, Loader, Modal, ModalContent, Segment} from "./Theme";
|
||||
import {QueryContext, ThemeContext} from "../contexts/contexts";
|
||||
|
||||
const SUGGESTED_APPS = [
|
||||
{location: '/admin', title: 'Downloads', description: 'View and control your downloads'},
|
||||
|
|
@ -128,6 +137,7 @@ export function useSuggestions(searchStr, tagNames, filter, anyTag) {
|
|||
const {data: filesData, sendRequest: sendFilesRequest, loading: filesLoading} = useLatestRequest(500);
|
||||
// Zims are slow, so they are separate.
|
||||
const {data: zimData, sendRequest: sendZimRequest, loading: zimLoading} = useLatestRequest(500);
|
||||
const {data: otherData, sendRequest: sendOtherRequest, loading: otherLoading} = useLatestRequest(500);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (searchStr || (tagNames && tagNames.length > 0)) {
|
||||
|
|
@ -139,6 +149,7 @@ export function useSuggestions(searchStr, tagNames, filter, anyTag) {
|
|||
}
|
||||
sendFilesRequest(async () => await searchEstimateFiles(searchStr, tagNames, mimetypes, months, dateRange, anyTag));
|
||||
sendZimRequest(async () => await searchEstimateZims(searchStr, tagNames));
|
||||
sendOtherRequest(async () => await searchEstimateOthers(tagNames));
|
||||
}
|
||||
}, [
|
||||
searchStr,
|
||||
|
|
@ -179,6 +190,14 @@ export function useSuggestions(searchStr, tagNames, filter, anyTag) {
|
|||
}
|
||||
}, [setSuggestions, zimData]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!_.isEmpty(otherData)) {
|
||||
setSuggestions((prevState) => {
|
||||
return {...prevState, otherEstimates: otherData.others}
|
||||
});
|
||||
}
|
||||
}, [setSuggestions, otherData]);
|
||||
|
||||
return {suggestions, loading: generalLoading || zimLoading || filesLoading}
|
||||
}
|
||||
|
||||
|
|
@ -269,6 +288,8 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames, anyTag)
|
|||
}
|
||||
}
|
||||
|
||||
const otherSum = suggestions.otherEstimates ? _.sum(Object.values(suggestions.otherEstimates)) : 0;
|
||||
|
||||
const matchingApps = SUGGESTED_APPS.filter(i =>
|
||||
i.title.toLowerCase().includes(lowerSearchStr)
|
||||
|| fuzzyMatch(i.title.toLowerCase(), lowerSearchStr)
|
||||
|
|
@ -283,6 +304,7 @@ export function useSearchSuggestions(defaultSearchStr, defaultTagNames, anyTag)
|
|||
setSuggestionsSums({
|
||||
fileGroups: newSuggestions.fileGroups,
|
||||
zims: zimSum,
|
||||
otherSum: otherSum,
|
||||
channels: newSuggestions.channels.length,
|
||||
domains: newSuggestions.domains.length,
|
||||
tags: matchingTags?.length,
|
||||
|
|
@ -342,10 +364,12 @@ export function SearchView({suggestions, suggestionsSums, loading}) {
|
|||
|
||||
const filesTabName = <span>Files <Label>{normalizeEstimate(suggestionsSums?.fileGroups)}</Label></span>;
|
||||
const zimsTabName = <span>Zims <Label>{normalizeEstimate(suggestionsSums?.zims)}</Label></span>;
|
||||
const othersTabName = <span>Other <Label>{normalizeEstimate(suggestionsSums?.otherSum)}</Label></span>;
|
||||
|
||||
const links = [
|
||||
{text: filesTabName, to: '/search', key: 'filesSearch_', end: true},
|
||||
{text: zimsTabName, to: '/search/zim', key: 'zimsSearch'},
|
||||
{text: othersTabName, to: '/search/other', key: 'othersSearch'},
|
||||
];
|
||||
|
||||
return <React.Fragment>
|
||||
|
|
@ -353,6 +377,7 @@ export function SearchView({suggestions, suggestionsSums, loading}) {
|
|||
<Routes>
|
||||
<Route path='/*' element={<FilesSearchView/>}/>
|
||||
<Route path='/zim' exact element={<ZimSearchView suggestions={suggestions} loading={loading}/>}/>
|
||||
<Route path='/other' exact element={<OtherSearchView loading={loading}/>}/>
|
||||
</Routes>
|
||||
</React.Fragment>
|
||||
}
|
||||
|
|
@ -403,3 +428,58 @@ export function SearchIconButton() {
|
|||
</Modal>
|
||||
</React.Fragment>
|
||||
}
|
||||
|
||||
function SearchChannelPreview({channel}) {
|
||||
const {t} = React.useContext(ThemeContext);
|
||||
|
||||
return <GridRow {...t}>
|
||||
<GridColumn>
|
||||
<Link to={`/videos/channel/${channel.id}/video`}>
|
||||
{channel.name}
|
||||
</Link>
|
||||
</GridColumn>
|
||||
</GridRow>
|
||||
}
|
||||
|
||||
function OtherSearchView({loading}) {
|
||||
const {searchParams} = React.useContext(QueryContext);
|
||||
const [activeIndex, setActiveIndex] = React.useState(0);
|
||||
const activeTags = searchParams.getAll('tag');
|
||||
const {channels, loading: channelsLoading} = useSearchChannels(activeTags);
|
||||
|
||||
const handleClick = (newIndex) => {
|
||||
console.log('newIndex', newIndex, 'activeIndex', activeIndex);
|
||||
setActiveIndex(activeIndex === newIndex ? null : newIndex);
|
||||
}
|
||||
|
||||
if (loading || channelsLoading) {
|
||||
return <Accordion>
|
||||
<Segment><Loader active/></Segment>
|
||||
</Accordion>
|
||||
}
|
||||
|
||||
const channelsAccordion = <React.Fragment>
|
||||
<AccordionTitle
|
||||
index={0}
|
||||
active={activeIndex === 0}
|
||||
onClick={() => handleClick(0)}
|
||||
>
|
||||
<Header as='h3'>
|
||||
<Icon name='dropdown'/>
|
||||
Channels
|
||||
<Label>{normalizeEstimate(channels.length)}</Label>
|
||||
</Header>
|
||||
</AccordionTitle>
|
||||
<AccordionContent active={activeIndex === 0}>
|
||||
<Grid>
|
||||
{!_.isEmpty(channels) ?
|
||||
channels.map(i => <SearchChannelPreview channel={i}/>)
|
||||
: 'No Channels'}
|
||||
</Grid>
|
||||
</AccordionContent>
|
||||
</React.Fragment>;
|
||||
|
||||
return <Accordion>
|
||||
{channelsAccordion}
|
||||
</Accordion>
|
||||
}
|
||||
|
|
@ -243,6 +243,7 @@ function VideosStatistics() {
|
|||
{key: 'month', label: 'Downloads Past Month'},
|
||||
{key: 'year', label: 'Downloads Past Year'},
|
||||
{key: 'sum_duration', label: 'Total Duration'},
|
||||
{key: 'censored_videos', label: 'Censored Videos'},
|
||||
];
|
||||
const commentsNames = [
|
||||
{key: 'have_comments', label: 'Have Comments'},
|
||||
|
|
@ -255,6 +256,7 @@ function VideosStatistics() {
|
|||
];
|
||||
const channelNames = [
|
||||
{key: 'channels', label: 'Channels'},
|
||||
{key: 'tagged_channels', label: 'Tagged Channels'},
|
||||
];
|
||||
|
||||
const buildSegment = (title, names, stats) => {
|
||||
|
|
|
|||
|
|
@ -255,18 +255,7 @@ class RecurringDownloadRow extends React.Component {
|
|||
handleRestart = async () => {
|
||||
const {id} = this.props;
|
||||
try {
|
||||
const response = await restartDownload(id);
|
||||
if (response.status !== 204) {
|
||||
throw Error('Unable to restart download');
|
||||
}
|
||||
} catch (e) {
|
||||
toast({
|
||||
type: 'error',
|
||||
title: 'Error',
|
||||
description: 'Unable to restart download',
|
||||
time: 5000,
|
||||
})
|
||||
throw e;
|
||||
await restartDownload(id);
|
||||
} finally {
|
||||
if (this.props.fetchDownloads) {
|
||||
this.props.fetchDownloads();
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ export class SettingsPage extends React.Component {
|
|||
qrOpen: false,
|
||||
ready: false,
|
||||
|
||||
archive_directory: null,
|
||||
archive_destination: null,
|
||||
download_on_startup: null,
|
||||
download_timeout: null,
|
||||
hotspot_device: null,
|
||||
|
|
@ -190,12 +190,12 @@ export class SettingsPage extends React.Component {
|
|||
hotspot_status: null,
|
||||
ignore_outdated_zims: null,
|
||||
log_level: null,
|
||||
map_directory: null,
|
||||
map_destination: null,
|
||||
navColor: null,
|
||||
throttle_on_startup: null,
|
||||
throttle_status: null,
|
||||
videos_directory: null,
|
||||
zims_directory: null,
|
||||
videos_destination: null,
|
||||
zims_destination: null,
|
||||
}
|
||||
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
|
|
@ -207,7 +207,7 @@ export class SettingsPage extends React.Component {
|
|||
const settings = await getSettings();
|
||||
this.setState({
|
||||
ready: true,
|
||||
archive_directory: settings.archive_directory,
|
||||
archive_destination: settings.archive_destination,
|
||||
disabled: settings.wrol_mode,
|
||||
download_on_startup: settings.download_on_startup,
|
||||
download_timeout: settings.download_timeout || '',
|
||||
|
|
@ -217,12 +217,12 @@ export class SettingsPage extends React.Component {
|
|||
hotspot_status: settings.hotspot_status,
|
||||
ignore_outdated_zims: settings.ignore_outdated_zims,
|
||||
log_level: fromApiLogLevel(settings.log_level),
|
||||
map_directory: settings.map_directory,
|
||||
map_destination: settings.map_destination,
|
||||
navColor: settings.nav_color || 'violet',
|
||||
throttle_on_startup: settings.throttle_on_startup,
|
||||
throttle_status: settings.throttle_status,
|
||||
videos_directory: settings.videos_directory,
|
||||
zims_directory: settings.zims_directory,
|
||||
videos_destination: settings.videos_destination,
|
||||
zims_destination: settings.zims_destination,
|
||||
}, this.handleHotspotChange);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
|
|
@ -233,7 +233,7 @@ export class SettingsPage extends React.Component {
|
|||
async handleSubmit(callback) {
|
||||
this.setState({disabled: true, pending: true});
|
||||
let settings = {
|
||||
archive_directory: this.state.archive_directory,
|
||||
archive_destination: this.state.archive_destination,
|
||||
download_on_startup: this.state.download_on_startup,
|
||||
download_timeout: this.state.download_timeout ? parseInt(this.state.download_timeout) : 0,
|
||||
hotspot_device: this.state.hotspot_device,
|
||||
|
|
@ -241,11 +241,11 @@ export class SettingsPage extends React.Component {
|
|||
hotspot_ssid: this.state.hotspot_ssid,
|
||||
ignore_outdated_zims: this.state.ignore_outdated_zims,
|
||||
log_level: toApiLogLevel(this.state.log_level),
|
||||
map_directory: this.state.map_directory,
|
||||
map_destination: this.state.map_destination,
|
||||
nav_color: this.state.navColor,
|
||||
throttle_on_startup: this.state.throttle_on_startup,
|
||||
videos_directory: this.state.videos_directory,
|
||||
zims_directory: this.state.zims_directory,
|
||||
videos_destination: this.state.videos_destination,
|
||||
zims_destination: this.state.zims_destination,
|
||||
}
|
||||
try {
|
||||
const response = await saveSettings(settings);
|
||||
|
|
@ -304,7 +304,7 @@ export class SettingsPage extends React.Component {
|
|||
}
|
||||
|
||||
const {
|
||||
archive_directory,
|
||||
archive_destination,
|
||||
disabled,
|
||||
download_on_startup,
|
||||
download_timeout,
|
||||
|
|
@ -314,13 +314,13 @@ export class SettingsPage extends React.Component {
|
|||
hotspot_ssid,
|
||||
ignore_outdated_zims,
|
||||
log_level,
|
||||
map_directory,
|
||||
map_destination,
|
||||
navColor,
|
||||
pending,
|
||||
qrCodeValue,
|
||||
throttle_on_startup,
|
||||
videos_directory,
|
||||
zims_directory,
|
||||
videos_destination,
|
||||
zims_destination,
|
||||
} = this.state;
|
||||
|
||||
const qrButton = <Button icon style={{marginBottom: '1em'}}><Icon name='qrcode' size='big'/></Button>;
|
||||
|
|
@ -468,9 +468,9 @@ export class SettingsPage extends React.Component {
|
|||
<label>Archive Directory</label>
|
||||
<Input
|
||||
label={mediaDirectoryLabel}
|
||||
value={archive_directory}
|
||||
value={archive_destination}
|
||||
disabled={!edit_special_directories}
|
||||
onChange={(e, d) => this.handleInputChange(e, 'archive_directory', d.value)}
|
||||
onChange={(e, d) => this.handleInputChange(e, 'archive_destination', d.value)}
|
||||
/>
|
||||
</FormField>
|
||||
</GridColumn>
|
||||
|
|
@ -479,9 +479,9 @@ export class SettingsPage extends React.Component {
|
|||
<label>Videos Directory</label>
|
||||
<Input
|
||||
label={mediaDirectoryLabel}
|
||||
value={videos_directory}
|
||||
value={videos_destination}
|
||||
disabled={!edit_special_directories}
|
||||
onChange={(e, d) => this.handleInputChange(e, 'videos_directory', d.value)}
|
||||
onChange={(e, d) => this.handleInputChange(e, 'videos_destination', d.value)}
|
||||
/>
|
||||
</FormField>
|
||||
</GridColumn>
|
||||
|
|
@ -492,9 +492,9 @@ export class SettingsPage extends React.Component {
|
|||
<label>Map Directory</label>
|
||||
<Input
|
||||
label={mediaDirectoryLabel}
|
||||
value={map_directory}
|
||||
value={map_destination}
|
||||
disabled={!edit_special_directories}
|
||||
onChange={(e, d) => this.handleInputChange(e, 'map_directory', d.value)}
|
||||
onChange={(e, d) => this.handleInputChange(e, 'map_destination', d.value)}
|
||||
/>
|
||||
</FormField>
|
||||
</GridColumn>
|
||||
|
|
@ -503,9 +503,9 @@ export class SettingsPage extends React.Component {
|
|||
<label>Zims Directory</label>
|
||||
<Input
|
||||
label={mediaDirectoryLabel}
|
||||
value={zims_directory}
|
||||
value={zims_destination}
|
||||
disabled={!edit_special_directories}
|
||||
onChange={(e, d) => this.handleInputChange(e, 'zims_directory', d.value)}
|
||||
onChange={(e, d) => this.handleInputChange(e, 'zims_destination', d.value)}
|
||||
/>
|
||||
</FormField>
|
||||
</GridColumn>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue