Partial S3 support
This commit is contained in:
@@ -91,6 +91,9 @@ if [ "$DISTNAME" = "unknown" ]; then
|
|||||||
elif [ "$VERSION_ID" = "15.1" ]; then
|
elif [ "$VERSION_ID" = "15.1" ]; then
|
||||||
DISTNAME=debian
|
DISTNAME=debian
|
||||||
DISTVER=9
|
DISTVER=9
|
||||||
|
elif [ "$VERSION_ID" = "15.2" ]; then
|
||||||
|
DISTNAME=debian
|
||||||
|
DISTVER=9
|
||||||
else
|
else
|
||||||
resetDistVer
|
resetDistVer
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -110,8 +110,9 @@ class App extends IPCContainer {
|
|||||||
const remoteSupported = this.props.LocationsLookup[selectedVersion] &&
|
const remoteSupported = this.props.LocationsLookup[selectedVersion] &&
|
||||||
this.props.LocationsLookup[selectedVersion].supports_remote;
|
this.props.LocationsLookup[selectedVersion].supports_remote;
|
||||||
|
|
||||||
const s3Supported = this.props.LocationsLookup[selectedVersion] &&
|
let s3Supported = this.props.LocationsLookup[selectedVersion] &&
|
||||||
this.props.LocationsLookup[selectedVersion].s3_support;
|
this.props.LocationsLookup[selectedVersion].s3_support;
|
||||||
|
//s3Supported = true;
|
||||||
|
|
||||||
const skynetSupported = this.props.LocationsLookup[selectedVersion] &&
|
const skynetSupported = this.props.LocationsLookup[selectedVersion] &&
|
||||||
this.props.LocationsLookup[selectedVersion].skynet_support;
|
this.props.LocationsLookup[selectedVersion].skynet_support;
|
||||||
@@ -174,6 +175,7 @@ class App extends IPCContainer {
|
|||||||
|
|
||||||
const configDisplay = createModalConditionally(showConfig, <Configuration
|
const configDisplay = createModalConditionally(showConfig, <Configuration
|
||||||
version={selectedVersion}
|
version={selectedVersion}
|
||||||
|
s3Supported={s3Supported}
|
||||||
remoteSupported={remoteSupported}/>);
|
remoteSupported={remoteSupported}/>);
|
||||||
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
|
const confirmDisplay = createModalConditionally(this.props.DisplayConfirmYesNo, <YesNo/>);
|
||||||
const dependencyDisplay = createModalConditionally(showDependencies,
|
const dependencyDisplay = createModalConditionally(showDependencies,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, '__esModule', {value: true});
|
||||||
value: true
|
exports.DEV_PUBLIC_KEY =
|
||||||
});
|
'-----BEGIN PUBLIC KEY-----\n' +
|
||||||
exports.DEV_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----\n' +
|
|
||||||
'MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEKfZmq5mMAtD4kSt2Gc/5J\n' +
|
'MIIEIjANBgkqhkiG9w0BAQEFAAOCBA8AMIIECgKCBAEKfZmq5mMAtD4kSt2Gc/5J\n' +
|
||||||
'H+HHTYtUZE6YYvsvz8TNG/bNL67ZtNRyaoMyhLTfIN4rPBNLUfD+owNS+u5Yk+lS\n' +
|
'H+HHTYtUZE6YYvsvz8TNG/bNL67ZtNRyaoMyhLTfIN4rPBNLUfD+owNS+u5Yk+lS\n' +
|
||||||
'ZLYyOuhoCZIFefayYqKLr42G8EeuRbx0IMzXmJtN0a4rqxlWhkYufJubpdQ+V4DF\n' +
|
'ZLYyOuhoCZIFefayYqKLr42G8EeuRbx0IMzXmJtN0a4rqxlWhkYufJubpdQ+V4DF\n' +
|
||||||
@@ -30,10 +29,15 @@ exports.DEV_PUBLIC_KEY = '-----BEGIN PUBLIC KEY-----\n' +
|
|||||||
const REPERTORY_BRANCH = '1.3.x_branch';
|
const REPERTORY_BRANCH = '1.3.x_branch';
|
||||||
const REPERTORY_UI_BRANCH = '1.3.x_branch';
|
const REPERTORY_UI_BRANCH = '1.3.x_branch';
|
||||||
|
|
||||||
exports.RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory/raw/' + REPERTORY_BRANCH + '/releases_1.3.json';
|
exports.RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory/raw/' +
|
||||||
exports.UI_RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory-ui/raw/' + REPERTORY_UI_BRANCH + '/releases.json';
|
REPERTORY_BRANCH + '/releases_1.3.json';
|
||||||
|
exports.UI_RELEASES_URL =
|
||||||
|
'https://bitbucket.org/blockstorage/repertory-ui/raw/' +
|
||||||
|
REPERTORY_UI_BRANCH + '/releases.json';
|
||||||
|
|
||||||
exports.LINUX_DETECT_SCRIPT_URL = 'https://bitbucket.org/blockstorage/repertory/raw/' + REPERTORY_BRANCH + '/detect_linux2.sh';
|
exports.LINUX_DETECT_SCRIPT_URL =
|
||||||
|
'https://bitbucket.org/blockstorage/repertory/raw/' + REPERTORY_BRANCH +
|
||||||
|
'/detect_linux2.sh';
|
||||||
|
|
||||||
exports.LINUX_SELECTABLE_PLATFORMS = [
|
exports.LINUX_SELECTABLE_PLATFORMS = [
|
||||||
'centos7',
|
'centos7',
|
||||||
@@ -50,7 +54,6 @@ exports.DATA_LOCATIONS = {
|
|||||||
exports.PROVIDER_LIST = [
|
exports.PROVIDER_LIST = [
|
||||||
'Sia',
|
'Sia',
|
||||||
'Skynet',
|
'Skynet',
|
||||||
'S3',
|
|
||||||
'ScPrime',
|
'ScPrime',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
13
src/containers/AddMount/AddMount.css
Normal file
13
src/containers/AddMount/AddMount.css
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
.AddRemoteMount {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.AddMountButtons {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.AddMountButton {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
222
src/containers/AddMount/AddMount.js
Normal file
222
src/containers/AddMount/AddMount.js
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Component} from 'react';
|
||||||
|
import './AddMount.css';
|
||||||
|
import {connect} from 'react-redux';
|
||||||
|
import Button from '../../components/UI/Button/Button';
|
||||||
|
import Box from '../../components/UI/Box/Box';
|
||||||
|
import Text from '../../components/UI/Text/Text';
|
||||||
|
import {notifyError} from '../../redux/actions/error_actions';
|
||||||
|
import {addRemoteMount, addS3Mount} from '../../redux/actions/mount_actions';
|
||||||
|
import {createModalConditionally} from '../../utils';
|
||||||
|
|
||||||
|
const mapStateToProps = state => {
|
||||||
|
return {
|
||||||
|
RemoteMounts: state.mounts.RemoteMounts,
|
||||||
|
S3Mounts: state.mounts.S3Mounts,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => {
|
||||||
|
return {
|
||||||
|
addRemoteMount: (hostNameOrIp, port, token) => dispatch(addRemoteMount(hostNameOrIp, port, token)),
|
||||||
|
addS3Mount: (name, accessKey, secretKey, region, bucketName) => dispatch(addS3Mount(name, accessKey, secretKey, region, bucketName)),
|
||||||
|
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const default_state = {
|
||||||
|
AccessKey: '',
|
||||||
|
BucketName: '',
|
||||||
|
DisplayRemote: false,
|
||||||
|
DisplayS3: false,
|
||||||
|
HostNameOrIp: '',
|
||||||
|
Name: '',
|
||||||
|
Port: 20000,
|
||||||
|
Region: 'any',
|
||||||
|
SecretKey: '',
|
||||||
|
Token: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(class extends Component {
|
||||||
|
state = {
|
||||||
|
...default_state,
|
||||||
|
};
|
||||||
|
|
||||||
|
addRemoteMount = () => {
|
||||||
|
if (this.state.HostNameOrIp.length === 0) {
|
||||||
|
this.props.notifyError('Hostname or IP cannot be empty.');
|
||||||
|
} else {
|
||||||
|
const provider = 'Remote' + this.state.HostNameOrIp + ':' + this.state.Port;
|
||||||
|
if (this.props.RemoteMounts.includes(provider)) {
|
||||||
|
this.props.notifyError('Remote host already exists');
|
||||||
|
} else {
|
||||||
|
this.setState({
|
||||||
|
Display: false
|
||||||
|
}, () => {
|
||||||
|
this.props.addRemoteMount(this.state.HostNameOrIp, this.state.Port, this.state.Token);
|
||||||
|
this.setState({
|
||||||
|
...default_state,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
addS3Mount = () => {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
handleAddS3Mount = () => {
|
||||||
|
this.setState({
|
||||||
|
DisplayRemote: false,
|
||||||
|
DisplayS3: true,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
handleAddRemoteMount = () => {
|
||||||
|
this.setState({
|
||||||
|
DisplayRemote: true,
|
||||||
|
DisplayS3: false,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const displayAddRemote = createModalConditionally(this.state.DisplayRemote, (
|
||||||
|
<Box dxDark
|
||||||
|
dxStyle={{width: 'auto', height: 'auto', padding: 'var(--default_spacing)'}}>
|
||||||
|
<h1 style={{textAlign: 'center', paddingBottom: 'var(--default_spacing)'}}>Add Remote
|
||||||
|
Mount</h1>
|
||||||
|
<Text text={'Hostname or IP'}
|
||||||
|
textAlign={'left'}
|
||||||
|
type={'Heading2'}/>
|
||||||
|
<input onChange={e => this.setState({HostNameOrIp: e.target.value.trim()})}
|
||||||
|
className={'ConfigurationItemInput'}
|
||||||
|
type={'text'}
|
||||||
|
value={this.state.HostNameOrIp}/>
|
||||||
|
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||||
|
<Text text={'Port'}
|
||||||
|
textAlign={'left'}
|
||||||
|
type={'Heading2'}/>
|
||||||
|
<input max={65535}
|
||||||
|
min={1025}
|
||||||
|
onChange={e => this.setState({Port: e.target.value})}
|
||||||
|
className={'ConfigurationItemInput'}
|
||||||
|
type={'number'}
|
||||||
|
value={this.state.Port}/>
|
||||||
|
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||||
|
<Text text={'Remote Token'}
|
||||||
|
textAlign={'left'}
|
||||||
|
type={'Heading2'}/>
|
||||||
|
<input onChange={e => this.setState({Token: e.target.value})}
|
||||||
|
className={'ConfigurationItemInput'}
|
||||||
|
type={'text'}
|
||||||
|
value={this.state.Token}/>
|
||||||
|
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||||
|
<table cellSpacing={1}
|
||||||
|
width="100%">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td width="50%">
|
||||||
|
<Button buttonStyles={{width: '100%'}}
|
||||||
|
clicked={() => this.addRemoteMount()}>OK</Button>
|
||||||
|
</td>
|
||||||
|
<td width="50%">
|
||||||
|
<Button buttonStyles={{width: '100%'}}
|
||||||
|
clicked={() => this.setState({DisplayRemote: false})}>Cancel</Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</Box>
|
||||||
|
));
|
||||||
|
|
||||||
|
const displayAddS3 = createModalConditionally(this.state.DisplayS3, (
|
||||||
|
<Box dxDark
|
||||||
|
dxStyle={{width: 'auto', height: 'auto', padding: 'var(--default_spacing)'}}>
|
||||||
|
<h1 style={{textAlign: 'center', paddingBottom: 'var(--default_spacing)'}}>Add S3
|
||||||
|
Mount</h1>
|
||||||
|
<Text text={'Name'}
|
||||||
|
textAlign={'left'}
|
||||||
|
type={'Heading2'}/>
|
||||||
|
<input onChange={e => this.setState({Name: e.target.value.trim()})}
|
||||||
|
className={'ConfigurationItemInput'}
|
||||||
|
style={{width: '100%'}}
|
||||||
|
type={'text'}
|
||||||
|
value={this.state.Name}/>
|
||||||
|
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||||
|
<Text text={'Bucket Name (optional)'}
|
||||||
|
textAlign={'left'}
|
||||||
|
type={'Heading2'}/>
|
||||||
|
<input onChange={e => this.setState({BucketName: e.target.value})}
|
||||||
|
className={'ConfigurationItemInput'}
|
||||||
|
style={{width: '100%'}}
|
||||||
|
type={'text'}
|
||||||
|
value={this.state.BucketName}/>
|
||||||
|
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||||
|
<Text text={'Region'}
|
||||||
|
textAlign={'left'}
|
||||||
|
type={'Heading2'}/>
|
||||||
|
<input onChange={e => this.setState({Region: e.target.value})}
|
||||||
|
className={'ConfigurationItemInput'}
|
||||||
|
type={'text'}
|
||||||
|
value={this.state.Region}/>
|
||||||
|
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||||
|
|
||||||
|
<div style={{display: 'flex', flexDirection: 'row'}}>
|
||||||
|
<Text text={'Access Key'}
|
||||||
|
textAlign={'left'}
|
||||||
|
type={'Heading2'}/>
|
||||||
|
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
|
||||||
|
<Text text={'Secret Key'}
|
||||||
|
textAlign={'left'}
|
||||||
|
type={'Heading2'}/>
|
||||||
|
</div>
|
||||||
|
<div style={{display: 'flex', flexDirection: 'row'}}>
|
||||||
|
<input onChange={e => this.setState({AccessKey: e.target.value})}
|
||||||
|
className={'ConfigurationItemInput'}
|
||||||
|
type={'text'}
|
||||||
|
value={this.state.AccessKey}/>
|
||||||
|
<div style={{paddingLeft: 'var(--default_spacing)'}}/>
|
||||||
|
<input onChange={e => this.setState({SecretKey: e.target.value})}
|
||||||
|
className={'ConfigurationItemInput'}
|
||||||
|
type={'text'}
|
||||||
|
value={this.state.SecretKey}/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||||
|
<table cellSpacing={1}
|
||||||
|
width="100%">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td width="50%">
|
||||||
|
<Button buttonStyles={{width: '100%'}}
|
||||||
|
clicked={() => this.addS3Mount()}>OK</Button>
|
||||||
|
</td>
|
||||||
|
<td width="50%">
|
||||||
|
<Button buttonStyles={{width: '100%'}}
|
||||||
|
clicked={() => this.setState({DisplayS3: false})}>Cancel</Button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</Box>
|
||||||
|
));
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={'AddMount'}>
|
||||||
|
{displayAddRemote}
|
||||||
|
{displayAddS3}
|
||||||
|
<div className={'AddMountButtons'}>
|
||||||
|
{this.props.remoteSupported ?
|
||||||
|
<Button className={'AddMountButton'}
|
||||||
|
clicked={this.handleAddRemoteMount}>Add Remote Mount</Button> : null}
|
||||||
|
{this.props.remoteSupported && this.props.s3Supported ?
|
||||||
|
<div style={{paddingRight: 'var(--default_spacing)'}}/> : null}
|
||||||
|
{this.props.s3Supported ?
|
||||||
|
<Button className={'AddMountButton'}
|
||||||
|
clicked={this.handleAddS3Mount}>Add S3 Mount</Button> : null}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
.AddRemoteMount {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import {Component} from 'react';
|
|
||||||
import './AddRemoteMount.css';
|
|
||||||
import {connect} from 'react-redux';
|
|
||||||
import Button from '../../components/UI/Button/Button';
|
|
||||||
import Box from '../../components/UI/Box/Box';
|
|
||||||
import Text from '../../components/UI/Text/Text';
|
|
||||||
import {notifyError} from '../../redux/actions/error_actions';
|
|
||||||
import {addRemoteMount} from '../../redux/actions/mount_actions';
|
|
||||||
import {createModalConditionally} from '../../utils';
|
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
|
||||||
return {
|
|
||||||
RemoteMounts: state.mounts.RemoteMounts,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
|
||||||
return {
|
|
||||||
addRemoteMount: (hostNameOrIp, port, token) => dispatch(addRemoteMount(hostNameOrIp, port, token)),
|
|
||||||
notifyError: (msg, critical, callback) => dispatch(notifyError(msg, critical, callback)),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(class extends Component {
|
|
||||||
state = {
|
|
||||||
Display: false,
|
|
||||||
HostNameOrIp: '',
|
|
||||||
Port: 20000,
|
|
||||||
Token: '',
|
|
||||||
};
|
|
||||||
|
|
||||||
addRemoteMount = () => {
|
|
||||||
if (this.state.HostNameOrIp.length === 0) {
|
|
||||||
this.props.notifyError('Hostname or IP cannot be empty.');
|
|
||||||
} else {
|
|
||||||
const provider = 'Remote' + this.state.HostNameOrIp + ':' + this.state.Port;
|
|
||||||
if (this.props.RemoteMounts.includes(provider)) {
|
|
||||||
this.props.notifyError('Remote host already exists');
|
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
Display: false
|
|
||||||
}, () => {
|
|
||||||
this.props.addRemoteMount(this.state.HostNameOrIp, this.state.Port, this.state.Token);
|
|
||||||
this.setState({
|
|
||||||
HostNameOrIp: '',
|
|
||||||
Port: 20000,
|
|
||||||
Token: '',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
handleAddRemoteMount = () => {
|
|
||||||
this.setState({
|
|
||||||
Display: true,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const displayAdd = createModalConditionally(this.state.Display, (
|
|
||||||
<Box dxDark
|
|
||||||
dxStyle={{width: 'auto', height: 'auto', padding: 'var(--default_spacing)'}}>
|
|
||||||
<h1 style={{textAlign: 'center', paddingBottom: 'var(--default_spacing)'}}>Add Remote Mount</h1>
|
|
||||||
<Text text={'Hostname or IP'}
|
|
||||||
textAlign={'left'}
|
|
||||||
type={'Heading2'}/>
|
|
||||||
<input onChange={e => this.setState({HostNameOrIp: e.target.value.trim()})}
|
|
||||||
className={'ConfigurationItemInput'}
|
|
||||||
type={'text'}
|
|
||||||
value={this.state.HostNameOrIp}/>
|
|
||||||
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
|
||||||
<Text text={'Port'}
|
|
||||||
textAlign={'left'}
|
|
||||||
type={'Heading2'}/>
|
|
||||||
<input max={65535}
|
|
||||||
min={1025}
|
|
||||||
onChange={e => this.setState({Port: e.target.value})}
|
|
||||||
className={'ConfigurationItemInput'}
|
|
||||||
type={'number'}
|
|
||||||
value={this.state.Port}/>
|
|
||||||
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
|
||||||
<Text text={'Remote Token'}
|
|
||||||
textAlign={'left'}
|
|
||||||
type={'Heading2'}/>
|
|
||||||
<input onChange={e => this.setState({Token: e.target.value})}
|
|
||||||
className={'ConfigurationItemInput'}
|
|
||||||
type={'text'}
|
|
||||||
value={this.state.Token}/>
|
|
||||||
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
|
||||||
<table cellSpacing={1}
|
|
||||||
width="100%">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td width="50%">
|
|
||||||
<Button buttonStyles={{width: '100%'}}
|
|
||||||
clicked={() => this.addRemoteMount()}>OK</Button>
|
|
||||||
</td>
|
|
||||||
<td width="50%">
|
|
||||||
<Button buttonStyles={{width: '100%'}}
|
|
||||||
clicked={() => this.setState({Display: false})}>Cancel</Button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</Box>
|
|
||||||
));
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={'AddRemoteMount'}>
|
|
||||||
{displayAdd}
|
|
||||||
<Button clicked={this.handleAddRemoteMount}>Add Remote Mount</Button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -82,6 +82,7 @@ class Configuration extends IPCContainer {
|
|||||||
this.sendRequest(Constants.IPC_Get_Config_Template, {
|
this.sendRequest(Constants.IPC_Get_Config_Template, {
|
||||||
Provider: this.props.DisplayConfiguration,
|
Provider: this.props.DisplayConfiguration,
|
||||||
Remote: this.props.DisplayRemoteConfiguration,
|
Remote: this.props.DisplayRemoteConfiguration,
|
||||||
|
S3: this.props.DisplayS3Configuration,
|
||||||
Version: this.props.version,
|
Version: this.props.version,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -96,7 +97,7 @@ class Configuration extends IPCContainer {
|
|||||||
const itemList = Object
|
const itemList = Object
|
||||||
.keys(config)
|
.keys(config)
|
||||||
.map(key => {
|
.map(key => {
|
||||||
const ret = {
|
return {
|
||||||
advanced: template[key] ? template[key].advanced : false,
|
advanced: template[key] ? template[key].advanced : false,
|
||||||
hide_remote: template[key] ? template[key].hide_remote : false,
|
hide_remote: template[key] ? template[key].hide_remote : false,
|
||||||
label: key,
|
label: key,
|
||||||
@@ -108,7 +109,6 @@ class Configuration extends IPCContainer {
|
|||||||
config[key] :
|
config[key] :
|
||||||
config[key].toString(),
|
config[key].toString(),
|
||||||
};
|
};
|
||||||
return ret;
|
|
||||||
})
|
})
|
||||||
.filter(i=> {
|
.filter(i=> {
|
||||||
let ret = template[i.label];
|
let ret = template[i.label];
|
||||||
@@ -193,6 +193,7 @@ class Configuration extends IPCContainer {
|
|||||||
this.sendRequest(Constants.IPC_Get_Config, {
|
this.sendRequest(Constants.IPC_Get_Config, {
|
||||||
Provider: this.props.DisplayConfiguration,
|
Provider: this.props.DisplayConfiguration,
|
||||||
Remote: this.props.DisplayRemoteConfiguration,
|
Remote: this.props.DisplayRemoteConfiguration,
|
||||||
|
S3: this.props.DisplayS3Configuration,
|
||||||
Version: this.props.version,
|
Version: this.props.version,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -240,6 +241,7 @@ class Configuration extends IPCContainer {
|
|||||||
Items: changedItems,
|
Items: changedItems,
|
||||||
Provider: this.props.DisplayConfiguration,
|
Provider: this.props.DisplayConfiguration,
|
||||||
Remote: this.props.DisplayRemoteConfiguration,
|
Remote: this.props.DisplayRemoteConfiguration,
|
||||||
|
S3: this.props.DisplayS3Configuration,
|
||||||
Version: this.props.version,
|
Version: this.props.version,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -361,6 +363,7 @@ const mapStateToProps = state => {
|
|||||||
return {
|
return {
|
||||||
DisplayConfiguration: state.mounts.DisplayConfiguration,
|
DisplayConfiguration: state.mounts.DisplayConfiguration,
|
||||||
DisplayRemoteConfiguration: state.mounts.DisplayRemoteConfiguration,
|
DisplayRemoteConfiguration: state.mounts.DisplayRemoteConfiguration,
|
||||||
|
DisplayS3Configuration: state.mounts.DisplayS3Configuration,
|
||||||
Platform: state.common.Platform,
|
Platform: state.common.Platform,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
displayConfiguration: (provider, remote) => dispatch(displayConfiguration(provider, remote)),
|
displayConfiguration: (provider, remote, s3) => dispatch(displayConfiguration(provider, remote, s3)),
|
||||||
displaySkynetExport: display => dispatch(displaySkynetExport(display)),
|
displaySkynetExport: display => dispatch(displaySkynetExport(display)),
|
||||||
displaySkynetImport: display => dispatch(displaySkynetImport(display)),
|
displaySkynetImport: display => dispatch(displaySkynetImport(display)),
|
||||||
removeRemoteMount: provider => dispatch(removeRemoteMount(provider)),
|
removeRemoteMount: provider => dispatch(removeRemoteMount(provider)),
|
||||||
@@ -63,7 +63,9 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
|||||||
rowSpan={6}>
|
rowSpan={6}>
|
||||||
<img alt=''
|
<img alt=''
|
||||||
height={'16px'}
|
height={'16px'}
|
||||||
onClick={props.MState.AllowMount ? ()=>props.displayConfiguration(props.provider, props.remote) : e=>{e.preventDefault();}}
|
onClick={props.MState.AllowMount ? () => props.displayConfiguration(props.provider, props.remote, props.s3) : e => {
|
||||||
|
e.preventDefault();
|
||||||
|
}}
|
||||||
src={configureImage}
|
src={configureImage}
|
||||||
style={{padding: 0, border: 0, margin: 0, ...pointer}}
|
style={{padding: 0, border: 0, margin: 0, ...pointer}}
|
||||||
width={'16px'}/>
|
width={'16px'}/>
|
||||||
@@ -120,12 +122,13 @@ export default connect(mapStateToProps, mapDispatchToProps)(props => {
|
|||||||
width={19}/>;
|
width={19}/>;
|
||||||
|
|
||||||
const actionsDisplay = (
|
const actionsDisplay = (
|
||||||
<Button clicked={()=>props.clicked(props.provider, props.remote, !props.MState.Mounted, props.PState.MountLocation)}
|
<Button
|
||||||
col={inputColumnSpan + 2}
|
clicked={() => props.clicked(props.provider, props.remote, props.s3, !props.MState.Mounted, props.PState.MountLocation)}
|
||||||
colSpan={21}
|
col={inputColumnSpan + 2}
|
||||||
disabled={!props.MState.AllowMount}
|
colSpan={21}
|
||||||
row={secondRow}
|
disabled={!props.MState.AllowMount}
|
||||||
rowSpan={7}>
|
row={secondRow}
|
||||||
|
rowSpan={7}>
|
||||||
{buttonDisplay}
|
{buttonDisplay}
|
||||||
</Button>);
|
</Button>);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import AddRemoteMount from '../AddRemoteMount/AddRemoteMount';
|
import AddMount from '../AddMount/AddMount';
|
||||||
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';
|
||||||
@@ -94,7 +94,7 @@ class MountItems extends IPCContainer {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
displayRetryMount = (provider, remote, mountLocation, msg) => {
|
displayRetryMount = (provider, remote, s3, mountLocation, msg) => {
|
||||||
if (!this.state.RetryItems[provider]) {
|
if (!this.state.RetryItems[provider]) {
|
||||||
let retryItems = {
|
let retryItems = {
|
||||||
...this.state.RetryItems
|
...this.state.RetryItems
|
||||||
@@ -121,7 +121,7 @@ class MountItems extends IPCContainer {
|
|||||||
const retrySeconds = retryItems[provider].RetrySeconds - 1;
|
const retrySeconds = retryItems[provider].RetrySeconds - 1;
|
||||||
if (retrySeconds === 0) {
|
if (retrySeconds === 0) {
|
||||||
this.cancelRetryMount(provider, () => {
|
this.cancelRetryMount(provider, () => {
|
||||||
this.handleMountUnMount(provider, remote,true, mountLocation);
|
this.handleMountUnMount(provider, remote, s3, true, mountLocation);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
retryItems[provider].RetrySeconds = retrySeconds;
|
retryItems[provider].RetrySeconds = retrySeconds;
|
||||||
@@ -152,17 +152,18 @@ class MountItems extends IPCContainer {
|
|||||||
this.props.setProviderState(provider, state);
|
this.props.setProviderState(provider, state);
|
||||||
};
|
};
|
||||||
|
|
||||||
handleMountUnMount = (provider, remote, mount, location) => {
|
handleMountUnMount = (provider, remote, s3, mount, location) => {
|
||||||
if (!location || (location.trim().length === 0)) {
|
if (!location || (location.trim().length === 0)) {
|
||||||
this.props.notifyError('Mount location is not set');
|
this.props.notifyError('Mount location is not set');
|
||||||
} else {
|
} else {
|
||||||
let allowAction = true;
|
let allowAction = true;
|
||||||
if (mount) {
|
if (mount) {
|
||||||
let result = remote || provider === 'S3' || provider === 'Skynet' ?
|
let result = remote || s3 || provider === 'Skynet' ?
|
||||||
{Valid: true, Success: true} :
|
{Valid: true, Success: true} :
|
||||||
this.sendSyncRequest(Constants.IPC_Check_Daemon_Version, {
|
this.sendSyncRequest(Constants.IPC_Check_Daemon_Version, {
|
||||||
Provider: provider,
|
Provider: provider,
|
||||||
Remote: remote,
|
Remote: remote,
|
||||||
|
S3: s3,
|
||||||
Version: this.props.InstalledVersion
|
Version: this.props.InstalledVersion
|
||||||
}).data;
|
}).data;
|
||||||
if (result.Success) {
|
if (result.Success) {
|
||||||
@@ -179,11 +180,11 @@ class MountItems extends IPCContainer {
|
|||||||
} else {
|
} else {
|
||||||
allowAction = false;
|
allowAction = false;
|
||||||
if ((result.Code === new Uint32Array([-1])[0]) || (result.Code === new Uint8Array([-1])[0])) {
|
if ((result.Code === new Uint32Array([-1])[0]) || (result.Code === new Uint8Array([-1])[0])) {
|
||||||
this.displayRetryMount(provider, remote, location, 'Failed to connect to ' + provider + ' daemon');
|
this.displayRetryMount(provider, remote, s3, location, 'Failed to connect to ' + provider + ' daemon');
|
||||||
} else if ((result.Code === new Uint32Array([-3])[0]) || (result.Code === new Uint8Array([-3])[0])) {
|
} else if ((result.Code === new Uint32Array([-3])[0]) || (result.Code === new Uint8Array([-3])[0])) {
|
||||||
this.displayRetryMount(provider, remote, location, 'Incompatible ' + provider + ' daemon. Please upgrade ' + provider + '.');
|
this.displayRetryMount(provider, remote, s3, location, 'Incompatible ' + provider + ' daemon. Please upgrade ' + provider + '.');
|
||||||
} else {
|
} else {
|
||||||
this.displayRetryMount(provider, remote, location, 'Version check failed: ' + result.Error);
|
this.displayRetryMount(provider, remote, s3, location, 'Version check failed: ' + result.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -191,7 +192,7 @@ class MountItems extends IPCContainer {
|
|||||||
if (this.props.Platform === 'win32') {
|
if (this.props.Platform === 'win32') {
|
||||||
this.props.notifyError('Failed to launch repertory. Please install Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019.');
|
this.props.notifyError('Failed to launch repertory. Please install Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019.');
|
||||||
} else {
|
} else {
|
||||||
this.displayRetryMount(provider, remote, location, 'Version check failed: ' + result.Error);
|
this.displayRetryMount(provider, remote, s3, location, 'Version check failed: ' + result.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,6 +206,7 @@ class MountItems extends IPCContainer {
|
|||||||
Location: location,
|
Location: location,
|
||||||
Provider: provider,
|
Provider: provider,
|
||||||
Remote: remote,
|
Remote: remote,
|
||||||
|
S3: s3,
|
||||||
Version: this.props.InstalledVersion,
|
Version: this.props.InstalledVersion,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -212,6 +214,7 @@ class MountItems extends IPCContainer {
|
|||||||
Location: location,
|
Location: location,
|
||||||
Provider: provider,
|
Provider: provider,
|
||||||
Remote: remote,
|
Remote: remote,
|
||||||
|
S3: s3,
|
||||||
Version: this.props.InstalledVersion,
|
Version: this.props.InstalledVersion,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -221,8 +224,7 @@ class MountItems extends IPCContainer {
|
|||||||
|
|
||||||
getProviderList = providersOnly => {
|
getProviderList = providersOnly => {
|
||||||
const providerList = Constants.PROVIDER_LIST.filter(i => {
|
const providerList = Constants.PROVIDER_LIST.filter(i => {
|
||||||
return ((i === 'S3') && this.props.s3Supported) ||
|
return ((i === 'Skynet') && this.props.skynetSupported) ||
|
||||||
((i === 'Skynet') && this.props.skynetSupported) ||
|
|
||||||
((i === 'ScPrime') && this.props.scPrimeSupported) ||
|
((i === 'ScPrime') && this.props.scPrimeSupported) ||
|
||||||
((i === 'Sia') && this.props.siaSupported);
|
((i === 'Sia') && this.props.siaSupported);
|
||||||
});
|
});
|
||||||
@@ -232,9 +234,15 @@ class MountItems extends IPCContainer {
|
|||||||
remoteList = [...this.props.RemoteMounts];
|
remoteList = [...this.props.RemoteMounts];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let s3List = [];
|
||||||
|
if (this.props.s3Supported && !providersOnly) {
|
||||||
|
s3List = [...this.props.S3Mounts];
|
||||||
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...providerList,
|
...providerList,
|
||||||
...remoteList,
|
...remoteList,
|
||||||
|
...s3List,
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -337,7 +345,11 @@ class MountItems extends IPCContainer {
|
|||||||
retryDisplay = (
|
retryDisplay = (
|
||||||
<Modal>
|
<Modal>
|
||||||
<Box dxDark dxStyle={{padding: 'var(--default_spacing)', minWidth: '70vw'}}>
|
<Box dxDark dxStyle={{padding: 'var(--default_spacing)', minWidth: '70vw'}}>
|
||||||
<h1 style={{textAlign: 'center', paddingBottom: 'var(--default_spacing)', color: 'var(--text_color_error)'}}>Mount Failed</h1>
|
<h1 style={{
|
||||||
|
textAlign: 'center',
|
||||||
|
paddingBottom: 'var(--default_spacing)',
|
||||||
|
color: 'var(--text_color_error)'
|
||||||
|
}}>Mount Failed</h1>
|
||||||
{retryList}
|
{retryList}
|
||||||
</Box>
|
</Box>
|
||||||
</Modal>
|
</Modal>
|
||||||
@@ -345,8 +357,10 @@ class MountItems extends IPCContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let footerItems = [];
|
let footerItems = [];
|
||||||
if (this.props.remoteSupported) {
|
if (this.props.remoteSupported || this.props.s3Supported) {
|
||||||
footerItems.push(<AddRemoteMount key={'hi_' + footerItems.length}/>);
|
footerItems.push(<AddMount remoteSupported={this.props.remoteSupported}
|
||||||
|
s3Supported={this.props.s3Supported}
|
||||||
|
key={'hi_' + footerItems.length}/>);
|
||||||
} else {
|
} else {
|
||||||
footerItems.push(<div key={'hi_' + footerItems.length}
|
footerItems.push(<div key={'hi_' + footerItems.length}
|
||||||
style={{height: '27px'}}/>);
|
style={{height: '27px'}}/>);
|
||||||
@@ -380,15 +394,31 @@ class MountItems extends IPCContainer {
|
|||||||
items.push(<div key={'it_' + items.length}
|
items.push(<div key={'it_' + items.length}
|
||||||
style={{paddingTop: 'var(--default_spacing)'}}/>)
|
style={{paddingTop: 'var(--default_spacing)'}}/>)
|
||||||
}
|
}
|
||||||
items.splice(items.length - 1, 1);
|
|
||||||
} else {
|
|
||||||
items.splice(items.length - 1, 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.props.s3Supported) {
|
||||||
|
for (const provider of this.props.S3Mounts) {
|
||||||
|
items.push((
|
||||||
|
<MountItem allowRemove={true}
|
||||||
|
browseClicked={this.handleBrowseLocation}
|
||||||
|
changed={e => this.handleMountLocationChanged(provider, e.target.value)}
|
||||||
|
clicked={this.handleMountUnMount}
|
||||||
|
key={'it_' + items.length}
|
||||||
|
provider={provider}
|
||||||
|
s3/>
|
||||||
|
));
|
||||||
|
items.push(<div key={'it_' + items.length}
|
||||||
|
style={{paddingTop: 'var(--default_spacing)'}}/>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
items.splice(items.length - 1, 1);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{margin: 0, padding: 0}}>
|
<div style={{margin: 0, padding: 0}}>
|
||||||
{retryDisplay}
|
{retryDisplay}
|
||||||
<div className={this.props.remoteSupported ? 'MountItemsRemote' : 'MountItems'}>
|
<div
|
||||||
|
className={this.props.remoteSupported || this.props.s3Supported ? 'MountItemsRemote' : 'MountItems'}>
|
||||||
{items}
|
{items}
|
||||||
</div>
|
</div>
|
||||||
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||||
@@ -406,6 +436,7 @@ const mapStateToProps = state => {
|
|||||||
Platform: state.common.Platform,
|
Platform: state.common.Platform,
|
||||||
ProviderState: state.mounts.ProviderState,
|
ProviderState: state.mounts.ProviderState,
|
||||||
RemoteMounts: state.mounts.RemoteMounts,
|
RemoteMounts: state.mounts.RemoteMounts,
|
||||||
|
S3Mounts: state.mounts.S3Mounts,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -213,10 +213,14 @@ const _getDataDirectory = () => {
|
|||||||
return _resolvePath(Constants.DATA_LOCATIONS[os.platform()]);
|
return _resolvePath(Constants.DATA_LOCATIONS[os.platform()]);
|
||||||
};
|
};
|
||||||
|
|
||||||
const _getDefaultRepertoryArgs = (provider, remote) => {
|
const _getDefaultRepertoryArgs = (provider, remote, s3) => {
|
||||||
const providerLower = provider.toLowerCase();
|
const providerLower = provider.toLowerCase();
|
||||||
const args = [];
|
const args = [];
|
||||||
if (remote) {
|
if (s3) {
|
||||||
|
args.push('-s3');
|
||||||
|
args.push('-na');
|
||||||
|
args.push(provider.substr(2));
|
||||||
|
} else if (remote) {
|
||||||
args.push('-rm');
|
args.push('-rm');
|
||||||
args.push(provider.substr(6));
|
args.push(provider.substr(6));
|
||||||
} else if (Constants.PROVIDER_ARG[providerLower] && (Constants.PROVIDER_ARG[providerLower].length > 0)) {
|
} else if (Constants.PROVIDER_ARG[providerLower] && (Constants.PROVIDER_ARG[providerLower].length > 0)) {
|
||||||
@@ -276,7 +280,7 @@ module.exports.checkDaemonVersion = (version, provider) => {
|
|||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, false);
|
const args = _getDefaultRepertoryArgs(provider);
|
||||||
args.push('-cv');
|
args.push('-cv');
|
||||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||||
|
|
||||||
@@ -368,7 +372,9 @@ module.exports.detectRepertoryMounts = (version, providerList) => {
|
|||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, !Constants.PROVIDER_LIST.includes(provider));
|
const args = _getDefaultRepertoryArgs(provider,
|
||||||
|
!Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('remote'),
|
||||||
|
!Constants.PROVIDER_LIST.includes(provider) && provider.toLowerCase().startsWith('s3'));
|
||||||
args.push('-status');
|
args.push('-status');
|
||||||
|
|
||||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||||
@@ -560,7 +566,7 @@ module.exports.executeScript = script => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.executeMount = (version, provider, remote, location, exitCallback) => {
|
module.exports.executeMount = (version, provider, remote, s3, location, exitCallback) => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const repertoryExec = _getRepertoryExec(version);
|
const repertoryExec = _getRepertoryExec(version);
|
||||||
const processOptions = {
|
const processOptions = {
|
||||||
@@ -570,7 +576,7 @@ module.exports.executeMount = (version, provider, remote, location, exitCallback
|
|||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, remote);
|
const args = _getDefaultRepertoryArgs(provider, remote, s3);
|
||||||
|
|
||||||
if ((os.platform() === 'linux') || (os.platform() === 'darwin')) {
|
if ((os.platform() === 'linux') || (os.platform() === 'darwin')) {
|
||||||
args.push('-o');
|
args.push('-o');
|
||||||
@@ -645,7 +651,7 @@ module.exports.exportSkylinks = (version, paths) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getConfig = (version, provider, remote) => {
|
module.exports.getConfig = (version, provider, remote, s3) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const repertoryExec = _getRepertoryExec(version);
|
const repertoryExec = _getRepertoryExec(version);
|
||||||
const processOptions = {
|
const processOptions = {
|
||||||
@@ -655,7 +661,7 @@ module.exports.getConfig = (version, provider, remote) => {
|
|||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, remote);
|
const args = _getDefaultRepertoryArgs(provider, remote, s3);
|
||||||
args.push('-dc');
|
args.push('-dc');
|
||||||
|
|
||||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||||
@@ -689,7 +695,7 @@ module.exports.getConfig = (version, provider, remote) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.getConfigTemplate = (version, provider, remote) => {
|
module.exports.getConfigTemplate = (version, provider, remote, s3) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const repertoryExec = _getRepertoryExec(version);
|
const repertoryExec = _getRepertoryExec(version);
|
||||||
const processOptions = {
|
const processOptions = {
|
||||||
@@ -699,7 +705,7 @@ module.exports.getConfigTemplate = (version, provider, remote) => {
|
|||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, remote);
|
const args = _getDefaultRepertoryArgs(provider, remote, s3);
|
||||||
args.push('-gt');
|
args.push('-gt');
|
||||||
|
|
||||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||||
@@ -969,7 +975,7 @@ module.exports.removeDirectoryRecursively = _removeDirectoryRecursively;
|
|||||||
|
|
||||||
module.exports.resolvePath = _resolvePath;
|
module.exports.resolvePath = _resolvePath;
|
||||||
|
|
||||||
module.exports.setConfigValue = (name, value, provider, remote, version) => {
|
module.exports.setConfigValue = (name, value, provider, remote, s3, version) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const repertoryExec = _getRepertoryExec(version);
|
const repertoryExec = _getRepertoryExec(version);
|
||||||
const processOptions = {
|
const processOptions = {
|
||||||
@@ -979,7 +985,7 @@ module.exports.setConfigValue = (name, value, provider, remote, version) => {
|
|||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, remote);
|
const args = _getDefaultRepertoryArgs(provider, remote, s3);
|
||||||
args.push('-set');
|
args.push('-set');
|
||||||
args.push(name);
|
args.push(name);
|
||||||
args.push(value);
|
args.push(value);
|
||||||
@@ -998,7 +1004,7 @@ module.exports.setConfigValue = (name, value, provider, remote, version) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.stopMountProcess = (version, provider, remote) => {
|
module.exports.stopMountProcess = (version, provider, remote, s3) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const repertoryExec = _getRepertoryExec(version);
|
const repertoryExec = _getRepertoryExec(version);
|
||||||
const processOptions = {
|
const processOptions = {
|
||||||
@@ -1008,7 +1014,7 @@ module.exports.stopMountProcess = (version, provider, remote) => {
|
|||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, remote);
|
const args = _getDefaultRepertoryArgs(provider, remote, s3);
|
||||||
args.push('-unmount');
|
args.push('-unmount');
|
||||||
|
|
||||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||||
@@ -1029,7 +1035,7 @@ module.exports.stopMountProcess = (version, provider, remote) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports.stopMountProcessSync = (version, provider, remote) => {
|
module.exports.stopMountProcessSync = (version, provider, remote, s3) => {
|
||||||
const repertoryExec = _getRepertoryExec(version);
|
const repertoryExec = _getRepertoryExec(version);
|
||||||
const processOptions = {
|
const processOptions = {
|
||||||
cwd: repertoryExec.working,
|
cwd: repertoryExec.working,
|
||||||
@@ -1038,7 +1044,7 @@ module.exports.stopMountProcessSync = (version, provider, remote) => {
|
|||||||
windowsHide: true,
|
windowsHide: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const args = _getDefaultRepertoryArgs(provider, remote);
|
const args = _getDefaultRepertoryArgs(provider, remote, s3);
|
||||||
args.push('-unmount');
|
args.push('-unmount');
|
||||||
|
|
||||||
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
const process = new spawn(repertoryExec.cmd, args, processOptions);
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import * as Constants from '../../constants';
|
|
||||||
import {createAction} from '@reduxjs/toolkit';
|
import {createAction} from '@reduxjs/toolkit';
|
||||||
|
|
||||||
|
import * as Constants from '../../constants';
|
||||||
import {getIPCRenderer} from '../../utils';
|
import {getIPCRenderer} from '../../utils';
|
||||||
import {
|
|
||||||
confirmYesNo,
|
import {confirmYesNo, saveState} from './common_actions';
|
||||||
saveState
|
|
||||||
} from './common_actions';
|
|
||||||
import {notifyError} from './error_actions';
|
import {notifyError} from './error_actions';
|
||||||
|
|
||||||
export const addRemoteMount = (hostNameOrIp, port, token) => {
|
export const addRemoteMount = (hostNameOrIp, port, token) => {
|
||||||
@@ -23,7 +22,8 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
|
|||||||
Version: getState().relver.InstalledVersion,
|
Version: getState().relver.InstalledVersion,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
dispatch(notifyError('Failed to set \'RemoteToken\': ' + arg.data.Error));
|
dispatch(
|
||||||
|
notifyError('Failed to set \'RemoteToken\': ' + arg.data.Error));
|
||||||
dispatch(setBusy(false));
|
dispatch(setBusy(false));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -42,15 +42,53 @@ export const addRemoteMount = (hostNameOrIp, port, token) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const addS3Mount = (name, accessKey, secretKey, region, bucketName) => {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
const ipcRenderer = getIPCRenderer();
|
||||||
|
|
||||||
|
const provider = 'S3' + name;
|
||||||
|
dispatch(addS3Mount2(provider));
|
||||||
|
dispatch(setBusy(true));
|
||||||
|
|
||||||
|
ipcRenderer.once(Constants.IPC_Set_Config_Values_Reply, (_, arg) => {
|
||||||
|
if (arg.data.Success) {
|
||||||
|
ipcRenderer.send(Constants.IPC_Detect_Mount, {
|
||||||
|
Provider: provider,
|
||||||
|
S3Mounts: getState().mounts.S3Mounts,
|
||||||
|
Version: getState().relver.InstalledVersion,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
dispatch(
|
||||||
|
notifyError('Failed to create S3 instance: ' + arg.data.Error));
|
||||||
|
dispatch(setBusy(false));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.send(Constants.IPC_Set_Config_Values, {
|
||||||
|
Items: [
|
||||||
|
{Name: 'S3Config.AccessKey', Value: accessKey},
|
||||||
|
{Name: 'S3Config.SecretKey', Value: secretKey},
|
||||||
|
{Name: 'S3Config.Region', Value: region},
|
||||||
|
{Name: 'S3Config.BucketName', Value: bucketName},
|
||||||
|
],
|
||||||
|
Provider: provider,
|
||||||
|
S3: true,
|
||||||
|
Version: getState().relver.InstalledVersion,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export const addRemoteMount2 = createAction('mounts/addRemoteMount2');
|
export const addRemoteMount2 = createAction('mounts/addRemoteMount2');
|
||||||
|
export const addS3Mount2 = createAction('mounts/addS3Mount2');
|
||||||
|
|
||||||
export const DISPLAY_CONFIGURATION = 'mounts/displayConfiguration';
|
export const DISPLAY_CONFIGURATION = 'mounts/displayConfiguration';
|
||||||
export const displayConfiguration = (provider, remote) => {
|
export const displayConfiguration = (provider, remote, s3) => {
|
||||||
return {
|
return {
|
||||||
type: DISPLAY_CONFIGURATION,
|
type: DISPLAY_CONFIGURATION,
|
||||||
payload: {
|
payload: {
|
||||||
provider,
|
provider,
|
||||||
remote,
|
remote,
|
||||||
|
s3,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -58,11 +96,11 @@ export const displayConfiguration = (provider, remote) => {
|
|||||||
export const removeRemoteMount = provider => {
|
export const removeRemoteMount = provider => {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
dispatch(confirmYesNo('Delete [' + provider.substr(6) + ']?'))
|
dispatch(confirmYesNo('Delete [' + provider.substr(6) + ']?'))
|
||||||
.then(confirmed => {
|
.then(confirmed => {
|
||||||
if (confirmed) {
|
if (confirmed) {
|
||||||
dispatch(removeRemoteMount2(provider));
|
dispatch(removeRemoteMount2(provider));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,67 +121,40 @@ export const removeRemoteMount3 = createAction('mounts/removeRemoteMount3');
|
|||||||
|
|
||||||
export const RESET_MOUNTS_STATE = 'mounts/resetMountsState';
|
export const RESET_MOUNTS_STATE = 'mounts/resetMountsState';
|
||||||
export const resetMountsState = () => {
|
export const resetMountsState = () => {
|
||||||
return {
|
return {type: RESET_MOUNTS_STATE, payload: null,}
|
||||||
type: RESET_MOUNTS_STATE,
|
|
||||||
payload: null,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const SET_ALLOW_MOUNT = 'mounts/setAllowMount';
|
export const SET_ALLOW_MOUNT = 'mounts/setAllowMount';
|
||||||
export const setAllowMount = (provider, allow) => {
|
export const setAllowMount =
|
||||||
return {
|
(provider,
|
||||||
type: SET_ALLOW_MOUNT,
|
allow) => {
|
||||||
payload: {
|
return {type: SET_ALLOW_MOUNT, payload: {provider, allow}};
|
||||||
provider,
|
|
||||||
allow
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
export const SET_AUTO_MOUNT_PROCESSED = 'mounts/setAutoMountProcessed';
|
export const SET_AUTO_MOUNT_PROCESSED = 'mounts/setAutoMountProcessed';
|
||||||
export const setAutoMountProcessed = (provider, processed) => {
|
export const setAutoMountProcessed = (provider, processed) => {
|
||||||
return {
|
return {type: SET_AUTO_MOUNT_PROCESSED, payload: {provider, processed}};
|
||||||
type: SET_AUTO_MOUNT_PROCESSED,
|
|
||||||
payload: {
|
|
||||||
provider,
|
|
||||||
processed
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setBusy = createAction('mounts/setBusy');
|
export const setBusy = createAction('mounts/setBusy');
|
||||||
|
|
||||||
export const SET_MOUNT_STATE = 'mounts/setMountState';
|
export const SET_MOUNT_STATE = 'mounts/setMountState';
|
||||||
export const setMountState = (provider, state) => {
|
export const setMountState =
|
||||||
return {
|
(provider,
|
||||||
type: SET_MOUNT_STATE,
|
state) => {
|
||||||
payload: {
|
return {type: SET_MOUNT_STATE, payload: {provider, state}};
|
||||||
provider,
|
|
||||||
state
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
export const SET_MOUNTED = 'mounts/setMounted';
|
export const SET_MOUNTED = 'mounts/setMounted';
|
||||||
export const setMounted = (provider, mounted) => {
|
export const setMounted =
|
||||||
return {
|
(provider,
|
||||||
type: SET_MOUNTED,
|
mounted) => {
|
||||||
payload: {
|
return {type: SET_MOUNTED, payload: {provider, mounted}};
|
||||||
provider,
|
|
||||||
mounted
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
export const SET_PROVIDER_STATE = 'mounts/setProviderState';
|
export const SET_PROVIDER_STATE = 'mounts/setProviderState';
|
||||||
export const setProviderState = (provider, state) => {
|
export const setProviderState = (provider, state) => {
|
||||||
return {
|
return {type: SET_PROVIDER_STATE, payload: {provider, state}}
|
||||||
type: SET_PROVIDER_STATE,
|
|
||||||
payload: {
|
|
||||||
provider,
|
|
||||||
state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const unmountAll = completedCallback => {
|
export const unmountAll = completedCallback => {
|
||||||
|
|||||||
@@ -1,24 +1,28 @@
|
|||||||
import * as Constants from '../../constants';
|
|
||||||
import {createReducer} from '@reduxjs/toolkit';
|
import {createReducer} from '@reduxjs/toolkit';
|
||||||
|
|
||||||
|
import * as Constants from '../../constants';
|
||||||
import {
|
import {
|
||||||
addRemoteMount2,
|
addRemoteMount2,
|
||||||
|
addS3Mount2,
|
||||||
DISPLAY_CONFIGURATION,
|
DISPLAY_CONFIGURATION,
|
||||||
removeRemoteMount3,
|
removeRemoteMount3,
|
||||||
RESET_MOUNTS_STATE,
|
RESET_MOUNTS_STATE,
|
||||||
SET_ALLOW_MOUNT,
|
SET_ALLOW_MOUNT,
|
||||||
SET_AUTO_MOUNT_PROCESSED,
|
SET_AUTO_MOUNT_PROCESSED,
|
||||||
setBusy,
|
|
||||||
SET_MOUNT_STATE,
|
SET_MOUNT_STATE,
|
||||||
SET_MOUNTED,
|
SET_MOUNTED,
|
||||||
SET_PROVIDER_STATE
|
SET_PROVIDER_STATE,
|
||||||
|
setBusy
|
||||||
} from '../actions/mount_actions';
|
} from '../actions/mount_actions';
|
||||||
|
|
||||||
export const createMountReducer = state => {
|
export const createMountReducer = state => {
|
||||||
let providerList = [
|
let providerList = [
|
||||||
...Constants.PROVIDER_LIST,
|
...Constants.PROVIDER_LIST,
|
||||||
...(state.RemoteMounts||[]),
|
...(state.RemoteMounts || []),
|
||||||
|
...(state.S3Mounts || []),
|
||||||
];
|
];
|
||||||
const providerState = providerList.map(provider=> {
|
const providerState = providerList
|
||||||
|
.map(provider => {
|
||||||
return {
|
return {
|
||||||
[provider]: {
|
[provider]: {
|
||||||
AutoMount: false,
|
AutoMount: false,
|
||||||
@@ -26,14 +30,13 @@ export const createMountReducer = state => {
|
|||||||
MountLocation: '',
|
MountLocation: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).reduce((map, obj) => {
|
})
|
||||||
return {
|
.reduce((map, obj) => {
|
||||||
...map,
|
return {...map, ...obj}
|
||||||
...obj
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const mountState = providerList.map(provider => {
|
const mountState = providerList
|
||||||
|
.map(provider => {
|
||||||
return {
|
return {
|
||||||
[provider]: {
|
[provider]: {
|
||||||
AllowMount: false,
|
AllowMount: false,
|
||||||
@@ -41,154 +44,172 @@ export const createMountReducer = state => {
|
|||||||
Mounted: false,
|
Mounted: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).reduce((map, obj) => {
|
})
|
||||||
return {
|
.reduce((map, obj) => {
|
||||||
...map,
|
return {...map, ...obj}
|
||||||
...obj
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const autoMountProcessed = providerList.map(provider => {
|
const autoMountProcessed =
|
||||||
return {
|
providerList.map(provider => {
|
||||||
[provider]: false,
|
return {[provider]: false,}
|
||||||
}
|
})
|
||||||
}).reduce((map, obj) => {
|
.reduce((map, obj) => {
|
||||||
return {
|
return {...map, ...obj}
|
||||||
...map,
|
});
|
||||||
...obj
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return createReducer({
|
return createReducer(
|
||||||
AutoMountProcessed: autoMountProcessed,
|
{
|
||||||
DisplayConfiguration: null,
|
AutoMountProcessed: autoMountProcessed,
|
||||||
DisplayRemoteConfiguration: false,
|
DisplayConfiguration: null,
|
||||||
MountsBusy: false,
|
DisplayRemoteConfiguration: false,
|
||||||
MountState: mountState,
|
DisplayS3Configuration: false,
|
||||||
ProviderState: providerState,
|
MountsBusy: false,
|
||||||
RemoteMounts: state.RemoteMounts ? state.RemoteMounts : [],
|
MountState: mountState,
|
||||||
}, {
|
ProviderState: providerState,
|
||||||
[addRemoteMount2]: (state, action) => {
|
RemoteMounts: state.RemoteMounts ? state.RemoteMounts : [],
|
||||||
let mountState = {...state.MountState};
|
S3Mounts: state.S3Mounts ? state.S3Mounts : [],
|
||||||
mountState[action.payload] = {
|
|
||||||
AllowMount: false,
|
|
||||||
DriveLetters: [],
|
|
||||||
Mounted: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
let providerState = {...state.ProviderState};
|
|
||||||
providerState[action.payload] = {
|
|
||||||
AutoMount: false,
|
|
||||||
AutoRestart: false,
|
|
||||||
MountLocation: '',
|
|
||||||
};
|
|
||||||
|
|
||||||
let autoMountProcessed = {...state.AutoMountProcessed};
|
|
||||||
autoMountProcessed[action.payload] = true;
|
|
||||||
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
AutoMountProcessed: autoMountProcessed,
|
|
||||||
MountState: mountState,
|
|
||||||
ProviderState: providerState,
|
|
||||||
RemoteMounts: [...state.RemoteMounts, action.payload],
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[DISPLAY_CONFIGURATION]: (state, action) => {
|
{
|
||||||
return {
|
[addRemoteMount2]: (state, action) => {
|
||||||
...state,
|
let mountState = {...state.MountState};
|
||||||
DisplayConfiguration: action.payload.provider,
|
mountState[action.payload] = {
|
||||||
DisplayRemoteConfiguration: action.payload.remote,
|
AllowMount: false,
|
||||||
};
|
DriveLetters: [],
|
||||||
},
|
Mounted: false,
|
||||||
[removeRemoteMount3]: (state, action) => {
|
};
|
||||||
let mountState = {...state.MountState};
|
|
||||||
delete mountState[action.payload];
|
|
||||||
|
|
||||||
let providerState = {...state.ProviderState};
|
let providerState = {...state.ProviderState};
|
||||||
delete providerState[action.payload];
|
providerState[action.payload] = {
|
||||||
|
AutoMount: false,
|
||||||
|
AutoRestart: false,
|
||||||
|
MountLocation: '',
|
||||||
|
};
|
||||||
|
|
||||||
let autoMountProcessed = {...state.AutoMountProcessed};
|
let autoMountProcessed = {...state.AutoMountProcessed};
|
||||||
delete autoMountProcessed[action.payload];
|
autoMountProcessed[action.payload] = true;
|
||||||
|
|
||||||
const remoteMounts = state.RemoteMounts.filter(i => i !== action.payload);
|
return {
|
||||||
return {
|
...state, AutoMountProcessed: autoMountProcessed,
|
||||||
...state,
|
MountState: mountState, ProviderState: providerState,
|
||||||
AutoMountProcessed: autoMountProcessed,
|
RemoteMounts: [...state.RemoteMounts, action.payload],
|
||||||
MountState: mountState,
|
|
||||||
ProviderState: providerState,
|
|
||||||
RemoteMounts: remoteMounts,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
[RESET_MOUNTS_STATE]: (state, action) => {
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
MountsBusy: false,
|
|
||||||
MountState: mountState,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
[SET_AUTO_MOUNT_PROCESSED]: (state, action) => {
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
AutoMountProcessed: {
|
|
||||||
...state.AutoMountProcessed,
|
|
||||||
[action.payload.provider]: action.payload.processed,
|
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
},
|
[addS3Mount2]: (state, action) => {
|
||||||
[SET_ALLOW_MOUNT]: (state, action) => {
|
let mountState = {...state.MountState};
|
||||||
return {
|
mountState[action.payload] = {
|
||||||
...state,
|
AllowMount: false,
|
||||||
MountState: {
|
DriveLetters: [],
|
||||||
...state.MountState,
|
Mounted: false,
|
||||||
[action.payload.provider]: {
|
};
|
||||||
...state.MountState[action.payload.provider],
|
|
||||||
AllowMount: action.payload.allow,
|
let providerState = {...state.ProviderState};
|
||||||
|
providerState[action.payload] = {
|
||||||
|
AutoMount: false,
|
||||||
|
AutoRestart: false,
|
||||||
|
MountLocation: '',
|
||||||
|
};
|
||||||
|
|
||||||
|
let autoMountProcessed = {...state.AutoMountProcessed};
|
||||||
|
autoMountProcessed[action.payload] = true;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state, AutoMountProcessed: autoMountProcessed,
|
||||||
|
MountState: mountState, ProviderState: providerState,
|
||||||
|
S3Mounts: [...state.S3Mounts, action.payload],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[DISPLAY_CONFIGURATION]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
DisplayConfiguration: action.payload.provider,
|
||||||
|
DisplayRemoteConfiguration: action.payload.remote,
|
||||||
|
DisplayS3Configuration: action.payload.s3,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[removeRemoteMount3]: (state, action) => {
|
||||||
|
let mountState = {...state.MountState};
|
||||||
|
delete mountState[action.payload];
|
||||||
|
|
||||||
|
let providerState = {...state.ProviderState};
|
||||||
|
delete providerState[action.payload];
|
||||||
|
|
||||||
|
let autoMountProcessed = {...state.AutoMountProcessed};
|
||||||
|
delete autoMountProcessed[action.payload];
|
||||||
|
|
||||||
|
const remoteMounts =
|
||||||
|
state.RemoteMounts.filter(i => i !== action.payload);
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
AutoMountProcessed: autoMountProcessed,
|
||||||
|
MountState: mountState,
|
||||||
|
ProviderState: providerState,
|
||||||
|
RemoteMounts: remoteMounts,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[RESET_MOUNTS_STATE]: (state, action) => {
|
||||||
|
return {...state, MountsBusy: false, MountState: mountState,}
|
||||||
|
},
|
||||||
|
[SET_AUTO_MOUNT_PROCESSED]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
AutoMountProcessed: {
|
||||||
|
...state.AutoMountProcessed,
|
||||||
|
[action.payload.provider]: action.payload.processed,
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
},
|
||||||
},
|
[SET_ALLOW_MOUNT]: (state, action) => {
|
||||||
[setBusy]: (state, action) => {
|
return {
|
||||||
return {
|
...state,
|
||||||
...state,
|
MountState: {
|
||||||
MountsBusy: action.payload
|
...state.MountState,
|
||||||
};
|
[action.payload.provider]: {
|
||||||
},
|
...state.MountState[action.payload.provider],
|
||||||
[SET_MOUNT_STATE]: (state, action) => {
|
AllowMount: action.payload.allow,
|
||||||
return {
|
}
|
||||||
...state,
|
|
||||||
MountState: {
|
|
||||||
...state.MountState,
|
|
||||||
[action.payload.provider]: {
|
|
||||||
...state.MountState[action.payload.provider],
|
|
||||||
...action.payload.state
|
|
||||||
},
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
[SET_MOUNTED]: (state, action) => {
|
|
||||||
return {
|
|
||||||
...state,
|
|
||||||
MountState: {
|
|
||||||
...state.MountState,
|
|
||||||
[action.payload.provider]: {
|
|
||||||
...state.MountState[action.payload.provider],
|
|
||||||
Mounted: action.payload.mounted,
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
},
|
||||||
},
|
[setBusy]:
|
||||||
[SET_PROVIDER_STATE]: (state, action) => {
|
(state,
|
||||||
return {
|
action) => {
|
||||||
...state,
|
return {...state, MountsBusy: action.payload};
|
||||||
ProviderState: {
|
},
|
||||||
...state.ProviderState,
|
[SET_MOUNT_STATE]: (state, action) => {
|
||||||
[action.payload.provider]: {
|
return {
|
||||||
...state.ProviderState[action.payload.provider],
|
...state,
|
||||||
...action.payload.state
|
MountState: {
|
||||||
},
|
...state.MountState,
|
||||||
}
|
[action.payload.provider]: {
|
||||||
};
|
...state.MountState[action.payload.provider],
|
||||||
}
|
...action.payload.state
|
||||||
});
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[SET_MOUNTED]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
MountState: {
|
||||||
|
...state.MountState,
|
||||||
|
[action.payload.provider]: {
|
||||||
|
...state.MountState[action.payload.provider],
|
||||||
|
Mounted: action.payload.mounted,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
[SET_PROVIDER_STATE]: (state, action) => {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
ProviderState: {
|
||||||
|
...state.ProviderState,
|
||||||
|
[action.payload.provider]: {
|
||||||
|
...state.ProviderState[action.payload.provider],
|
||||||
|
...action.payload.state
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const helpers = require('../../helpers');
|
|||||||
const addListeners = (ipcMain, {standardIPCReply}) => {
|
const addListeners = (ipcMain, {standardIPCReply}) => {
|
||||||
ipcMain.on(Constants.IPC_Get_Config, (event, data) => {
|
ipcMain.on(Constants.IPC_Get_Config, (event, data) => {
|
||||||
helpers
|
helpers
|
||||||
.getConfig(data.Version, data.Provider, data.Remote)
|
.getConfig(data.Version, data.Provider, data.Remote, data.S3)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data.Code === 0) {
|
if (data.Code === 0) {
|
||||||
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {
|
standardIPCReply(event, Constants.IPC_Get_Config_Reply, {
|
||||||
@@ -21,7 +21,7 @@ const addListeners = (ipcMain, {standardIPCReply}) => {
|
|||||||
|
|
||||||
ipcMain.on(Constants.IPC_Get_Config_Template, (event, data) => {
|
ipcMain.on(Constants.IPC_Get_Config_Template, (event, data) => {
|
||||||
helpers
|
helpers
|
||||||
.getConfigTemplate(data.Version, data.Provider, data.Remote)
|
.getConfigTemplate(data.Version, data.Provider, data.Remote, data.S3)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {
|
standardIPCReply(event, Constants.IPC_Get_Config_Template_Reply, {
|
||||||
Template: data,
|
Template: data,
|
||||||
@@ -36,7 +36,7 @@ const addListeners = (ipcMain, {standardIPCReply}) => {
|
|||||||
const setConfigValue = (i) => {
|
const setConfigValue = (i) => {
|
||||||
if (i < data.Items.length) {
|
if (i < data.Items.length) {
|
||||||
helpers
|
helpers
|
||||||
.setConfigValue(data.Items[i].Name, data.Items[i].Value, data.Provider, data.Remote, data.Version)
|
.setConfigValue(data.Items[i].Name, data.Items[i].Value, data.Provider, data.Remote, data.S3, data.Version)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
setConfigValue(++i);
|
setConfigValue(++i);
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const unmountAllDrives = () => {
|
|||||||
// Unmount all items
|
// Unmount all items
|
||||||
for (const i in mountedLocations) {
|
for (const i in mountedLocations) {
|
||||||
const data = mountedData[mountedLocations[i]];
|
const data = mountedData[mountedLocations[i]];
|
||||||
helpers.stopMountProcessSync(data.Version, data.Provider, data.Remote);
|
helpers.stopMountProcessSync(data.Version, data.Provider, data.Remote, data.S3);
|
||||||
}
|
}
|
||||||
|
|
||||||
mountedLocations = [];
|
mountedLocations = [];
|
||||||
@@ -206,6 +206,7 @@ const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
|
|||||||
mountedData[data.Location] = {
|
mountedData[data.Location] = {
|
||||||
Provider: data.Provider,
|
Provider: data.Provider,
|
||||||
Remote: data.Remote,
|
Remote: data.Remote,
|
||||||
|
S3: data.S3,
|
||||||
Version: data.Version,
|
Version: data.Version,
|
||||||
};
|
};
|
||||||
const errorHandler = (pid, error) => {
|
const errorHandler = (pid, error) => {
|
||||||
@@ -219,16 +220,18 @@ const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
|
|||||||
Location: data.Location,
|
Location: data.Location,
|
||||||
Provider: data.Provider,
|
Provider: data.Provider,
|
||||||
Remote: data.Remote,
|
Remote: data.Remote,
|
||||||
|
S3: data.S3,
|
||||||
}, error || Error(data.Provider + ' Unmounted'));
|
}, error || Error(data.Provider + ' Unmounted'));
|
||||||
};
|
};
|
||||||
helpers
|
helpers
|
||||||
.executeMount(data.Version, data.Provider, data.Remote, data.Location, (error, pid) => {
|
.executeMount(data.Version, data.Provider, data.Remote, data.S3, data.Location, (error, pid) => {
|
||||||
errorHandler(pid, error);
|
errorHandler(pid, error);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
standardIPCReply(event, Constants.IPC_Mount_Drive_Reply, {
|
standardIPCReply(event, Constants.IPC_Mount_Drive_Reply, {
|
||||||
Provider: data.Provider,
|
Provider: data.Provider,
|
||||||
Remote: data.Remote,
|
Remote: data.Remote,
|
||||||
|
S3: data.S3,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@@ -259,7 +262,7 @@ const addListeners = (ipcMain, {setTrayImage, standardIPCReply}) => {
|
|||||||
|
|
||||||
expectedUnmount[data.Provider] = true;
|
expectedUnmount[data.Provider] = true;
|
||||||
helpers
|
helpers
|
||||||
.stopMountProcess(data.Version, data.Provider, data.Remote)
|
.stopMountProcess(data.Version, data.Provider, data.Remote, data.S3)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
console.log(result);
|
console.log(result);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user