#40: Support for remote Windows mounts - partial

This commit is contained in:
2019-10-01 17:11:07 -05:00
parent 686774741f
commit 6a7c471f46
11 changed files with 82 additions and 20 deletions

View File

@@ -77,9 +77,9 @@ const createWindow = () => {
}
// Create the browser window.
const height = (process.env.ELECTRON_START_URL || (os.platform() === 'darwin') ? 294 : 274) - ((os.platform() === 'win32') ? 0 : 20);
const height = (process.env.ELECTRON_START_URL || (os.platform() === 'darwin') ? 294 : 274) + 30 - ((os.platform() === 'win32') ? 0 : 20);
mainWindow = new BrowserWindow({
width: 428 + ((os.platform() === 'win32') ? 0 : (os.platform() === 'darwin') ? 150 : 160),
width: 468 + ((os.platform() === 'win32') ? 0 : (os.platform() === 'darwin') ? 150 : 160),
height: height,
fullscreen: false,
resizable: false,

View File

@@ -141,7 +141,7 @@ class App extends IPCContainer {
let key = 0;
mainContent.push((
<div key={'rvd_' + key++}
style={{'paddingBottom': '8px'}}>
style={{'paddingBottom': '4px'}}>
<ReleaseVersionDisplay downloadDisabled={!downloadEnabled}
version={selectedVersion}/>
</div>
@@ -152,7 +152,8 @@ class App extends IPCContainer {
<MountItems allowConfig={allowConfig}
allowSiaPrime={allowSiaPrime}
key={'md_' + key++}
noConsoleSupported={noConsoleSupported}/>
noConsoleSupported={noConsoleSupported}
remoteSupported={remoteSupported}/>
));
}
}

View File

@@ -6,6 +6,12 @@
"HostNameOrIp": "IP address or host name of Sia/ScPrime daemon.",
"TimeoutMs": "Number of milliseconds to wait for Sia/ScPrime API responses before timing out."
},
"RemoteMount": {
"EnableRemoteMount": "Allow mounting this location over TCP.",
"RemoteHostNameOrIp": "Host name or IP of host to connect to for remote mounting.",
"RemotePort": "TCP port used for remote mounting.",
"RemoteToken": "Encryption token used for remote mounts. This value must be the same on local and remote systems."
},
"Settings": {
"ApiAuth": "Password used to communicate with Repertory's API. Auto-generated by default.",
"ApiPort": "Repertory API port to use for JSON-RPC requests.",

View File

@@ -0,0 +1,4 @@
.AddRemoteMount {
margin: 0;
padding: 0;
}

View File

@@ -0,0 +1,17 @@
import React from 'react';
import './AddRemoteMount.css';
import {connect} from 'react-redux';
import Button from '../UI/Button/Button';
const mapDispatchToProps = dispatch => {
return {
}
};
export default connect(null, mapDispatchToProps)(props => {
return (
<div className={'AddRemoteMount'}>
<Button>Add Remote Mount</Button>
</div>
);
});

View File

@@ -1,3 +1,10 @@
.MountItem {
padding: 0;
margin: 0;
height: 56px;
overflow: visible;
}
input.MountItemInput {
margin: 0;
padding: 4px;

View File

@@ -140,7 +140,8 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
);
return (
<Grid>
<div className={'MountItem'}>
<Grid noScroll>
{configButton}
<Text
col={configButton ? 6 : 0}
@@ -152,5 +153,6 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
{autoMountControl}
{autoRestartControl}
</Grid>
</div>
);
});

View File

@@ -88,7 +88,9 @@ class Configuration extends IPCContainer {
advanced: template[key] ? template[key].advanced : false,
label: key,
remote: template[key] ? template[key].remote : false,
value: config[key],
value: (template[key] && (template[key].type === 'object')) ?
config[key] :
config[key].toString(),
};
})
.filter(i=> {
@@ -99,7 +101,6 @@ class Configuration extends IPCContainer {
}
return ret;
});
return {
ObjectList: objectList,
ItemList: itemList,

View File

@@ -1,6 +1,8 @@
.MountItems {
padding: 0;
margin: 0;
height: 161px;
width: 100%;
box-sizing: border-box;
overflow-x: scroll;
}

View File

@@ -1,4 +1,5 @@
import React from 'react';
import AddRemoteMount from '../../components/AddRemoteMount/AddRemoteMount';
import Box from '../../components/UI/Box/Box';
import Button from '../../components/UI/Button/Button';
import {connect} from 'react-redux';
@@ -298,16 +299,35 @@ class MountItems extends IPCContainer {
for (const provider of Constants.PROVIDER_LIST) {
items.push((
<MountItem allowConfig={this.props.allowConfig}
allowRemove={false}
browseClicked={this.handleBrowseLocation}
changed={e => this.handleMountLocationChanged(provider, e.target.value)}
clicked={this.handleMountUnMount}
key={'mi_' + items.length}
provider={provider}/>
));
if (items.length !== this.state.length) {
items.push(<div key={'di_' + items.length}
style={{paddingTop: '12px'}} />)
style={{paddingTop: '4px'}} />)
}
if (this.props.remoteSupported) {
for (const provider of this.props.RemoteMounts) {
items.push((
<MountItem allowConfig={this.props.allowConfig}
allowRemove={true}
browseClicked={this.handleBrowseLocation}
changed={e => this.handleMountLocationChanged(provider, e.target.value)}
clicked={this.handleMountUnMount}
key={'mi_' + items.length}
provider={provider}/>
));
items.push(<div key={'di_' + items.length}
style={{paddingTop: '4px'}}/>)
}
items.push(<AddRemoteMount key={'mia_' + items.length + 1}/>);
} else {
items.splice(items.length - 1, 1)
}
return (
@@ -326,6 +346,7 @@ const mapStateToProps = state => {
MountsBusy: state.mounts.MountsBusy,
Platform: state.common.Platform,
ProviderState: state.mounts.ProviderState,
RemoteMounts: state.mounts.RemoteMounts,
}
};

View File

@@ -47,6 +47,7 @@ export const mountReducer = createReducer({
MountsBusy: false,
MountState: mountState,
ProviderState: providerState,
RemoteMounts: [],
}, {
[displayConfiguration]: (state, action) => {
return {