mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
Refactor bucket delete and bucket policy (#5580)
This commit adds the bucket delete and bucket policy functionalities to the browser. Part of rewriting the browser code to follow best practices and guidelines of React (issues #5409 and #5410) The backend code has been modified by @krishnasrinivas to prevent issue #4498 from occuring. The relevant changes have been made to the code according to the latest commit and the unit tests in the backend. This commit also addresses issue #5449.
This commit is contained in:
committed by
Harshavardhana
parent
416841869a
commit
a6adef0bdf
@@ -16,12 +16,22 @@
|
||||
|
||||
import * as actionsBuckets from "./actions"
|
||||
|
||||
const removeBucket = (list, action) => {
|
||||
const idx = list.findIndex(bucket => bucket === action.bucket)
|
||||
if (idx == -1) {
|
||||
return list
|
||||
}
|
||||
return [...list.slice(0, idx), ...list.slice(idx + 1)]
|
||||
}
|
||||
|
||||
export default (
|
||||
state = {
|
||||
list: [],
|
||||
filter: "",
|
||||
currentBucket: "",
|
||||
showMakeBucketModal: false
|
||||
showMakeBucketModal: false,
|
||||
policies: [],
|
||||
showBucketPolicy: false
|
||||
},
|
||||
action
|
||||
) => {
|
||||
@@ -36,6 +46,11 @@ export default (
|
||||
...state,
|
||||
list: [action.bucket, ...state.list]
|
||||
}
|
||||
case actionsBuckets.REMOVE:
|
||||
return {
|
||||
...state,
|
||||
list: removeBucket(state.list, action),
|
||||
}
|
||||
case actionsBuckets.SET_FILTER:
|
||||
return {
|
||||
...state,
|
||||
@@ -51,6 +66,16 @@ export default (
|
||||
...state,
|
||||
showMakeBucketModal: action.show
|
||||
}
|
||||
case actionsBuckets.SET_POLICIES:
|
||||
return {
|
||||
...state,
|
||||
policies: action.policies
|
||||
}
|
||||
case actionsBuckets.SHOW_BUCKET_POLICY:
|
||||
return {
|
||||
...state,
|
||||
showBucketPolicy: action.show
|
||||
}
|
||||
default:
|
||||
return state
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user