mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
browser: Humanize expiry time for Share-Object. (#3861)
This commit is contained in:
parent
bff4d29415
commit
29ff9674a0
@ -101,7 +101,7 @@ export const hideShareObject = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const shareObject = (object, expiry) => (dispatch, getState) => {
|
export const shareObject = (object, days, hours, minutes) => (dispatch, getState) => {
|
||||||
const {currentBucket, web} = getState()
|
const {currentBucket, web} = getState()
|
||||||
let host = location.host
|
let host = location.host
|
||||||
let bucket = currentBucket
|
let bucket = currentBucket
|
||||||
@ -111,6 +111,7 @@ export const shareObject = (object, expiry) => (dispatch, getState) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let expiry = days * 24 * 60 * 60 + hours * 60 * 60 + minutes * 60
|
||||||
web.PresignedGet({
|
web.PresignedGet({
|
||||||
host,
|
host,
|
||||||
bucket,
|
bucket,
|
||||||
@ -121,7 +122,7 @@ export const shareObject = (object, expiry) => (dispatch, getState) => {
|
|||||||
dispatch(showShareObject(object, obj.url))
|
dispatch(showShareObject(object, obj.url))
|
||||||
dispatch(showAlert({
|
dispatch(showAlert({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: `Object shared, expires in ${expiry} seconds`
|
message: `Object shared. Expires in ${days} days ${hours} hours ${minutes} minutes.`
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
@ -271,8 +271,8 @@ export default class Browse extends React.Component {
|
|||||||
shareObject(e, object) {
|
shareObject(e, object) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const {dispatch} = this.props
|
const {dispatch} = this.props
|
||||||
let expiry = 5 * 24 * 60 * 60 // 5 days expiry by default
|
// let expiry = 5 * 24 * 60 * 60 // 5 days expiry by default
|
||||||
dispatch(actions.shareObject(object, expiry))
|
dispatch(actions.shareObject(object, 5, 0, 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
hideShareObjectModal() {
|
hideShareObjectModal() {
|
||||||
@ -375,8 +375,7 @@ export default class Browse extends React.Component {
|
|||||||
this.refs.expireDays.value = 7
|
this.refs.expireDays.value = 7
|
||||||
}
|
}
|
||||||
const {dispatch} = this.props
|
const {dispatch} = this.props
|
||||||
let expiry = this.refs.expireDays.value * 24 * 60 * 60 + this.refs.expireHours.value * 60 * 60 + this.refs.expireMins.value * 60
|
dispatch(actions.shareObject(object, this.refs.expireDays.value, this.refs.expireHours.value, this.refs.expireMins.value))
|
||||||
dispatch(actions.shareObject(object, expiry))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkObject(e, objectName) {
|
checkObject(e, objectName) {
|
||||||
|
Loading…
Reference in New Issue
Block a user