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

@@ -20,8 +20,7 @@ import {
setNewReleasesAvailable, setNewReleasesAvailable,
} from './redux/actions/release_version_actions'; } from './redux/actions/release_version_actions';
import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay'; import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay';
import { displaySelectAppPlatform, saveState } from './redux/actions/common_actions'; import { saveState } from './redux/actions/common_actions';
import SelectAppPlatform from './containers/SelectAppPlatform/SelectAppPlatform';
import Text from './components/UI/Text/Text'; import Text from './components/UI/Text/Text';
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon'; import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
import UpgradeUI from './components/UpgradeUI/UpgradeUI'; import UpgradeUI from './components/UpgradeUI/UpgradeUI';
@@ -40,11 +39,7 @@ class App extends IPCContainer {
componentDidMount() { componentDidMount() {
const detectUpgrades = () => { const detectUpgrades = () => {
if (this.props.AppPlatform === 'unknown') { if (this.props.AppPlatform === 'unknown') {
if (this.props.Platform === 'linux') { this.props.notifyError('Operating system is not supported.', true);
this.props.displaySelectAppPlatform(true);
} else {
this.props.notifyError('Operating system is not supported.', true);
}
} else { } else {
this.props.loadReleases(); this.props.loadReleases();
} }
@@ -163,7 +158,6 @@ class App extends IPCContainer {
!this.props.DisplayInfo && !this.props.DisplayInfo &&
!this.props.InstallActive && !this.props.InstallActive &&
!this.props.RebootRequired && !this.props.RebootRequired &&
!this.props.DisplaySelectAppPlatform &&
!showUpgrade && !showUpgrade &&
!this.props.DismissNewReleasesAvailable && !this.props.DismissNewReleasesAvailable &&
this.props.NewReleasesAvailable.length > 0; this.props.NewReleasesAvailable.length > 0;
@@ -173,7 +167,6 @@ class App extends IPCContainer {
!this.props.DownloadActive && !this.props.DownloadActive &&
!showNewReleases && !showNewReleases &&
!this.props.RebootRequired && !this.props.RebootRequired &&
!this.props.DisplaySelectAppPlatform &&
!showUpgrade && !showUpgrade &&
this.props.DisplayAddEditHost; this.props.DisplayAddEditHost;
@@ -183,7 +176,6 @@ class App extends IPCContainer {
!this.props.DownloadActive && !this.props.DownloadActive &&
!showNewReleases && !showNewReleases &&
!this.props.RebootRequired && !this.props.RebootRequired &&
!this.props.DisplaySelectAppPlatform &&
!showUpgrade && !showUpgrade &&
this.props.DisplayImport; this.props.DisplayImport;
@@ -193,7 +185,6 @@ class App extends IPCContainer {
!this.props.DownloadActive && !this.props.DownloadActive &&
!showNewReleases && !showNewReleases &&
!this.props.RebootRequired && !this.props.RebootRequired &&
!this.props.DisplaySelectAppPlatform &&
!showUpgrade && !showUpgrade &&
this.props.DisplayExport; this.props.DisplayExport;
@@ -227,10 +218,6 @@ class App extends IPCContainer {
const infoDisplay = createModalConditionally(this.props.DisplayInfo, <InfoDetails />, true); const infoDisplay = createModalConditionally(this.props.DisplayInfo, <InfoDetails />, true);
const newReleasesDisplay = createModalConditionally(showNewReleases, <NewReleases />); const newReleasesDisplay = createModalConditionally(showNewReleases, <NewReleases />);
const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot />); const rebootDisplay = createModalConditionally(this.props.RebootRequired, <Reboot />);
const selectAppPlatformDisplay = createModalConditionally(
this.props.DisplaySelectAppPlatform,
<SelectAppPlatform />
);
const upgradeDisplay = createModalConditionally(showUpgrade, <UpgradeUI />); const upgradeDisplay = createModalConditionally(showUpgrade, <UpgradeUI />);
const importDisplay = createModalConditionally( const importDisplay = createModalConditionally(
showSkynetImport, showSkynetImport,
@@ -249,7 +236,7 @@ class App extends IPCContainer {
); );
let mainContent = []; let mainContent = [];
if (this.props.DisplaySelectAppPlatform || !this.props.AppReady) { if (!this.props.AppReady) {
mainContent = ( mainContent = (
<Box col={0} colSpan={'remain'} row={10} rowSpan={'remain'}> <Box col={0} colSpan={'remain'} row={10} rowSpan={'remain'}>
<Loading /> <Loading />
@@ -337,7 +324,6 @@ class App extends IPCContainer {
{importDisplay} {importDisplay}
{exportDisplay} {exportDisplay}
{newReleasesDisplay} {newReleasesDisplay}
{selectAppPlatformDisplay}
{dependencyDisplay} {dependencyDisplay}
{upgradeDisplay} {upgradeDisplay}
{pinnedManagerDisplay} {pinnedManagerDisplay}
@@ -371,7 +357,6 @@ const mapStateToProps = (state) => {
DisplayImport: state.skynet.DisplayImport, DisplayImport: state.skynet.DisplayImport,
DisplayInfo: state.error.DisplayInfo, DisplayInfo: state.error.DisplayInfo,
DisplayPinnedManager: state.pinned.DisplayPinnedManager, DisplayPinnedManager: state.pinned.DisplayPinnedManager,
DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform,
DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable, DismissNewReleasesAvailable: state.relver.DismissNewReleasesAvailable,
DownloadActive: state.download.DownloadActive, DownloadActive: state.download.DownloadActive,
InstallActive: state.install.InstallActive, InstallActive: state.install.InstallActive,
@@ -395,7 +380,6 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => { const mapDispatchToProps = (dispatch) => {
return { return {
displaySelectAppPlatform: (display) => dispatch(displaySelectAppPlatform(display)),
loadReleases: () => dispatch(loadReleases()), loadReleases: () => dispatch(loadReleases()),
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)), notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
saveState: () => dispatch(saveState()), saveState: () => dispatch(saveState()),

View File

@@ -40,7 +40,7 @@ exports.UI_RELEASES_URL =
exports.LINUX_DETECT_SCRIPT_URL = exports.LINUX_DETECT_SCRIPT_URL =
'https://bitbucket.org/blockstorage/repertory/raw/' + _REPERTORY_BRANCH + '/detect_linux2.sh'; '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 = [ exports.WINFSP_VERSION_NAMES = [
'WinFsp 2019', 'WinFsp 2019',
@@ -106,7 +106,6 @@ exports.RELEASE_TYPES = ['Release', 'RC', 'Beta', 'Alpha'];
exports.INSTALL_TYPES = { exports.INSTALL_TYPES = {
Dependency: 'dependency', Dependency: 'dependency',
Release: 'release', Release: 'release',
TestRelease: 'test_release',
Upgrade: 'upgrade', 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 = 'set_config_values';
exports.IPC_Set_Config_Values_Reply = 'set_config_values_reply'; 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_Shutdown = 'shutdown';
exports.IPC_Skynet_Test_Logon = 'skynet_test_logon'; exports.IPC_Skynet_Test_Logon = 'skynet_test_logon';

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);

View File

@@ -8,16 +8,6 @@ import { getIPCRenderer } from '../../utils.jsx';
const ipcRenderer = getIPCRenderer(); 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 NOTIFY_APPLICATION_BUSY = 'common/notifyApplicationBusy';
export const notifyApplicationBusy = (busy, transparent) => { export const notifyApplicationBusy = (busy, transparent) => {
return { return {
@@ -67,16 +57,6 @@ export const saveState = () => {
export const setAllowMount = createAction('common/setAllowMount'); export const setAllowMount = createAction('common/setAllowMount');
export const setApplicationReady = createAction('common/setApplicationReady'); 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 = () => { export const setRebootRequired = () => {
return (dispatch) => { return (dispatch) => {
dispatch(showWindow()); dispatch(showWindow());

View File

@@ -4,12 +4,7 @@ import * as Constants from '../../constants';
import { getIPCRenderer } from '../../utils.jsx'; import { getIPCRenderer } from '../../utils.jsx';
import { notifyError } from './error_actions'; import { notifyError } from './error_actions';
import { import { installDependency, installRelease, installUpgrade } from './install_actions';
installAndTestRelease,
installDependency,
installRelease,
installUpgrade,
} from './install_actions';
export const setAllowDownload = createAction('download/setAllowDownload'); export const setAllowDownload = createAction('download/setAllowDownload');
@@ -21,7 +16,7 @@ export const setDownloadBegin = (name, type, url) => {
export const setDownloadEnd = createAction('download/setDownloadEnd'); export const setDownloadEnd = createAction('download/setDownloadEnd');
export const setDownloadProgress = createAction('download/setDownloadProgress'); 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) => { return (dispatch, getState) => {
if (!Array.isArray(urls)) { if (!Array.isArray(urls)) {
urls = [urls]; urls = [urls];
@@ -36,9 +31,6 @@ export const downloadItem = (name, type, urls, isWinFSP, testVersion, appPlatfor
case Constants.INSTALL_TYPES.Release: case Constants.INSTALL_TYPES.Release:
dispatch(installRelease(result.Destination)); dispatch(installRelease(result.Destination));
break; break;
case Constants.INSTALL_TYPES.TestRelease:
dispatch(installAndTestRelease(result.Destination, testVersion, appPlatform));
break;
case Constants.INSTALL_TYPES.Upgrade: case Constants.INSTALL_TYPES.Upgrade:
// const info = // const info =
// this.props.LocationsLookup[this.props.AppPlatform][this.props.VersionLookup[this.props.AppPlatform][0]]; // this.props.LocationsLookup[this.props.AppPlatform][this.props.VersionLookup[this.props.AppPlatform][0]];

View File

@@ -5,10 +5,8 @@ import { getIPCRenderer, getSelectedVersionFromState } from '../../utils.jsx';
import { import {
confirmYesNoAction, confirmYesNoAction,
displaySelectAppPlatform,
setAllowMount, setAllowMount,
setApplicationReady, setApplicationReady,
setLinuxAppPlatform,
setRebootRequired, setRebootRequired,
showWindow, showWindow,
shutdownApplication, shutdownApplication,
@@ -17,7 +15,6 @@ import { downloadItem, setAllowDownload } from './download_actions';
import { notifyError } from './error_actions'; import { notifyError } from './error_actions';
import { unmountAll } from './mount_actions'; import { unmountAll } from './mount_actions';
import { import {
loadReleases,
setActiveRelease, setActiveRelease,
setInstalledVersion, setInstalledVersion,
setNewReleasesAvailable2, 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) => { export const installReleaseByVersion = (release, version) => {
return (dispatch, getState) => { return (dispatch, getState) => {
const install = () => { const install = () => {

View File

@@ -3,10 +3,8 @@ import {
confirmYesNoAction, confirmYesNoAction,
NOTIFY_APPLICATION_BUSY, NOTIFY_APPLICATION_BUSY,
notifyRebootRequired, notifyRebootRequired,
SET_DISPLAY_SELECT_APPPLATFORM,
setAllowMount, setAllowMount,
setApplicationReady, setApplicationReady,
setLinuxAppPlatform,
} from '../actions/common_actions'; } from '../actions/common_actions';
export const createCommonReducer = (platformInfo, version) => { export const createCommonReducer = (platformInfo, version) => {
@@ -19,7 +17,6 @@ export const createCommonReducer = (platformInfo, version) => {
AppReady: false, AppReady: false,
DisplayConfirmYesNo: false, DisplayConfirmYesNo: false,
ConfirmTitle: null, ConfirmTitle: null,
DisplaySelectAppPlatform: false,
Platform: platformInfo.Platform, Platform: platformInfo.Platform,
RebootRequired: false, RebootRequired: false,
Version: version, Version: version,
@@ -33,9 +30,6 @@ export const createCommonReducer = (platformInfo, version) => {
action.payload.display && action.payload.data ? action.payload.data.title : null, 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) => { [setAllowMount]: (state, action) => {
return { ...state, AllowMount: action.payload }; return { ...state, AllowMount: action.payload };
}, },
@@ -45,9 +39,6 @@ export const createCommonReducer = (platformInfo, version) => {
AppReady: action.payload, AppReady: action.payload,
}; };
}, },
[setLinuxAppPlatform]: (state, action) => {
return { ...state, AppPlatform: action.payload };
},
[NOTIFY_APPLICATION_BUSY]: (state, action) => { [NOTIFY_APPLICATION_BUSY]: (state, action) => {
return { return {
...state, ...state,

View File

@@ -4,17 +4,7 @@ const helpers = require('../../helpers');
const os = require('os'); const os = require('os');
const path = require('path'); const path = require('path');
let _platformOverride; const addListeners = (ipcMain, { detectScript }) => {
const getPlatformOverride = () => {
return _platformOverride;
};
const setPlatformOverride = (platformOverride) => {
_platformOverride = platformOverride;
};
const addListeners = (ipcMain, { detectScript, saveUiSettings }) => {
ipcMain.on(Constants.IPC_Get_Platform, (event) => { ipcMain.on(Constants.IPC_Get_Platform, (event) => {
const sendResponse = (appPlatform, platform) => { const sendResponse = (appPlatform, platform) => {
event.sender.send(Constants.IPC_Get_Platform_Reply, { event.sender.send(Constants.IPC_Get_Platform_Reply, {
@@ -25,54 +15,42 @@ const addListeners = (ipcMain, { detectScript, saveUiSettings }) => {
const platform = os.platform(); const platform = os.platform();
if (platform === 'linux') { if (platform === 'linux') {
if (_platformOverride && _platformOverride.length > 0) { const scriptFile = path.join(os.tmpdir(), 'repertory_detect_linux.sh');
sendResponse(_platformOverride, 'linux'); fs.writeFileSync(scriptFile, detectScript);
} else {
const scriptFile = path.join(os.tmpdir(), 'repertory_detect_linux.sh');
fs.writeFileSync(scriptFile, detectScript);
helpers helpers
.executeScript(scriptFile) .executeScript(scriptFile)
.then((data) => { .then((data) => {
let appPlatform = data.replace(/(\r\n|\n|\r)/gm, ''); let appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
if (appPlatform === 'unknown') { if (appPlatform === 'unknown') {
helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => { helpers.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, (err) => {
if (err) { if (err) {
sendResponse(appPlatform, platform); sendResponse(appPlatform, platform);
} else { } else {
helpers helpers
.executeScript(scriptFile) .executeScript(scriptFile)
.then((data) => { .then((data) => {
appPlatform = data.replace(/(\r\n|\n|\r)/gm, ''); appPlatform = data.replace(/(\r\n|\n|\r)/gm, '');
sendResponse(appPlatform, platform); sendResponse(appPlatform, platform);
}) })
.catch(() => { .catch(() => {
sendResponse(appPlatform, platform); sendResponse(appPlatform, platform);
}); });
} }
}); });
} else { } else {
sendResponse(appPlatform, platform); sendResponse(appPlatform, platform);
} }
}) })
.catch(() => { .catch(() => {
sendResponse(platform, platform); sendResponse(platform, platform);
}); });
}
} else { } else {
sendResponse(platform, platform); sendResponse(platform, platform);
} }
}); });
ipcMain.on(Constants.IPC_Set_Linux_AppPlatform, (event, data) => {
setPlatformOverride(data.AppPlatform);
saveUiSettings();
event.returnValue = true;
});
}; };
module.exports = { module.exports = {
getPlatformOverride,
setPlatformOverride,
addListeners, addListeners,
}; };