#36: Add ability to select Linux distribution type if OS is unsupported - partial

This commit is contained in:
2019-08-28 13:34:11 -05:00
parent 3dd3955846
commit 0671a39809
8 changed files with 90 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
# Changelog # Changelog
## 1.0.8 ## 1.0.8
* \#36: Add ability to select Linux distribution type if OS is unsupported
* Added additional WinFsp uninstall strings * Added additional WinFsp uninstall strings
## 1.0.7 ## 1.0.7

View File

@@ -28,6 +28,7 @@ let expectedUnmount = {};
let launchHidden = false; let launchHidden = false;
let firstMountCheck = true; let firstMountCheck = true;
let manualMountDetection = {}; let manualMountDetection = {};
let platformOverride;
let isShutdown = false; let isShutdown = false;
let isQuiting = false; let isQuiting = false;
@@ -244,6 +245,7 @@ const loadUiSettings = () => {
if (fs.statSync(settingFile).isFile()) { if (fs.statSync(settingFile).isFile()) {
const settings = JSON.parse(fs.readFileSync(settingFile, 'utf8')); const settings = JSON.parse(fs.readFileSync(settingFile, 'utf8'));
launchHidden = settings.launch_hidden; launchHidden = settings.launch_hidden;
platformOverride = settings.platform_override;
} }
} catch (e) { } catch (e) {
} }
@@ -659,13 +661,16 @@ ipcMain.on(Constants.IPC_Get_Platform, (event) => {
const platform = os.platform(); const platform = os.platform();
if (platform === 'linux') { if (platform === 'linux') {
if (platformOverride && (platformOverride.trim().length > 0)) {
sendResponse(platformOverride, 'linux');
} else {
const scriptFile = path.join(os.tmpdir(), 'repertory_detect_linux.sh'); const scriptFile = path.join(os.tmpdir(), 'repertory_detect_linux.sh');
fs.writeFileSync(scriptFile, detectScript); 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 helpers
.downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, err => { .downloadFile(Constants.LINUX_DETECT_SCRIPT_URL, scriptFile, null, err => {
@@ -690,6 +695,7 @@ ipcMain.on(Constants.IPC_Get_Platform, (event) => {
.catch(() => { .catch(() => {
sendResponse(platform, platform); sendResponse(platform, platform);
}); });
}
} else { } else {
sendResponse(platform, platform); sendResponse(platform, platform);
} }

View File

@@ -14,7 +14,11 @@ import MountItems from './containers/MountItems/MountItems';
import {notifyError} from './redux/actions/error_actions'; import {notifyError} from './redux/actions/error_actions';
import Reboot from './components/Reboot/Reboot'; import Reboot from './components/Reboot/Reboot';
import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay'; import ReleaseVersionDisplay from './components/ReleaseVersionDisplay/ReleaseVersionDisplay';
import {saveState} from './redux/actions/common_actions'; import {
displaySelectAppPlatform,
saveState
} from './redux/actions/common_actions';
import SelectAppPlatform from './components/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';
@@ -30,7 +34,11 @@ 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.displaySelectAppPlatform(true);
} else {
this.props.notifyError('Operating system is not supported.', true); this.props.notifyError('Operating system is not supported.', true);
}
} else { } else {
this.props.loadReleases(); this.props.loadReleases();
} }
@@ -119,9 +127,12 @@ class App extends IPCContainer {
const downloadDisplay = this.createModalConditionally(this.props.DownloadActive, <DownloadProgress/>); const downloadDisplay = this.createModalConditionally(this.props.DownloadActive, <DownloadProgress/>);
const errorDisplay = this.createModalConditionally(this.props.DisplayError, <ErrorDetails/>, true); const errorDisplay = this.createModalConditionally(this.props.DisplayError, <ErrorDetails/>, true);
const upgradeDisplay = this.createModalConditionally(showUpgrade, <UpgradeUI/>); const upgradeDisplay = this.createModalConditionally(showUpgrade, <UpgradeUI/>);
const selectAppPlatformDisplay = this.createModalConditionally(this.props.DisplaySelectAppPlatform, <SelectAppPlatform/>);
let mainContent = []; let mainContent = [];
if (this.props.AppReady) { if (this.props.DisplaySelectAppPlatform || !this.props.AppReady) {
mainContent = <Loading/>
} else {
let key = 0; let key = 0;
mainContent.push(( mainContent.push((
<div key={'rvd_' + key++} <div key={'rvd_' + key++}
@@ -140,12 +151,11 @@ class App extends IPCContainer {
</div> </div>
)); ));
} }
} else {
mainContent = <Loading/>
} }
return ( return (
<div className={'App'}> <div className={'App'}>
{selectAppPlatformDisplay}
{errorDisplay} {errorDisplay}
{dependencyDisplay} {dependencyDisplay}
{upgradeDisplay} {upgradeDisplay}
@@ -193,12 +203,14 @@ const mapStateToProps = state => {
DismissDependencies: state.install.DismissDependencies, DismissDependencies: state.install.DismissDependencies,
DisplayConfiguration: state.mounts.DisplayConfiguration, DisplayConfiguration: state.mounts.DisplayConfiguration,
DisplayError: state.error.DisplayError, DisplayError: state.error.DisplayError,
DisplaySelectAppPlatform: state.common.DisplaySelectAppPlatform,
DownloadActive: state.download.DownloadActive, DownloadActive: state.download.DownloadActive,
InstallActive: state.install.InstallActive, InstallActive: state.install.InstallActive,
InstalledVersion: state.relver.InstalledVersion, InstalledVersion: state.relver.InstalledVersion,
LocationsLookup: state.relver.LocationsLookup, LocationsLookup: state.relver.LocationsLookup,
MissingDependencies: state.install.MissingDependencies, MissingDependencies: state.install.MissingDependencies,
MountsBusy: state.mounts.MountsBusy, MountsBusy: state.mounts.MountsBusy,
Platform: state.common.Platform,
ProviderState: state.mounts.ProviderState, ProviderState: state.mounts.ProviderState,
RebootRequired: state.common.RebootRequired, RebootRequired: state.common.RebootRequired,
Release: state.relver.Release, Release: state.relver.Release,
@@ -212,6 +224,7 @@ const mapStateToProps = state => {
const mapDispatchToProps = dispatch => { const mapDispatchToProps = dispatch => {
return { return {
displaySelectAppPlatform: ()=> dispatch(displaySelectAppPlatform()),
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

@@ -0,0 +1,11 @@
.SAPHeading {
color: var(--text_color_error);
text-align: center;
margin-bottom: 4px;
}
.SAPContent {
max-height: 60vh;
overflow-y: auto;
margin-bottom: 8px;
}

View File

@@ -0,0 +1,27 @@
import React from 'react';
import './SelectAppPlatform.css';
import * as Constants from '../../constants';
import {connect} from 'react-redux';
import Box from '../UI/Box/Box';
import Button from '../UI/Button/Button';
import DropDown from '../UI/DropDown/DropDown';
import {rebootSystem} from '../../redux/actions/common_actions';
const mapDispatchToProps = dispatch => {
return {
rebootSystem: () => dispatch(rebootSystem()),
};
};
export default connect(null, mapDispatchToProps)(props => {
return (
<Box dxDark dxStyle={{padding: '8px'}}>
<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>
<DropDown items={Constants.LINUX_SELECTABLE_PLATFORMS}/>
<Button clicked={}>Test</Button>
</Box>
);
});

View File

@@ -36,6 +36,12 @@ exports.UI_RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory-ui/raw/'
exports.LINUX_DETECT_SCRIPT_URL = 'https://bitbucket.org/blockstorage/repertory/raw/' + REPERTORY_BRANCH + '/detect_linux.sh'; exports.LINUX_DETECT_SCRIPT_URL = 'https://bitbucket.org/blockstorage/repertory/raw/' + REPERTORY_BRANCH + '/detect_linux.sh';
exports.LINUX_SELECTABLE_PLATFORMS = [
'ubuntu18.04',
'ubuntu18.10',
'ubuntu19.04'
];
exports.DATA_LOCATIONS = { exports.DATA_LOCATIONS = {
linux: '~/.local/repertory/ui', linux: '~/.local/repertory/ui',
darwin: '~/Library/Application Support/repertory/ui', darwin: '~/Library/Application Support/repertory/ui',

View File

@@ -4,6 +4,7 @@ import {getIPCRenderer} from '../../utils';
const ipcRenderer = getIPCRenderer(); const ipcRenderer = getIPCRenderer();
export const displaySelectAppPlatform = createAction('common/displaySelectAppPlatform');
export const notifyRebootRequired = createAction('common/notifyRebootRequired'); export const notifyRebootRequired = createAction('common/notifyRebootRequired');
export const setAllowMount = createAction('common/setAllowMount'); export const setAllowMount = createAction('common/setAllowMount');

View File

@@ -1,5 +1,6 @@
import {createReducer} from 'redux-starter-kit'; import {createReducer} from 'redux-starter-kit';
import { import {
displaySelectAppPlatform,
notifyRebootRequired, notifyRebootRequired,
setAllowMount, setAllowMount,
setApplicationReady, setApplicationReady,
@@ -10,10 +11,17 @@ export const createCommonReducer = (platform, appPlatform, version) => {
AllowMount: false, AllowMount: false,
AppPlatform: appPlatform, AppPlatform: appPlatform,
AppReady: false, AppReady: false,
DisplaySelectAppPlatform: false,
Platform: platform, Platform: platform,
RebootRequired: false, RebootRequired: false,
Version: version, Version: version,
}, { }, {
[displaySelectAppPlatform]: (state, action) => {
return {
...state,
DisplaySelectAppPlatform: action.payload,
}
},
[setAllowMount]: (state, action) => { [setAllowMount]: (state, action) => {
return { return {
...state, ...state,