@@ -34,10 +34,13 @@ class BandwidthStatusCard extends React.Component {
34
34
*/
35
35
setBandwidth = ( ) => {
36
36
const { bandwidthText, hasError} = this . state ;
37
- // console.log(bandwidthText, hasError);
38
- if ( bandwidthText && ! hasError ) {
37
+ if ( ! hasError ) {
39
38
const { setBandwidth} = this . props ;
40
- setBandwidth ( bandwidthText ) ;
39
+ if ( bandwidthText )
40
+ setBandwidth ( bandwidthText ) ;
41
+ else {
42
+ setBandwidth ( "0M" ) ;
43
+ }
41
44
} else {
42
45
toast . error ( "Error in form" ) ;
43
46
}
@@ -53,7 +56,7 @@ class BandwidthStatusCard extends React.Component {
53
56
const validateInput = validateSizeSuffix ( inputValue ) ;
54
57
this . setState ( {
55
58
bandwidthText : inputValue ,
56
- hasError : ! validateInput
59
+ hasError : ( inputValue !== "" ? ! validateInput : false )
57
60
} )
58
61
} ;
59
62
@@ -82,9 +85,12 @@ class BandwidthStatusCard extends React.Component {
82
85
83
86
< Row >
84
87
< 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 >
88
94
</ BandwidthWidget >
89
95
</ Col >
90
96
< Col lg = { 6 } sm = { 12 } className = { showChangeBandwidth ? "" : "d-none" } >
@@ -93,8 +99,6 @@ class BandwidthStatusCard extends React.Component {
93
99
< CardBody >
94
100
< Form onSubmit = { this . setBandwidth } >
95
101
< FormGroup row >
96
-
97
-
98
102
< Label for = "bandwidthValue" sm = { 5 } > New Bandwidth</ Label >
99
103
< Col sm = { 7 } >
100
104
< Input type = "text" value = { bandwidthText }
@@ -106,8 +110,6 @@ class BandwidthStatusCard extends React.Component {
106
110
etc</ FormFeedback >
107
111
108
112
</ Col >
109
-
110
-
111
113
</ FormGroup >
112
114
< Button className = "float-right" color = "success" type = "submit" > Set</ Button >
113
115
0 commit comments