Refactoring
This commit is contained in:
@@ -8,6 +8,7 @@ import Text from '../UI/Text/Text';
|
||||
import Button from '../UI/Button/Button';
|
||||
import UpgradeIcon from '../UpgradeIcon/UpgradeIcon';
|
||||
import {setActiveRelease} from "../../redux/actions/release_version_actions";
|
||||
import {downloadItem} from '../../redux/actions/download_actions';
|
||||
|
||||
const mapStateToProps = state => {
|
||||
return {
|
||||
@@ -16,6 +17,7 @@ const mapStateToProps = state => {
|
||||
InstallActive: state.install.InstallActive,
|
||||
InstallType: state.install.InstallType,
|
||||
InstalledVersion: state.relver.InstalledVersion,
|
||||
LocationsLookup: state.relver.LocationsLookup,
|
||||
MountsBusy: state.mounts.MountsBusy,
|
||||
Release: state.relver.Release,
|
||||
ReleaseUpgradeAvailable: state.relver.ReleaseUpgradeAvailable,
|
||||
@@ -26,11 +28,17 @@ const mapStateToProps = state => {
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
downloadItem: (name, type, urls) => dispatch(downloadItem(name, type, urls)),
|
||||
setActiveRelease: (release, version) => dispatch(setActiveRelease(release, version)),
|
||||
}
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
||||
const handleDownloadRelease = () => {
|
||||
const fileName = props.version + '.zip';
|
||||
props.downloadItem(fileName, Constants.INSTALL_TYPES.Release, props.LocationsLookup[props.version].urls);
|
||||
};
|
||||
|
||||
const handleReleaseChanged = e => {
|
||||
const release = parseInt(e.target.value, 10);
|
||||
const releaseVersion = props.VersionLookup[Constants.RELEASE_TYPES[release]].length - 1;
|
||||
@@ -88,7 +96,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
||||
));
|
||||
} else {
|
||||
optionsDisplay.push((
|
||||
<Button clicked={props.downloadClicked}
|
||||
<Button clicked={handleDownloadRelease}
|
||||
col={dimensions => (dimensions.columns / 3) * 2}
|
||||
colSpan={20}
|
||||
key={key++}
|
||||
|
||||
Reference in New Issue
Block a user