Remove Linux platform selection
This commit is contained in:
22
src/App.jsx
22
src/App.jsx
@@ -20,8 +20,7 @@ import {
|
||||
setNewReleasesAvailable,
|
||||
} from './redux/actions/release_version_actions';
|
||||
import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay';
|
||||
import { displaySelectAppPlatform, saveState } from './redux/actions/common_actions';
|
||||
import SelectAppPlatform from './containers/SelectAppPlatform/SelectAppPlatform';
|
||||
import { saveState } from './redux/actions/common_actions';
|
||||
import Text from './components/UI/Text/Text';
|
||||
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
|
||||
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
|
||||
@@ -40,11 +39,7 @@ class App extends IPCContainer {
|
||||
componentDidMount() {
|
||||
const detectUpgrades = () => {
|
||||
if (this.props.AppPlatform === 'unknown') {
|
||||
if (this.props.Platform === 'linux') {
|
||||
this.props.displaySelectAppPlatform(true);
|
||||
} else {
|
||||
this.props.notifyError('Operating system is not supported.', true);
|
||||
}
|
||||
this.props.notifyError('Operating system is not supported.', true);
|
||||
} else {
|
||||
this.props.loadReleases();
|
||||
}
|
||||
@@ -163,7 +158,6 @@ class App extends IPCContainer {
|
||||
!this.props.DisplayInfo &&
|
||||
!this.props.InstallActive &&
|
||||
!this.props.RebootRequired &&
|
||||
!this.props.DisplaySelectAppPlatform &&
|
||||
!showUpgrade &&
|
||||
!this.props.DismissNewReleasesAvailable &&
|
||||
this.props.NewReleasesAvailable.length > 0;
|
||||
@@ -173,7 +167,6 @@ class App extends IPCContainer {
|
||||
!this.props.DownloadActive &&
|
||||
!showNewReleases &&
|
||||
!this.props.RebootRequired &&
|
||||
!this.props.DisplaySelectAppPlatform &&
|
||||
!showUpgrade &&
|
||||
this.props.DisplayAddEditHost;
|
||||
|
||||
@@ -183,7 +176,6 @@ class App extends IPCContainer {
|
||||
!this.props.DownloadActive &&
|
||||
!showNewReleases &&
|
||||
!this.props.RebootRequired &&
|
||||
!this.props.DisplaySelectAppPlatform &&
|
||||
!showUpgrade &&
|
||||
this.props.DisplayImport;
|
||||
|
||||
@@ -193,7 +185,6 @@ class App extends IPCContainer {
|
||||
!this.props.DownloadActive &&
|
||||
!showNewReleases &&
|
||||
!this.props.RebootRequired &&
|
||||
!this.props.DisplaySelectAppPlatform &&
|
||||
!showUpgrade &&
|
||||
this.props.DisplayExport;
|
||||
|
||||
@@ -227,10 +218,6 @@ class App extends IPCContainer {
|
||||
const infoDisplay = createModalConditionally(this.props.DisplayInfo, <InfoDetails />, true);
|
||||
const newReleasesDisplay = createModalConditionally(showNewReleases, <NewReleases />);
|
||||
const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot />);
|
||||
const selectAppPlatformDisplay = createModalConditionally(
|
||||
this.props.DisplaySelectAppPlatform,
|
||||
<SelectAppPlatform />
|
||||
);
|
||||
const upgradeDisplay = createModalConditionally(showUpgrade, <UpgradeUI />);
|
||||
const importDisplay = createModalConditionally(
|
||||
showSkynetImport,
|
||||
@@ -249,7 +236,7 @@ class App extends IPCContainer {
|
||||
);
|
||||
|
||||
let mainContent = [];
|
||||
if (this.props.DisplaySelectAppPlatform || !this.props.AppReady) {
|
||||
if (!this.props.AppReady) {
|
||||
mainContent = (
|
||||
<Box col={0} colSpan={'remain'} row={10} rowSpan={'remain'}>
|
||||
<Loading />
|
||||
@@ -337,7 +324,6 @@ class App extends IPCContainer {
|
||||
{importDisplay}
|
||||
{exportDisplay}
|
||||
{newReleasesDisplay}
|
||||
{selectAppPlatformDisplay}
|
||||
{dependencyDisplay}
|
||||
{upgradeDisplay}
|
||||
{pinnedManagerDisplay}
|
||||
@@ -371,7 +357,6 @@ const mapStateToProps = (state) => {
|
||||
DisplayImport: state.skynet.DisplayImport,
|
||||
DisplayInfo: state.error.DisplayInfo,
|
||||
DisplayPinnedManager: state.pinned.DisplayPinnedManager,
|
||||
DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform,
|
||||
DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable,
|
||||
DownloadActive: state.download.DownloadActive,
|
||||
InstallActive: state.install.InstallActive,
|
||||
@@ -395,7 +380,6 @@ const mapStateToProps = (state) => {
|
||||
|
||||
const mapDispatchToProps = (dispatch) => {
|
||||
return {
|
||||
displaySelectAppPlatform: (display) => dispatch(displaySelectAppPlatform(display)),
|
||||
loadReleases: () => dispatch(loadReleases()),
|
||||
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
|
||||
saveState: () => dispatch(saveState()),
|
||||
|
||||
@@ -40,7 +40,7 @@ exports.UI_RELEASES_URL =
|
||||
exports.LINUX_DETECT_SCRIPT_URL =
|
||||
'https://bitbucket.org/blockstorage/repertory/raw/' + _REPERTORY_BRANCH + '/detect_linux2.sh';
|
||||
|
||||
exports.LINUX_SELECTABLE_PLATFORMS = ['centos7'];
|
||||
exports.LINUX_SELECTABLE_PLATFORMS = ['linux'];
|
||||
|
||||
exports.WINFSP_VERSION_NAMES = [
|
||||
'WinFsp 2019',
|
||||
@@ -106,7 +106,6 @@ exports.RELEASE_TYPES = ['Release', 'RC', 'Beta', 'Alpha'];
|
||||
exports.INSTALL_TYPES = {
|
||||
Dependency: 'dependency',
|
||||
Release: 'release',
|
||||
TestRelease: 'test_release',
|
||||
Upgrade: 'upgrade',
|
||||
};
|
||||
|
||||
@@ -196,8 +195,6 @@ exports.IPC_Show_Window = 'show_window';
|
||||
exports.IPC_Set_Config_Values = 'set_config_values';
|
||||
exports.IPC_Set_Config_Values_Reply = 'set_config_values_reply';
|
||||
|
||||
exports.IPC_Set_Linux_AppPlatform = 'IPC_Set_Linux_AppPlatform';
|
||||
|
||||
exports.IPC_Shutdown = 'shutdown';
|
||||
|
||||
exports.IPC_Skynet_Test_Logon = 'skynet_test_logon';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
@@ -8,16 +8,6 @@ import { getIPCRenderer } from '../../utils.jsx';
|
||||
|
||||
const ipcRenderer = getIPCRenderer();
|
||||
|
||||
export const displaySelectAppPlatform = (display) => {
|
||||
return (dispatch) => {
|
||||
if (display) {
|
||||
dispatch(showWindow());
|
||||
}
|
||||
|
||||
dispatch(setDisplaySelectAppPlatform(display));
|
||||
};
|
||||
};
|
||||
|
||||
export const NOTIFY_APPLICATION_BUSY = 'common/notifyApplicationBusy';
|
||||
export const notifyApplicationBusy = (busy, transparent) => {
|
||||
return {
|
||||
@@ -67,16 +57,6 @@ export const saveState = () => {
|
||||
export const setAllowMount = createAction('common/setAllowMount');
|
||||
export const setApplicationReady = createAction('common/setApplicationReady');
|
||||
|
||||
export const SET_DISPLAY_SELECT_APPPLATFORM = 'common/displaySelectAppPlatform';
|
||||
export const setDisplaySelectAppPlatform = (display) => {
|
||||
return {
|
||||
type: SET_DISPLAY_SELECT_APPPLATFORM,
|
||||
payload: display,
|
||||
};
|
||||
};
|
||||
|
||||
export const setLinuxAppPlatform = createAction('common/setLinuxAppPlatform');
|
||||
|
||||
export const setRebootRequired = () => {
|
||||
return (dispatch) => {
|
||||
dispatch(showWindow());
|
||||
|
||||
@@ -4,12 +4,7 @@ import * as Constants from '../../constants';
|
||||
import { getIPCRenderer } from '../../utils.jsx';
|
||||
|
||||
import { notifyError } from './error_actions';
|
||||
import {
|
||||
installAndTestRelease,
|
||||
installDependency,
|
||||
installRelease,
|
||||
installUpgrade,
|
||||
} from './install_actions';
|
||||
import { installDependency, installRelease, installUpgrade } from './install_actions';
|
||||
|
||||
export const setAllowDownload = createAction('download/setAllowDownload');
|
||||
|
||||
@@ -21,7 +16,7 @@ export const setDownloadBegin = (name, type, url) => {
|
||||
export const setDownloadEnd = createAction('download/setDownloadEnd');
|
||||
export const setDownloadProgress = createAction('download/setDownloadProgress');
|
||||
|
||||
export const downloadItem = (name, type, urls, isWinFSP, testVersion, appPlatform) => {
|
||||
export const downloadItem = (name, type, urls, isWinFSP) => {
|
||||
return (dispatch, getState) => {
|
||||
if (!Array.isArray(urls)) {
|
||||
urls = [urls];
|
||||
@@ -36,9 +31,6 @@ export const downloadItem = (name, type, urls, isWinFSP, testVersion, appPlatfor
|
||||
case Constants.INSTALL_TYPES.Release:
|
||||
dispatch(installRelease(result.Destination));
|
||||
break;
|
||||
case Constants.INSTALL_TYPES.TestRelease:
|
||||
dispatch(installAndTestRelease(result.Destination, testVersion, appPlatform));
|
||||
break;
|
||||
case Constants.INSTALL_TYPES.Upgrade:
|
||||
// const info =
|
||||
// this.props.LocationsLookup[this.props.AppPlatform][this.props.VersionLookup[this.props.AppPlatform][0]];
|
||||
|
||||
@@ -5,10 +5,8 @@ import { getIPCRenderer, getSelectedVersionFromState } from '../../utils.jsx';
|
||||
|
||||
import {
|
||||
confirmYesNoAction,
|
||||
displaySelectAppPlatform,
|
||||
setAllowMount,
|
||||
setApplicationReady,
|
||||
setLinuxAppPlatform,
|
||||
setRebootRequired,
|
||||
showWindow,
|
||||
shutdownApplication,
|
||||
@@ -17,7 +15,6 @@ import { downloadItem, setAllowDownload } from './download_actions';
|
||||
import { notifyError } from './error_actions';
|
||||
import { unmountAll } from './mount_actions';
|
||||
import {
|
||||
loadReleases,
|
||||
setActiveRelease,
|
||||
setInstalledVersion,
|
||||
setNewReleasesAvailable2,
|
||||
@@ -157,43 +154,6 @@ export const installDependency = (source, url, isWinFSP) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const installAndTestRelease = (source, version, appPlatform) => {
|
||||
return (dispatch, getState) => {
|
||||
if (ipcRenderer && getState().install.InstallTestActive) {
|
||||
const extractReleaseComplete = () => {
|
||||
ipcRenderer.send(Constants.IPC_Delete_File, {
|
||||
FilePath: source,
|
||||
});
|
||||
|
||||
ipcRenderer.once(Constants.IPC_Test_Release_Reply, (_, arg) => {
|
||||
if (arg.data.Success) {
|
||||
ipcRenderer.sendSync(Constants.IPC_Set_Linux_AppPlatform, {
|
||||
AppPlatform: appPlatform,
|
||||
});
|
||||
dispatch(setLinuxAppPlatform(appPlatform));
|
||||
dispatch(setInstallTestActive(false));
|
||||
dispatch(displaySelectAppPlatform(false));
|
||||
dispatch(setAllowDownload(false));
|
||||
dispatch(loadReleases());
|
||||
} else {
|
||||
dispatch(notifyError(arg.data.Error));
|
||||
dispatch(setInstallTestActive(false));
|
||||
}
|
||||
});
|
||||
ipcRenderer.send(Constants.IPC_Test_Release, {
|
||||
Version: version,
|
||||
});
|
||||
};
|
||||
|
||||
ipcRenderer.once(Constants.IPC_Extract_Release_Complete, extractReleaseComplete);
|
||||
ipcRenderer.send(Constants.IPC_Extract_Release, {
|
||||
Source: source,
|
||||
Version: version,
|
||||
});
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
export const installReleaseByVersion = (release, version) => {
|
||||
return (dispatch, getState) => {
|
||||
const install = () => {
|
||||
|
||||
@@ -3,10 +3,8 @@ import {
|
||||
confirmYesNoAction,
|
||||
NOTIFY_APPLICATION_BUSY,
|
||||
notifyRebootRequired,
|
||||
SET_DISPLAY_SELECT_APPPLATFORM,
|
||||
setAllowMount,
|
||||
setApplicationReady,
|
||||
setLinuxAppPlatform,
|
||||
} from '../actions/common_actions';
|
||||
|
||||
export const createCommonReducer = (platformInfo, version) => {
|
||||
@@ -19,7 +17,6 @@ export const createCommonReducer = (platformInfo, version) => {
|
||||
AppReady: false,
|
||||
DisplayConfirmYesNo: false,
|
||||
ConfirmTitle: null,
|
||||
DisplaySelectAppPlatform: false,
|
||||
Platform: platformInfo.Platform,
|
||||
RebootRequired: false,
|
||||
Version: version,
|
||||
@@ -33,9 +30,6 @@ export const createCommonReducer = (platformInfo, version) => {
|
||||
action.payload.display && action.payload.data ? action.payload.data.title : null,
|
||||
};
|
||||
},
|
||||
[SET_DISPLAY_SELECT_APPPLATFORM]: (state, action) => {
|
||||
return { ...state, DisplaySelectAppPlatform: action.payload };
|
||||
},
|
||||
[setAllowMount]: (state, action) => {
|
||||
return { ...state, AllowMount: action.payload };
|
||||
},
|
||||
@@ -45,9 +39,6 @@ export const createCommonReducer = (platformInfo, version) => {
|
||||
AppReady: action.payload,
|
||||
};
|
||||
},
|
||||
[setLinuxAppPlatform]: (state, action) => {
|
||||
return { ...state, AppPlatform: action.payload };
|
||||
},
|
||||
[NOTIFY_APPLICATION_BUSY]: (state, action) => {
|
||||
return {
|
||||
...state,
|
||||
|
||||
@@ -4,17 +4,7 @@ const helpers = require('../../helpers');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
|
||||
let _platformOverride;
|
||||
|
||||
const getPlatformOverride = () => {
|
||||
return _platformOverride;
|
||||
};
|
||||
|
||||
const setPlatformOverride = (platformOverride) => {
|
||||
_platformOverride = platformOverride;
|
||||
};
|
||||
|
||||
const addListeners = (ipcMain, { detectScript, saveUiSettings }) => {
|
||||
const addListeners = (ipcMain, { detectScript }) => {
|
||||
ipcMain.on(Constants.IPC_Get_Platform, (event) => {
|
||||
const sendResponse = (appPlatform, platform) => {
|
||||
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||
@@ -25,54 +15,42 @@ const addListeners = (ipcMain, { detectScript, saveUiSettings }) => {
|
||||
|
||||
const platform = os.platform();
|
||||
if (platform === 'linux') {
|
||||
if (_platformOverride && _platformOverride.length > 0) {
|
||||
sendResponse(_platformOverride, 'linux');
|
||||
} else {
|
||||
const scriptFile = path.join(os.tmpdir(), 'repertory_detect_linux.sh');
|
||||
fs.writeFileSync(scriptFile, detectScript);
|
||||
const scriptFile = path.join(os.tmpdir(), 'repertory_detect_linux.sh');
|
||||
fs.writeFileSync(scriptFile, detectScript);
|
||||
|
||||
helpers
|
||||
.executeScript(scriptFile)
|
||||
.then((data) => {
|
||||
let appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
|
||||
if (appPlatform === 'unknown') {
|
||||
helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => {
|
||||
if (err) {
|
||||
sendResponse(appPlatform, platform);
|
||||
} else {
|
||||
helpers
|
||||
.executeScript(scriptFile)
|
||||
.then((data) => {
|
||||
appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
|
||||
sendResponse(appPlatform, platform);
|
||||
})
|
||||
.catch(() => {
|
||||
sendResponse(appPlatform, platform);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sendResponse(appPlatform, platform);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
sendResponse(platform, platform);
|
||||
});
|
||||
}
|
||||
helpers
|
||||
.executeScript(scriptFile)
|
||||
.then((data) => {
|
||||
let appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
|
||||
if (appPlatform === 'unknown') {
|
||||
helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => {
|
||||
if (err) {
|
||||
sendResponse(appPlatform, platform);
|
||||
} else {
|
||||
helpers
|
||||
.executeScript(scriptFile)
|
||||
.then((data) => {
|
||||
appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
|
||||
sendResponse(appPlatform, platform);
|
||||
})
|
||||
.catch(() => {
|
||||
sendResponse(appPlatform, platform);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sendResponse(appPlatform, platform);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
sendResponse(platform, platform);
|
||||
});
|
||||
} else {
|
||||
sendResponse(platform, platform);
|
||||
}
|
||||
});
|
||||
|
||||
ipcMain.on(Constants.IPC_Set_Linux_AppPlatform, (event, data) => {
|
||||
setPlatformOverride(data.AppPlatform);
|
||||
saveUiSettings();
|
||||
event.returnValue = true;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getPlatformOverride,
|
||||
setPlatformOverride,
|
||||
addListeners,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user