Remove Linux platform selection

This commit is contained in:
2021-05-24 21:28:26 -05:00
parent 9bc5ae99f6
commit ad4e312d7a
9 changed files with 36 additions and 276 deletions

View File

@@ -1,18 +0,0 @@
.SAPHeading {
color: var(--text_color_error);
text-align: center;
margin-bottom: 4px;
}
.SAPContent {
max-height: 60vh;
width: 255px;
overflow-y: auto;
margin-bottom: var(--default_spacing);
}
.SAPActions {
margin-top: 4px;
display: flex;
flex-direction: row;
}

View File

@@ -1,104 +0,0 @@
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 (
<Box dxDark dxStyle={{ padding: 'var(--default_spacing)' }}>
<h1 className={'SAPHeading'}>Select Linux Platform</h1>
<div className={'SAPContent'}>
<p>
Repertory was unable to detect your Linux distribution. Please select one of the
following and click <b>Test</b> to continue:
</p>
</div>
<div className={'SAPActions'}>
<DropDown
changed={this.handleChanged}
disabled={this.props.InstallTestActive}
items={Constants.LINUX_SELECTABLE_PLATFORMS}
selected={Constants.LINUX_SELECTABLE_PLATFORMS[this.state.Selected]}
/>
<Button clicked={this.handleTestClicked} disabled={this.props.InstallTestActive}>
Test
</Button>
</div>
</Box>
);
}
}
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);