Dynamic provider support
This commit is contained in:
14
src/App.js
14
src/App.js
@@ -108,6 +108,15 @@ 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 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 &&
|
const showConfig = !missingDependencies &&
|
||||||
this.props.DisplayConfiguration &&
|
this.props.DisplayConfiguration &&
|
||||||
!this.props.RebootRequired;
|
!this.props.RebootRequired;
|
||||||
@@ -184,7 +193,10 @@ class App extends IPCContainer {
|
|||||||
mainContent.push((
|
mainContent.push((
|
||||||
<Box dxStyle={{padding: 'var(--default_spacing)', height: 'auto'}}
|
<Box dxStyle={{padding: 'var(--default_spacing)', height: 'auto'}}
|
||||||
key={'md_' + key++}>
|
key={'md_' + key++}>
|
||||||
<MountItems remoteSupported={remoteSupported}/>
|
<MountItems gooboxS3Supported={gooboxS3Supported}
|
||||||
|
remoteSupported={remoteSupported}
|
||||||
|
scPrimeSupported={scPrimeSupported}
|
||||||
|
skynetSupported={skynetSupported}/>
|
||||||
</Box>
|
</Box>
|
||||||
));
|
));
|
||||||
} else if (selectedVersion !== 'unavailable') {
|
} else if (selectedVersion !== 'unavailable') {
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ exports.DATA_LOCATIONS = {
|
|||||||
exports.PROVIDER_LIST = [
|
exports.PROVIDER_LIST = [
|
||||||
'Sia',
|
'Sia',
|
||||||
'Skynet',
|
'Skynet',
|
||||||
|
'GooboxS3',
|
||||||
'ScPrime',
|
'ScPrime',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@ exports.PROVIDER_ARG = {
|
|||||||
sia: '',
|
sia: '',
|
||||||
skynet: '-sk',
|
skynet: '-sk',
|
||||||
scprime: '-sp',
|
scprime: '-sp',
|
||||||
|
gooboxs3: '-gb',
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.RELEASE_TYPES = [
|
exports.RELEASE_TYPES = [
|
||||||
|
|||||||
@@ -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 [
|
return [
|
||||||
...Constants.PROVIDER_LIST,
|
...providerList,
|
||||||
...this.props.RemoteMounts,
|
...remoteList,
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -341,7 +353,7 @@ class MountItems extends IPCContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let items = [];
|
let items = [];
|
||||||
for (const provider of Constants.PROVIDER_LIST) {
|
for (const provider of this.getProviderList(true)) {
|
||||||
items.push((
|
items.push((
|
||||||
<MountItem allowRemove={false}
|
<MountItem allowRemove={false}
|
||||||
browseClicked={this.handleBrowseLocation}
|
browseClicked={this.handleBrowseLocation}
|
||||||
|
|||||||
Reference in New Issue
Block a user