mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
Refactor download object and bulk action components (#5546)
This commit is contained in:
committed by
Harshavardhana
parent
da4558a8f7
commit
6a42727e00
@@ -19,12 +19,17 @@ import { connect } from "react-redux"
|
||||
import humanize from "humanize"
|
||||
import Moment from "moment"
|
||||
import { getDataType } from "../mime"
|
||||
import * as actions from "./actions"
|
||||
import { getCheckedList } from "./selectors"
|
||||
|
||||
export const ObjectItem = ({
|
||||
name,
|
||||
contentType,
|
||||
size,
|
||||
lastModified,
|
||||
checked,
|
||||
checkObject,
|
||||
uncheckObject,
|
||||
actionButtons,
|
||||
onClick
|
||||
}) => {
|
||||
@@ -32,7 +37,14 @@ export const ObjectItem = ({
|
||||
<div className={"fesl-row"} data-type={getDataType(name, contentType)}>
|
||||
<div className="fesl-item fesl-item-icon">
|
||||
<div className="fi-select">
|
||||
<input type="checkbox" name={name} checked={false} />
|
||||
<input
|
||||
type="checkbox"
|
||||
name={name}
|
||||
checked={checked}
|
||||
onChange={() => {
|
||||
checked ? uncheckObject(name) : checkObject(name)
|
||||
}}
|
||||
/>
|
||||
<i className="fis-icon" />
|
||||
<i className="fis-helper" />
|
||||
</div>
|
||||
@@ -55,4 +67,17 @@ export const ObjectItem = ({
|
||||
)
|
||||
}
|
||||
|
||||
export default ObjectItem
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
checked: getCheckedList(state).indexOf(ownProps.name) >= 0
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
checkObject: name => dispatch(actions.checkObject(name)),
|
||||
uncheckObject: name => dispatch(actions.uncheckObject(name))
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(ObjectItem)
|
||||
|
||||
Reference in New Issue
Block a user