ui: Added UI options to select shallow restore options (#1301)

This commit is contained in:
Jarek Kowalski authored and GitHub committed 2021-09-19 09:57:26 -07:00
1 parent d76cbcf47e
commit 6d40d2b7ad
4 files changed
+37 -2

No files matched your search

+18 -1
View File
@@ -5,7 +5,7 @@ import Form from 'react-bootstrap-v5/lib/Form';
import Row from 'react-bootstrap-v5/lib/Row';
import Col from 'react-bootstrap-v5/lib/Col';
import { Link } from "react-router-dom";
import { handleChange, RequiredBoolean, RequiredField, validateRequiredFields } from './forms';
import { handleChange, RequiredBoolean, RequiredField, RequiredNumberField, validateRequiredFields } from './forms';
import { errorAlert, GoBackButton } from './uiutil';
export class BeginRestore extends Component {
@@ -23,6 +23,8 @@ export class BeginRestore extends Component {
overwriteDirectories: false,
overwriteSymlinks: false,
ignorePermissionErrors: true,
restoreDirEntryAtDepth: 1000,
minSizeForPlaceholder: 0,
restoreTask: "",
};
@@ -44,6 +46,8 @@ export class BeginRestore extends Component {
options: {
incremental: this.state.incremental,
ignoreErrors: this.state.continueOnErrors,
restoreDirEntryAtDepth: this.state.restoreDirEntryAtDepth,
minSizeForPlaceholder: this.state.minSizeForPlaceholder,
},
}
@@ -119,9 +123,22 @@ export class BeginRestore extends Component {
<Row>
{RequiredBoolean(this, "Overwrite Symbolic Links", "overwriteSymlinks")}
</Row>
<Row>
<Col><hr/></Col>
</Row>
<Row>
{RequiredNumberField(this, "Shallow Restore At Depth", "restoreDirEntryAtDepth")}
{RequiredNumberField(this, "Minimal File Size For Shallow Restore", "minSizeForPlaceholder")}
</Row>
<Row>
<Col><hr/></Col>
</Row>
<Row>
{RequiredBoolean(this, "Disable ZIP compression", "uncompressedZip", "Do not compress when restoring to a ZIP file (faster).")}
</Row>
<Row>
<Col><hr/></Col>
</Row>
<Row>
<Col>
<Button variant="primary" type="submit" data-testid="submit-button">Begin Restore</Button>
+1 -1
View File
@@ -160,7 +160,7 @@ export class RepoStatus extends Component {
<Form.Control readOnly defaultValue={this.state.status.splitter} />
</Form.Group>
<Form.Group as={Col}>
<Form.Label>Supports Content Compression</Form.Label>
<Form.Label>Internal Compression</Form.Label>
<Form.Control readOnly defaultValue={this.state.status.supportsContentCompression ? "yes" : "no"} />
</Form.Group>
</Row>
+16
View File
@@ -138,6 +138,22 @@ export function OptionalNumberField(component, label, name, props = {}) {
</Form.Group>
}
export function RequiredNumberField(component, label, name, props = {}) {
return <Form.Group as={Col}>
<Form.Label>{label}</Form.Label>
<Form.Control
size="sm"
name={name}
isInvalid={stateProperty(component, name, null) === '' || isInvalidNumber(stateProperty(component, name))}
value={stateProperty(component, name)}
onChange={e => component.handleChange(e, valueToNumber)}
data-testid={'control-' + name}
{...props} />
<Form.Control.Feedback type="invalid">Must be a valid number or empty</Form.Control.Feedback>
</Form.Group>
}
export function hasExactlyOneOf(component, names) {
let count = 0;
+2
View File
@@ -65,6 +65,8 @@ func (s *Stats) clone() Stats {
// Options provides optional restore parameters.
type Options struct {
// NOTE: this structure is passed as-is from the UI, make sure to add
// required bindings in the UI.
Parallel int `json:"parallel"`
Incremental bool `json:"incremental"`
IgnoreErrors bool `json:"ignoreErrors"`