Skip to content

Commit 9893b5c

Browse files
committed
Bandwidth status dashboard: UI modifications.
1 parent 5329cb3 commit 9893b5c

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

GSOC.md

Whitespace-only changes.

src/utils/RclonePropTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const PROP_ITEM = PropTypes.shape({
3434
});
3535

3636
export const PROP_BANDWIDTH = PropTypes.shape({
37-
bytesPerSecond: PropTypes.number.isRequired,
37+
// bytesPerSecond: PropTypes.number.isRequired,
3838
rate: PropTypes.string.isRequired
3939

4040
});

src/views/Base/BandwidthStatusCard/BandwidthStatusCard.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ class BandwidthStatusCard extends React.Component {
3434
*/
3535
setBandwidth = () => {
3636
const {bandwidthText, hasError} = this.state;
37-
// console.log(bandwidthText, hasError);
38-
if (bandwidthText && !hasError) {
37+
if (!hasError) {
3938
const {setBandwidth} = this.props;
40-
setBandwidth(bandwidthText);
39+
if (bandwidthText)
40+
setBandwidth(bandwidthText);
41+
else {
42+
setBandwidth("0M");
43+
}
4144
} else {
4245
toast.error("Error in form");
4346
}
@@ -53,7 +56,7 @@ class BandwidthStatusCard extends React.Component {
5356
const validateInput = validateSizeSuffix(inputValue);
5457
this.setState({
5558
bandwidthText: inputValue,
56-
hasError: !validateInput
59+
hasError: (inputValue !== "" ? !validateInput : false)
5760
})
5861
};
5962

@@ -82,9 +85,12 @@ class BandwidthStatusCard extends React.Component {
8285

8386
<Row>
8487
<Col lg={showChangeBandwidth ? 6 : 12} sm={12}>
85-
<BandwidthWidget icon="icon-speedometer" color="danger" header={bandwidth.rate} lg={6} sm={12}>
86-
Current bandwidth <Button color="link" onClick={this.toggleShowChangeBandwidth}>Change <i
87-
className="fa fa-lg fa-angle-right"/></Button>
88+
<BandwidthWidget icon="icon-speedometer" color="danger"
89+
header={(bandwidth.rate !== "off") ? bandwidth.rate : "Unlimited"} lg={6} sm={12}>
90+
Current bandwidth <Button color="link"
91+
onClick={this.toggleShowChangeBandwidth}>{!showChangeBandwidth ? "Change" : "Close"}
92+
<i
93+
className={"fa fa-lg fa-angle-" + (!showChangeBandwidth ? "right" : "left")}/></Button>
8894
</BandwidthWidget>
8995
</Col>
9096
<Col lg={6} sm={12} className={showChangeBandwidth ? "" : "d-none"}>
@@ -93,8 +99,6 @@ class BandwidthStatusCard extends React.Component {
9399
<CardBody>
94100
<Form onSubmit={this.setBandwidth}>
95101
<FormGroup row>
96-
97-
98102
<Label for="bandwidthValue" sm={5}>New Bandwidth</Label>
99103
<Col sm={7}>
100104
<Input type="text" value={bandwidthText}
@@ -106,8 +110,6 @@ class BandwidthStatusCard extends React.Component {
106110
etc</FormFeedback>
107111

108112
</Col>
109-
110-
111113
</FormGroup>
112114
<Button className="float-right" color="success" type="submit">Set</Button>
113115

0 commit comments

Comments
 (0)