Dynamic provider support

This commit is contained in:
2020-04-23 13:56:09 -05:00
parent d7aaab1d31
commit 4fbb1105a5
3 changed files with 31 additions and 5 deletions

View File

@@ -108,6 +108,15 @@ class App extends IPCContainer {
const remoteSupported = this.props.LocationsLookup[selectedVersion] &&
this.props.LocationsLookup[selectedVersion].supports_remote;
const gooboxS3Supported = this.props.LocationsLookup[selectedVersion] &&
this.props.LocationsLookup[selectedVersion].gooboxs3_support;
const skynetSupported = this.props.LocationsLookup[selectedVersion] &&
this.props.LocationsLookup[selectedVersion].skynet_support;
const scPrimeSupported = this.props.LocationsLookup[selectedVersion] &&
this.props.LocationsLookup[selectedVersion].siaprime_support;
const showConfig = !missingDependencies &&
this.props.DisplayConfiguration &&
!this.props.RebootRequired;
@@ -184,7 +193,10 @@ class App extends IPCContainer {
mainContent.push((
<Box dxStyle={{padding: 'var(--default_spacing)', height: 'auto'}}
key={'md_' + key++}>
<MountItems remoteSupported={remoteSupported}/>
<MountItems gooboxS3Supported={gooboxS3Supported}
remoteSupported={remoteSupported}
scPrimeSupported={scPrimeSupported}
skynetSupported={skynetSupported}/>
</Box>
));
} else if (selectedVersion !== 'unavailable') {

View File

@@ -50,6 +50,7 @@ exports.DATA_LOCATIONS = {
exports.PROVIDER_LIST = [
'Sia',
'Skynet',
'GooboxS3',
'ScPrime',
];
@@ -57,6 +58,7 @@ exports.PROVIDER_ARG = {
sia: '',
skynet: '-sk',
scprime: '-sp',
gooboxs3: '-gb',
};
exports.RELEASE_TYPES = [

View File

@@ -219,10 +219,22 @@ class MountItems extends IPCContainer {
}
};
getProviderList = () => {
getProviderList = providersOnly => {
const providerList = Constants.PROVIDER_LIST.filter(i => {
return ((i === 'GooboxS3') && this.props.gooboxS3Supported) ||
((i === 'Skynet') && this.props.skynetSupported) ||
((i === 'ScPrime') && this.props.scPrimeSupported) ||
((i !== 'GooboxS3') && (i !== 'Skynet') && (i !== 'ScPrime'));
});
let remoteList = [];
if (this.props.remoteSupported && !providersOnly) {
remoteList = [...this.props.RemoteMounts];
}
return [
...Constants.PROVIDER_LIST,
...this.props.RemoteMounts,
...providerList,
...remoteList,
];
};
@@ -341,7 +353,7 @@ class MountItems extends IPCContainer {
}
let items = [];
for (const provider of Constants.PROVIDER_LIST) {
for (const provider of this.getProviderList(true)) {
items.push((
<MountItem allowRemove={false}
browseClicked={this.handleBrowseLocation}