SiaPrime support

This commit is contained in:
Scott E. Graves
2018-11-03 12:29:31 -05:00
parent 2dbb791a5f
commit 2f24544400
3 changed files with 104 additions and 25 deletions

View File

@@ -36,6 +36,12 @@ class MountItems extends Component {
Mounted: false,
PID: -1,
},
SiaPrime: {
AllowMount: false,
DriveLetters: [],
Mounted: false,
PID: -1,
},
};
componentWillUnmount = () => {
@@ -104,6 +110,13 @@ class MountItems extends Component {
Mounted: (arg.data.Locations.Sia.length > 0),
PID: arg.data.PIDS.Sia,
};
const siaPrime = {
...this.state.SiaPrime,
AllowMount: true,
DriveLetters: (arg.data.DriveLetters.SiaPrime),
Mounted: (arg.data.Locations.SiaPrime.length > 0),
PID: arg.data.PIDS.SiaPrime,
};
const hs = {
...this.state.Hyperspace,
AllowMount: true,
@@ -117,6 +130,7 @@ class MountItems extends Component {
this.setState({
Hyperspace: hs,
Sia: sia,
SiaPrime: siaPrime,
}, () => {
let hsLocation = arg.data.Locations.Hyperspace;
if ((hsLocation.length === 0) && (this.props.platform === 'win32')) {
@@ -134,6 +148,14 @@ class MountItems extends Component {
this.props.changed('Sia', siaLocation);
}
let siaPrimeLocation = arg.data.Locations.SiaPrime;
if ((siaPrimeLocation.length === 0) && (this.props.platform === 'win32')) {
siaPrimeLocation = this.props.siaprime.MountLocation || arg.data.DriveLetters.SiaPrime[0];
}
if (siaPrimeLocation !== this.props.siaprime.MountLocation) {
this.props.changed('SiaPrime', siaPrimeLocation);
}
this.performAutoMount();
});
} else {
@@ -171,6 +193,11 @@ class MountItems extends Component {
(this.props.sia.MountLocation.length > 0)) {
this.handleMountUnMount('Sia', true, this.props.sia.MountLocation);
}
if (this.props.siaprime.AutoMount &&
!this.state.SiaPrime.Mounted &&
(this.props.siaprime.MountLocation.length > 0)) {
this.handleMountUnMount('SiaPrime', true, this.props.siaprime.MountLocation);
}
}
};
@@ -204,6 +231,20 @@ class MountItems extends Component {
pid={this.state.Sia.PID}
platform={this.props.platform}
title={'Sia'}/>
<div style={{paddingTop: '8px'}}/>
<MountItem allowConfig={this.props.allowConfig}
allowMount={this.state.Sia.AllowMount}
autoMount={this.props.siaprime.AutoMount}
autoMountChanged={(e)=>this.props.autoMountChanged('SiaPrime', e)}
changed={(e) => this.handleMountLocationChanged('SiaPrime', e.target.value)}
clicked={this.handleMountUnMount}
configClicked={()=>this.props.configClicked('SiaPrime')}
items={this.state.SiaPrime.DriveLetters}
location={this.props.siaprime.MountLocation}
mounted={this.state.SiaPrime.Mounted}
pid={this.state.SiaPrime.PID}
platform={this.props.platform}
title={'SiaPrime'}/>
</div>);
}
}