mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
Refactor make bucket and upload components (#5521)
This commit is contained in:
committed by
Harshavardhana
parent
9bfa07ecf5
commit
44f8f7059c
@@ -16,10 +16,14 @@
|
||||
|
||||
import web from "../web"
|
||||
import history from "../history"
|
||||
import * as alertActions from "../alert/actions"
|
||||
import * as objectsActions from "../objects/actions"
|
||||
|
||||
export const SET_LIST = "buckets/SET_LIST"
|
||||
export const ADD = "buckets/ADD"
|
||||
export const SET_FILTER = "buckets/SET_FILTER"
|
||||
export const SET_CURRENT_BUCKET = "buckets/SET_CURRENT_BUCKET"
|
||||
export const SHOW_MAKE_BUCKET_MODAL = "buckets/SHOW_MAKE_BUCKET_MODAL"
|
||||
|
||||
export const fetchBuckets = () => {
|
||||
return function(dispatch) {
|
||||
@@ -50,6 +54,7 @@ export const setFilter = filter => {
|
||||
export const selectBucket = bucket => {
|
||||
return function(dispatch) {
|
||||
dispatch(setCurrentBucket(bucket))
|
||||
dispatch(objectsActions.selectPrefix(""))
|
||||
history.push(`/${bucket}`)
|
||||
}
|
||||
}
|
||||
@@ -60,3 +65,39 @@ export const setCurrentBucket = bucket => {
|
||||
bucket
|
||||
}
|
||||
}
|
||||
|
||||
export const makeBucket = bucket => {
|
||||
return function(dispatch) {
|
||||
return web
|
||||
.MakeBucket({
|
||||
bucketName: bucket
|
||||
})
|
||||
.then(() => {
|
||||
dispatch(addBucket(bucket))
|
||||
dispatch(selectBucket(bucket))
|
||||
})
|
||||
.catch(err =>
|
||||
dispatch(
|
||||
alertActions.set({
|
||||
type: "danger",
|
||||
message: err.message
|
||||
})
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export const addBucket = bucket => ({
|
||||
type: ADD,
|
||||
bucket
|
||||
})
|
||||
|
||||
export const showMakeBucketModal = () => ({
|
||||
type: SHOW_MAKE_BUCKET_MODAL,
|
||||
show: true
|
||||
})
|
||||
|
||||
export const hideMakeBucketModal = () => ({
|
||||
type: SHOW_MAKE_BUCKET_MODAL,
|
||||
show: false
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user