| | |
| | | import React from 'react'; |
| | | import {FormButton, FormCheckbox, FormLabelField, FormLabelInputField} from '../../general/forms/FormComponents'; |
| | | import {Button} from 'reactstrap'; |
| | | import { |
| | | FormCheckbox, |
| | | FormField, |
| | | FormGroup, |
| | | FormInput, |
| | | FormLabel, |
| | | FormLabelField, |
| | | FormLabelInputField, |
| | | FormOption, |
| | | FormSelect |
| | | } from '../../general/forms/FormComponents'; |
| | | import {getRestServiceUrl} from '../../../utilities/global'; |
| | | import I18n from '../../general/translation/I18n'; |
| | | import ErrorAlertGenericRestFailure from '../../general/ErrorAlertGenericRestFailure'; |
| | | import Loading from '../../general/Loading'; |
| | | import ConfirmModal from '../../general/modal/ConfirmModal'; |
| | | |
| | | class ConfigServerTab extends React.Component { |
| | | loadConfig = () => { |
| | |
| | | showDemoRepos: true, |
| | | maxArchiveContentCacheCapacityMb: 100, |
| | | redirect: false, |
| | | confirmModal: false |
| | | binary: 'manual' |
| | | }; |
| | | |
| | | this.handleTextChange = this.handleTextChange.bind(this); |
| | | this.handleCheckboxChange = this.handleCheckboxChange.bind(this); |
| | | this.loadConfig = this.loadConfig.bind(this); |
| | | this.toggleModal = this.toggleModal.bind(this); |
| | | } |
| | | |
| | | componentDidMount() { |
| | |
| | | }) |
| | | } |
| | | |
| | | toggleModal() { |
| | | this.setState({ |
| | | confirmModal: !this.state.confirmModal |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | if (this.state.loading) { |
| | | return <Loading/>; |
| | |
| | | |
| | | return ( |
| | | <div> |
| | | <ConfirmModal |
| | | onConfirm={ConfigServerTab.clearAllCaches} |
| | | title={'Are you sure?'} |
| | | toggle={this.toggleModal} |
| | | open={this.state.confirmModal} |
| | | > |
| | | Do you really want to clear all caches? All Archive file lists and caches for repo and archive |
| | | information will be cleared. |
| | | <br/> |
| | | This is a safe option but it may take some time to re-fill the caches (on demand) again. |
| | | </ConfirmModal> |
| | | <form> |
| | | <FormLabelField> |
| | | <FormButton id={'clearAllCaches'} onClick={this.toggleModal}> Clear all caches |
| | | </FormButton> |
| | | </FormLabelField> |
| | | <FormGroup> |
| | | <FormLabel>{'Borg command'}</FormLabel> |
| | | <FormField length={2}> |
| | | <FormSelect |
| | | value={this.state.binary} |
| | | name={'binary'} |
| | | onChange={this.handleTextChange} |
| | | hint={'Choose your OS and BorgButler will download and use a ready to run borg binary from https://github.com/borgbackup/borg/releases or choose a manual installed version.'} |
| | | > |
| | | {this.state.binaries |
| | | .map((binary, index) => <FormOption label={binary[1]} value={binary[0]} |
| | | key={index}/>)} |
| | | <FormOption label={'Manual'} value={'manual'}/> |
| | | </FormSelect> |
| | | </FormField> |
| | | <FormField length={6}> |
| | | <FormInput name={'borgCommand'} value={this.state.borgCommand} |
| | | onChange={this.handleTextChange} |
| | | placeholder="Enter path of borg command"/> |
| | | </FormField> |
| | | <FormField length={2}> |
| | | <Button className={'outline-primary'} onClick={this.onCancel} |
| | | hint={'Tests the borg version.'}>Test |
| | | </Button> |
| | | </FormField> |
| | | </FormGroup> |
| | | <FormLabelInputField label={'Port'} fieldLength={2} type="number" min={0} max={65535} |
| | | step={1} |
| | | name={'port'} value={this.state.port} |