import React from 'react'; import './SelectAppPlatform.css'; import axios from 'axios'; import {connect} from 'react-redux'; import * as Constants from '../../constants'; import Box from '../../components/UI/Box/Box'; import Button from '../../components/UI/Button/Button'; import { downloadItem, setAllowDownload } from '../../redux/actions/download_actions'; import DropDown from '../../components/UI/DropDown/DropDown'; import IPCContainer from '../IPCContainer/IPCContainer'; import {notifyError} from '../../redux/actions/error_actions'; import {setInstallTestActive} from '../../redux/actions/install_actions'; class SelectAppPlatform extends IPCContainer { state = { Selected: 0, }; grabLatestRelease = appPlatform => { const errorHandler = error => { this.props.notifyError(error); this.props.setInstallTestActive(false); this.props.setAllowDownload(false); }; axios .get(Constants.RELEASES_URL) .then(response => { try { const releases = response.data.Versions.Release[appPlatform]; const latestVersion = releases[releases.length - 1]; const release = response.data.Locations[appPlatform][latestVersion]; this.props.downloadItem(latestVersion + '.zip', Constants.INSTALL_TYPES.TestRelease, release.urls, false, latestVersion, appPlatform); } catch (error) { errorHandler(error); } }) .catch(error => { errorHandler(error); }); }; handleTestClicked = () => { this.props.setInstallTestActive(true); this.props.setAllowDownload(true); this.grabLatestRelease(Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]) }; handleChanged = e => { this.setState({ ...this.state, Selected: Constants.LINUX_SELECTABLE_PLATFORMS.indexOf(e.target.value), }); }; render() { return (

Select Linux Platform

Repertory was unable to detect your Linux distribution. Please select one of the following and click Test to continue:

); } } const mapStateToProps = state => { return { InstallTestActive: state.install.InstallTestActive, } }; const mapDispatchToProps = dispatch => { return { downloadItem: (name, type, urls, isWinFSP, testVersion, appPlatform) => dispatch(downloadItem(name, type, urls, isWinFSP, testVersion, appPlatform)), notifyError: msg => dispatch(notifyError(msg)), setAllowDownload: allow => dispatch(setAllowDownload(allow)), setInstallTestActive: active => dispatch(setInstallTestActive(active)), }; }; export default connect(mapStateToProps, mapDispatchToProps)(SelectAppPlatform);