Refactoring

This commit is contained in:
Scott E. Graves
2019-06-08 00:03:05 -05:00
parent 05128febd9
commit 798980cbbd
7 changed files with 58 additions and 62 deletions

View File

@@ -5,6 +5,7 @@ import Configuration from './containers/Configuration/Configuration';
import {connect} from 'react-redux';
import DependencyList from './components/DependencyList/DependencyList';
import DownloadProgress from './components/DownloadProgress/DownloadProgress';
import {extractFileNameFromURL} from './utils';
import ErrorDetails from './components/ErrorDetails/ErrorDetails';
import Grid from './components/UI/Grid/Grid';
import IPCContainer from './containers/IPCContainer/IPCContainer';
@@ -93,11 +94,6 @@ class App extends IPCContainer {
}
};
extractFileNameFromURL = url => {
const parts = url.split('/');
return parts[parts.length - 1];
};
getSelectedVersion = () => {
return (this.props.ReleaseVersion === -1) ?
'unavailable' :
@@ -105,7 +101,7 @@ class App extends IPCContainer {
};
handleDownloadDependency = url => {
this.props.downloadItem(this.extractFileNameFromURL(url), Constants.INSTALL_TYPES.Dependency, url, this.onDownloadFileComplete);
this.props.downloadItem(extractFileNameFromURL(url), Constants.INSTALL_TYPES.Dependency, url, this.onDownloadFileComplete);
};
handleDownloadRelease = () => {
@@ -116,7 +112,7 @@ class App extends IPCContainer {
handleDownloadUpgrade = () => {
const url = this.props.UpgradeData.urls[0];
const name = this.props.Platform === 'win32' ? 'upgrade.exe' : this.extractFileNameFromURL(url);
const name = this.props.Platform === 'win32' ? 'upgrade.exe' : extractFileNameFromURL(url);
this.props.downloadItem(name, Constants.INSTALL_TYPES.Upgrade, url, this.onDownloadFileComplete);
};