Partial S3 support
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import AddRemoteMount from '../AddRemoteMount/AddRemoteMount';
|
||||
import AddMount from '../AddMount/AddMount';
|
||||
import Box from '../../components/UI/Box/Box';
|
||||
import Button from '../../components/UI/Button/Button';
|
||||
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]) {
|
||||
let retryItems = {
|
||||
...this.state.RetryItems
|
||||
@@ -121,7 +121,7 @@ class MountItems extends IPCContainer {
|
||||
const retrySeconds = retryItems[provider].RetrySeconds - 1;
|
||||
if (retrySeconds === 0) {
|
||||
this.cancelRetryMount(provider, () => {
|
||||
this.handleMountUnMount(provider, remote,true, mountLocation);
|
||||
this.handleMountUnMount(provider, remote, s3, true, mountLocation);
|
||||
});
|
||||
} else {
|
||||
retryItems[provider].RetrySeconds = retrySeconds;
|
||||
@@ -152,17 +152,18 @@ class MountItems extends IPCContainer {
|
||||
this.props.setProviderState(provider, state);
|
||||
};
|
||||
|
||||
handleMountUnMount = (provider, remote, mount, location) => {
|
||||
handleMountUnMount = (provider, remote, s3, mount, location) => {
|
||||
if (!location || (location.trim().length === 0)) {
|
||||
this.props.notifyError('Mount location is not set');
|
||||
} else {
|
||||
let allowAction = true;
|
||||
if (mount) {
|
||||
let result = remote || provider === 'S3' || provider === 'Skynet' ?
|
||||
let result = remote || s3 || provider === 'Skynet' ?
|
||||
{Valid: true, Success: true} :
|
||||
this.sendSyncRequest(Constants.IPC_Check_Daemon_Version, {
|
||||
Provider: provider,
|
||||
Remote: remote,
|
||||
S3: s3,
|
||||
Version: this.props.InstalledVersion
|
||||
}).data;
|
||||
if (result.Success) {
|
||||
@@ -179,11 +180,11 @@ class MountItems extends IPCContainer {
|
||||
} else {
|
||||
allowAction = false;
|
||||
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])) {
|
||||
this.displayRetryMount(provider, remote, location, 'Incompatible ' + provider + ' daemon. Please upgrade ' + provider + '.');
|
||||
this.displayRetryMount(provider, remote, s3, location, 'Incompatible ' + provider + ' daemon. Please upgrade ' + provider + '.');
|
||||
} else {
|
||||
this.displayRetryMount(provider, remote, location, 'Version check failed: ' + result.Error);
|
||||
this.displayRetryMount(provider, remote, s3, location, 'Version check failed: ' + result.Error);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -191,7 +192,7 @@ class MountItems extends IPCContainer {
|
||||
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.');
|
||||
} 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,
|
||||
Provider: provider,
|
||||
Remote: remote,
|
||||
S3: s3,
|
||||
Version: this.props.InstalledVersion,
|
||||
});
|
||||
} else {
|
||||
@@ -212,6 +214,7 @@ class MountItems extends IPCContainer {
|
||||
Location: location,
|
||||
Provider: provider,
|
||||
Remote: remote,
|
||||
S3: s3,
|
||||
Version: this.props.InstalledVersion,
|
||||
});
|
||||
}
|
||||
@@ -221,8 +224,7 @@ class MountItems extends IPCContainer {
|
||||
|
||||
getProviderList = providersOnly => {
|
||||
const providerList = Constants.PROVIDER_LIST.filter(i => {
|
||||
return ((i === 'S3') && this.props.s3Supported) ||
|
||||
((i === 'Skynet') && this.props.skynetSupported) ||
|
||||
return ((i === 'Skynet') && this.props.skynetSupported) ||
|
||||
((i === 'ScPrime') && this.props.scPrimeSupported) ||
|
||||
((i === 'Sia') && this.props.siaSupported);
|
||||
});
|
||||
@@ -232,9 +234,15 @@ class MountItems extends IPCContainer {
|
||||
remoteList = [...this.props.RemoteMounts];
|
||||
}
|
||||
|
||||
let s3List = [];
|
||||
if (this.props.s3Supported && !providersOnly) {
|
||||
s3List = [...this.props.S3Mounts];
|
||||
}
|
||||
|
||||
return [
|
||||
...providerList,
|
||||
...remoteList,
|
||||
...s3List,
|
||||
];
|
||||
};
|
||||
|
||||
@@ -337,7 +345,11 @@ class MountItems extends IPCContainer {
|
||||
retryDisplay = (
|
||||
<Modal>
|
||||
<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}
|
||||
</Box>
|
||||
</Modal>
|
||||
@@ -345,8 +357,10 @@ class MountItems extends IPCContainer {
|
||||
}
|
||||
|
||||
let footerItems = [];
|
||||
if (this.props.remoteSupported) {
|
||||
footerItems.push(<AddRemoteMount key={'hi_' + footerItems.length}/>);
|
||||
if (this.props.remoteSupported || this.props.s3Supported) {
|
||||
footerItems.push(<AddMount remoteSupported={this.props.remoteSupported}
|
||||
s3Supported={this.props.s3Supported}
|
||||
key={'hi_' + footerItems.length}/>);
|
||||
} else {
|
||||
footerItems.push(<div key={'hi_' + footerItems.length}
|
||||
style={{height: '27px'}}/>);
|
||||
@@ -380,15 +394,31 @@ class MountItems extends IPCContainer {
|
||||
items.push(<div key={'it_' + items.length}
|
||||
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 (
|
||||
<div style={{margin: 0, padding: 0}}>
|
||||
{retryDisplay}
|
||||
<div className={this.props.remoteSupported ? 'MountItemsRemote' : 'MountItems'}>
|
||||
<div
|
||||
className={this.props.remoteSupported || this.props.s3Supported ? 'MountItemsRemote' : 'MountItems'}>
|
||||
{items}
|
||||
</div>
|
||||
<div style={{paddingTop: 'var(--default_spacing)'}}/>
|
||||
@@ -406,6 +436,7 @@ const mapStateToProps = state => {
|
||||
Platform: state.common.Platform,
|
||||
ProviderState: state.mounts.ProviderState,
|
||||
RemoteMounts: state.mounts.RemoteMounts,
|
||||
S3Mounts: state.mounts.S3Mounts,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user