storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/browser/app/js/buckets/BucketPolicyModal.js (about) 1 /* 2 * MinIO Cloud Storage (C) 2018 MinIO, Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import React from "react" 18 import { connect } from "react-redux" 19 import { Modal, ModalHeader } from "react-bootstrap" 20 import * as actionsBuckets from "./actions" 21 import PolicyInput from "./PolicyInput" 22 import Policy from "./Policy" 23 24 export const BucketPolicyModal = ({ showBucketPolicy, currentBucket, hideBucketPolicy, policies }) => { 25 return ( 26 <Modal className="modal-policy" 27 animation={ false } 28 show={ showBucketPolicy } 29 onHide={ hideBucketPolicy } 30 > 31 <ModalHeader> 32 Bucket Policy ( 33 { currentBucket }) 34 <button className="close close-alt" onClick={ hideBucketPolicy }> 35 <span>×</span> 36 </button> 37 </ModalHeader> 38 <div className="pm-body"> 39 <PolicyInput /> 40 { policies.map((policy, i) => <Policy key={ i } prefix={ policy.prefix } policy={ policy.policy } /> 41 ) } 42 </div> 43 </Modal> 44 ) 45 } 46 47 const mapStateToProps = state => { 48 return { 49 currentBucket: state.buckets.currentBucket, 50 showBucketPolicy: state.buckets.showBucketPolicy, 51 policies: state.buckets.policies 52 } 53 } 54 55 const mapDispatchToProps = dispatch => { 56 return { 57 hideBucketPolicy: () => dispatch(actionsBuckets.hideBucketPolicy()) 58 } 59 } 60 61 export default connect(mapStateToProps, mapDispatchToProps)(BucketPolicyModal)