OS X changes

This commit is contained in:
Scott E. Graves
2018-12-07 19:59:20 -06:00
parent c90f660f91
commit de012dbcda
6 changed files with 95 additions and 127 deletions

View File

@@ -25,9 +25,9 @@ function createWindow() {
loadUiSettings(); loadUiSettings();
// Create the browser window. // Create the browser window.
const height = process.env.ELECTRON_START_URL ? 394 : 374; const height = (process.env.ELECTRON_START_URL ? 394 : 374) - (os.platform() === 'win32' ? 0 : 20);
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
width: 425, width: 425 + (os.platform() === 'win32' ? 0 : 130),
height: height, height: height,
resizable: false, resizable: false,
show: !launchHidden, show: !launchHidden,

View File

@@ -289,8 +289,8 @@ module.exports.getConfigTemplate = (directory, version, storageType) => {
module.exports.getMissingDependencies = dependencies => { module.exports.getMissingDependencies = dependencies => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!dependencies || (dependencies.length === 0)) { if (!dependencies) {
reject(Error('Dependency list is empty')); reject(Error('Dependency list is invalid'));
} }
let missing = []; let missing = [];

View File

@@ -0,0 +1,13 @@
input.Input {
display: block;
margin: 0;
padding: 2px;
border-radius: var(--border_radius);
background: rgba(160, 160, 160, 0.1);
border: none;
box-shadow: none;
outline: none;
color: var(--text_color);
box-sizing: border-box;
width: 100%;
}

View File

@@ -39,16 +39,17 @@ export default CSSModules((props) => {
selected={props.items.indexOf(props.location)}/>; selected={props.items.indexOf(props.location)}/>;
} else { } else {
inputColumnSpan = 60; inputColumnSpan = 50;
inputControl = ( inputControl = (
<RootElem colSpan={inputColumnSpan} <RootElem colSpan={inputColumnSpan}
row={secondRow} row={secondRow}
rowSpan={7}> rowSpan={7}>
<input disabled={!props.allowMount || props.mounted || props.disabled} <input disabled={!props.allowMount || props.mounted || props.disabled}
onChange={props.changed} onChange={props.changed}
styleName={'Input'}
type={'text'} type={'text'}
value={props.location}/> value={props.location}/>
</RootElem>); </RootElem>);
} }
const buttonDisplay = props.allowMount || props.disabled ? const buttonDisplay = props.allowMount || props.disabled ?
@@ -61,7 +62,7 @@ export default CSSModules((props) => {
const actionsDisplay = ( const actionsDisplay = (
<Button clicked={()=>props.clicked(props.title, !props.mounted, props.location, props.pid)} <Button clicked={()=>props.clicked(props.title, !props.mounted, props.location, props.pid)}
col={inputColumnSpan + 2} col={inputColumnSpan + 2}
colSpan={20} colSpan={21}
disabled={!props.allowMount || props.disabled} disabled={!props.allowMount || props.disabled}
row={secondRow} row={secondRow}
rowSpan={7}> rowSpan={7}>
@@ -69,8 +70,8 @@ export default CSSModules((props) => {
</Button>); </Button>);
const autoMountControl = ( const autoMountControl = (
<RootElem col={inputColumnSpan + 23} <RootElem col={inputColumnSpan + 24}
colSpan={26} colSpan={28}
row={secondRow} row={secondRow}
rowSpan={7}> rowSpan={7}>
<input checked={props.autoMount} <input checked={props.autoMount}
@@ -81,7 +82,7 @@ export default CSSModules((props) => {
); );
const autoRestartControl = ( const autoRestartControl = (
<RootElem col={inputColumnSpan + 23 + 25} <RootElem col={inputColumnSpan + 24 + 28}
colSpan={24} colSpan={24}
row={secondRow} row={secondRow}
rowSpan={7}> rowSpan={7}>

View File

@@ -60,12 +60,12 @@ class MountItems extends Component {
}); });
}; };
handleMountLocationChanged = (systemType, value) => { handleMountLocationChanged = (storageType, value) => {
if (this.props.platform === 'win32') { if (this.props.platform === 'win32') {
this.props.changed(systemType, this.state[systemType].DriveLetters[value]); this.props.changed(storageType, this.state[storageType].DriveLetters[value]);
} }
else { else {
this.props.changed(systemType, value); this.props.changed(storageType, value);
} }
}; };
@@ -103,57 +103,36 @@ class MountItems extends Component {
onDetectMountsReply = (event, arg) => { onDetectMountsReply = (event, arg) => {
if (arg.data.Success) { if (arg.data.Success) {
const sia = { let state = {};
...this.state.Sia, let mountsBusy = false;
AllowMount: true, for (const name in this.state) {
DriveLetters: (arg.data.DriveLetters.Sia), state[name] = {
Mounted: (arg.data.Locations.Sia.length > 0), ...this.state[name],
PID: arg.data.PIDS.Sia, AllowMount: true,
}; DriveLetters: (arg.data.DriveLetters[name]),
const siaPrime = { Mounted: (arg.data.Locations[name].length > 0),
...this.state.SiaPrime, PID: arg.data.PIDS[name],
AllowMount: true, };
DriveLetters: (arg.data.DriveLetters.SiaPrime), mountsBusy = mountsBusy || state[name].Mounted;
Mounted: (arg.data.Locations.SiaPrime.length > 0), }
PID: arg.data.PIDS.SiaPrime, this.props.mountsBusy(mountsBusy);
};
const hs = {
...this.state.Hyperspace,
AllowMount: true,
DriveLetters: (arg.data.DriveLetters.Hyperspace),
Mounted: (arg.data.Locations.Hyperspace.length > 0),
PID: arg.data.PIDS.Hyperspace,
};
this.props.mountsBusy(hs.Mounted || sia.Mounted); this.setState(state, () => {
const updateMountLocation = (data, name) => {
this.setState({ const nameLower = name.toLowerCase();
Hyperspace: hs, let location = data.Locations[name];
Sia: sia, if (location.length === 0) {
SiaPrime: siaPrime, location = (this.props.platform === 'win32') ?
}, () => { this.props[nameLower].MountLocation || data.DriveLetters[name][0] :
let hsLocation = arg.data.Locations.Hyperspace; this.props[nameLower].MountLocation;
if ((hsLocation.length === 0) && (this.props.platform === 'win32')) { }
hsLocation = this.props.hyperspace.MountLocation || arg.data.DriveLetters.Hyperspace[0]; if (location !== this.props[nameLower].MountLocation) {
} this.props.changed(name, location);
if (hsLocation !== this.props.hyperspace.MountLocation) { }
this.props.changed('Hyperspace', hsLocation); };
}
for (const name in this.state) {
let siaLocation = arg.data.Locations.Sia; updateMountLocation(arg.data, name);
if ((siaLocation.length === 0) && (this.props.platform === 'win32')) {
siaLocation = this.props.sia.MountLocation || arg.data.DriveLetters.Sia[0];
}
if (siaLocation !== this.props.sia.MountLocation) {
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(); this.performAutoMount();
@@ -177,7 +156,6 @@ class MountItems extends Component {
}; };
onUnmountDriveReply = (event, arg) => { onUnmountDriveReply = (event, arg) => {
console.log(arg);
if ((this.props.platform === 'win32') && arg && arg.data && !arg.data.Expected && arg.data.Location && this.props[arg.data.StorageType.toLowerCase()].AutoRestart) { if ((this.props.platform === 'win32') && arg && arg.data && !arg.data.Expected && arg.data.Location && this.props[arg.data.StorageType.toLowerCase()].AutoRestart) {
this.handleMountUnMount(arg.data.StorageType, true, arg.data.Location) this.handleMountUnMount(arg.data.StorageType, true, arg.data.Location)
} else { } else {
@@ -188,75 +166,51 @@ class MountItems extends Component {
performAutoMount = ()=> { performAutoMount = ()=> {
if (this.props.processAutoMount) { if (this.props.processAutoMount) {
this.props.autoMountProcessed(); this.props.autoMountProcessed();
if (this.props.hyperspace.AutoMount && const processAutoMount = (name) => {
!this.state.Hyperspace.Mounted && const nameLower = name.toLowerCase();
(this.props.hyperspace.MountLocation.length > 0)) { if (this.props[nameLower].AutoMount &&
this.handleMountUnMount('Hyperspace', true, this.props.hyperspace.MountLocation); !this.state[name].Mounted &&
} (this.props[nameLower].MountLocation.length > 0)) {
if (this.props.sia.AutoMount && this.handleMountUnMount(name, true, this.props[nameLower].MountLocation);
!this.state.Sia.Mounted && }
(this.props.sia.MountLocation.length > 0)) { };
this.handleMountUnMount('Sia', true, this.props.sia.MountLocation); for (const name in this.state) {
} processAutoMount(name);
if (this.props.allowSiaPrime && this.props.siaprime.AutoMount &&
!this.state.SiaPrime.Mounted &&
(this.props.siaprime.MountLocation.length > 0)) {
this.handleMountUnMount('SiaPrime', true, this.props.siaprime.MountLocation);
} }
} }
}; };
render() { render() {
let items = [];
for (const name in this.state) {
const nameLower = name.toLowerCase();
items.push((
<MountItem allowConfig={this.props.allowConfig}
allowMount={this.state[name].AllowMount}
autoMount={this.props[nameLower].AutoMount}
autoMountChanged={(e)=>this.props.autoMountChanged(name, e)}
autoRestart={this.props[nameLower].AutoRestart}
autoRestartChanged={(e)=>this.props.autoRestartChanged(name, e)}
changed={(e) => this.handleMountLocationChanged(name, e.target.value)}
clicked={this.handleMountUnMount}
configClicked={()=>this.props.configClicked(name)}
items={this.state[name].DriveLetters}
key={'mi_' + items.length}
location={this.props[nameLower].MountLocation}
mounted={this.state[name].Mounted}
pid={this.state[name].PID}
platform={this.props.platform}
title={name} />
));
if (items.length !== this.state.length) {
items.push(<div key={'di_' + items.length}
style={{paddingTop: '12px'}} />)
}
}
return ( return (
<div styleName='MountItems'> <div styleName='MountItems'>
<MountItem allowConfig={this.props.allowConfig} {items}
allowMount={this.state.Hyperspace.AllowMount}
autoMount={this.props.hyperspace.AutoMount}
autoMountChanged={(e)=>this.props.autoMountChanged('Hyperspace', e)}
autoRestart={this.props.hyperspace.AutoRestart}
autoRestartChanged={(e)=>this.props.autoRestartChanged('Hyperspace', e)}
changed={(e) => this.handleMountLocationChanged('Hyperspace', e.target.value)}
clicked={this.handleMountUnMount}
configClicked={()=>this.props.configClicked('Hyperspace')}
items={this.state.Hyperspace.DriveLetters}
location={this.props.hyperspace.MountLocation}
mounted={this.state.Hyperspace.Mounted}
pid={this.state.Hyperspace.PID}
platform={this.props.platform}
title={'Hyperspace'}/>
<div style={{paddingTop: '12px'}}/>
<MountItem allowConfig={this.props.allowConfig}
allowMount={this.state.Sia.AllowMount}
autoMount={this.props.sia.AutoMount}
autoMountChanged={(e)=>this.props.autoMountChanged('Sia', e)}
autoRestart={this.props.sia.AutoRestart}
autoRestartChanged={(e)=>this.props.autoRestartChanged('Sia', e)}
changed={(e) => this.handleMountLocationChanged('Sia', e.target.value)}
clicked={this.handleMountUnMount}
configClicked={()=>this.props.configClicked('Sia')}
items={this.state.Sia.DriveLetters}
location={this.props.sia.MountLocation}
mounted={this.state.Sia.Mounted}
pid={this.state.Sia.PID}
platform={this.props.platform}
title={'Sia'}/>
<div style={{paddingTop: '12px'}}/>
<MountItem allowConfig={this.props.allowConfig}
allowMount={this.state.SiaPrime.AllowMount}
autoMount={this.props.siaprime.AutoMount}
autoMountChanged={(e)=>this.props.autoMountChanged('SiaPrime', e)}
autoRestart={this.props.siaprime.AutoRestart}
autoRestartChanged={(e)=>this.props.autoRestartChanged('SiaPrime', e)}
changed={(e) => this.handleMountLocationChanged('SiaPrime', e.target.value)}
clicked={this.handleMountUnMount}
configClicked={()=>this.props.configClicked('SiaPrime')}
disabled={!this.props.allowSiaPrime}
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>); </div>);
} }
} }

View File

@@ -18,7 +18,7 @@
* { * {
font-family: 'Nunito', sans-serif; font-family: 'Nunito', sans-serif;
font-size: 3.5vw; font-size: 4.4vmin;
} }
*::-moz-focus-inner { *::-moz-focus-inner {