storj.io/minio@v0.0.0-20230509071714-0cbc90f649b1/browser/app/js/uploads/AbortConfirmModal.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 classNames from "classnames" 19 import { connect } from "react-redux" 20 import ConfirmModal from "../browser/ConfirmModal" 21 import * as uploadsActions from "./actions" 22 23 export class AbortConfirmModal extends React.Component { 24 abortUploads() { 25 const { abort, uploads } = this.props 26 for (var slug in uploads) { 27 abort(slug) 28 } 29 } 30 render() { 31 const { hideAbort } = this.props 32 let baseClass = classNames({ 33 "abort-upload": true 34 }) 35 let okIcon = classNames({ 36 fas: true, 37 "fa-times": true 38 }) 39 let cancelIcon = classNames({ 40 fas: true, 41 "fa-cloud-upload-alt": true 42 }) 43 44 return ( 45 <ConfirmModal 46 show={true} 47 baseClass={baseClass} 48 text="Abort uploads in progress?" 49 icon="fas fa-info-circle mci-amber" 50 sub="This cannot be undone!" 51 okText="Abort" 52 okIcon={okIcon} 53 cancelText="Upload" 54 cancelIcon={cancelIcon} 55 okHandler={this.abortUploads.bind(this)} 56 cancelHandler={hideAbort} 57 /> 58 ) 59 } 60 } 61 62 const mapStateToProps = state => { 63 return { 64 uploads: state.uploads.files 65 } 66 } 67 68 const mapDispatchToProps = dispatch => { 69 return { 70 abort: slug => dispatch(uploadsActions.abortUpload(slug)), 71 hideAbort: () => dispatch(uploadsActions.hideAbortModal()) 72 } 73 } 74 75 export default connect(mapStateToProps, mapDispatchToProps)(AbortConfirmModal)