[Fix VC runtime detection] [Remote mount changes]
This commit is contained in:
@@ -37,12 +37,14 @@ export default connect(null, mapDispatchToProps)(props => {
|
||||
switch (props.template.type) {
|
||||
case "bool":
|
||||
data = <input checked={JSON.parse(props.value)}
|
||||
disabled={props.readOnly}
|
||||
onChange={e=>handleChanged(e)}
|
||||
type={'checkbox'}/>;
|
||||
break;
|
||||
|
||||
case "double":
|
||||
data = <input min={0.0}
|
||||
disabled={props.readOnly}
|
||||
onChange={e=>handleChanged(e)}
|
||||
step={"0.01"}
|
||||
className={'ConfigurationItemInput'}
|
||||
@@ -60,6 +62,7 @@ export default connect(null, mapDispatchToProps)(props => {
|
||||
data = (
|
||||
<select onChange={e=>handleChanged(e)}
|
||||
className={'ConfigurationItemSelect'}
|
||||
disabled={props.readOnly}
|
||||
value={props.value}>
|
||||
{options}
|
||||
</select>
|
||||
@@ -69,6 +72,7 @@ export default connect(null, mapDispatchToProps)(props => {
|
||||
case "string":
|
||||
data = <input onChange={e=>handleChanged(e)}
|
||||
className={'ConfigurationItemInput'}
|
||||
disabled={props.readOnly}
|
||||
type={'text'}
|
||||
value={props.value}/>;
|
||||
break;
|
||||
@@ -76,6 +80,7 @@ export default connect(null, mapDispatchToProps)(props => {
|
||||
case "uint8":
|
||||
data = <input max={255}
|
||||
min={0}
|
||||
disabled={props.readOnly}
|
||||
onChange={e=>handleChanged(e)}
|
||||
className={'ConfigurationItemInput'}
|
||||
type={'number'}
|
||||
@@ -85,6 +90,7 @@ export default connect(null, mapDispatchToProps)(props => {
|
||||
case "uint16":
|
||||
data = <input max={65535}
|
||||
min={0}
|
||||
disabled={props.readOnly}
|
||||
onChange={e=>handleChanged(e)}
|
||||
className={'ConfigurationItemInput'}
|
||||
type={'number'}
|
||||
@@ -94,6 +100,7 @@ export default connect(null, mapDispatchToProps)(props => {
|
||||
case "uint32":
|
||||
data = <input max={4294967295}
|
||||
min={0}
|
||||
disabled={props.readOnly}
|
||||
onChange={e=>handleChanged(e)}
|
||||
className={'ConfigurationItemInput'}
|
||||
type={'number'}
|
||||
@@ -103,6 +110,7 @@ export default connect(null, mapDispatchToProps)(props => {
|
||||
case "uint64":
|
||||
data = <input max={18446744073709551615}
|
||||
min={0}
|
||||
disabled={props.readOnly}
|
||||
onChange={e=>handleChanged(e)}
|
||||
className={'ConfigurationItemInput'}
|
||||
type={'number'}
|
||||
|
||||
@@ -20,6 +20,7 @@ class Configuration extends IPCContainer {
|
||||
ObjectLookup: {},
|
||||
OriginalItemList: [],
|
||||
OriginalObjectLookup: {},
|
||||
IsRemoteMount: false,
|
||||
ItemList: [],
|
||||
Saving: false,
|
||||
ShowAdvanced: false,
|
||||
@@ -87,6 +88,7 @@ class Configuration extends IPCContainer {
|
||||
.map(key => {
|
||||
return {
|
||||
advanced: template[key] ? template[key].advanced : false,
|
||||
hide_remote: template[key] ? template[key].hide_remote : false,
|
||||
label: key,
|
||||
remote: template[key] ? template[key].remote : false,
|
||||
value: (template[key] && (template[key].type === 'object')) ?
|
||||
@@ -143,8 +145,20 @@ class Configuration extends IPCContainer {
|
||||
const list2 = this.createItemList(obj.value, this.state.Template[obj.label].template);
|
||||
objectLookup[obj.label] = list2.ItemList;
|
||||
}
|
||||
|
||||
const isRemoteMount = this.props.remoteSupported &&
|
||||
JSON.parse(objectLookup['RemoteMount'].find(s => s.label === 'IsRemoteMount').value);
|
||||
if (isRemoteMount) {
|
||||
for (const obj of list.ObjectList) {
|
||||
if (obj.hide_remote) {
|
||||
delete objectLookup[obj.label];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const objectLookupCopy = JSON.parse(JSON.stringify(objectLookup));
|
||||
this.setState({
|
||||
IsRemoteMount: isRemoteMount,
|
||||
ItemList: list.ItemList,
|
||||
ObjectLookup: objectLookup,
|
||||
OriginalItemList: itemListCopy,
|
||||
@@ -250,7 +264,7 @@ class Configuration extends IPCContainer {
|
||||
const configurationItems = this.state.ItemList
|
||||
.map((k, i) => {
|
||||
return (
|
||||
(!k.advanced || (this.state.ShowAdvanced && k.advanced)) ?
|
||||
((!this.state.IsRemoteMount || !k.hide_remote) && (!k.advanced || (this.state.ShowAdvanced && k.advanced))) ?
|
||||
<ConfigurationItem advanced={k.advanced}
|
||||
changed={e=>this.handleItemChanged(e, i)}
|
||||
grouping={'Settings'}
|
||||
@@ -278,6 +292,7 @@ class Configuration extends IPCContainer {
|
||||
items={this.state.Template[key].template[k.label].items}
|
||||
key={i}
|
||||
label={k.label}
|
||||
readOnly={this.state.IsRemoteMount && ((k.label === 'RemoteHostNameOrIp') || (k.label === 'RemotePort'))}
|
||||
template={this.state.Template[key].template[k.label]}
|
||||
value={k.value}/> :
|
||||
null)
|
||||
|
||||
@@ -488,46 +488,56 @@ module.exports.getMissingDependencies = dependencies => {
|
||||
};
|
||||
|
||||
const Registry = require('winreg');
|
||||
for (const dep of dependencies) {
|
||||
let hive = null;
|
||||
const hiveName = dep.registry[0].split('\\')[0];
|
||||
switch (hiveName) {
|
||||
case 'HKEY_CLASSES_ROOT':
|
||||
hive = Registry.HKCR;
|
||||
break;
|
||||
case 'HKEY_CURRENT_CONFIG':
|
||||
hive = Registry.HKCC;
|
||||
break;
|
||||
case 'HKEY_CURRENT_USER':
|
||||
hive = Registry.HKCU;
|
||||
break;
|
||||
case 'HKEY_LOCAL_MACHINE':
|
||||
hive = Registry.HKLM;
|
||||
break;
|
||||
case 'HKEY_USERS':
|
||||
hive = Registry.HKU;
|
||||
break;
|
||||
default:
|
||||
throw Error('Invalid registry hive: ' + hiveName);
|
||||
}
|
||||
|
||||
const key = dep.registry[0].substr(hiveName.length);
|
||||
const regKey = new Registry({
|
||||
hive: hive,
|
||||
key: key
|
||||
});
|
||||
regKey.valueExists('DisplayName', (err, exists) => {
|
||||
if (err || !exists) {
|
||||
regKey.valueExists('ProductName', (err, exists) => {
|
||||
if (err || !exists) {
|
||||
missing.push(dep);
|
||||
}
|
||||
resolveIfComplete();
|
||||
});
|
||||
} else {
|
||||
resolveIfComplete();
|
||||
const checkRegistry = (dep, index) => {
|
||||
if (index >= dep.registry.length) {
|
||||
missing.push(dep);
|
||||
resolveIfComplete();
|
||||
} else {
|
||||
let hive = null;
|
||||
const hiveName = dep.registry[index].split('\\')[0];
|
||||
switch (hiveName) {
|
||||
case 'HKEY_CLASSES_ROOT':
|
||||
hive = Registry.HKCR;
|
||||
break;
|
||||
case 'HKEY_CURRENT_CONFIG':
|
||||
hive = Registry.HKCC;
|
||||
break;
|
||||
case 'HKEY_CURRENT_USER':
|
||||
hive = Registry.HKCU;
|
||||
break;
|
||||
case 'HKEY_LOCAL_MACHINE':
|
||||
hive = Registry.HKLM;
|
||||
break;
|
||||
case 'HKEY_USERS':
|
||||
hive = Registry.HKU;
|
||||
break;
|
||||
default:
|
||||
throw Error('Invalid registry hive: ' + hiveName);
|
||||
}
|
||||
});
|
||||
|
||||
const key = dep.registry[index].substr(hiveName.length);
|
||||
const regKey = new Registry({
|
||||
hive: hive,
|
||||
key: key
|
||||
});
|
||||
regKey.valueExists('DisplayName', (err, exists) => {
|
||||
if (err || !exists) {
|
||||
regKey.valueExists('ProductName', (err, exists) => {
|
||||
if (err || !exists) {
|
||||
checkRegistry(dep, ++index);
|
||||
} else {
|
||||
resolveIfComplete();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
resolveIfComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
for (const dependency of dependencies) {
|
||||
checkRegistry(dependency,0);
|
||||
}
|
||||
} else {
|
||||
for (const dep of dependencies) {
|
||||
|
||||
Reference in New Issue
Block a user