mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
browser: Use custom input number step-up/down function (#4524)
This commit is contained in:
parent
8293f546af
commit
d0f18dc1b5
@ -370,8 +370,24 @@ export default class Browse extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleExpireValue(targetInput, inc, object) {
|
handleExpireValue(targetInput, inc, object) {
|
||||||
inc === -1 ? this.refs[targetInput].stepDown(1) : this.refs[targetInput].stepUp(1)
|
let value = this.refs[targetInput].value
|
||||||
|
let maxValue = (targetInput == 'expireHours') ? 23 : (targetInput == 'expireMins') ? 59 : (targetInput == 'expireDays') ? 7 : 0
|
||||||
|
value = isNaN(value) ? 0 : value
|
||||||
|
|
||||||
|
// Use custom step count to support browser Edge
|
||||||
|
if((inc === -1)) {
|
||||||
|
if(value != 0) {
|
||||||
|
value--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if(value != maxValue) {
|
||||||
|
value++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.refs[targetInput].value = value
|
||||||
|
|
||||||
|
// Reset hours and mins when days reaches it's max value
|
||||||
if (this.refs.expireDays.value == 7) {
|
if (this.refs.expireDays.value == 7) {
|
||||||
this.refs.expireHours.value = 0
|
this.refs.expireHours.value = 0
|
||||||
this.refs.expireMins.value = 0
|
this.refs.expireMins.value = 0
|
||||||
@ -379,6 +395,7 @@ export default class Browse extends React.Component {
|
|||||||
if (this.refs.expireDays.value + this.refs.expireHours.value + this.refs.expireMins.value == 0) {
|
if (this.refs.expireDays.value + this.refs.expireHours.value + this.refs.expireMins.value == 0) {
|
||||||
this.refs.expireDays.value = 7
|
this.refs.expireDays.value = 7
|
||||||
}
|
}
|
||||||
|
|
||||||
const {dispatch} = this.props
|
const {dispatch} = this.props
|
||||||
dispatch(actions.shareObject(object, this.refs.expireDays.value, this.refs.expireHours.value, this.refs.expireMins.value))
|
dispatch(actions.shareObject(object, this.refs.expireDays.value, this.refs.expireHours.value, this.refs.expireMins.value))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user