#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. // 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({ 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, height: height,
fullscreen: false, fullscreen: false,
resizable: false, resizable: false,

View File

@@ -141,7 +141,7 @@ class App extends IPCContainer {
let key = 0; let key = 0;
mainContent.push(( mainContent.push((
<div key={'rvd_' + key++} <div key={'rvd_' + key++}
style={{'paddingBottom': '8px'}}> style={{'paddingBottom': '4px'}}>
<ReleaseVersionDisplay downloadDisabled={!downloadEnabled} <ReleaseVersionDisplay downloadDisabled={!downloadEnabled}
version={selectedVersion}/> version={selectedVersion}/>
</div> </div>
@@ -152,7 +152,8 @@ class App extends IPCContainer {
<MountItems allowConfig={allowConfig} <MountItems allowConfig={allowConfig}
allowSiaPrime={allowSiaPrime} allowSiaPrime={allowSiaPrime}
key={'md_' + key++} 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.", "HostNameOrIp": "IP address or host name of Sia/ScPrime daemon.",
"TimeoutMs": "Number of milliseconds to wait for Sia/ScPrime API responses before timing out." "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": { "Settings": {
"ApiAuth": "Password used to communicate with Repertory's API. Auto-generated by default.", "ApiAuth": "Password used to communicate with Repertory's API. Auto-generated by default.",
"ApiPort": "Repertory API port to use for JSON-RPC requests.", "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 { input.MountItemInput {
margin: 0; margin: 0;
padding: 4px; padding: 4px;

View File

@@ -140,17 +140,19 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
); );
return ( return (
<Grid> <div className={'MountItem'}>
{configButton} <Grid noScroll>
<Text {configButton}
col={configButton ? 6 : 0} <Text
rowSpan={5} col={configButton ? 6 : 0}
text={props.provider} rowSpan={5}
type={'Heading1'}/> text={props.provider}
{inputControls} type={'Heading1'}/>
{actionsDisplay} {inputControls}
{autoMountControl} {actionsDisplay}
{autoRestartControl} {autoMountControl}
</Grid> {autoRestartControl}
</Grid>
</div>
); );
}); });

View File

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

View File

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

View File

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

View File

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